summaryrefslogtreecommitdiff
path: root/apps/fabric/src/fabric_doc_open.erl
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-10-20 14:55:24 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-10-20 14:55:24 -0400
commit46d7b8cd7d9088cc6a5257d23679b51e962c7e30 (patch)
treec64433cb41b7b3c3e4e933006676a6479eecae70 /apps/fabric/src/fabric_doc_open.erl
parented231d0fd1cf7647cc7a154de81e85cd584bc8b5 (diff)
repair should run with R=N
Diffstat (limited to 'apps/fabric/src/fabric_doc_open.erl')
-rw-r--r--apps/fabric/src/fabric_doc_open.erl5
1 files changed, 3 insertions, 2 deletions
diff --git a/apps/fabric/src/fabric_doc_open.erl b/apps/fabric/src/fabric_doc_open.erl
index 9131c94b..dd4917b9 100644
--- a/apps/fabric/src/fabric_doc_open.erl
+++ b/apps/fabric/src/fabric_doc_open.erl
@@ -25,16 +25,17 @@ go(DbName, Id, Options) ->
[Id, [deleted|Options]]),
SuppressDeletedDoc = not lists:member(deleted, Options),
R = couch_util:get_value(r, Options, couch_config:get("cluster","r","2")),
+ RepairOpts = [{r, integer_to_list(mem3:n(DbName))} | Options],
Acc0 = {length(Workers), list_to_integer(R), []},
case fabric_util:recv(Workers, #shard.ref, fun handle_message/3, Acc0) of
{ok, Reply} ->
format_reply(Reply, SuppressDeletedDoc);
{error, needs_repair, Reply} ->
- spawn(fabric, open_revs, [DbName, Id, all, Options]),
+ spawn(fabric, open_revs, [DbName, Id, all, RepairOpts]),
format_reply(Reply, SuppressDeletedDoc);
{error, needs_repair} ->
% we couldn't determine the correct reply, so we'll run a sync repair
- {ok, Results} = fabric:open_revs(DbName, Id, all, Options),
+ {ok, Results} = fabric:open_revs(DbName, Id, all, RepairOpts),
case lists:partition(fun({ok, #doc{deleted=Del}}) -> Del end, Results) of
{[], []} ->
{not_found, missing};