couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject git commit: Fix ets lookup case_clause error after ddoc is updated
Date Tue, 17 Jan 2012 20:40:30 GMT
Updated Branches:
  refs/heads/1.2.x 3b63f8daf -> c65cca613


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

Branch: refs/heads/1.2.x
Commit: c65cca613a5d39e453fd04dc6669d859849ce822
Parents: 3b63f8d
Author: Filipe David Borba Manana <fdmanana@apache.org>
Authored: Tue Jan 17 15:22:52 2012 +0000
Committer: Filipe David Borba Manana <fdmanana@apache.org>
Committed: Tue Jan 17 20:38:54 2012 +0000

----------------------------------------------------------------------
 src/couchdb/couch_view.erl |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/c65cca61/src/couchdb/couch_view.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_view.erl b/src/couchdb/couch_view.erl
index 2c28d05..29026ed 100644
--- a/src/couchdb/couch_view.erl
+++ b/src/couchdb/couch_view.erl
@@ -288,17 +288,16 @@ init([]) ->
         ({created, DbName}) ->
             gen_server:cast(couch_view, {reset_indexes, DbName});
         ({ddoc_updated, {DbName, DDocId}}) ->
-            case ets:match_object(couch_groups_by_db, {DbName, {DDocId, '$1'}}) of
-            [] ->
-                ok;
-            [{DbName, {DDocId, Sig}}] ->
-                case ets:lookup(group_servers_by_sig, {DbName, Sig}) of
-                [{_, GroupPid}] ->
-                    (catch gen_server:cast(GroupPid, ddoc_updated));
-                [] ->
-                    ok
-                end
-            end;
+            lists:foreach(
+                fun({_DbName, {_DDocId, Sig}}) ->
+                    case ets:lookup(group_servers_by_sig, {DbName, Sig}) of
+                    [{_, GroupPid}] ->
+                        (catch gen_server:cast(GroupPid, ddoc_updated));
+                    [] ->
+                        ok
+                    end
+                end,
+                ets:match_object(couch_groups_by_db, {DbName, {DDocId, '$1'}}));
         (_Else) ->
             ok
         end),


Mime
View raw message