<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/couchdb.git/src/ddoc_cache/test, branch devnode-boot-script</title>
<subtitle>github.com: apache/couchdb.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/couchdb.git/'/>
<entry>
<title>Speedup eunit: ddoc_cache_no_cache_test</title>
<updated>2019-12-25T19:52:32+00:00</updated>
<author>
<name>Paul J. Davis</name>
<email>paul.joseph.davis@gmail.com</email>
</author>
<published>2019-12-25T17:40:07+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/couchdb.git/commit/?id=f6654da881e1501d76c9c13fe8a748a57d0db54c'/>
<id>f6654da881e1501d76c9c13fe8a748a57d0db54c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Refactor test to keep setup/teardown out of timer</title>
<updated>2019-08-19T00:56:05+00:00</updated>
<author>
<name>Adam Kocoloski</name>
<email>kocolosk@apache.org</email>
</author>
<published>2019-08-18T13:33:25+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/couchdb.git/commit/?id=adc0315ecdb37a30ebb3eeaada70143ebe7dbd70'/>
<id>adc0315ecdb37a30ebb3eeaada70143ebe7dbd70</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Move couch startup to a fixture</title>
<updated>2019-08-09T11:58:04+00:00</updated>
<author>
<name>Adam Kocoloski</name>
<email>kocolosk@apache.org</email>
</author>
<published>2019-08-07T02:46:43+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/couchdb.git/commit/?id=aab0c51d8dca39d6556d4636edec20d14f65e36d'/>
<id>aab0c51d8dca39d6556d4636edec20d14f65e36d</id>
<content type='text'>
This improves reliability because that time isn't charged to the test,
and also speeds up the test.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This improves reliability because that time isn't charged to the test,
and also speeds up the test.
</pre>
</div>
</content>
</entry>
<entry>
<title>Move eunit tests into test/eunit directory</title>
<updated>2019-07-29T11:24:37+00:00</updated>
<author>
<name>ILYA Khlopotov</name>
<email>iilyak@apache.org</email>
</author>
<published>2019-05-10T00:45:21+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/couchdb.git/commit/?id=cf60cffb44bf18889aa8362b616bafb7bed87445'/>
<id>cf60cffb44bf18889aa8362b616bafb7bed87445</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Suppress export-related compiler warnings</title>
<updated>2018-12-27T21:07:57+00:00</updated>
<author>
<name>Jay Doane</name>
<email>jay.s.doane@gmail.com</email>
</author>
<published>2018-12-27T20:49:47+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/couchdb.git/commit/?id=4e75964898bd49218087de1e02391300da024e6c'/>
<id>4e75964898bd49218087de1e02391300da024e6c</id>
<content type='text'>
- For export_all warnings: either replace with explicit exports, add
nowarn_export_all compiler directives when appropriate, or in the case
of couch_epi_sup, move the test to dedicated test file and export the
function needed for testing.

- For "function already exported" warning in couch_key_tree_prop_tests,
remove include_lib attribute for eunit.hrl since it already gets
imported in triq.hrl
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- For export_all warnings: either replace with explicit exports, add
nowarn_export_all compiler directives when appropriate, or in the case
of couch_epi_sup, move the test to dedicated test file and export the
function needed for testing.

- For "function already exported" warning in couch_key_tree_prop_tests,
remove include_lib attribute for eunit.hrl since it already gets
imported in triq.hrl
</pre>
</div>
</content>
</entry>
<entry>
<title>Handle db deletion in couch_db:load_validation_funs</title>
<updated>2018-11-22T12:19:09+00:00</updated>
<author>
<name>ILYA Khlopotov</name>
<email>iilyak@apache.org</email>
</author>
<published>2018-09-27T10:34:01+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/couchdb.git/commit/?id=d35b5c9c4a5c2820e25944de2c4fde8bc866c8c1'/>
<id>d35b5c9c4a5c2820e25944de2c4fde8bc866c8c1</id>
<content type='text'>
Previously there were quite a few problems with load_validation_funs
in the case when clustered database is deleted.

- the calls to load_validation_funs were failing with `internal_server` error [1]
- the deleted database stayed opened because:
  - the caller of the load_validation_funs (update_doc) stayed alive
  - the main_pid of the deleted database wasn't killed either
- there was an infinite loop in ddoc_cache_entry trying to recover ddoc from deleted database

The solution is:
- do not call `recover` for deleted database
- close `main_pid`
- use `erlang:error` to crash the caller

