You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2015/02/04 16:49:45 UTC
[1/4] couch-index commit: updated refs/heads/master to 0c5f25b
Repository: couchdb-couch-index
Updated Branches:
refs/heads/master eb616267e -> 0c5f25b1c
Add vsn to modules implementing config_listener
COUCHDB-2561
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/commit/762a236c
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/tree/762a236c
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/diff/762a236c
Branch: refs/heads/master
Commit: 762a236c85b62ca4712779cebdeacfed817f85ce
Parents: b14a73d
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Authored: Fri Jan 30 12:04:27 2015 -0800
Committer: ILYA Khlopotov <ii...@ca.ibm.com>
Committed: Wed Feb 4 06:07:37 2015 -0800
----------------------------------------------------------------------
src/couch_index.erl | 2 ++
src/couch_index_server.erl | 2 ++
2 files changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/762a236c/src/couch_index.erl
----------------------------------------------------------------------
diff --git a/src/couch_index.erl b/src/couch_index.erl
index b22bf12..63a6bf9 100644
--- a/src/couch_index.erl
+++ b/src/couch_index.erl
@@ -14,6 +14,8 @@
-behaviour(gen_server).
-behaviour(config_listener).
+-vsn(1).
+
%% API
-export([start_link/1, stop/1, get_state/2, get_info/1]).
-export([trigger_update/2]).
http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/762a236c/src/couch_index_server.erl
----------------------------------------------------------------------
diff --git a/src/couch_index_server.erl b/src/couch_index_server.erl
index a7c8990..b8c29f0 100644
--- a/src/couch_index_server.erl
+++ b/src/couch_index_server.erl
@@ -14,6 +14,8 @@
-behaviour(gen_server).
-behaviour(config_listener).
+-vsn(1).
+
-export([start_link/0, validate/2, get_index/4, get_index/3, get_index/2]).
-export([init/1, terminate/2, code_change/3]).
[4/4] couch-index commit: updated refs/heads/master to 0c5f25b
Posted by kx...@apache.org.
Merge remote-tracking branch 'iilyak/2561-make-config-API-consistent'
This closes #4
COUCHDB-2561
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/commit/0c5f25b1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/tree/0c5f25b1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/diff/0c5f25b1
Branch: refs/heads/master
Commit: 0c5f25b1ce8a92fd83d2adc1f86e5e53c6d54a14
Parents: eb61626 762a236
Author: Alexander Shorin <kx...@apache.org>
Authored: Wed Feb 4 18:45:05 2015 +0300
Committer: Alexander Shorin <kx...@apache.org>
Committed: Wed Feb 4 18:45:05 2015 +0300
----------------------------------------------------------------------
src/couch_index.erl | 17 +++++++++--------
src/couch_index_server.erl | 18 +++++++++++-------
2 files changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
[2/4] couch-index commit: updated refs/heads/master to 0c5f25b
Posted by kx...@apache.org.
Don't restart event handler on termination
COUCHDB-2561
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/commit/b14a73dd
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/tree/b14a73dd
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/diff/b14a73dd
Branch: refs/heads/master
Commit: b14a73dd89bf49cbb68ccf7837c2a54a3ef69083
Parents: 3aa6a19
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Authored: Fri Jan 30 11:17:15 2015 -0800
Committer: ILYA Khlopotov <ii...@ca.ibm.com>
Committed: Wed Feb 4 06:07:37 2015 -0800
----------------------------------------------------------------------
src/couch_index.erl | 1 +
src/couch_index_server.erl | 1 +
2 files changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/b14a73dd/src/couch_index.erl
----------------------------------------------------------------------
diff --git a/src/couch_index.erl b/src/couch_index.erl
index 509053b..b22bf12 100644
--- a/src/couch_index.erl
+++ b/src/couch_index.erl
@@ -360,6 +360,7 @@ handle_config_change("query_server_config", "commit_freq", Val, _, _) ->
handle_config_change(_, _, _, _, _) ->
{ok, nil}.
+handle_config_terminate(_Server, stop, _State) -> ok;
handle_config_terminate(_Server, _Reason, _State) ->
spawn(fun() ->
timer:sleep(5000),
http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/b14a73dd/src/couch_index_server.erl
----------------------------------------------------------------------
diff --git a/src/couch_index_server.erl b/src/couch_index_server.erl
index 5e5c307..a7c8990 100644
--- a/src/couch_index_server.erl
+++ b/src/couch_index_server.erl
@@ -198,6 +198,7 @@ handle_config_change("couchdb", "view_index_dir", _, _, _) ->
handle_config_change(_, _, _, _, RootDir) ->
{ok, RootDir}.
+handle_config_terminate(_Server, stop, _State) -> ok;
handle_config_terminate(_Server, _Reason, _State) ->
State = couch_index_util:root_dir(),
spawn(fun() ->
[3/4] couch-index commit: updated refs/heads/master to 0c5f25b
Posted by kx...@apache.org.
Update config_listener behaviuor
COUCHDB-2561
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/commit/3aa6a195
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/tree/3aa6a195
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/diff/3aa6a195
Branch: refs/heads/master
Commit: 3aa6a19552eece95df0969c98af143fe6090c8f0
Parents: eb61626
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Authored: Thu Jan 29 13:40:27 2015 -0800
Committer: ILYA Khlopotov <ii...@ca.ibm.com>
Committed: Wed Feb 4 06:07:37 2015 -0800
----------------------------------------------------------------------
src/couch_index.erl | 14 ++++++--------
src/couch_index_server.erl | 15 ++++++++-------
2 files changed, 14 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/3aa6a195/src/couch_index.erl
----------------------------------------------------------------------
diff --git a/src/couch_index.erl b/src/couch_index.erl
index b44d351..509053b 100644
--- a/src/couch_index.erl
+++ b/src/couch_index.erl
@@ -25,7 +25,7 @@
-export([handle_call/3, handle_cast/2, handle_info/2]).
% config_listener api
--export([handle_config_change/5]).
+-export([handle_config_change/5, handle_config_terminate/3]).
-include_lib("couch/include/couch_db.hrl").
@@ -297,13 +297,6 @@ handle_cast(ddoc_updated, State) ->
handle_cast(_Mesg, State) ->
{stop, unhandled_cast, State}.
-
-handle_info({gen_event_EXIT, {config_listener, ?MODULE}, _Reason}, State) ->
- erlang:send_after(5000, self(), restart_config_listener),
- {noreply, State};
-handle_info(restart_config_listener, State) ->
- ok = config:listen_for_changes(?MODULE, nil),
- {noreply, State};
handle_info(commit, #st{committed=true}=State) ->
{noreply, State};
handle_info(commit, State) ->
@@ -367,6 +360,11 @@ handle_config_change("query_server_config", "commit_freq", Val, _, _) ->
handle_config_change(_, _, _, _, _) ->
{ok, nil}.
+handle_config_terminate(_Server, _Reason, _State) ->
+ spawn(fun() ->
+ timer:sleep(5000),
+ config:listen_for_changes(?MODULE, nil)
+ end).
maybe_restart_updater(#st{waiters=[]}) ->
ok;
http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/3aa6a195/src/couch_index_server.erl
----------------------------------------------------------------------
diff --git a/src/couch_index_server.erl b/src/couch_index_server.erl
index 76adb6a..5e5c307 100644
--- a/src/couch_index_server.erl
+++ b/src/couch_index_server.erl
@@ -22,6 +22,7 @@
% Exported for callbacks
-export([
handle_config_change/5,
+ handle_config_terminate/3,
handle_db_event/3
]).
@@ -163,13 +164,6 @@ handle_cast({reset_indexes, DbName}, State) ->
reset_indexes(DbName, State#st.root_dir),
{noreply, State}.
-
-handle_info({gen_event_EXIT, {config_listener, ?MODULE}, _Reason}, State) ->
- erlang:send_after(5000, self(), restart_config_listener),
- {noreply, State};
-handle_info(restart_config_listener, State) ->
- ok = config:listen_for_changes(?MODULE, State#st.root_dir),
- {noreply, State};
handle_info({'EXIT', Pid, Reason}, Server) ->
case ets:lookup(?BY_PID, Pid) of
[{Pid, {DbName, Sig}}] ->
@@ -204,6 +198,13 @@ handle_config_change("couchdb", "view_index_dir", _, _, _) ->
handle_config_change(_, _, _, _, RootDir) ->
{ok, RootDir}.
+handle_config_terminate(_Server, _Reason, _State) ->
+ State = couch_index_util:root_dir(),
+ spawn(fun() ->
+ timer:sleep(5000),
+ config:listen_for_changes(?MODULE, State)
+ end).
+
new_index({Mod, IdxState, DbName, Sig}) ->
DDocId = Mod:get(idx_name, IdxState),
case couch_index:start_link({Mod, IdxState}) of