couchdb.git
45 hours agoMerge pull request #1805 from cloudant/fix-with-haproxy master
iilyak [Tue, 11 Dec 2018 15:35:22 +0000 (07:35 -0800)] 
Merge pull request #1805 from cloudant/fix-with-haproxy

Fix haproxy config file location

46 hours agoFix haproxy config file location 1805/head
ILYA Khlopotov [Tue, 11 Dec 2018 15:02:16 +0000 (15:02 +0000)] 
Fix haproxy config file location

The problem was introduced in 94eff0d8 during rebase of
https://github.com/apache/couchdb/pull/1774

47 hours agoMerge pull request #1774 from cloudant/support-more-than-3-nodes
iilyak [Tue, 11 Dec 2018 13:39:03 +0000 (05:39 -0800)] 
Merge pull request #1774 from cloudant/support-more-than-3-nodes

Support for more than 3 nodes dev cluster

47 hours agoSupport for more than 3 nodes dev cluster 1774/head
ILYA Khlopotov [Wed, 28 Nov 2018 19:54:17 +0000 (19:54 +0000)] 
Support for more than 3 nodes dev cluster

2 days agoMerge pull request #1796 from cloudant/tests/port-delayed_commits-to-elixir
Eric Avdey [Tue, 11 Dec 2018 00:22:47 +0000 (20:22 -0400)] 
Merge pull request #1796 from cloudant/tests/port-delayed_commits-to-elixir

Port delayed_commits test to Elixir

2 days agoPort delayed_commits test to Elixir 1796/head
Eric Avdey [Thu, 6 Dec 2018 19:32:43 +0000 (15:32 -0400)] 
Port delayed_commits test to Elixir

2 days agoAdd elixir helper to restart a node or the whole cluster
Eric Avdey [Thu, 6 Dec 2018 19:32:05 +0000 (15:32 -0400)] 
Add elixir helper to restart a node or the whole cluster

3 days agoMerge pull request #1802 from van-mronov/moduledoc
iilyak [Mon, 10 Dec 2018 11:03:36 +0000 (03:03 -0800)] 
Merge pull request #1802 from van-mronov/moduledoc

Fix running elixir test suite

5 days agoAdd moduledoc attribute 1802/head
Ivan Mironov [Fri, 7 Dec 2018 22:29:44 +0000 (17:29 -0500)] 
Add moduledoc attribute

5 days agoMerge pull request #1770 from cloudant/COUCHDB-1384-function-clause-error
Peng Hui Jiang [Sat, 8 Dec 2018 02:02:49 +0000 (10:02 +0800)] 
Merge pull request #1770 from cloudant/COUCHDB-1384-function-clause-error

Fix function_clause exception on invalid DB security objects

5 days agoFix function_clause error 1770/head
wenwl [Wed, 28 Nov 2018 13:43:22 +0000 (21:43 +0800)] 
Fix function_clause error

   -  fix function_clause error on invalid DB security objects
   when the request body of PUT db/_security endpoint is not
   a correct json format

Closes #1384

5 days agoAvoid calls to `fabric:design_docs/1`
Paul J. Davis [Wed, 5 Dec 2018 19:43:31 +0000 (13:43 -0600)] 
Avoid calls to `fabric:design_docs/1`

The underlying clustered _all_docs call can cause significant extra load
during compaction.

5 days agoAdd `couch_db:get_design_doc/2`
Paul J. Davis [Wed, 5 Dec 2018 19:42:47 +0000 (13:42 -0600)] 
Add `couch_db:get_design_doc/2`

This adds an API call for looking up a single design doc regardless of
whether the database is clustered or not.

