summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Bulk docs transaction batchingbatch-bulk-docsNick Vatamaniuc2020-05-205-29/+380
| | | | | | | | | | | | | | | * Interactive (regular) requests are split into smaller transactions, so larger updates won't fail with either timeout so or transaction too large FDB errors. * Non-interactive (replicated) requests can now batch their updates in a few transaction and gain extra performance. Batch size is configurable: ``` [fabric] update_docs_batch_size = 5000000 ```
* Fix flaky couch_jobs type monitor testNick Vatamaniuc2020-05-151-2/+36
| | | | | | | Sometimes this test fails on Jenkins but doesn't fail locally. The attempted fix is to make sure to simply retry a few times for the number of children in the supervisor to be the expected values. Also extend the timeout to 15 seconds.
* Merge pull request #2870 from cloudant/pagination-api-2iilyak2020-05-157-54/+1683
|\ | | | | Pagination API
| * Add tests for pagination APIILYA Khlopotov2020-05-151-0/+771
| |
| * Implement pagination APIILYA Khlopotov2020-05-156-45/+600
| |
| * Add tests for legacy API before refactoringILYA Khlopotov2020-05-151-0/+302
| |
| * Move not_implemented check down to allow testing of validationILYA Khlopotov2020-05-151-5/+6
| |
| * Fix variable shadowingILYA Khlopotov2020-05-151-4/+4
|/
* Fix compiler warningJay Doane2020-05-141-1/+1
|
* Fix a few flaky tests in fabric2_dbNick Vatamaniuc2020-05-134-17/+22
| | | | | | Add some longer timeouts and fix a race condition in db cleanup tests (Thanks to @jdoane for the patch)
* Merge pull request #2857 from apache/background-db-deletionPeng Hui Jiang2020-05-134-3/+358
|\ | | | | Background database deletion
| * background deletion for soft-deleted databasejiangph2020-05-134-3/+358
|/ | | | | | | | allow background job to delete soft-deleted database according to specified criteria to release space. Once database is hard-deleted, the data can't be fetched back. Co-authored-by: Nick Vatamaniuc<vatamane@apache.org>
* Fix couch_views updater_running info resultNick Vatamaniuc2020-05-093-34/+56
| | | | | | | | | | | | Previously we always returned `false` because the result from `couch_jobs:get_job_state` was expected to be just `Status`, but it is `{ok, Status}`. That part is now explicit so we account for every possible job state and would fail on a clause match if we get something else there. Moved `job_state/2` function to `couch_view_jobs` to avoid duplicating the logic on how to calculate job_id and keep it all in one module. Tests were updated to explicitly check for each state job state.
* mix format all_docs_test.exsGarren Smith2020-05-081-58/+65
|
* add local_docs to fold_doc with docidsGarren Smith2020-05-084-23/+292
|
* Convert aegis key cach to LRU with hard expiration timeEric Avdey2020-05-074-20/+327
|
* Merge pull request #2874 from cloudant/enable-exunitiilyak2020-05-073-2/+4
|\ | | | | Re-enable ExUnit tests
| * Update erlfdbILYA Khlopotov2020-05-071-1/+1
| |
| * Re-enable ExUnit testsILYA Khlopotov2020-05-072-1/+3
|/
* add test to make sure type <<"text">> design docs are ignored (#2866)Tony Sun2020-05-051-0/+8
|
* return correct not implemented for reduceGarren Smith2020-05-041-1/+1
|
* Fix list_dbs_info_tx_too_old flaky testNick Vatamaniuc2020-04-291-1/+1
| | | | | On CI creating a 100 dbs in a row was too much to do in 5 seconds so bump it to 15.
* Fix a flaky fdbcore index testNick Vatamaniuc2020-04-291-2/+2
|
* Improve robustness of couch expiring cache testJay Doane2020-04-282-34/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In its current incarnation, the so-called "simple lifecycle" test is prone to numerous failures in the CI system [1], doubtless because it's riddled with race conditions. The original author makes many assumptions about how quickly an (actual, unmocked) FDB instance will respond to a request. The primary goal is to stop failing CI builds, while other considerations include: keeping the run time of the test as low as possible, keeping the code coverage high, and documenting the known races. Specifically: - Increase the `stale` and `expired` times by a factor of 5 to decrease sensitivity to poor FDB performance. - Change default timer from `erlang:system_time/1` to `os:timestamp` on the assumption that the latter is less prone to warping [2]. - Decrease the period of the cache server reaper by half to increase accuracy of eviction time. - Inline and modify the `test_util:wait` code to make the timer explicit, and emphasize that `timer:delay/1` only works with millisecond resolution. - Don't fail the test if it can't get a fresh lookup immediately after insertion, but let it continue on to the next race, at least to the point of expiration and deletion, which continue to be asserted. - Factor `Timeout` and `Interval` to allow declarations near the other hard-coded parameters. - Move cache server `Opts` into `setup/0` and eliminate `start_link/0`. - Double the overall test timeout to 20 seconds. This has soaked for hundreds of runs on a 5 year old laptop, but the real test is the CI system. Should this test continue to fail CI builds, additional improvements could include mocking the timer and/or FDB layer to eliminate the variability of an integrated system. [1] https://ci-couchdb.apache.org/blue/organizations/jenkins/jenkins-cm1%2FPullRequests/detail/PR-2813/10/pipeline [2] http://erlang.org/doc/apps/erts/time_correction.html#terminology
* Re-enable the tx options testsNick Vatamaniuc2020-04-282-3/+15
| | | | | | | And an extra level of error checking to erlfdb:set_option since it could fail if we forget to update erlfdb dependency or fdb server version is too old. That operation can fail with an error:badarg which is exactly how list_to_integer fails and result in a confusing log message.
* Temporary disable fabric2_tx_options_testsEric Avdey2020-04-281-1/+1
|
* Remove etag from changes and _list_dbsGarren Smith2020-04-282-28/+13
|
* Fix mango test suitePaul J. Davis2020-04-271-1/+2
|
* Allow specifying FDB transaction optionsNick Vatamaniuc2020-04-274-12/+245
| | | | | | | | | | | | | | | With the latest erlfdb release v1.1.0 we have the ability to set default transaction options on the database handle. Once set, those are inherited by every transaction started from that handle. Use this feature to give advanced users a way to experiment with various transaction options. Descriptions of those options in the default.ini file have been mostly a copy and paste from the fdb_c_option.g.h file from the client library. In addition, specify some safer default values for transaction timeouts (1min) and retry limit (100). These quite conservative and are basically something less that "infinity". In the future these may be adjusted lower.
* Update erlfdb to v1.1.0Nick Vatamaniuc2020-04-271-1/+1
| | | | https://github.com/apache/couchdb-erlfdb/releases/tag/v1.1.0
* Add a couch_views test for multiple design documents with the same mapNick Vatamaniuc2020-04-271-8/+80
|
* Merge pull request #2826 from apache/aegisRobert Newson2020-04-2720-38/+849
|\ | | | | Add native encryption support
| * Add native encryption supportRobert Newson2020-04-2720-38/+849
|/ | | | | | | | | | | | | | | | | | | | | | | A new application, aegis, is introduced to provide strong at-rest protection of CouchDB data (where possible). Currently we encrypt the following values (if enabled): 1. Document content 2. Attachment content 3. Index values Things not encrypted: 1. _all_docs 2. _changes 3. doc id 4. doc rev 5. Index keys 6. All other metadata Co-Authored-By: Eric Avdey <eiri@apache.org> Co-Authored-By: Robert Samuel Newson <rnewson@apache.org>
* Report the chttpd_auth authentication db in session infoJay Doane2020-04-253-1/+111
| | | | | | | Currently, GET `/_session` reports the `authentication_db` of the obsolete admin port 5986. This updates it to report the actual db used for authentication, provided it is configured. Otherwise, it omits `authentication_db` entirely from session info.
* Add fold_docs for DocId listGarren Smith2020-04-233-9/+177
| | | | | | | | Adds a fold_docs function that will do a parallel fetch for the supplied Doc Ids. This is used for _all_docs?keys=["id1", "id2"]. This uses a queue for fetching the revs and another queue for fetching the doc bodies. These queues will be drained if the future queue gets to large.
* Refactor fetching rev code in fabric2_fdbGarren Smith2020-04-233-20/+20
| | | | | Use a common `get_revs_future` and `get_revs_wait` for fetching winning revs and all revs.
* Add after_interactive_write plugin to couch_views_updaterGarren Smith2020-04-233-2/+47
|
* Merge pull request #2796 from cloudant/fix-typoiilyak2020-04-201-1/+1
|\ | | | | Fix typo in error message
| * Fix typo in error messageILYA Khlopotov2020-04-201-1/+1
|/
* Fetch doc in same transaction as _all_doc rowGarren Smith2020-04-171-1/+1
|
* Allow using cached security and revs_limit propertiesNick Vatamaniuc2020-04-163-11/+67
| | | | | | | | | | | | | | By default, transactions are used to check metadata, and possibly reopen the db, to get a current db handle. However, if a `max_age` option is provided and db handle was checked less than `max_age` milliseconds ago, use properties from that cached handle instead. The main use of this feature be in pluggable authorization handlers where it might be necessary to inspect the security doc multiple times for the same request before a final decision is made. `revs_limit/1` was updated as well, mainly for consistency since it is almost identical to `get_security/1`.
* Merge pull request #2783 from cloudant/merge-rebar-configiilyak2020-04-164-3/+16
|\ | | | | Merge keys from rebar.config
| * Merge keys from rebar.configILYA Khlopotov2020-04-144-3/+16
| | | | | | | | | | | | | | | | | | This change allows creation of local `src/couch/rebar.config` and `rebar.config` files to set additional configuration options. This is useful for: - disabling deprecation warnings `{nowarn_deprecated_function, MFAs}` - control debugging in eunit tests - `DEBUG` - `{eunit_compile_opts, [{d, DEBUG, true}]}` - `NODEBUG` - `{eunit_compile_opts, [{d, NODEBUG, true}]}`
* | Clean up old expiry key on update insertJay Doane2020-04-152-2/+44
| | | | | | | | | | | | | | | | | | | | | | | | When an existing key is inserted with different timestamps, the primary key is the same but the primary value is different from the existing one. Currently, this results in a new expiry key being inserted, but the old one is not deleted and lingers until it is removed by the inexorable advance of time via the `remove_expired` server messages. This checks whether there's already primary key for the inserted key, and if so, cleans up the existing expiry key before proceeding with the insert.
* | Refactor expiring cache FDB interfaceJay Doane2020-04-153-25/+38
| | | | | | | | | | | | | | | | | | - Rename `clear_expired_range` to `clear_range_to` - Move `EXPIRING_CACHE` layer prefix into fabric2.hrl - Move primary key setting to just after key & value calculations - Factor out `get_val/2` to lookup a key from FDB and unpack the value - Factor out `prefixes/2` - Factor out `fold_range/5`
* | report changes stats intermittently (#2777)Tony Sun2020-04-154-34/+171
| | | | | | | | | | | | | | | | | | * report changes stats intermittently with boolean market Stats are reported at the end of a request. With changes feeds, sometimes the request can be long or forever. This commit allows stats to be reported intermittently via a configurable time in seconds. The report function can return a boolean whether stats was reported so that a reset may not necessarily be needed.
* | Enable configurable binary chunk sizeJay Doane2020-04-153-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | Currently, the size of binary chunks used for values is fixed at the FDB imposed limit of 100kB, although they recommend using 10KB [1], (also note they subtly change units). This makes that value configurable, allowing e.g. benchmarks to compare performance of runs with varying chunk size. The cost is a ~10µs config lookup penalty each time data needs to be chunked. [1] https://www.foundationdb.org/files/record-layer-paper.pdf
* | Merge pull request #2789 from cloudant/fdb-integrate-emilioiilyak2020-04-157-1/+182
|\ \ | |/ |/| | | | | Integrate emilio - erang linter Merging it on the grounds of CI pass and +1 in the original PR.
| * Integrate emilio - erang linterILYA Khlopotov2020-04-157-1/+182
|/
* Implement couch_views_cleanup_test.erlPaul J. Davis2020-04-101-0/+411
| | | | Add tests for view cleanup.