Author: davisp
Date: Sun Sep 18 21:51:35 2011
New Revision: 1172377
URL: http://svn.apache.org/viewvc?rev=1172377&view=rev
Log:
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.
Modified:
couchdb/trunk/src/couch_index/src/couch_index.erl
Modified: couchdb/trunk/src/couch_index/src/couch_index.erl
URL:
http://svn.apache.org/viewvc/couchdb/trunk/src/couch_index/src/couch_index.erl?rev=1172377&r1=1172376&r2=1172377&view=diff
==============================================================================
--- couchdb/trunk/src/couch_index/src/couch_index.erl (original)
+++ couchdb/trunk/src/couch_index/src/couch_index.erl Sun Sep 18 21:51:35 2011
@@ -174,14 +174,17 @@ handle_call({compacted, NewIdxState}, _F
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
}};
_ ->