davisp commented on a change in pull request #635: Stop indexing activity on 
ddoc update
URL: https://github.com/apache/couchdb/pull/635#discussion_r128800838
 
 

 ##########
 File path: src/couch_index/src/couch_index_server.erl
 ##########
 @@ -106,6 +106,13 @@ get_index(Module, IdxState) ->
     Sig = Module:get(signature, IdxState),
     case ets:lookup(?BY_SIG, {DbName, Sig}) of
         [{_, Pid}] when is_pid(Pid) ->
+            DDocId = Module:get(idx_name, IdxState),
+            case ets:match_object(?BY_DB, {DbName, {DDocId, Sig}}) of
+                [] ->
+                    Args = [DbName, DDocId, Sig],
+                    gen_server:cast(?MODULE, {add_to_ets, Args});
 
 Review comment:
   You should pass the pid through the cast here so that when handling the 
add_to_ets message we can assert that the entry in ?BY_PID still exists and if 
not then ignore them message. Otherwise this might lead to race conditions 
where we go to insert the entry just after the index was removed from the ets 
tables.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to