diff options
author | Filipe David Borba Manana <fdmanana@apache.org> | 2012-01-17 16:39:31 +0000 |
---|---|---|
committer | Filipe David Borba Manana <fdmanana@apache.org> | 2012-01-17 20:38:41 +0000 |
commit | 8d6363cd3b4a2dfcbc2e488f7c3e716dfdc8f17b (patch) | |
tree | 1721414a8c93950bfe2205ed3b4127a01d10d47a /src/couch_index | |
parent | 6228b178543429732c17b3a784c957d3782573b9 (diff) | |
download | couchdb-8d6363cd3b4a2dfcbc2e488f7c3e716dfdc8f17b.tar.gz |
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
Diffstat (limited to 'src/couch_index')
-rw-r--r-- | src/couch_index/src/couch_index_server.erl | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/couch_index/src/couch_index_server.erl b/src/couch_index/src/couch_index_server.erl index 975f44dab..398c27d91 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. |