summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2011-12-29 23:07:06 -0500
committerRobert Newson <robert.newson@cloudant.com>2012-11-14 16:26:55 +0000
commitdc150276e7bb74bab5eeb4c26a3b2cd41e844407 (patch)
tree33898586595ff63ba4eb5d1f2f20306c22e58fc7 /apps
parent574be32dc59813a94134726c158cf1bc24b81038 (diff)
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
Diffstat (limited to 'apps')
-rw-r--r--apps/couch/src/couch_db_updater.erl11
1 files 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