summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Add SameSite setting when clearing session cookie (2)delete-session-cookie-samesite-2-3.xRobert Newson2021-12-091-1/+1
| | | | I missed a case.
* Fix TLS custom (couch) dist for Erlang 20Nick Vatamaniuc2021-12-082-1/+44
| | | | | | | | | | | * Fix quoting so that it works with all OTP versions 20 through 24 [1]. * Dist API in 20 [2] did not have a `listen/2` [3] callback. Implement `listen/1` so we're compatible with all the supported OTP versions. [1] https://github.com/apache/couchdb/issues/3821#issuecomment-985089867 [2] https://github.com/erlang/otp/blob/maint-20/lib/kernel/src/inet_tcp_dist.erl#L71-L72 [3] https://github.com/erlang/otp/blob/master/lib/kernel/src/inet_tcp_dist.erl#L79-L80
* Merge pull request #3864 from apache/erlang_ls_improveRobert Newson2021-12-081-1/+4
|\ | | | | improve erlang_ls.config
| * improve erlang_ls.configRobert Newson2021-12-081-1/+4
|/
* add GET _dbs_infojiahuili2021-12-084-28/+194
|
* Merge pull request #3861 from apache/delete-session-cookie-samesite-3.xRobert Newson2021-12-061-1/+1
|\ | | | | Delete session cookie samesite 3.x
| * Add SameSite setting when clearing session cookieRobert Newson2021-12-061-1/+1
|/
* Remove obsolete ddoc_cache_openerAdam Kocoloski2021-12-016-122/+3
|
* Avoid routing events through ddoc_cache_openerAdam Kocoloski2021-12-011-4/+2
| | | | | | | | This flow was presumably in place for some cluster upgrade scenarios several years ago, and no one ever completed the work to finalize the event flow. All the ddoc_cache_opener process does at this point is forward the event back to ddoc_cache_lru, so let's just send that message directly and remove the superfluous gen_server.
* Cleanup couch_ejson_compare C moduleNick Vatamaniuc2021-11-241-2/+6
| | | | | | | | | | | Add `static` modifiers to some of the newer functions. Fix function protype for get_collator to be `void`. This squashes this warning on MS compiler: ``` 'get_collator': no function prototype given: converting '()' to '(void)' ```
* Fix Jenkins email quoting failuresNick Vatamaniuc2021-11-231-7/+6
| | | | | | | Should fix: ``` Warning: A secret was passed to "mail" using Groovy String interpolation, which is insecure. ```
* Apply erlfmt formatting to source treeNick Vatamaniuc2021-11-22553-38647/+45794
| | | | | | | | | | | | | | | | | | | | | | | | | | | These exceptions from main were ported over to 3.x ``` --- a/src/chttpd/src/chttpd.erl +++ b/src/chttpd/src/chttpd.erl @@ -491,6 +491,7 @@ extract_cookie(#httpd{mochi_req = MochiReq}) -> end. %%% end hack +%% erlfmt-ignore set_auth_handlers() -> AuthenticationDefault = "{chttpd_auth, cookie_authentication_handler}, ``` ``` --- a/src/couch/src/couch_debug.erl +++ b/src/couch/src/couch_debug.erl @@ -49,6 +49,7 @@ help() -> ]. -spec help(Function :: atom()) -> ok. +%% erlfmt-ignore help(opened_files) -> ```
* Port erlfmt formatting to 3.xNick Vatamaniuc2021-11-2210-6/+236
| | | | | | | | | | | | | | | | | | From PR: #3568 A few changes to the formatting logic compared to `main`: * rebar3 and `erlfmt` don't work with Erlang 20, so added an OTP version check to skip formatting for Erlang 20 * `make erlfmt-*` commands are faster. Instead of spawning an `erlfmt` process per-file, spawn one per `directory/*.erl` pattern. * Remove the non-0 return code work-around. `erlfmt` was returning an error on `main` because the line width option used for formatting was different than the one used during format checking. Making both the default removed all the spurious non-0 exits with the current version of `erlfmt`. Thanks to Adam Kocoloski for pointing out the issue.
* Reduce skipped integration testsJay Doane2021-11-141-285/+1
| | | | | | | | | The `skip.elixir` file was ported [1] from FDB-based main branch but contains more exclusions than necessary for 3.x. This removes tests from `skip.elixir` that pass on 3.x. [1] https://github.com/apache/couchdb/commit/65fbc6cfdb29bab1072a42f4d6005da452a7fa65#diff-d9485d6f3162015017bc09c9db3f87df0ca489d961c44347241a035854eb8044
* Eliminate elixir test compiler warningsJay Doane2021-11-103-3/+3
| | | | | | | | | | | | | | | | Eliminates the following: warning: variable "epoch" is unused (if the variable is not meant to be used, prefix it with an underscore) src/couchdb/test/elixir/test/replication_test.exs:1756: ReplicationTest.seq_to_shards/1 warning: variable "uuid" is unused (if the variable is not meant to be used, prefix it with an underscore) src/couchdb/test/elixir/test/replication_test.exs:1756: ReplicationTest.seq_to_shards/1 warning: variable "string" is unused (if the variable is not meant to be used, prefix it with an underscore) src/couchdb/test/elixir/test/utf8_test.exs:32: UTF8Test."test UTF8 support"/1 warning: variable "repeated_view_offset_test_fun" does not exist and is being expanded to "repeated_view_offset_test_fun()", please use parentheses to remove the ambiguity or change the variable name src/couchdb/test/elixir/test/view_offsets_test.exs:63: ViewOffsetTest."test repeated view offsets"/1
* Using _bulk_docs with new_edits false and without _rev should responds 400 ↵jiahuili2021-11-082-1/+43
| | | | Bad Request
* Use `weatherreport_check_nodes_connected:check/1`Jay Doane2021-11-061-1/+1
| | | | | | | | | | The arity 0 version does not exist. Fixes dialyzer warning: {warn_callgraph,{"src/weatherreport_node.erl",126}, {call_to_missing,[weatherreport_check_nodes_connected,check, 0]}}
* Bump version to 3.2.1 and update dependencies3.2.1-RC13.2.1Nick Vatamaniuc2021-11-023-4/+4
|
* Fix reduce view row collation with unicode equivalent keysNick Vatamaniuc2021-11-011-3/+18
| | | | | | | | | | | | Previously, view reduce collation with keys relied on the keys in the rows returned from the view shards to exactly match (=:=) the keys specified in the args. However, in the case when there are multiple rows which compare equal with the unicode collator, that may not always be the case. In that case when the rows are fetched from the row dict by key, they should be matched using the same collation algorithm as the one used on the view shards.
* fix(local.ini): straggling s/couch_httpd_auth/chttpd_auth/Jay Doane2021-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | The appropriately named `hack_local_ini` function in dev/run lives up to its name by adding a random `secret` to the end of whichever section contains the line `"; require_valid_user = false\n"`. Recent commits [1] updated the `setup` application from `couch_httpd_auth` to `chttpd_auth` without also changing this line in local.ini, which had the fun effect of causing `setup` to fail with this error: ``` [error] 2021-10-30T18:50:15.019274Z node1@127.0.0.1 <0.817.0> 85d0421b9c setup sync_admin results [{badrpc,{'EXIT',{function_clause,[{config,set,["chttpd_auth","secret",undefined,true,nil],[{file,"src/config.erl"},{line,189}]},{rpc,'-handle_call_call/6-fun-0-',5,[{file,"rpc.erl"},{line,197}]}]}}},{badrpc,{'EXIT',{function_clause,[{config,set,["chttpd_auth","secret",undefined,true,nil],[{file,"src/config.erl"},{line,189}]},{rpc,'-handle_call_call/6-fun-0-',5,[{file,"rpc.erl"},{line,197}]}]}}}] errors [] [notice] 2021-10-30T18:50:15.019530Z node1@127.0.0.1 <0.817.0> 85d0421b9c 127.0.0.1:15984 127.0.0.1 adm POST /_cluster_setup 500 ok 12 ``` This change "fixes" dev/run by also updating the straggling section name in local.ini. [1] https://github.com/apache/couchdb/pull/3808
* feat(prometheus): allow users with _metrics role to readJan Lehnardt2021-10-301-0/+2
| | | | Closes #3801
* fix(auth): straggling s/couch_httpd_auth/chttpd/Jan Lehnardt2021-10-301-1/+1
|
* fix(setup): straggling s/couch_httpd_auth/chttpd_auth/ closes #3805Jan Lehnardt2021-10-301-2/+2
|
* Eliminate custodian false positive errors for dbs with N < default NNick Vatamaniuc2021-10-281-4/+3
| | | | | | | | | | | | | Previously, dbs with N < cluster default N would pollute logs with critical errors regarding not having enough shards. Instead, use each database's expected N value to emit custodian reports. Note: the expected N value is a bit tricky to understand since with shard splitting feature, shard ranges are not guaranteed to exactly match for all copies. The N value is then defined as the max number of rings which can be completed with the given set of shards -- complete the ring once, remove participating shards, try again, etc. Lucky for us, that function is already written (`mem3_util:calculate_max_n(Shards)` so we are just re-using it.
* Use configured shards db in custodian instead of `"dbs"`Nick Vatamaniuc2021-10-282-2/+3
|
* Mock `couch_log:warning/2`Jay Doane2021-10-271-5/+22
| | | | | | | | | | | | | | | | | Prevent failures like: mem3_rep: find_source_seq_unknown_node_test...*failed* in function gen_server:call/2 (gen_server.erl, line 206) in call from couch_log:log/3 (src/couch_log.erl, line 73) in call from mem3_rep:find_source_seq_int/5 (src/mem3_rep.erl, line 248) in call from mem3_rep:'-find_source_seq_unknown_node_test/0-fun-0-'/0 (src/mem3_rep.erl, line 794) **exit:{noproc,{gen_server,call, [couch_log_server, {log,{log_entry,warning,<0.17426.5>, ["mem3_rep",32,102,105,110,100|...], "--------", ["2021",45,"10",45|...]}}]}} output:<<"">>
* Use unique ddoc id to prevent collisionsJay Doane2021-10-271-2/+4
| | | | | | | | | | | | | | | | | | | | Prevent failures like this from repeated test runs: mem3_bdu_test:73: mem3_bdu_shard_doc_test_ (t_design_docs_are_not_validated)...*failed* in function mem3_bdu_test:'-t_design_docs_are_not_validated/1-fun-0-'/1 (test/eunit/mem3_bdu_test.erl, line 206) in call from mem3_bdu_test:t_design_docs_are_not_validated/1 (test/eunit/mem3_bdu_test.erl, line 206) in call from eunit_test:run_testfun/1 (eunit_test.erl, line 71) in call from eunit_proc:run_test/1 (eunit_proc.erl, line 510) in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 335) in call from eunit_proc:handle_test/2 (eunit_proc.erl, line 493) in call from eunit_proc:tests_inorder/3 (eunit_proc.erl, line 435) in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 325) **error:{assertEqual,[{module,mem3_bdu_test}, {line,206}, {expression,"Code"}, {expected,201}, {value,409}]} output:<<"">>
* Parameterize shards dbJay Doane2021-10-271-31/+31
| | | | | Depending on configuration, it is possible for the shards db to be different than `_dbs`.
* Mock `couch_log` for config applicationJay Doane2021-10-271-0/+4
| | | | | | | | | | | | | | | Prevent failures like this: mem3_sync_event_listener:267: should_set_sync_delay...*failed* in function gen_server:call/3 (gen_server.erl, line 214) in call from mem3_sync_event_listener:'-should_set_sync_delay/1-fun-1-'/1 (src/mem3_sync_event_listener.erl, line 268) **exit:{{noproc,{gen_server,call, [couch_log_server, {log,{log_entry,notice,<0.31789.5>, ["config",58,32,91,[...]|...], "--------", ["2021",45,[...]|...]}}]}},
* Minimize rewinds when a node is down (#3792)Adam Kocoloski2021-10-271-17/+59
| | | | | | | | | | | | | | | | | | | | | Our existing logic for handling rewinds in the changes feed addresses the following cases: - A node that contributed to a sequence is in maintenance mode - A shard that contributed to a sequence has been split This patch adds support for cases where the node that contributed to a client-supplied sequence is down at the beginning of the request handling. It reuses the same logic as the maintenance mode case as these two situations really ought to be handled the same way. A future improvement would be to unify the "node down" and "shard split" logic so that we could handle the compound case, e.g. replacing a shard from a down node with a pair of shards from nodes that cover the same range. Fixes #3788 Co-authored-by: Nick Vatamaniuc <vatamane@gmail.com>
* Eliminate eunit compiler warningsJay Doane2021-10-256-33/+18
| | | | | | | | | - Unused functions in `couch_util_tests` - Unused variables in `couch_prometheus_e2e_tests` - Unused variable in `dreyfus_blacklist_await_test` - Deprecated BIF `erlang:now/0` in `dreyfus_purge_test` - `export_all` flag in dreyfus tests - Unused variable in `mem3_reshard_test`
* Fix flaky mem3_bdu testNick Vatamaniuc2021-10-251-9/+1
| | | | | | The test only checks that we can update the shard doc so we just verifythat. Apparently, it doesn't mean we can synchronously access the newly created db info right away so we just skip that part to avoid a flaky failure.
* Fix flaky retain_stats replicator testNick Vatamaniuc2021-10-241-6/+14
| | | | | | | | | | | | | | | | Noticed this flaky test show up in a few recent test runs, for [example](https://ci-couchdb.apache.org/blue/organizations/jenkins/jenkins-cm1%2FPullRequests/detail/PR-3799/1/pipeline) The test was flaky as We were only waiting for the replication task or scheduler job to appear in the list but didn't not wait until the value of the task had been updated to an expected value. So the task might have appeared but then only half the docs written (say, 5 instead of 10). Testing the value at that stage is too early and the test would fail. To fix the issue, besides waiting on the task/job to appear in the list, also wait until its `docs_written` value matches the expected value. By that point `docs_read` should have caught up as well.
* Add libicu version fetching and emit it in the _node/_local/_versionsNick Vatamaniuc2021-10-244-10/+98
| | | | | | | Fetch the libicu base version as well as the collator version. The base version may be used to determine which libicu library CouchDB is using. The collator version may be used to debug view behavior in case when collation order had changed from one version ot the next.
* Move custodian VDU to a BDU and fix _all_dbs off-by-one limit bugNick Vatamaniuc2021-10-248-81/+448
| | | | | | | | | This fixes issue: https://github.com/apache/couchdb/issues/3786 In addition, add few _all_dbs limit tests since we didn't seem to have any previously to catch such issues. Plus, test some of the corner cases which should be caught by the BDU and should return a 403 error code.
* Include shard uuids in db_info update sequencesNick Vatamaniuc2021-10-194-3/+97
| | | | | | | | | | | | | | | | | | | | | This means `update_seq` values from `GET $db` `last_seq` returned from ` GET $db/_changes?since=now&limit=` will be more resilient to change feed rewinds. Besides, those sequences will now be more consistent and users won't have to wonder why one opaque sequence works slightly differently than another opaque update sequence. Previously, when the sequences were returned only as numeric values, it was impossible to calculate replacements and change feeds had to always rewind back to 0 for those ranges. With uuids and epochs in play, it is possible to figure out that some shards might have moved to new nodes or find internal replication checkpoints to avoid streaming changes feeds from 0 on those ranges. Some replication Elixir tests decode update sequences, so those were updated to handle the new uuid and epoch format as well. Fixes: https://github.com/apache/couchdb/issues/3787 Co-author: Adam Kocoloski kocolosk@apache.org
* Remove couch_icu_driver moduleNick Vatamaniuc2021-10-1511-343/+390
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | couch_icu_driver is only used for binary strings comparison in couch_ejson_compare when expression depth becomes greater than 10. The logic for string comparison is identical to what couch_ejson_compare uses, so opt to just use couch_ejson_compare instead of keeping a whole other binary collation driver around. To avoid a possible infinite loop if couch_ejson_compare nif fails to load, throw a nif loading error as is common for nif modules. To avoid another case of a possible infinite retry from of badarg generated by max depth, and/or an actual bad ejson term, use a specific max depth error so we don't have to guess when we catch it and retry term traversal in erlang. There was another uncodumented case when badarg was thrown besides max depth or an invalid arg. It was when a prop value was compared with any other supported type. In erlang it would be handled in these clauses: ``` less_erl({A},{B}) when is_list(A), is_list(B) -> less_props(A,B); less_erl({A},_) when is_list(A) -> -1; less_erl(_,{B}) when is_list(B) -> 1. ``` However, in C we threw a badarg for the last two clauses and relied on erlang to do all the work. This case was a potential performance issue as well since that is a common comparison for mango where we may compare keys against the max json object value (<<255,255,255,255>>). Add a few property tests in order to validate collation behavior. The two main ones are: 1) Given an expected sort order of some test values, assert that both the erlang and nif collators would correctly order any of those test values. 2) In general, the nif collator would sort any json the same way as the erlang one.
* Fix badarith error in get_db_timeout when request timeout = infinityNick Vatamaniuc2021-10-151-1/+9
| | | | | | | | | | | | | `infinity` it turns out is a valid configuration value for fabric request_timeout. We can pass that to Erlang `receive` statement, any arithmetic with it would fail. To guard against the crash use the max small int value (60 bits). With enough shards, due to the exponential nature of the algorithm, we still get a nice progression from the minimum 100 msec all the way up to the large int value. This case is illustrated in the test. Issue: https://github.com/apache/couchdb/issues/3789
* Avoid badmatch for fabric:cleanup_index_filesjiahuili2021-10-131-1/+5
|
* Return empty list from fabric:inactive_index_files/1 when database doesn't existjiahuili2021-10-122-3/+67
|
* Kill Pid synchronouslyJay Doane2021-10-121-1/+1
| | | | | | | | Prevent this race condition: *** context setup failed *** **in function couch_replicator_doc_processor:setup/0 (src/couch_replicator_doc_processor.erl, line 872) **error:{badmatch,{error,{already_started,<0.4946.0>}}}
* Eliminate compiler warningsJay Doane2021-10-123-3/+4
| | | | | | - Prepend unused variable with underscore - Add nowarn_export_all compiler option - Use STACKTRACE macro
* Eliminate compiler warningsJay Doane2021-10-092-4/+1
| | | | Delete unused function and remove unused variable.
* Try harder to avoid a change feed rewind after a shard moveNick Vatamaniuc2021-10-081-8/+24
| | | | | | | | | | | | | | | | In the previous attempt [1] we improved the logic by spawning workers on the matching target shards only. However, that wasn't enough as workers might still reject the passed in sequence from the old node when it asserts ownership locally on each shard. Re-use the already existing replacement clause, where after uuid is matched, we try harder to find the highest viable sequence. To use the unit test setup as an example, if the shard moved from node1 to node2, and recorded epoch `{node2, 10}` on the new node, then a sequence generated on node1 before the move, for example 12, would rewind down to 10 only when calculated on new location on node2, instead of being rewound all the way down to 0. [1] https://github.com/apache/couchdb/commit/e83935c7f8c3e47b47f07f22ece327f6529d4da0
* Bump docs for 3.2.0-RC23.2.0-RC23.2.0Nick Vatamaniuc2021-10-051-1/+1
| | | | To include another changelog entry: https://github.com/apache/couchdb-documentation/commit/4f00da0b0cedf63ebf391e43b1a56bb36f7d0f96
* Fix Windows makefile for Fauxton (#3777)Joan Touzet2021-10-051-1/+1
| | | Missed file in f85cff669f20cee0a54da7bb8c645dfc4d2de5c9
* Bump jiffy to CouchDB-1.0.9-1Nick Vatamaniuc2021-10-051-1/+1
| | | | | | Based off of the upstream 1.0.9 + CouchDB clone changes https://github.com/apache/couchdb-jiffy/releases/tag/CouchDB-1.0.9-1
* backport C++ standard settings from SM86 to SM78Dave Cottlehuber2021-09-301-2/+2
|
* Bump version to 3.2.0 and update dependencies3.2.0-RC1Nick Vatamaniuc2021-09-274-8/+8
| | | | | | Fauxton was failing so we backported the fix from main https://github.com/apache/couchdb/commit/f85cff669f20cee0a54da7bb8c645dfc4d2de5c9 for it.
* Remove unused variables and extra whitespaceJay Doane2021-09-271-3/+2
|