Permalink
Browse files

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
  • Loading branch information...
kocolosk authored and Robert Newson committed Dec 30, 2011
1 parent 574be32 commit dc150276e7bb74bab5eeb4c26a3b2cd41e844407
Showing with 4 additions and 7 deletions.
  1. +4 −7 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

0 comments on commit dc15027

Please sign in to comment.