5 days agoRefactor elixir test suite initialization (#1779)
Ivan Mironov [Fri, 7 Dec 2018 21:47:21 +0000 (16:47 -0500)] 
Refactor elixir test suite initialization (#1779)

* Move CouchTestCase to separate file
* Move setup context functions to separate module

5 days agoAdd Credo to Elixir test suite (#1769)
Alessio Biancalana [Fri, 7 Dec 2018 20:58:39 +0000 (21:58 +0100)] 
Add Credo to Elixir test suite (#1769)

This PR adds Credo as the static code analysis tool of choice for the Elixir test suite.

6 days agoFormat and check all code using python black (#1776)
Joan Touzet [Thu, 6 Dec 2018 23:03:57 +0000 (18:03 -0500)] 
Format and check all code using python black (#1776)

The Makefile target builds a python3 venv at .venv and installs
black if possible. Since black is Python 3.6 and up only, we
skip the check on systems with an older Python 3.x.

6 days agoFilter out empty missing_revs results in mem3_rep
Nick Vatamaniuc [Thu, 6 Dec 2018 18:47:49 +0000 (13:47 -0500)] 
Filter out empty missing_revs results in mem3_rep

This avoids needlessly making cross-cluster fabric:update_docs(Db, [], Opts)
calls.

6 days agoMerge pull request #1797 from apache/ignore-clang-compile-commands-db-file
Joan Touzet [Thu, 6 Dec 2018 21:06:38 +0000 (16:06 -0500)] 
Merge pull request #1797 from apache/ignore-clang-compile-commands-db-file

Ignore clang compile commands database file

6 days agoIgnore clang compile commands database file 1797/head
Eric Avdey [Thu, 6 Dec 2018 20:28:08 +0000 (16:28 -0400)] 
Ignore clang compile commands database file

New rebar leaves behind a clang compile commands database file
after compiling the ports.

8 days agoMerge pull request #1790 from cloudant/move-tests-to-suite
iilyak [Tue, 4 Dec 2018 16:30:27 +0000 (08:30 -0800)] 
Merge pull request #1790 from cloudant/move-tests-to-suite

Move tests to suite

9 days agomock couch_log 1790/head
ILYA Khlopotov [Mon, 3 Dec 2018 21:21:51 +0000 (21:21 +0000)] 
mock couch_log

9 days agoFix expected result from test
ILYA Khlopotov [Mon, 3 Dec 2018 18:35:23 +0000 (18:35 +0000)] 
Fix expected result from test

9 days agoMove couch_flags_config tests into its own module
ILYA Khlopotov [Mon, 3 Dec 2018 18:34:51 +0000 (18:34 +0000)] 
Move couch_flags_config tests into its own module

12 days agoMerge pull request #1786 from apache/no-dev-data-dir
Joan Touzet [Sat, 1 Dec 2018 02:22:12 +0000 (21:22 -0500)] 
Merge pull request #1786 from apache/no-dev-data-dir

dev/run: do not create needless dev/data/ dir

12 days agoMerge branch 'master' into no-dev-data-dir 1786/head
Joan Touzet [Sat, 1 Dec 2018 00:11:38 +0000 (19:11 -0500)] 
Merge branch 'master' into no-dev-data-dir

12 days agoUse devclean on elixir target for consistency of Makefile (#1785)
Eric Avdey [Fri, 30 Nov 2018 21:31:20 +0000 (17:31 -0400)] 
Use devclean on elixir target for consistency of Makefile (#1785)

Use devclean on elixir target for consistency of Makefile

12 days agodev/run: do not create needless dev/data/ dir
Joan Touzet [Fri, 30 Nov 2018 21:07:14 +0000 (16:07 -0500)] 
dev/run: do not create needless dev/data/ dir

13 days agoMerge pull request #1780 from apache/2.3.0-prep 2.3.x 2.3.0 2.3.0-RC1
Joan Touzet [Thu, 29 Nov 2018 18:48:31 +0000 (13:48 -0500)] 
Merge pull request #1780 from apache/2.3.0-prep

Bump fauxton, docs, version to 2.3.0

13 days agoBump fauxton, docs, version to 2.3.0 1780/head
Joan Touzet [Thu, 29 Nov 2018 18:00:27 +0000 (13:00 -0500)] 
Bump fauxton, docs, version to 2.3.0

13 days agofix: re-enable _doc_id & _design_docs filter optimisation paths (#1771)
Jan Lehnardt [Thu, 29 Nov 2018 17:30:44 +0000 (18:30 +0100)] 
fix: re-enable _doc_id & _design_docs filter optimisation paths (#1771)

13 days agoCache query servers in ets table (#1778)
iilyak [Thu, 29 Nov 2018 13:42:55 +0000 (05:42 -0800)] 
Cache query servers in ets table (#1778)

The configuration of query servers is done via environment variables.
Calling os:getenv every time we need a new query process is expensive.
Instead we extact all configured query servers from the environemt on
`couch_proc_manager` startup and cache them in ets table.

fixes #1772

2 weeks agoUse fabric to get design docs in the compaction daemon
Nick Vatamaniuc [Wed, 28 Nov 2018 03:37:38 +0000 (22:37 -0500)] 
Use fabric to get design docs in the compaction daemon

Previously the compaction daemon looked for design docs in each shard file.
This worked well for versions < 2.x, however, for clustered databases design
documents will only be found in their respective shards based on the document
id hashing algorithm. This meant that in a default setup of Q=8 only the views
of one shard range, where the _design document lives, would be compacted.

The fix for this issue is to use fabric to retrive all the design documents for
clustered database.

Issue #1579

2 weeks agotest: port large_docs.js to Elixir test suite (#1745)
Alessio Biancalana [Wed, 28 Nov 2018 08:58:51 +0000 (09:58 +0100)] 
test: port large_docs.js to Elixir test suite (#1745)

2 weeks agotest: port coffee.js to Elixir test suite (#1760)
Alessio Biancalana [Wed, 28 Nov 2018 08:08:23 +0000 (09:08 +0100)] 
test: port coffee.js to Elixir test suite (#1760)

2 weeks agoMerge pull request #1767 from van-mronov/mix-format
Joan Touzet [Wed, 28 Nov 2018 04:30:09 +0000 (23:30 -0500)] 
Merge pull request #1767 from van-mronov/mix-format

Check code format before running elixir test suite

2 weeks agoMerge branch 'master' into mix-format 1767/head
Joan Touzet [Wed, 28 Nov 2018 03:54:31 +0000 (22:54 -0500)] 
Merge branch 'master' into mix-format

2 weeks agoMerge pull request #1764 from apache/switch-scripts-to-python3
Joan Touzet [Wed, 28 Nov 2018 03:54:21 +0000 (22:54 -0500)] 
Merge pull request #1764 from apache/switch-scripts-to-python3

* Switch scripts to python3
* Update mango test harness to use venv

2 weeks agoDon't use activate script; Windows fixes 1764/head
Joan Touzet [Wed, 28 Nov 2018 00:29:42 +0000 (19:29 -0500)] 
Don't use activate script; Windows fixes

2 weeks agoUpdate win makefile
Ivan Mironov [Tue, 27 Nov 2018 20:36:31 +0000 (15:36 -0500)] 
Update win makefile

2 weeks agoFormat elixir test
Ivan Mironov [Tue, 27 Nov 2018 20:25:44 +0000 (15:25 -0500)] 
Format elixir test

2 weeks agoAdd elixir-check-formatted make task
Ivan Mironov [Tue, 27 Nov 2018 19:24:02 +0000 (14:24 -0500)] 
Add elixir-check-formatted make task

2 weeks agoAdd formatter config
Ivan Mironov [Tue, 27 Nov 2018 19:22:31 +0000 (14:22 -0500)] 
Add formatter config

2 weeks agoRun mango tests with Python 3
Nick Vatamaniuc [Wed, 3 Oct 2018 19:11:57 +0000 (15:11 -0400)] 
Run mango tests with Python 3

Before we were ignoring venv setup in the Makefile, so update the test runner
to use that instead of pestering developers to install those dependencies by
hand.

Issue #1632

2 weeks agoSwitch to python 3
Nick Vatamaniuc [Wed, 3 Oct 2018 17:30:18 +0000 (13:30 -0400)] 
Switch to python 3

Ran 2to3 and fixed a few deprecated warnings

Issue #1632

2 weeks agoImplement replicator session refresh based on cookie max age
Nick Vatamaniuc [Fri, 21 Sep 2018 17:12:03 +0000 (13:12 -0400)] 
Implement replicator session refresh based on cookie max age

Force couch_replicator_auth_session plugin to refresh the session periodically.
Normally it is not needed as the session would be refreshed when requests start
failing with a 401 (authentication) or 403 (authorization) errors. In some
cases when anonymous writes are allowed to the database and a VDU function is
used to forbid writes based on the authenticated in username, requests with an
expired session cookie will not fail with a 401 and the session will not be
refreshed.

To fix the issue using these two approaches:

 1. Use cookie's max-age expiry time to schedule a refresh. To ensure that time
 is provided in the cookie, switch the the option to enable it by default. This
 handles the issue for endpoints which are updated with this commit.

 2. For endpoints which do not put a max-age time in the cookie, use a value
 that's less than CouchDB's default auth timeout. If users changed their
 auth timeout value, and use VDUs in the pattern described above, and don't
 update their endpoints to version which sends max-age by default, they could
 adjust `[replicator] session_refresh_interval_sec` to their auth timeout minus
 some small delay.

Of course refresh based on auth/authz failures should still works as before.

Fixes #1607

2 weeks agotest: port lots_of_docs.js to Elixir test suite (#1738)
Alessio Biancalana [Mon, 26 Nov 2018 14:17:39 +0000 (15:17 +0100)] 
test: port lots_of_docs.js to Elixir test suite (#1738)

2 weeks agoMerge pull request #1761 from cloudant/fix-couch_epi-typespec
iilyak [Fri, 23 Nov 2018 19:39:24 +0000 (11:39 -0800)] 
Merge pull request #1761 from cloudant/fix-couch_epi-typespec

Fix couch_epi typespec for data provider

2 weeks agoFix couch_epi typespec for data provider 1761/head
ILYA Khlopotov [Fri, 23 Nov 2018 11:59:01 +0000 (11:59 +0000)] 
Fix couch_epi typespec for data provider

There were few problems:
- `module` was renamed into `static_module`
  - https://github.com/apache/couchdb/commit/0fefc859eb9c18120064317da61a30adaeac5f92#diff-d9e3e3c91d4866fe966666619bda7991
- `callback_module` was added
  - https://github.com/apache/couchdb/commit/cf65280466499d652cff1171a2039af49c5677e8#diff-d9e3e3c91d4866fe966666619bda7991
- data provider specification can include options
  - https://github.com/apache/couchdb/blob/master/src/couch_epi/src/couch_epi_plugin.erl#L143

2 weeks agoMerge pull request #1754 from cloudant/do-not-use-list-as-config-key
iilyak [Fri, 23 Nov 2018 15:26:30 +0000 (07:26 -0800)] 
Merge pull request #1754 from cloudant/do-not-use-list-as-config-key

Do not use [] in feature_flags configuration

2 weeks agoReplace erl_parse based parser with our own 1754/head
ILYA Khlopotov [Thu, 22 Nov 2018 20:25:58 +0000 (20:25 +0000)] 
Replace erl_parse based parser with our own

2 weeks agoDo not use [] in feature_flags configuration
ILYA Khlopotov [Thu, 22 Nov 2018 13:12:48 +0000 (13:12 +0000)] 
Do not use [] in feature_flags configuration

[] characters are fobidden in configuration keys for security reason.
Use list without [] to configure flags. Example configuration:

[feature_flags]
foo,bar,baz||test* = true

2 weeks agofeat: do not record server admin requests as cache misses (#1755)
Jan Lehnardt [Thu, 22 Nov 2018 19:53:19 +0000 (20:53 +0100)] 
feat: do not record server admin requests as cache misses (#1755)

Closes #1746

2 weeks agoMerge pull request #1629 from cloudant/84736-handle-db-deletion-in-load_validation_funs
iilyak [Thu, 22 Nov 2018 13:16:00 +0000 (05:16 -0800)] 
Merge pull request #1629 from cloudant/84736-handle-db-deletion-in-load_validation_funs

handle db deletion in load validation funs

3 weeks agoHandle db deletion in couch_db:load_validation_funs 1629/head
ILYA Khlopotov [Thu, 27 Sep 2018 10:34:01 +0000 (03:34 -0700)] 
Handle db deletion in couch_db:load_validation_funs

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}]}]}
```

3 weeks agoMerge pull request #1744 from cloudant/fix-_design_docs_total_rows
Eric Avdey [Wed, 21 Nov 2018 23:09:01 +0000 (19:09 -0400)] 
Merge pull request #1744 from cloudant/fix-_design_docs_total_rows

Fix total_rows value for queries on `_design_docs` handler

3 weeks agoAdd a new test suite for _design_doc handler 1744/head
Eric Avdey [Mon, 19 Nov 2018 17:45:43 +0000 (13:45 -0400)] 
Add a new test suite for _design_doc handler

3 weeks agoRemove empty spaces from couch_mrview_test_util
Eric Avdey [Mon, 19 Nov 2018 14:58:04 +0000 (10:58 -0400)] 
Remove empty spaces from couch_mrview_test_util

3 weeks agoFix misleading assertion in design_docs_query.js test
Eric Avdey [Fri, 16 Nov 2018 19:44:16 +0000 (15:44 -0400)] 
Fix misleading assertion in design_docs_query.js test

3 weeks agoRemove ending spaces from design_docs_query.js
Eric Avdey [Fri, 16 Nov 2018 19:43:44 +0000 (15:43 -0400)] 
Remove ending spaces from design_docs_query.js

3 weeks agoFix total_rows for _design_docs with keys
Eric Avdey [Fri, 16 Nov 2018 18:57:37 +0000 (14:57 -0400)] 
Fix total_rows for _design_docs with keys

This adds a new fabric provider for getting a counter for design docs
in a database. It allows for a valid query for total_rows when _design_docs
handler queried with an array of keys.

3 weeks agoFix total_rows for _design_docs handler
Eric Avdey [Fri, 16 Nov 2018 18:53:48 +0000 (14:53 -0400)] 
Fix total_rows for _design_docs handler

3 weeks agoThis adds in downgrade code for Database partitions work. We add an
Garren Smith [Tue, 23 Oct 2018 14:35:29 +0000 (16:35 +0200)] 
This adds in downgrade code for Database partitions work. We add an
extra field in the header.

3 weeks agoMerge pull request #1750 from apache/remove-setting-on-chttpd_view_test
Peng Hui Jiang [Tue, 20 Nov 2018 12:16:52 +0000 (20:16 +0800)] 
Merge pull request #1750 from apache/remove-setting-on-chttpd_view_test

Remove unnecessary setting on chttpd_view_test

3 weeks agoRemove unnecessary setting on chttpd_view_test 1750/head
jiangph [Tue, 20 Nov 2018 09:12:01 +0000 (17:12 +0800)] 
Remove unnecessary setting on chttpd_view_test

3 weeks agoMerge pull request #1748 from apache/win-fix-makefile
Joan Touzet [Mon, 19 Nov 2018 22:04:26 +0000 (17:04 -0500)] 
Merge pull request #1748 from apache/win-fix-makefile

Add query server to eunit, Makefile.win

3 weeks agoAdd query server to eunit, Makefile.win win-fix-makefile 1748/head
Joan Touzet [Mon, 19 Nov 2018 20:20:56 +0000 (15:20 -0500)] 
Add query server to eunit, Makefile.win

3 weeks agoSet query server env variable in Makefile for isolated eunit tests (#1747)
Eric Avdey [Mon, 19 Nov 2018 20:10:47 +0000 (16:10 -0400)] 
Set query server env variable in Makefile for isolated eunit tests (#1747)

3 weeks agoMerge pull request #1739 from apache/timeout-_purged_infos_limit
Peng Hui Jiang [Fri, 16 Nov 2018 00:03:56 +0000 (08:03 +0800)] 
Merge pull request #1739 from apache/timeout-_purged_infos_limit

Avoid badmatch when getting fabric timeout

3 weeks agoAvoid badmatch when getting fabric timeout timeout-_purged_infos_limit 1739/head
jiangph [Wed, 14 Nov 2018 13:35:19 +0000 (21:35 +0800)] 
Avoid badmatch when getting fabric timeout

   - Avoid badmatch when putting set_purge_infos_limit
     and getting fabric timeout

COUCHDB-3326

4 weeks agoMerge pull request #1717 from cloudant/COUCHDB-1380-fix-nasty-error
Peng Hui Jiang [Thu, 15 Nov 2018 05:31:13 +0000 (13:31 +0800)] 
Merge pull request #1717 from cloudant/COUCHDB-1380-fix-nasty-error

Fix nasty 500 error on POST to /_config

4 weeks agoFix nasty 500 error on POST to /_config 1717/head
wenwl [Wed, 7 Nov 2018 08:46:57 +0000 (16:46 +0800)] 
Fix nasty 500 error on POST to /_config

4 weeks agoAdd support for _bulk_get with multipart/mixed and multipart/realated responses
AlexanderKaraberov [Mon, 12 Nov 2018 16:20:04 +0000 (17:20 +0100)] 
Add support for _bulk_get with multipart/mixed and multipart/realated responses

4 weeks agoMerge pull request #1736 from apache/1732-mango-tests-windows
Joan Touzet [Tue, 13 Nov 2018 23:17:54 +0000 (18:17 -0500)] 
Merge pull request #1736 from apache/1732-mango-tests-windows

Test suite fixes for Windows

4 weeks agoRevert breaking change to Makefile.win 1736/head
Joan Touzet [Tue, 13 Nov 2018 22:02:27 +0000 (17:02 -0500)] 
Revert breaking change to Makefile.win

4 weeks ago[Win] elixir fix: use 127.0.0.1, not localhost
Joan Touzet [Tue, 13 Nov 2018 21:44:47 +0000 (16:44 -0500)] 
[Win] elixir fix: use 127.0.0.1, not localhost

"It's the test suite, it can't be DNS!"

"It's ALWAYS DNS."

4 weeks agoMango test suite Windows fixes, closes #1732
Joan Touzet [Tue, 13 Nov 2018 21:42:23 +0000 (16:42 -0500)] 
Mango test suite Windows fixes, closes #1732

Unfortuantely, os:timestamp() on Windows only has millisecond
accuracy. That means that the two Mango tests checking for a positive
value of execution_time fail, since these tests appear to be running
in <1ms on my test setup (a rather anemic Windows VM!)

This change disables only the check for execution_time in two tests,
and leaves the remainder of the execution_stats checks in place
on Windows.

It also introduces a convenience "make.cmd" file so you can
"make check" without typing "make -f Makefile.win check" all the time.

4 weeks agoImprove Mango test harness, add Windows compat (#1733)
Joan Touzet [Tue, 13 Nov 2018 18:04:26 +0000 (13:04 -0500)] 
Improve Mango test harness, add Windows compat (#1733)

4 weeks agoMerge pull request #1682 from cloudant/feature_flags2
iilyak [Tue, 13 Nov 2018 11:07:23 +0000 (03:07 -0800)] 
Merge pull request #1682 from cloudant/feature_flags2

Feature flags

4 weeks agoImplement efficient feature flags 1682/head
ILYA Khlopotov [Thu, 18 Oct 2018 16:40:34 +0000 (09:40 -0700)] 
Implement efficient feature flags

4 weeks agoFix typespec for couch_epi:get_value/3
ILYA Khlopotov [Fri, 26 Oct 2018 13:02:54 +0000 (06:02 -0700)] 
Fix typespec for couch_epi:get_value/3

4 weeks agoEmit clauses in the order of definitions
ILYA Khlopotov [Thu, 18 Oct 2018 16:39:42 +0000 (09:39 -0700)] 
Emit clauses in the order of definitions

4 weeks agoSupport prefix based matching in couch_epi_data_gen
ILYA Khlopotov [Wed, 17 Oct 2018 17:35:11 +0000 (10:35 -0700)] 
Support prefix based matching in couch_epi_data_gen

4 weeks agoSupport elixir 1.7 (#1726)
Jay Doane [Tue, 13 Nov 2018 01:59:49 +0000 (17:59 -0800)] 
Support elixir 1.7 (#1726)

* Reformat mix.lock
* Suppress elixir 1.7 warnings

4 weeks ago[win32] Fix dev/run and Makefile for test suite (#1731)
Joan Touzet [Tue, 13 Nov 2018 00:50:42 +0000 (19:50 -0500)] 
[win32] Fix dev/run and Makefile for test suite (#1731)

4 weeks agoRemove eliminated config options from tests
Jay Doane [Sun, 11 Nov 2018 06:24:34 +0000 (22:24 -0800)] 
Remove eliminated config options from tests

4 weeks agoEnable cluster auto-assembly through a seedlist (#1658)
Adam Kocoloski [Sun, 11 Nov 2018 02:40:43 +0000 (21:40 -0500)] 
Enable cluster auto-assembly through a seedlist (#1658)

Enable cluster auto-assembly through a seedlist

This introduces a new config setting which allows an administrator to
configure an initial list of nodes that should be contacted when a node
boots up:

[cluster]
seedlist = couchdb@node1.example.com,couchdb@node2.example.com,couchdb@node3.example.com

If configured, CouchDB will add every node in the seedlist to the _nodes
DB automatically, which will trigger a distributed Erlang connection and
a replication of the internal system databases to the local node. This
eliminates the need to explicitly add each node using the HTTP API.

We also modify the /_up endpoint to reflect the progress of the initial seeding
of the node. If a seedlist is configured the endpoint will return 404 until the
local node has updated its local replica of each of the system databases from
one of the members of the seedlist. Once the status flips to "ok" the endpoint
will return 200 and it's safe to direct requests to the new node.

4 weeks agoImprove retry_until (#1725)
Jay Doane [Sat, 10 Nov 2018 20:34:51 +0000 (12:34 -0800)] 
Improve retry_until (#1725)

* Fix bug in epoch millisecond calculation
* Include timeout milliseconds in exception message
* Support assertions in retry_until

Previously, retry_until would only work with boolean conditions.

This change supports assertions in code being retried, which requires
fewer changes to wrap existing code containing assertions.

4 weeks agoRetain replication stats between job runs
Nick Vatamaniuc [Thu, 8 Nov 2018 23:33:15 +0000 (18:33 -0500)] 
Retain replication stats between job runs

Previously stats counts between job runs were reset. So if a job was stopped
and restarted by the scheduler, its docs_written, docs_read, doc_write_failures,
etc., counts would go back to 0. For doc_write_failures this was especially bad
as it hid the fact that some documents were not replicated to the target
because either a VDU failed or one of the limits were hit.

This change preserves stats across job runs. Everytime active tasks is updated,
the stats object in rep record of each job in scheduler's ets table will be
updated asynchronously. On next job start the job will reinitialize from last
saved stats.

Relates somewhat to issue #1159

4 weeks agofeat: update couch-config to match #1602 (#1723)
Jan Lehnardt [Fri, 9 Nov 2018 19:37:46 +0000 (20:37 +0100)] 
feat: update couch-config to match #1602 (#1723)

4 weeks agofeat: change enaabling of chttpsd to `[ssl] enable = true`
Jan Lehnardt [Fri, 9 Nov 2018 10:23:04 +0000 (11:23 +0100)] 
feat: change enaabling of chttpsd to `[ssl] enable = true`

The previous configuration `[daemons] httpsd = {chttpd, start_link, [https]}`
is also sill supported for backwards cmpatibility reasons.

4 weeks agofeat: remove redundant string parsing
Jan Lehnardt [Fri, 9 Nov 2018 09:42:36 +0000 (10:42 +0100)] 
feat: remove redundant string parsing

4 weeks agofeat: move handler definition to .app file
Jan Lehnardt [Thu, 20 Sep 2018 09:53:47 +0000 (11:53 +0200)] 
feat: move handler definition to .app file

4 weeks agosimplify, h/t @vatamane
Jan Lehnardt [Mon, 17 Sep 2018 16:14:33 +0000 (18:14 +0200)] 
simplify, h/t @vatamane

4 weeks agocompatibility for erlang < 20
Jan Lehnardt [Sun, 16 Sep 2018 14:44:21 +0000 (16:44 +0200)] 
compatibility for erlang < 20

4 weeks agoremove daemons from config js tests
Jan Lehnardt [Sat, 15 Sep 2018 11:42:34 +0000 (13:42 +0200)] 
remove daemons from config js tests

4 weeks agoremove deprecated http proxy code and tests from couch_httpd
Jan Lehnardt [Sat, 15 Sep 2018 11:17:17 +0000 (13:17 +0200)] 
remove deprecated http proxy code and tests from couch_httpd

4 weeks agotest: fix os proc tests
Jan Lehnardt [Sat, 15 Sep 2018 07:51:30 +0000 (09:51 +0200)] 
test: fix os proc tests

4 weeks agofeat: point to branch on couhc_config that is needed here
Jan Lehnardt [Sat, 15 Sep 2018 07:50:59 +0000 (09:50 +0200)] 
feat: point to branch on couhc_config that is needed here

4 weeks agofeat: remove deprecated os_daemons
Jan Lehnardt [Sat, 15 Sep 2018 07:50:37 +0000 (09:50 +0200)] 
feat: remove deprecated os_daemons

4 weeks agofeat: move [native_]query_server & os_daemons setup out of runtime config
Jan Lehnardt [Fri, 14 Sep 2018 08:42:02 +0000 (10:42 +0200)] 
feat: move [native_]query_server & os_daemons setup out of runtime config

CouchDB ships with two default query_servers (javascript and coffeescript)
as well as one default native_query_server (query aka mango). These used
to be configured in default.ini in these sections:

```
[query_servers]
javascript = {{prefix}}/bin/couchjs {{prefix}}/share/server/main.js
coffeescript = {{prefix}}/bin/couchjs {{prefix}}/share/server/main-coffee.js

; enable mango query engine
[native_query_servers]
query = {mango_native_proc, start_link, []}
; erlang query server
; erlang = {couch_native_process, start_link, []}
```

This allowed end-users post-install and even runtime-changes to which
query servers are enabled and where their binaries live.

This patch changes things, so only a post-install, but not at-runtime
changes are possible from now on.

This still allows people to configure their CouchDB to run a third-
party query server like the somewhat popular Python query server,
but it changes the way the setup is done.

Query Servers

The javascript and coffeescript query servers continue to be enabled
by default. Setup differences have been moved from default.ini to
the couchdb and couchdb.cmd start scripts respectively.

Additional query servers can now be configured using environment
variables:

```
export COUCHDB_QUERY_SERVER_PYTHON="/path/to/python/query/server.py with args"
couchdb
```

Where the last segment in the environment variable matches the usual
lowercase(!) query language in the design doc `language` field.

Multiple query servers can be configured by using more environment
variables.

Native Query Servers

The mango query server continues to be enabled by default. The erlang
query server continues to be disabled by default. This patch adds
a `[native_query_servers] enable_erlang_query_server = BOOL` setting
(defaults to `"false"`) to enable the erlang query server.

If the legacy configuration for enabling the query server is detected,
that is counted as a `true` setting as well, so existing configurations
continue to work just fine.

Windows

Since the setting of the `./configure` time `PREFIX` happens during
`make release`, I had to adapt the `couchdb` and `couchdb.cmd` scripts
to have the correct env vars set and the `PREFIX` replaced there.

I did this to the best of my abilities and research, but this needs
review from the Windows team (Hi Joan! :).

OS Daemons

Although deprecated in 2.2.0, we’re keeping support for this until 3.x,
but the configuration changes analogous to query servers.

Previously, configuration looked like this:

```
[os_daemons]
name = /path/to/daemon with args
```

With this patch, setup looks like this:

```
COUCHDB_OS_DAEMON_NAME="/path/to/daemon with args"
couchdb
```

Multiple OS Daemons can be started with multiple env vars. The final
segment in the env var becomes the daemon identifier inside CouchDB
as lowercase(!).