davisp commented on a change in pull request #497: notify couch_index_processes 
on all shards when ddoc updated
URL: https://github.com/apache/couchdb/pull/497#discussion_r113965407
 
 

 ##########
 File path: src/couch_index/src/couch_index_server.erl
 ##########
 @@ -252,14 +252,20 @@ handle_db_event(DbName, deleted, St) ->
     gen_server:cast(?MODULE, {reset_indexes, DbName}),
     {ok, St};
 handle_db_event(DbName, {ddoc_updated, DDocId}, St) ->
-    lists:foreach(fun({_DbName, {_DDocId, Sig}}) ->
-        case ets:lookup(?BY_SIG, {DbName, Sig}) of
-            [{_, IndexPid}] ->
-                (catch gen_server:cast(IndexPid, ddoc_updated));
-            [] ->
-                ok
-        end
-    end, ets:match_object(?BY_DB, {DbName, {DDocId, '$1'}})),
+    DDocResult = couch_util:with_db(DbName, fun(Db) ->
+        couch_db:open_doc(Db, DDocId, [ejson_body, ?ADMIN_CTX])
+    end),
+    DbNames = [mem3:name(Sh) || Sh <- mem3:local_shards(mem3:dbname(DbName))],
+    lists:foreach(
+        fun(DBName) ->
+        lists:foreach(fun({_DBName, {_DDocId, Sig}}) ->
 
 Review comment:
   The `fun(DbName) ->` should be moved up a line with `lists:foreach(` and the 
rest should be at the same indentation level as it is now.
 
----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to