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 Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/c578e705 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/c578e705 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/c578e705 Branch: refs/heads/import Commit: c578e7050e282c6a9d9a2dcb44ee90d3b3fd36d9 Parents: 3c241b4 Author: Adam Kocoloski <[email protected]> Authored: Thu Dec 29 23:07:06 2011 -0500 Committer: Paul J. Davis <[email protected]> Committed: Fri Jan 17 16:44:29 2014 -0800 ---------------------------------------------------------------------- src/couch_db_updater.erl | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/c578e705/src/couch_db_updater.erl ---------------------------------------------------------------------- diff --git a/src/couch_db_updater.erl b/src/couch_db_updater.erl index 5a11650..414e3a0 100644 --- a/src/couch_db_updater.erl +++ b/src/couch_db_updater.erl @@ -526,6 +526,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(Db0) -> Db = Db0#db{user_ctx = #user_ctx{roles=[<<"_admin">>]}}, {ok, DesignDocs} = couch_db:get_design_docs(Db), @@ -538,13 +541,7 @@ refresh_validate_doc_funs(Db0) -> Fun -> [Fun] end end, DesignDocs), - case Db#db.name of - <<"shards/", _:18/binary, DbName/binary>> -> - fabric:reset_validation_funs(DbName), - Db#db{validate_doc_funs=undefined}; - _ -> - Db0#db{validate_doc_funs=ProcessDocFuns} - end. + Db#db{validate_doc_funs=ProcessDocFuns}. % rev tree functions
