Updated Branches: refs/heads/master 6228b1785 -> ca51333f3
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/master Commit: 8d6363cd3b4a2dfcbc2e488f7c3e716dfdc8f17b Parents: 6228b17 Author: Filipe David Borba Manana <fdman...@apache.org> Authored: Tue Jan 17 16:39:31 2012 +0000 Committer: Filipe David Borba Manana <fdman...@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.