From dc150276e7bb74bab5eeb4c26a3b2cd41e844407 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Thu, 29 Dec 2011 23:07:06 -0500 Subject: Skip ddoc pull, use middleman for validation reset We were pulling a list of design documents and then ignoring the result when the #db was a partition of a clustered database. Also, the call to fabric:reset_validation_funs/1 can occasionally cause a stray rexi_EXIT message to arrive in the db_updater mailbox (and subsequently kill the server) if a worker fails. I don't think that's desired behavior, though it's a debatable point. This patch spawns a middleman process to act as a sink for those stray messages. BugzID: 13087 --- apps/couch/src/couch_db_updater.erl | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/couch/src/couch_db_updater.erl b/apps/couch/src/couch_db_updater.erl index 9bf52ee0..1f25186a 100644 --- a/apps/couch/src/couch_db_updater.erl +++ b/apps/couch/src/couch_db_updater.erl @@ -459,6 +459,9 @@ close_db(#db{fd_monitor = Ref}) -> erlang:demonitor(Ref). +refresh_validate_doc_funs(#db{name = <<"shards/", _/binary>> = Name} = Db) -> + spawn(fabric, reset_validation_funs, [mem3:dbname(Name)]), + Db#db{validate_doc_funs = undefined}; refresh_validate_doc_funs(Db) -> {ok, DesignDocs} = couch_db:get_design_docs(Db), ProcessDocFuns = lists:flatmap( @@ -468,13 +471,7 @@ refresh_validate_doc_funs(Db) -> Fun -> [Fun] end end, DesignDocs), - case Db#db.name of - <<"shards/", _/binary>> = ShardName -> - fabric:reset_validation_funs(mem3:dbname(ShardName)), - Db#db{validate_doc_funs=undefined}; - _ -> - Db#db{validate_doc_funs=ProcessDocFuns} - end. + Db#db{validate_doc_funs=ProcessDocFuns}. % rev tree functions -- cgit v1.2.3