[1] - The stack trace was:
```
{database_does_not_exist,[
    {mem3_shards,load_shards_from_db,"bailey/meta",[
        {file,"src/mem3_shards.erl"},{line,394}]},
    {mem3_shards,load_shards_from_disk,1,[
        {file,"src/mem3_shards.erl"},{line,369}]},
    {mem3_shards,for_db,2,[
        {file,"src/mem3_shards.erl"},{line,54}]},
    {fabric_view_all_docs,go,5,[
        {file,"src/fabric_view_all_docs.erl"},{line,24}]},
    {ddoc_cache_entry_validation_funs,recover,1,[
        {file,"src/ddoc_cache_entry_validation_funs.erl"},{line,33}]},
    {ddoc_cache_entry,do_open,1,[
        {file,"src/ddoc_cache_entry.erl"},{line,294}]}]}
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously there were quite a few problems with load_validation_funs
in the case when clustered database is deleted.

- the calls to load_validation_funs were failing with `internal_server` error [1]
- the deleted database stayed opened because:
  - the caller of the load_validation_funs (update_doc) stayed alive
  - the main_pid of the deleted database wasn't killed either
- there was an infinite loop in ddoc_cache_entry trying to recover ddoc from deleted database

The solution is:
- do not call `recover` for deleted database
- close `main_pid`
- use `erlang:error` to crash the caller

[1] - The stack trace was:
```
{database_does_not_exist,[
    {mem3_shards,load_shards_from_db,"bailey/meta",[
        {file,"src/mem3_shards.erl"},{line,394}]},
    {mem3_shards,load_shards_from_disk,1,[
        {file,"src/mem3_shards.erl"},{line,369}]},
    {mem3_shards,for_db,2,[
        {file,"src/mem3_shards.erl"},{line,54}]},
    {fabric_view_all_docs,go,5,[
        {file,"src/fabric_view_all_docs.erl"},{line,24}]},
    {ddoc_cache_entry_validation_funs,recover,1,[
        {file,"src/ddoc_cache_entry_validation_funs.erl"},{line,33}]},
    {ddoc_cache_entry,do_open,1,[
        {file,"src/ddoc_cache_entry.erl"},{line,294}]}]}
```
</pre>
</div>
</content>
</entry>
<entry>
<title>Handle deprecated random module</title>
<updated>2017-10-05T15:40:41+00:00</updated>
<author>
<name>Nick Vatamaniuc</name>
<email>vatamane@apache.org</email>
</author>
<published>2017-10-03T06:14:22+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/couchdb.git/commit/?id=75984da4b22003d0e46a9fe1001978d999387636'/>
<id>75984da4b22003d0e46a9fe1001978d999387636</id>
<content type='text'>
Use erlang release version to decide if the newer `rand` module is present or
not.

`erlang:function_exported(rand, uniform, 0)` could not be used here as it
returns false when function isn't loaded, even if module and function are both
available.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use erlang release version to decide if the newer `rand` module is present or
not.

`erlang:function_exported(rand, uniform, 0)` could not be used here as it
returns false when function isn't loaded, even if module and function are both
available.
</pre>
</div>
</content>
</entry>
<entry>
<title>Replace deprecated crypto:rand_bytes call</title>
<updated>2017-10-02T21:41:39+00:00</updated>
<author>
<name>Nick Vatamaniuc</name>
<email>vatamane@apache.org</email>
</author>
<published>2017-10-02T18:16:43+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/couchdb.git/commit/?id=6bff5fb30726066e099f8214b9a220750b009ba0'/>
<id>6bff5fb30726066e099f8214b9a220750b009ba0</id>
<content type='text'>
Replaced with crypto:strong_rand_bytes
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replaced with crypto:strong_rand_bytes
</pre>
</div>
</content>
</entry>
<entry>
<title>Rewrite ddoc_cache to improve performance</title>
<updated>2017-08-01T15:32:59+00:00</updated>
<author>
<name>Paul J. Davis</name>
<email>paul.joseph.davis@gmail.com</email>
</author>
<published>2017-06-16T18:29:47+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/couchdb.git/commit/?id=939761b71830ec954701f94cb6df3dab6666a794'/>
<id>939761b71830ec954701f94cb6df3dab6666a794</id>
<content type='text'>
There were a couple issues with the previous ddoc_cache implementation
that made it possible to tip over the ddoc_cache_opener process. First,
there were a lot of messages flowing through a single gen_server. And
second, the cache relied on periodically evicting entries to ensure
proper behavior in not caching an entry forever after it had changed on
disk.

The new version makes two important changes. First, entries now have an
associated process that manages the cache entry. This process will
periodically refresh the entry and if the entry has changed or no longer
exists the process will remove its entry from cache.

The second major change is that the cache entry process directly mutates
the related ets table entries so that our performance is not dependent
on the speed of ets table mutations. Using a custom entry that does no
work the cache can now sustain roughly one million operations a second
with a twenty thousand clients fighting over a cache limited to one
thousand items. In production this means that cache performance will
likely be rate limited by other factors like loading design documents
from disk.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There were a couple issues with the previous ddoc_cache implementation
that made it possible to tip over the ddoc_cache_opener process. First,
there were a lot of messages flowing through a single gen_server. And
second, the cache relied on periodically evicting entries to ensure
proper behavior in not caching an entry forever after it had changed on
disk.

The new version makes two important changes. First, entries now have an
associated process that manages the cache entry. This process will
periodically refresh the entry and if the entry has changed or no longer
exists the process will remove its entry from cache.

The second major change is that the cache entry process directly mutates
the related ets table entries so that our performance is not dependent
on the speed of ets table mutations. Using a custom entry that does no
work the cache can now sustain roughly one million operations a second
with a twenty thousand clients fighting over a cache limited to one
thousand items. In production this means that cache performance will
likely be rate limited by other factors like loading design documents
from disk.
</pre>
</div>
</content>
</entry>
</feed>
