You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/01/17 23:08:20 UTC

[06/32] git commit: Only restart the updater if it was running.

Only restart the updater if it was running.

When compaction finished it was forcibly starting a new indexer process
even if one wasn't already running. This reverts to the old behavior.



git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1172377 13f79535-47bb-0310-9956-ffa450edef68


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/2cc4da18
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/tree/2cc4da18
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/diff/2cc4da18

Branch: refs/heads/import
Commit: 2cc4da18044a8044604556975c02e67c54080417
Parents: ca77713
Author: Paul Joseph Davis <da...@apache.org>
Authored: Sun Sep 18 21:51:35 2011 +0000
Committer: Paul Joseph Davis <da...@apache.org>
Committed: Sun Sep 18 21:51:35 2011 +0000

----------------------------------------------------------------------
 src/couch_index.erl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/2cc4da18/src/couch_index.erl
----------------------------------------------------------------------
diff --git a/src/couch_index.erl b/src/couch_index.erl
index 84e8863..5e51355 100644
--- a/src/couch_index.erl
+++ b/src/couch_index.erl
@@ -174,14 +174,17 @@ handle_call({compacted, NewIdxState}, _From, State) ->
     case NewSeq >= OldSeq of
         true ->
             {ok, NewIdxState1} = Mod:swap_compacted(OldIdxState, NewIdxState),
-            ok = couch_index_updater:restart(Updater, NewIdxState1),
+            % Restart the indexer if it's running.
+            case couch_index_updater:is_running(Updater) of
+                true -> ok = couch_index_updater:restart(Updater, NewIdxState1);
+                false -> ok
+            end,
             case State#st.committed of
                 true -> erlang:send_after(Delay, self(), commit);
                 false -> ok
             end,
             {reply, ok, State#st{
                 idx_state=NewIdxState1,
-                updater=Updater,
                 committed=false
             }};
         _ ->