couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject [11/50] git commit: Fix ets lookup case_clause error after ddoc is updated
Date Sun, 22 Jan 2012 23:43:13 GMT
Fix ets lookup case_clause error after ddoc is updated

This happens if the ddoc_updated event is received after
a client opens the new view group or if a design document
is updated several times in a row and there are still
clients streaming views from 2 or more view groups that
match old versions of the design document.

This relates to COUCHDB-1309


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/8d6363cd
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/8d6363cd
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/8d6363cd

Branch: refs/heads/COUCHDB-1342
Commit: 8d6363cd3b4a2dfcbc2e488f7c3e716dfdc8f17b
Parents: 6228b17
Author: Filipe David Borba Manana <fdmanana@apache.org>
Authored: Tue Jan 17 16:39:31 2012 +0000
Committer: Filipe David Borba Manana <fdmanana@apache.org>
Committed: Tue Jan 17 20:38:41 2012 +0000

----------------------------------------------------------------------
 src/couch_index/src/couch_index_server.erl |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/8d6363cd/src/couch_index/src/couch_index_server.erl
----------------------------------------------------------------------
diff --git a/src/couch_index/src/couch_index_server.erl b/src/couch_index/src/couch_index_server.erl
index 975f44d..398c27d 100644
--- a/src/couch_index/src/couch_index_server.erl
+++ b/src/couch_index/src/couch_index_server.erl
@@ -191,17 +191,16 @@ update_notify({deleted, DbName}) ->
 update_notify({created, DbName}) ->
     gen_server:cast(?MODULE, {reset_indexes, DbName});
 update_notify({ddoc_updated, {DbName, DDocId}}) ->
-    case ets:match_object(?BY_DB, {DbName, {DDocId, '$1'}}) of
-        [] ->
-            ok;
-        [{DbName, {DDocId, Sig}}] ->
+    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;
+        end,
+        ets:match_object(?BY_DB, {DbName, {DDocId, '$1'}}));
 update_notify(_) ->
     ok.
 


Mime
View raw message