Add ejson_body to all mem3 open_doc attempts that need it
Project: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/commit/4a7ed8ca Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/tree/4a7ed8ca Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/diff/4a7ed8ca Branch: refs/heads/import Commit: 4a7ed8ca1bdcf9475de3726d2cd69094da213b33 Parents: eef6b84 Author: Robert Newson <[email protected]> Authored: Mon Dec 23 16:55:10 2013 +0000 Committer: Paul J. Davis <[email protected]> Committed: Fri Jan 17 13:53:28 2014 -0800 ---------------------------------------------------------------------- src/mem3_nodes.erl | 2 +- src/mem3_rep.erl | 2 +- src/mem3_shards.erl | 4 ++-- src/mem3_util.erl | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/4a7ed8ca/src/mem3_nodes.erl ---------------------------------------------------------------------- diff --git a/src/mem3_nodes.erl b/src/mem3_nodes.erl index ad96646..782a8b5 100644 --- a/src/mem3_nodes.erl +++ b/src/mem3_nodes.erl @@ -113,7 +113,7 @@ first_fold(#full_doc_info{id = <<"_design/", _/binary>>}, _, Acc) -> first_fold(#full_doc_info{deleted=true}, _, Acc) -> {ok, Acc}; first_fold(#full_doc_info{id=Id}=DocInfo, _, Db) -> - {ok, #doc{body={Props}}} = couch_db:open_doc(Db, DocInfo), + {ok, #doc{body={Props}}} = couch_db:open_doc(Db, DocInfo, [ejson_body]), ets:insert(?MODULE, {mem3_util:to_atom(Id), Props}), {ok, Db}. http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/4a7ed8ca/src/mem3_rep.erl ---------------------------------------------------------------------- diff --git a/src/mem3_rep.erl b/src/mem3_rep.erl index 09fff9c..373bc3f 100644 --- a/src/mem3_rep.erl +++ b/src/mem3_rep.erl @@ -195,7 +195,7 @@ rexi_call(Node, MFA) -> end. calculate_start_seq(Db, #shard{node=Node, name=Name}, LocalId) -> - case couch_db:open_doc(Db, LocalId, []) of + case couch_db:open_doc(Db, LocalId, [ejson_body]) of {ok, #doc{body = {SProps}}} -> Opts = [{user_ctx, ?CTX}, {io_priority, {internal_repl, Name}}], try rexi_call(Node, {fabric_rpc, open_doc, [Name, LocalId, Opts]}) of http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/4a7ed8ca/src/mem3_shards.erl ---------------------------------------------------------------------- diff --git a/src/mem3_shards.erl b/src/mem3_shards.erl index 3437495..9949869 100644 --- a/src/mem3_shards.erl +++ b/src/mem3_shards.erl @@ -177,7 +177,7 @@ 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}) -> - case couch_db:open_doc(Db, DI, [conflicts]) of + case couch_db:open_doc(Db, DI, [ejson_body, conflicts]) of {ok, Doc} -> {Props} = Doc#doc.body, Shards = mem3_util:build_shards(Doc#doc.id, Props), @@ -242,7 +242,7 @@ load_shards_from_disk(DbName) when is_binary(DbName) -> end. load_shards_from_db(#db{} = ShardDb, DbName) -> - case couch_db:open_doc(ShardDb, DbName, []) of + case couch_db:open_doc(ShardDb, DbName, [ejson_body]) of {ok, #doc{body = {Props}}} -> Shards = mem3_util:build_shards(DbName, Props), gen_server:cast(?MODULE, {cache_insert, DbName, Shards}), http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/4a7ed8ca/src/mem3_util.erl ---------------------------------------------------------------------- diff --git a/src/mem3_util.erl b/src/mem3_util.erl index 610e284..4460df6 100644 --- a/src/mem3_util.erl +++ b/src/mem3_util.erl @@ -69,7 +69,7 @@ attach_nodes([S | Rest], Acc, [Node | Nodes], UsedNodes) -> open_db_doc(DocId) -> DbName = ?l2b(config:get("mem3", "shard_db", "dbs")), {ok, Db} = couch_db:open(DbName, []), - try couch_db:open_doc(Db, DocId, []) after couch_db:close(Db) end. + try couch_db:open_doc(Db, DocId, [ejson_body]) after couch_db:close(Db) end. write_db_doc(Doc) -> DbName = ?l2b(config:get("mem3", "shard_db", "dbs")), @@ -77,7 +77,7 @@ write_db_doc(Doc) -> write_db_doc(DbName, #doc{id=Id, body=Body} = Doc, ShouldMutate) -> {ok, Db} = couch_db:open(DbName, []), - try couch_db:open_doc(Db, Id, []) of + try couch_db:open_doc(Db, Id, [ejson_body]) of {ok, #doc{body = Body}} -> % the doc is already in the desired state, we're done here ok;
