You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/01/17 22:54:20 UTC
[02/50] git commit: Don't include deleted dbs in mem3:fold_shards/2
Don't include deleted dbs in mem3:fold_shards/2
The `delete` option was passed to couch_db:open_doc/2 which ended up
causing deleted databases to be included in mem3:fold_shards/2. This is
counterintuitive so is being removed.
Project: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/commit/abe10a09
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/tree/abe10a09
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/diff/abe10a09
Branch: refs/heads/import
Commit: abe10a0912fff304fdb68b951307736337bfe4db
Parents: 2ca9fa7
Author: Paul J. Davis <pa...@gmail.com>
Authored: Mon May 7 20:12:51 2012 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Mon May 7 20:12:51 2012 -0500
----------------------------------------------------------------------
src/mem3_shards.erl | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/abe10a09/src/mem3_shards.erl
----------------------------------------------------------------------
diff --git a/src/mem3_shards.erl b/src/mem3_shards.erl
index 70a83cb..9df4b9e 100644
--- a/src/mem3_shards.erl
+++ b/src/mem3_shards.erl
@@ -172,11 +172,15 @@ fold_fun(#full_doc_info{}=FDI, _, Acc) ->
DI = couch_doc:to_doc_info(FDI),
fold_fun(DI, nil, Acc);
fold_fun(#doc_info{}=DI, _, {Db, UFun, UAcc}) ->
- {ok, Doc} = couch_db:open_doc(Db, DI, [conflicts, deleted]),
- {Props} = Doc#doc.body,
- Shards = mem3_util:build_shards(Doc#doc.id, Props),
- NewUAcc = lists:foldl(UFun, UAcc, Shards),
- {ok, {Db, UFun, NewUAcc}}.
+ case couch_db:open_doc(Db, DI, [conflicts]) of
+ {ok, Doc} ->
+ {Props} = Doc#doc.body,
+ Shards = mem3_util:build_shards(Doc#doc.id, Props),
+ NewUAcc = lists:foldl(UFun, UAcc, Shards),
+ {ok, {Db, UFun, NewUAcc}};
+ _ ->
+ {ok, {Db, UFun, UAcc}}
+ end.
get_update_seq() ->
DbName = couch_config:get("mem3", "shards_db", "dbs"),