[couchdb-docker] branch custom_uid updated (07675aa -> f9a6391)

2019-08-15 Thread willholley
This is an automated email from the ASF dual-hosted git repository.

willholley pushed a change to branch custom_uid
in repository https://gitbox.apache.org/repos/asf/couchdb-docker.git.


omit 07675aa  address review comments
omit 9a3af1d  Allow running as arbitrary uid
 add d6cd383  add setuptools to dev images
 add d56816f  Merge pull request #152 from apache/setuptools
 add 37dfa64  Allow running as arbitrary uid
 add f9a6391  address review comments

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (07675aa)
\
 N -- N -- N   refs/heads/custom_uid (f9a6391)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 dev-cluster/Dockerfile | 5 +++--
 dev/Dockerfile | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)



[couchdb] branch epi-support-map-childspec created (now 1db0294)

2019-08-15 Thread eiri
This is an automated email from the ASF dual-hosted git repository.

eiri pushed a change to branch epi-support-map-childspec
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


  at 1db0294  Support map childspecs in couch_epi supervisor's children 
replacement

This branch includes the following new commits:

 new 1db0294  Support map childspecs in couch_epi supervisor's children 
replacement

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[couchdb] 01/01: Support map childspecs in couch_epi supervisor's children replacement

2019-08-15 Thread eiri
This is an automated email from the ASF dual-hosted git repository.

eiri pushed a commit to branch epi-support-map-childspec
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 1db0294eb1093066773760b75a200d99aa453be8
Author: Eric Avdey 
AuthorDate: Thu Aug 15 10:07:07 2019 -0300

Support map childspecs in couch_epi supervisor's children replacement
---
 src/couch_epi/src/couch_epi_sup.erl   |  5 +++-
 src/couch_epi/test/eunit/couch_epi_basic_test.erl | 34 +++
 2 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/src/couch_epi/src/couch_epi_sup.erl 
b/src/couch_epi/src/couch_epi_sup.erl
index 218db54..477cbe7 100644
--- a/src/couch_epi/src/couch_epi_sup.erl
+++ b/src/couch_epi/src/couch_epi_sup.erl
@@ -136,4 +136,7 @@ modules(#couch_epi_spec{kind = data_subscriptions, 
behaviour = Module}) ->
 merge([], Children) ->
 Children;
 merge([{Id, _, _, _, _, _} = Spec | Rest], Children) ->
-merge(Rest, lists:keystore(Id, 1, Children, Spec)).
+merge(Rest, lists:keystore(Id, 1, Children, Spec));
+merge([#{id := Id} = Spec | Rest], Children) ->
+Replace = fun(#{id := I}) when I == Id -> Spec; (E) -> E end,
+merge(Rest, lists:map(Replace, Children)).
diff --git a/src/couch_epi/test/eunit/couch_epi_basic_test.erl 
b/src/couch_epi/test/eunit/couch_epi_basic_test.erl
index 587d156..5ba6c9f 100644
--- a/src/couch_epi/test/eunit/couch_epi_basic_test.erl
+++ b/src/couch_epi/test/eunit/couch_epi_basic_test.erl
@@ -67,7 +67,9 @@ processes() ->
 [
 {?MODULE, [?CHILD(extra_process, worker)]},
 {?MODULE, [{to_replace, {new, start_link, [bar]},
-permanent, 5000, worker, [bar]}]}
+permanent, 5000, worker, [bar]}]},
+{?MODULE, [#{id => to_replace_map,
+start => {new, start_link, [bar]}, modules => [bar]}]}
 ].
 
 
@@ -95,9 +97,10 @@ parse_child_id(Id) ->
 -include_lib("eunit/include/eunit.hrl").
 
 basic_test() ->
