summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2020-08-14 17:17:07 +0100
committerGitHub <noreply@github.com>2020-08-14 17:17:07 +0100
commit7d9f1150ff51a7a606019e9913d73c688c86d355 (patch)
tree7517a4f4d11a9ca0db81a1bc84b2be23da3cdf60
parent7c9094cfdd9d5069b903b27105bb156c621a624b (diff)
parent5004f997a6a30831e65c864b96ca82c926f3dbac (diff)
downloadcouchdb-prototype/layer.tar.gz
Merge pull request #3075 from apache/couch_index_server_crash2archive/prototype/layerprototype/layerprototype/fdb-laer
Don't crash couch_index_server if the db isn't known yet
-rw-r--r--src/couch_index/src/couch_index_server.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/couch_index/src/couch_index_server.erl b/src/couch_index/src/couch_index_server.erl
index 67f0f8c6f..6bebff2d8 100644
--- a/src/couch_index/src/couch_index_server.erl
+++ b/src/couch_index/src/couch_index_server.erl
@@ -284,7 +284,11 @@ handle_db_event(<<"shards/", _/binary>> = DbName, {ddoc_updated,
DDocResult = couch_util:with_db(DbName, fun(Db) ->
couch_db:open_doc(Db, DDocId, [ejson_body, ?ADMIN_CTX])
end),
- DbShards = [mem3:name(Sh) || Sh <- mem3:local_shards(mem3:dbname(DbName))],
+ LocalShards = try mem3:local_shards(mem3:dbname(DbName))
+ catch error:database_does_not_exist ->
+ []
+ end,
+ DbShards = [mem3:name(Sh) || Sh <- LocalShards],
lists:foreach(fun(DbShard) ->
lists:foreach(fun({_DbShard, {_DDocId, Sig}}) ->
% check if there are other ddocs with the same Sig for the same db