You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2017/05/10 16:16:14 UTC
[couchdb] branch master updated (0460a70 -> 3691c2e)
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git.
from 0460a70 Mango $allMatch return false for empty list (#511)
new 9d99d6e Expose mem3_shards:get_changes_pid/0
new 3691c2e Test changes_listener dies on mem3_shards shutdown
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/mem3/src/mem3_shards.erl | 47 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
--
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <co...@couchdb.apache.org>'].
[couchdb] 02/02: Test changes_listener dies on mem3_shards shutdown
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 3691c2edbc6603963b1b5ad1bf97dfb69886c4a6
Author: Jay Doane <ja...@gmail.com>
AuthorDate: Sun May 7 22:56:38 2017 -0700
Test changes_listener dies on mem3_shards shutdown
This adds a test to ensure that the changes_listener process exits when
the mem3_shards process is shut down.
COUCHDB-3398
---
src/mem3/src/mem3_shards.erl | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/src/mem3/src/mem3_shards.erl b/src/mem3/src/mem3_shards.erl
index a419e45..8d9cfb9 100644
--- a/src/mem3/src/mem3_shards.erl
+++ b/src/mem3/src/mem3_shards.erl
@@ -732,4 +732,45 @@ wait_writer_result(WRef) ->
spawn_link_mock_writer(Db, Shards, Timeout) ->
erlang:spawn_link(fun() -> shard_writer(Db, Shards, Timeout) end).
+
+
+mem3_shards_changes_test_() -> {
+ "Test mem3_shards changes listener", {
+ foreach,
+ fun setup_changes/0, fun teardown_changes/1,
+ [
+ fun should_kill_changes_listener_on_shutdown/1
+ ]
+ }
+}.
+
+
+setup_changes() ->
+ ok = meck:expect(mem3_util, ensure_exists, ['_'],
+ {ok, #db{name = <<"dbs">>, update_seq = 0}}),
+ ok = meck:expect(couch_db, close, ['_'], ok),
+ ok = application:start(config),
+ {ok, Pid} = ?MODULE:start_link(),
+ true = erlang:unlink(Pid),
+ Pid.
+
+
+teardown_changes(Pid) ->
+ true = exit(Pid, shutdown),
+ ok = application:stop(config),
+ meck:unload().
+
+
+should_kill_changes_listener_on_shutdown(Pid) ->
+ ?_test(begin
+ ?assert(is_process_alive(Pid)),
+ {ok, ChangesPid} = get_changes_pid(),
+ ?assert(is_process_alive(ChangesPid)),
+ true = test_util:stop_sync_throw(
+ ChangesPid, fun() -> exit(Pid, shutdown) end, wait_timeout),
+ ?assertNot(is_process_alive(ChangesPid)),
+ ok
+ end).
+
+
-endif.
--
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.
[couchdb] 01/02: Expose mem3_shards:get_changes_pid/0
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 9d99d6e8ef9b7076b9a25cffcb9ebd08655bbef6
Author: Jay Doane <ja...@gmail.com>
AuthorDate: Sun May 7 22:49:06 2017 -0700
Expose mem3_shards:get_changes_pid/0
Simplify getting changes listener pid for testing
---
src/mem3/src/mem3_shards.erl | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/mem3/src/mem3_shards.erl b/src/mem3/src/mem3_shards.erl
index 3c2001b..a419e45 100644
--- a/src/mem3/src/mem3_shards.erl
+++ b/src/mem3/src/mem3_shards.erl
@@ -23,6 +23,7 @@
-export([for_db/1, for_db/2, for_docid/2, for_docid/3, get/3, local/1, fold/2]).
-export([for_shard_name/1]).
-export([set_max_size/1]).
+-export([get_changes_pid/0]).
-record(st, {
max_size = 25000,
@@ -169,6 +170,9 @@ fold(Fun, Acc) ->
set_max_size(Size) when is_integer(Size), Size > 0 ->
gen_server:call(?MODULE, {set_max_size, Size}).
+get_changes_pid() ->
+ gen_server:call(?MODULE, get_changes_pid).
+
handle_config_change("mem3", "shard_cache_size", SizeList, _, _) ->
Size = list_to_integer(SizeList),
{ok, gen_server:call(?MODULE, {set_max_size, Size}, infinity)};
@@ -219,6 +223,8 @@ handle_call(shard_db_changed, _From, St) ->
{reply, ok, St};
handle_call({set_write_timeout, Timeout}, _From, St) ->
{reply, ok, St#st{write_timeout = Timeout}};
+handle_call(get_changes_pid, _From, St) ->
+ {reply, {ok, St#st.changes_pid}, St};
handle_call(_Call, _From, St) ->
{noreply, St}.
--
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.