-Expected = lists:sort([
+Expected = [
 {extra_process, [], [extra_process]},
 {to_replace, [bar], [bar]},
+{to_replace_map, [bar], [bar]},
 {{my_service, providers},
 [couch_epi_functions_gen_my_service],
 [couch_epi_codechange_monitor, couch_epi_functions_gen_my_service,
@@ -114,18 +117,23 @@ basic_test() ->
 [couch_epi_data_gen_test_app_descriptions],
 lists:sort([couch_epi_codechange_monitor,
 couch_epi_data_gen_test_app_descriptions, ?MODULE])}
-]),
+],
 
-ToReplace = {to_replace,
-{old, start_link, [foo]}, permanent, 5000, worker, [foo]},
-Children = lists:sort(couch_epi_sup:plugin_childspecs(
-?MODULE, [?MODULE], [ToReplace])),
-Results = [
-{parse_child_id(Id), Args, lists:sort(Modules)}
-|| {Id, {_M, _F, Args}, _, _, _, Modules} <- Children
+ToReplace = [
+{to_replace, {old, start_link, [foo]}, permanent, 5000, worker, [foo]},
+#{id => to_replace_map, start => {old, start_link, [foo]}}
 ],
+Children = lists:sort(couch_epi_sup:plugin_childspecs(
+?MODULE, [?MODULE], ToReplace)),
+
+Results = lists:map(fun
+({Id, {_M, _F, Args}, _, _, _, Modules}) ->
+{parse_child_id(Id), Args, lists:sort(Modules)};
+(#{id := Id, start := {_M, _F, Args}, modules := Modules}) ->
+{parse_child_id(Id), Args, lists:sort(Modules)}
+end, Children),
 
-Tests = lists:zip(Expected, Results),
+Tests = lists:zip(lists:sort(Expected), lists:sort(Results)),
 [?assertEqual(Expect, Result) || {Expect, Result} <- Tests],
 
 ExpectedChild = {to_replace, {new, start_link, [bar]},
@@ -134,4 +142,8 @@ basic_test() ->
 ExpectedChild,
 lists:keyfind(to_replace, 1, Children)),
 
+ExpectedMapChildSpec = #{id => to_replace_map,
+start => {new, start_link, [bar]}, modules => [bar]},
+[MapChildSpec] = [E || #{id := to_replace_map} = E <- Children],
+?assertEqual(ExpectedMapChildSpec, MapChildSpec),
 ok.



[couchdb] 02/05: Don't try to publish trusty packages

2019-08-15 Thread kocolosk
This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a commit to branch jenkins-cpse-debugging
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 7a0d5f16aaa7606c3e2a8065ce3fed67da1e5100
Author: Adam Kocoloski 
AuthorDate: Wed Aug 14 12:07:38 2019 -0400

Don't try to publish trusty packages

We aren't building them anymore.
---
 Jenkinsfile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index f8f6a2f..342ac6c 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -529,8 +529,6 @@ pipeline {
 reprepro -b couchdb-pkg/repo includedeb jessie pkgs/jessie/*.deb
 cp js/debian-stretch/*.deb pkgs/stretch
 reprepro -b couchdb-pkg/repo includedeb stretch pkgs/stretch/*.deb
-cp js/ubuntu-trusty/*.deb pkgs/trusty
-reprepro -b couchdb-pkg/repo includedeb trusty pkgs/trusty/*.deb
 cp js/ubuntu-xenial/*.deb pkgs/xenial
 reprepro -b couchdb-pkg/repo includedeb xenial pkgs/xenial/*.deb
 cp js/ubuntu-bionic/*.deb pkgs/bionic



[couchdb] 04/05: Extend timeouts for chttpd_db_test suite

2019-08-15 Thread kocolosk
This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a commit to branch jenkins-cpse-debugging
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 86777ddcadd897abf106788b01848699ae6fa488
Author: Adam Kocoloski 
AuthorDate: Wed Aug 14 14:33:53 2019 -0400

Extend timeouts for chttpd_db_test suite

The last 9 tests take a few hundred milliseconds locally and flaked a
bit on Jenkins. For consistency's sake we bump the timeout from 5 to 60
seconds across the board.
---
 src/chttpd/test/eunit/chttpd_db_test.erl | 85 
 1 file changed, 43 insertions(+), 42 deletions(-)

diff --git a/src/chttpd/test/eunit/chttpd_db_test.erl 
b/src/chttpd/test/eunit/chttpd_db_test.erl
index 2708aa0..1725019 100644
--- a/src/chttpd/test/eunit/chttpd_db_test.erl
+++ b/src/chttpd/test/eunit/chttpd_db_test.erl
@@ -23,6 +23,7 @@
 -define(DESTHEADER2, {"Destination", "foo%2Fbar%23baz%3Fpow%3Afiz"}).
 -define(FIXTURE_TXT, ?ABS_PATH(?FILE)).
 -define(i2l(I), integer_to_list(I)).
+-define(TIMEOUT, 60). % seconds
 
 setup() ->
 Hashed = couch_passwords:hash_admin_password(?PASS),
@@ -88,7 +89,7 @@ all_test_() ->
 
 
 should_return_ok_true_on_bulk_update(Url) ->
-?_assertEqual(true,
+{timeout, ?TIMEOUT, ?_assertEqual(true,
 begin
 {ok, _, _, Body} = create_doc(Url, "testdoc"),
 {Json} = ?JSON_DECODE(Body),
@@ -99,27 +100,27 @@ should_return_ok_true_on_bulk_update(Url) ->
 ResultJson = ?JSON_DECODE(ResultBody),
 {InnerJson} = lists:nth(1, ResultJson),
 couch_util:get_value(<<"ok">>, InnerJson, undefined)
-end).
+end)}.
 
 
 should_return_ok_true_on_ensure_full_commit(Url0) ->
-?_test(begin
+{timeout, ?TIMEOUT, ?_test(begin
 Url = Url0 ++ "/_ensure_full_commit",
 {ok, RC, _, Body} = test_request:post(Url, [?CONTENT_JSON, ?AUTH], []),
 {Json} = ?JSON_DECODE(Body),
 ?assertEqual(201, RC),
 ?assert(couch_util:get_value(<<"ok">>, Json))
-end).
+end)}.
 
 
 should_return_404_for_ensure_full_commit_on_no_db(Url0) ->
-?_test(begin
+{timeout, ?TIMEOUT, ?_test(begin
 Url = Url0 ++ "-missing-db" ++ "/_ensure_full_commit",
 {ok, RC, _, Body} = test_request:post(Url, [?CONTENT_JSON, ?AUTH], []),
 {Json} = ?JSON_DECODE(Body),
 ?assertEqual(404, RC),
 ?assertEqual(<<"not_found">>, couch_util:get_value(<<"error">>, Json))
-end).
+end)}.
 
 
 should_accept_live_as_an_alias_for_continuous(Url) ->
@@ -135,7 +136,7 @@ should_accept_live_as_an_alias_for_continuous(Url) ->
 end,
 couch_util:get_value(<<"last_seq">>, Result, undefined)
 end,
-?_test(begin
+{timeout, ?TIMEOUT, ?_test(begin
 {ok, _, _, ResultBody1} =
 test_request:get(Url ++ "/_changes?feed=live&timeout=1", [?AUTH]),
 LastSeq1 = GetLastSeq(ResultBody1),
@@ -146,11 +147,11 @@ should_accept_live_as_an_alias_for_continuous(Url) ->
 LastSeq2 = GetLastSeq(ResultBody2),
 
 ?assertNotEqual(LastSeq1, LastSeq2)
-end).
+end)}.
 
 
 should_return_404_for_delete_att_on_notadoc(Url) ->
-?_test(begin
+{timeout, ?TIMEOUT, ?_test(begin
 {ok, RC, _, RespBody} = test_request:delete(
 Url ++ "/notadoc/att.pdf",
 [?CONTENT_JSON, ?AUTH],
@@ -168,11 +169,11 @@ should_return_404_for_delete_att_on_notadoc(Url) ->
 []
 ),
 ?assertEqual(404, RC1)
-end).
+end)}.
 
 
 should_return_409_for_del_att_without_rev(Url) ->
-?_test(begin
+{timeout, ?TIMEOUT, ?_test(begin
 {ok, RC, _, _} = test_request:put(
 Url ++ "/testdoc3",
 [?CONTENT_JSON, ?AUTH],
@@ -186,11 +187,11 @@ should_return_409_for_del_att_without_rev(Url) ->
 []
 ),
 ?assertEqual(409, RC1)
-end).
+end)}.
 
 
 should_return_200_for_del_att_with_rev(Url) ->
-  ?_test(begin
+  {timeout, ?TIMEOUT, ?_test(begin
   {ok, RC, _Headers, RespBody} = test_request:put(
   Url ++ "/testdoc4",
   [?CONTENT_JSON, ?AUTH],
@@ -207,11 +208,11 @@ should_return_200_for_del_att_with_rev(Url) ->
   []
   ),
   ?assertEqual(200, RC1)
-end).
+end)}.
 
 
 should_return_409_for_put_att_nonexistent_rev(Url) ->
-?_test(begin
+{timeout, ?TIMEOUT, ?_test(begin
 {ok, RC, _Headers, RespBody} = test_request:put(
 Url ++ "/should_return_404/file.erl?rev=1-000",
 [?CONTENT_JSON, ?AUTH],
@@ -222,11 +223,11 @@ should_return_409_for_put_att_nonexistent_rev(Url) ->
 {<<"error">>,<<"not_found">>},
 {<<"reason">>,<<"missing_rev">>}]},
 ?JSON_DECODE(RespBody))
-end).
+end)}.
 
 
 should_return_update_seq_when_set_on_all_docs(Url) ->
-?_test(begin
+{timeout, ?TIMEOUT, ?_test(begin
 [create_doc(Url, "testdoc" ++ ?i2l(I)) || I <- lists:seq(1, 

[couchdb] branch jenkins-cpse-debugging updated (809061e -> 2825df7)

2019-08-15 Thread kocolosk
This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a change to branch jenkins-cpse-debugging
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


omit 809061e  Extend timeouts for chttpd_view_test suite
omit 479282e  Extend timeouts for chttpd_db_test suite
omit bf27ded  Extend timeouts for couch_bt_engine_upgrade_tests
omit bc0b0ec  Merge branch 'master' into jenkins-cpse-debugging
omit 53b24e8  Don't try to publish trusty packages
omit dc1e8a6  Ensure EUnit inherits appropriate env vars
 new 841f730  Ensure EUnit inherits appropriate env vars
 new 7a0d5f1  Don't try to publish trusty packages
 new 6389326  Extend timeouts for couch_bt_engine_upgrade_tests
 new 86777dd  Extend timeouts for chttpd_db_test suite
 new 2825df7  Extend timeouts for chttpd_view_test suite

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (809061e)
\
 N -- N -- N   refs/heads/jenkins-cpse-debugging (2825df7)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Makefile.win | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



[couchdb] 03/05: Extend timeouts for couch_bt_engine_upgrade_tests

2019-08-15 Thread kocolosk
This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a commit to branch jenkins-cpse-debugging
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 638932686ec60161742f3e622b5a363745e9404b
Author: Adam Kocoloski 
AuthorDate: Wed Aug 14 13:19:23 2019 -0400

Extend timeouts for couch_bt_engine_upgrade_tests

Jenkins flaked out on one of these today.
---
 src/couch/test/eunit/couch_bt_engine_upgrade_tests.erl | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/couch/test/eunit/couch_bt_engine_upgrade_tests.erl 
b/src/couch/test/eunit/couch_bt_engine_upgrade_tests.erl
index 3a516f8..a2a972c 100644
--- a/src/couch/test/eunit/couch_bt_engine_upgrade_tests.erl
+++ b/src/couch/test/eunit/couch_bt_engine_upgrade_tests.erl
@@ -15,6 +15,7 @@
 -include_lib("couch/include/couch_eunit.hrl").
 -include_lib("couch/include/couch_db.hrl").
 
+-define(TIMEOUT, 60). % seconds
 
 setup(_) ->
 Ctx = test_util:start_couch(),
@@ -63,7 +64,7 @@ upgrade_test_() ->
 
 
 t_upgrade_without_purge_req(VersionFrom, {_Ctx, _NewPaths}) ->
-?_test(begin
+{timeout, ?TIMEOUT, ?_test(begin
 % There are three documents in the fixture
 % db with zero purge entries
 DbName = ?l2b("db_v"  ++ integer_to_list(VersionFrom)
@@ -99,11 +100,11 @@ t_upgrade_without_purge_req(VersionFrom, {_Ctx, 
_NewPaths}) ->
 ?assertEqual({ok, 4}, couch_db:get_doc_count(Db)),
 ?assertEqual(1, couch_db:get_purge_seq(Db))
 end)
-end).
+end)}.
 
 
 t_upgrade_with_1_purge_req(VersionFrom, {_Ctx, _NewPaths}) ->
-?_test(begin
+{timeout, ?TIMEOUT, ?_test(begin
 % There are two documents in the fixture database
 % with a single purge entry
 DbName = ?l2b("db_v"  ++ integer_to_list(VersionFrom)
@@ -140,11 +141,11 @@ t_upgrade_with_1_purge_req(VersionFrom, {_Ctx, 
_NewPaths}) ->
 ?assertEqual({ok, 3}, couch_db:get_doc_count(Db)),
 ?assertEqual(2, couch_db:get_purge_seq(Db))
 end)
-end).
+end)}.
 
 
 t_upgrade_with_N_purge_req(VersionFrom, {_Ctx, _NewPaths}) ->
-?_test(begin
+{timeout, ?TIMEOUT, ?_test(begin
 % There is one document in the fixture database
 % with two docs that have been purged
 DbName = ?l2b("db_v"  ++ integer_to_list(VersionFrom)
@@ -179,11 +180,11 @@ t_upgrade_with_N_purge_req(VersionFrom, {_Ctx, 
_NewPaths}) ->
 ?assertEqual({ok, 2}, couch_db:get_doc_count(Db)),
 ?assertEqual(3, couch_db:get_purge_seq(Db))
 end)
-end).
+end)}.
 
 
 t_upgrade_with_1_purge_req_for_2_docs(VersionFrom, {_Ctx, _NewPaths}) ->
-?_test(begin
+{timeout, ?TIMEOUT, ?_test(begin
 % There are two documents (Doc4 and Doc5) in the fixture database
 % with three docs (Doc1, Doc2 and Doc3) that have been purged, and
 % with one purge req for Doc1 and another purge req for Doc 2 and Doc3
@@ -219,7 +220,7 @@ t_upgrade_with_1_purge_req_for_2_docs(VersionFrom, {_Ctx, 
_NewPaths}) ->
 ?assertEqual({ok, 3}, couch_db:get_doc_count(Db)),
 ?assertEqual(4, couch_db:get_purge_seq(Db))
 end)
-end).
+end)}.
 
 
 save_doc(DbName, Json) ->



[couchdb] 01/05: Ensure EUnit inherits appropriate env vars

2019-08-15 Thread kocolosk
This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a commit to branch jenkins-cpse-debugging
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 841f7308576e92889dd54877f4cabc696c4586cc
Author: Adam Kocoloski 
AuthorDate: Fri Aug 9 16:34:43 2019 -0400

Ensure EUnit inherits appropriate env vars

Omitting COUCHDB_VERSION caused the EUnit build of the replicator to
have a corrupted User-Agent header. It tried to construct a version
using git, but when building from a release tarball there is no git
repo so the UA had a git error message in it. This error message
contained a newline, which plausibly confused some part of the HTTP
stack and caused replicator HTTP requests to hang.

Related to #2098.
---
 Makefile | 4 ++--
 Makefile.win | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 8f85ab8..f09ae32 100644
--- a/Makefile
+++ b/Makefile
@@ -168,11 +168,11 @@ eunit: export BUILDDIR = $(shell pwd)
 eunit: export ERL_AFLAGS = -config $(shell pwd)/rel/files/eunit.config
 eunit: export COUCHDB_QUERY_SERVER_JAVASCRIPT = $(shell pwd)/bin/couchjs 
$(shell pwd)/share/server/main.js
 eunit: couch
-   @$(REBAR) setup_eunit 2> /dev/null
+   @COUCHDB_VERSION=$(COUCHDB_VERSION) COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) 
$(REBAR) setup_eunit 2> /dev/null
@for dir in $(subdirs); do \
 tries=0; \
 while true; do \
-$(REBAR) -r eunit $(EUNIT_OPTS) apps=$$dir ; \
+COUCHDB_VERSION=$(COUCHDB_VERSION) 
COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) $(REBAR) -r eunit $(EUNIT_OPTS) apps=$$dir ; 
\
 if [ $$? -eq 0 ]; then \
 break; \
 else \
diff --git a/Makefile.win b/Makefile.win
index a5e23d4..eda27a0 100644
--- a/Makefile.win
+++ b/Makefile.win
@@ -141,8 +141,8 @@ eunit: export ERL_AFLAGS = $(shell echo "-config 
rel/files/eunit.config")
 eunit: export BUILDDIR = $(shell echo %cd%)
 eunit: export COUCHDB_QUERY_SERVER_JAVASCRIPT = $(shell echo %cd%)/bin/couchjs 
$(shell echo %cd%)/share/server/main.js
 eunit: couch
-   @$(REBAR) setup_eunit 2> nul
-   @$(REBAR) -r eunit $(EUNIT_OPTS)
+   @set COUCHDB_VERSION=$(COUCHDB_VERSION) && set 
COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) && $(REBAR) setup_eunit 2> nul
+   @set COUCHDB_VERSION=$(COUCHDB_VERSION) && set 
COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) && $(REBAR) -r eunit $(EUNIT_OPTS)
 
 .PHONY: exunit
 # target: exunit - Run ExUnit tests



[couchdb] 05/05: Extend timeouts for chttpd_view_test suite

2019-08-15 Thread kocolosk
This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a commit to branch jenkins-cpse-debugging
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 2825df7a3e935dfaa6864d948ad9a5633094bebc
Author: Adam Kocoloski 
AuthorDate: Wed Aug 14 16:30:02 2019 -0400

Extend timeouts for chttpd_view_test suite

More occasional flakiness on Jenkins.
---
 src/chttpd/test/eunit/chttpd_view_test.erl | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/chttpd/test/eunit/chttpd_view_test.erl 
b/src/chttpd/test/eunit/chttpd_view_test.erl
index 3457c6f..4c224bb 100644
--- a/src/chttpd/test/eunit/chttpd_view_test.erl
+++ b/src/chttpd/test/eunit/chttpd_view_test.erl
@@ -24,6 +24,7 @@
 
 -define(FIXTURE_TXT, ?ABS_PATH(?FILE)).
 -define(i2l(I), integer_to_list(I)).
+-define(TIMEOUT, 60). % seconds
 
 setup() ->
 Hashed = couch_passwords:hash_admin_password(?PASS),
@@ -71,7 +72,7 @@ all_view_test_() ->
 
 
 should_succeed_on_view_with_queries_keys(Url) ->
-?_test(begin
+{timeout, ?TIMEOUT, ?_test(begin
 [create_doc(Url, "testdoc" ++ ?i2l(I)) || I <- lists:seq(1, 10)],
 {ok, _, _, _} = test_request:put(Url ++ "/_design/bar",
 [?CONTENT_JSON, ?AUTH], ?DDOC),
@@ -83,11 +84,11 @@ should_succeed_on_view_with_queries_keys(Url) ->
 ResultJsonBody = couch_util:get_value(<<"results">>, ResultJson),
 {InnerJson} = lists:nth(1, ResultJsonBody),
 ?assertEqual(2, length(couch_util:get_value(<<"rows">>, InnerJson)))
-end).
+end)}.
 
 
 should_succeed_on_view_with_queries_limit_skip(Url) ->
-?_test(begin
+{timeout, ?TIMEOUT, ?_test(begin
 [create_doc(Url, "testdoc" ++ ?i2l(I)) || I <- lists:seq(1, 10)],
 {ok, _, _, _} = test_request:put(Url ++ "/_design/bar",
 [?CONTENT_JSON, ?AUTH], ?DDOC),
@@ -100,11 +101,11 @@ should_succeed_on_view_with_queries_limit_skip(Url) ->
 {InnerJson} = lists:nth(1, ResultJsonBody),
 ?assertEqual(2, couch_util:get_value(<<"offset">>, InnerJson)),
 ?assertEqual(5, length(couch_util:get_value(<<"rows">>, InnerJson)))
-end).
+end)}.
 
 
 should_succeed_on_view_with_multiple_queries(Url) ->
-?_test(begin
+{timeout, ?TIMEOUT, ?_test(begin
 [create_doc(Url, "testdoc" ++ ?i2l(I)) || I <- lists:seq(1, 10)],
 {ok, _, _, _} = test_request:put(Url ++ "/_design/bar",
 [?CONTENT_JSON, ?AUTH], ?DDOC),
@@ -120,4 +121,4 @@ should_succeed_on_view_with_multiple_queries(Url) ->
 {InnerJson2} = lists:nth(2, ResultJsonBody),
 ?assertEqual(2, couch_util:get_value(<<"offset">>, InnerJson2)),
 ?assertEqual(5, length(couch_util:get_value(<<"rows">>, InnerJson2)))
-end).
+end)}.



[couchdb] branch prototype/fdb-layer updated: only fetch 1 query server for indexing

2019-08-15 Thread garren
This is an automated email from the ASF dual-hosted git repository.

garren pushed a commit to branch prototype/fdb-layer
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/prototype/fdb-layer by this 
push:
 new ba3cd0a  only fetch 1 query server for indexing
ba3cd0a is described below

commit ba3cd0a6fd44c69e0a020a7c7af38db361a2c888
Author: Garren Smith 
AuthorDate: Thu Aug 15 15:08:48 2019 +0200

only fetch 1 query server for indexing
---
 src/couch_views/src/couch_views_indexer.erl | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/couch_views/src/couch_views_indexer.erl 
b/src/couch_views/src/couch_views_indexer.erl
index edee332..bebbd1a 100644
--- a/src/couch_views/src/couch_views_indexer.erl
+++ b/src/couch_views/src/couch_views_indexer.erl
@@ -215,7 +215,7 @@ write_docs(TxDb, Mrst, Docs, State) ->
 couch_views_fdb:set_update_seq(TxDb, Sig, LastSeq).
 
 
-start_query_server(#mrst{} = Mrst) ->
+start_query_server(#mrst{qserver = nil} = Mrst) ->
 #mrst{
 language = Language,
 lib = Lib,
@@ -223,7 +223,10 @@ start_query_server(#mrst{} = Mrst) ->
 } = Mrst,
 Defs = [View#mrview.def || View <- Views],
 {ok, QServer} = couch_query_servers:start_doc_map(Language, Defs, Lib),
-Mrst#mrst{qserver = QServer}.
+Mrst#mrst{qserver = QServer};
+
+start_query_server(#mrst{} = Mrst) ->
+Mrst.
 
 
 report_progress(State, UpdateType) ->



[couchdb] 01/01: Merge pull request #2118 from apache/epi-support-map-childspec

2019-08-15 Thread eiri
This is an automated email from the ASF dual-hosted git repository.

eiri pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 5dcc162c9e2bd7c79a93397bf82a9744864206c5
Merge: 36fd9da 1db0294
Author: Eric Avdey 
AuthorDate: Thu Aug 15 12:44:07 2019 -0300

Merge pull request #2118 from apache/epi-support-map-childspec

Support map childspecs in couch_epi supervisor's children replacement

 src/couch_epi/src/couch_epi_sup.erl   |  5 +++-
 src/couch_epi/test/eunit/couch_epi_basic_test.erl | 34 +++
 2 files changed, 27 insertions(+), 12 deletions(-)



[couchdb] branch epi-support-map-childspec deleted (was 1db0294)

2019-08-15 Thread eiri
This is an automated email from the ASF dual-hosted git repository.

eiri pushed a change to branch epi-support-map-childspec
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


 was 1db0294  Support map childspecs in couch_epi supervisor's children 
replacement

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



[couchdb] branch master updated (36fd9da -> 5dcc162)

2019-08-15 Thread eiri
This is an automated email from the ASF dual-hosted git repository.

eiri pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


from 36fd9da  Fix replication rescheduling Running < MaxJobs corner case
 add 1db0294  Support map childspecs in couch_epi supervisor's children 
replacement
 new 5dcc162  Merge pull request #2118 from apache/epi-support-map-childspec

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/couch_epi/src/couch_epi_sup.erl   |  5 +++-
 src/couch_epi/test/eunit/couch_epi_basic_test.erl | 34 +++
 2 files changed, 27 insertions(+), 12 deletions(-)



[couchdb] branch jenkins-cpse-debugging updated (2825df7 -> 617c654)

2019-08-15 Thread kocolosk
This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a change to branch jenkins-cpse-debugging
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


from 2825df7  Extend timeouts for chttpd_view_test suite
 add 1db0294  Support map childspecs in couch_epi supervisor's children 
replacement
 add 5dcc162  Merge pull request #2118 from apache/epi-support-map-childspec
 add 617c654  Merge branch 'master' into jenkins-cpse-debugging

No new revisions were added by this update.

Summary of changes:
 src/couch_epi/src/couch_epi_sup.erl   |  5 +++-
 src/couch_epi/test/eunit/couch_epi_basic_test.erl | 34 +++
 2 files changed, 27 insertions(+), 12 deletions(-)



[couchdb] branch jenkins-cpse-debugging updated (617c654 -> 0690bde)

2019-08-15 Thread kocolosk
This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a change to branch jenkins-cpse-debugging
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


from 617c654  Merge branch 'master' into jenkins-cpse-debugging
 add 69d15cd  Refactor fabric:cleanup_index_files
 add 5a6c944  Merge pull request #2101 from 
cloudant/refactor-clean_index_files
 add 0690bde  Merge branch 'master' into jenkins-cpse-debugging

No new revisions were added by this update.

Summary of changes:
 src/couch/test/exunit/fabric_test.exs | 101 ++
 src/fabric/src/fabric.erl |  25 +
 test/elixir/lib/setup/common.ex   |   5 ++
 3 files changed, 121 insertions(+), 10 deletions(-)
 create mode 100644 src/couch/test/exunit/fabric_test.exs



[couchdb] branch master updated: Refactor fabric:cleanup_index_files

2019-08-15 Thread iilyak
This is an automated email from the ASF dual-hosted git repository.

iilyak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/master by this push:
 new 69d15cd  Refactor fabric:cleanup_index_files
 new 5a6c944  Merge pull request #2101 from 
cloudant/refactor-clean_index_files
69d15cd is described below

commit 69d15cd10652de1895b7750dd86b37ba04267f1d
Author: ILYA Khlopotov 
AuthorDate: Wed Aug 7 16:45:15 2019 +

Refactor fabric:cleanup_index_files

Previous implementation assembled a regexp by concatenating active 
signatures.
The approach caused regexp to exceed system limit in the case of huge 
number of them.
---
 src/couch/test/exunit/fabric_test.exs | 101 ++
 src/fabric/src/fabric.erl |  25 +
 test/elixir/lib/setup/common.ex   |   5 ++
 3 files changed, 121 insertions(+), 10 deletions(-)

diff --git a/src/couch/test/exunit/fabric_test.exs 
b/src/couch/test/exunit/fabric_test.exs
new file mode 100644
index 000..bdb84e9
--- /dev/null
+++ b/src/couch/test/exunit/fabric_test.exs
@@ -0,0 +1,101 @@
+defmodule Couch.Test.Fabric do
+  use Couch.Test.ExUnit.Case
+  alias Couch.Test.Utils
+
+  alias Couch.Test.Setup
+
+  alias Couch.Test.Setup.Step
+
+  import Couch.DBTest
+
+  import Utils
+
+  @admin {:user_ctx, user_ctx(roles: ["_admin"])}
+
+  def with_db(context, setup) do
+setup =
+  setup
+  |> Setup.Common.with_db()
+  |> Setup.run()
+
+context =
+  Map.merge(context, %{
+db_name: setup |> Setup.get(:db) |> Step.Create.DB.name()
+  })
+
+{context, setup}
+  end
+
+  describe "Fabric miscellaneous API" do
+@describetag setup: &__MODULE__.with_db/2
+test "Get inactive_index_files", ctx do
+  {:ok, _rev} = update_doc(ctx.db_name, %{"_id" => "doc1"})
+
+  design_doc = %{
+"_id" => "_design/test",
+"language" => "javascript",
+"views" => %{
+  "view" => %{
+"map" => "function(doc){emit(doc._id, doc._rev)}"
+  }
+}
+  }
+
+  {:ok, rev1} = update_doc(ctx.db_name, design_doc)
+  wait_sig_update(ctx.db_name, "test", "")
+  prev_active = get_active_sig(ctx.db_name, "test")
+
+  updated_design_doc =
+put_in(design_doc, ["views", "view", "map"], 
"function(doc){emit(doc._id, null)}")
+
+  {:ok, rev2} =
+update_doc(
+  ctx.db_name,
+  Map.put(updated_design_doc, "_rev", rev1)
+)
+
+  assert rev1 != rev2
+  wait_sig_update(ctx.db_name, "test", prev_active)
+
+  {:ok, info} = :fabric.get_view_group_info(ctx.db_name, "_design/test")
+  active = info[:signature]
+
+  files = Enum.map(:fabric.inactive_index_files(ctx.db_name), 
&List.to_string/1)
+
+  assert [] != files, "We should have some inactive"
+
+  assert not Enum.any?(files, fn
+   file_path -> String.contains?(file_path, active)
+ end),
+ "We are not suppose to return active views"
+
+  assert Enum.all?(files, fn
+   file_path -> String.contains?(file_path, prev_active)
+ end),
+ "We expect all files to contain previous active signature"
+end
+  end
+
+  defp update_doc(db_name, body) do
+json_body = :jiffy.decode(:jiffy.encode(body))
+
+case :fabric.update_doc(db_name, json_body, [@admin]) do
+  {:ok, rev} ->
+{:ok, :couch_doc.rev_to_str(rev)}
+
+  error ->
+error
+end
+  end
+
+  defp get_active_sig(db_name, ddoc_id) do
+{:ok, info} = :fabric.get_view_group_info(db_name, "_design/#{ddoc_id}")
+info[:signature]
+  end
+
+  defp wait_sig_update(db_name, ddoc_id, prev_active) do
+retry_until(fn ->
+  get_active_sig(db_name, ddoc_id) != prev_active
+end)
+  end
+end
diff --git a/src/fabric/src/fabric.erl b/src/fabric/src/fabric.erl
index 6d04184..d98ffc9 100644
--- a/src/fabric/src/fabric.erl
+++ b/src/fabric/src/fabric.erl
@@ -36,7 +36,8 @@
 
 % miscellany
 -export([design_docs/1, reset_validation_funs/1, cleanup_index_files/0,
-cleanup_index_files/1, cleanup_index_files_all_nodes/1, dbname/1]).
+cleanup_index_files/1, cleanup_index_files_all_nodes/1, dbname/1,
+inactive_index_files/1]).
 
 -include_lib("fabric/include/fabric.hrl").
 
@@ -503,26 +504,30 @@ cleanup_index_files() ->
 %% @doc clean up index files for a specific db
 -spec cleanup_index_files(dbname()) -> ok.
 cleanup_index_files(DbName) ->
+lists:foreach(fun(File) ->
+file:delete(File)
+end, inactive_index_files(DbName)).
+
+%% @doc inactive index files for a specific db
+-spec inactive_index_files(dbname()) -> ok.
+inactive_index_files(DbName) ->
 {ok, DesignDocs} = fabric:design_docs(DbName),
 
-ActiveSigs = lists:map(fun(#doc{id = GroupId}) ->
+ActiveSigs = maps:from_list(lists:map(fun(#doc{id = GroupId}) ->
 {ok, Info} = fabric:g

[couchdb] branch prototype/couch-jobs-1 deleted (was c60306c)

2019-08-15 Thread vatamane
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a change to branch prototype/couch-jobs-1
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


 was c60306c  CouchDB background jobs

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.