summaryrefslogtreecommitdiff
path: root/src/ddoc_cache
Commit message (Collapse)AuthorAgeFilesLines
* Add format_status/2 callback in gen_server implementationsILYA Khlopotov2020-07-301-1/+20
|
* Update ddoc_cache to use fabric2Paul J. Davis2020-03-022-2/+2
|
* Speedup eunit: ddoc_cache_no_cache_testPaul J. Davis2019-12-251-3/+13
|
* Refactor test to keep setup/teardown out of timerAdam Kocoloski2019-08-181-8/+11
|
* Move couch startup to a fixtureAdam Kocoloski2019-08-091-39/+37
| | | | | This improves reliability because that time isn't charged to the test, and also speeds up the test.
* Move eunit tests into test/eunit directoryILYA Khlopotov2019-07-2915-0/+0
|
* Suppress export-related compiler warningsJay Doane2018-12-271-1/+10
| | | | | | | | | | | - 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
* Handle db deletion in couch_db:load_validation_funsILYA Khlopotov2018-11-2211-62/+178
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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}]}]} ```
* Allow disabling off-heap messagesNick Vatamaniuc2018-09-061-1/+1
| | | | | | | | | | | | | | Off-heap messages is an Erlang 19 feature: http://erlang.org/doc/man/erlang.html#process_flag_message_queue_data It is adviseable to use that setting for processes which expect to receive a lot of messages. CouchDB sets it for couch_server, couch_log_server and bunch of others as well. In some cases the off-heap behavior could alter the timing of message receives and expose subtle bugs that have been lurking in the code for years. Or could slightly reduce performance, so a safety measure allow disabling it.
* Call `set_mqd_off_heap` for critical processesPaul J. Davis2018-06-191-0/+1
| | | | | | This uses the new `couch_util:set_mqd_off_heap/0` function to set message queues to off_heap for some of our critical processes that receive a significant amount of load in terms of message volume.
* Fix cluster upgrades when deploying ddoc_cachePaul J. Davis2017-10-111-2/+5
| | | | | | | | | | | As it turns out I made a bit of a mistake when I forgot that the old ddoc_cache implementation had an ets_lru process registered as ddoc_cache_lru. These cast messages were causing that process to crash. If a cluster had enough design document activity and enough nodes this would cause nodes with the old ddoc_cache implementation to reboot the entire VM. This was a cascading failure due to the ets_lru process restarting frequently enough that it brought down the entire ddoc_cache application.
* Handle deprecated random moduleNick Vatamaniuc2017-10-051-1/+1
| | | | | | | | | 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.
* Replace deprecated crypto:rand_bytes callNick Vatamaniuc2017-10-021-2/+2
| | | | Replaced with crypto:strong_rand_bytes
* Rewrite ddoc_cache to improve performancePaul J. Davis2017-08-0126-349/+2419
| | | | | | | | | | | | | | | | | | | | | | | 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.
* use crypto:strong_rand_bytesRobert Newson2017-07-161-1/+1
|
* Allow ddoc_cache to be fully disabledJoan Touzet2017-06-021-3/+3
|
* Add 'src/ddoc_cache/' from commit 'c762e90a33ce3cda19ef142dd1120f1087ecd876'Jan Lehnardt2017-04-019-0/+783
git-subtree-dir: src/ddoc_cache git-subtree-mainline: 5e516ae39d12b795555f14ce37319131bc7b3f34 git-subtree-split: c762e90a33ce3cda19ef142dd1120f1087ecd876