Repository: couchdb-couch-index Updated Branches: refs/heads/master e15bed80e -> 13fed1ed2
Allow get_index to receive DDoc as a doc record The function `couch_mrview:compact/3` is passing to `get_index` a prepared #doc record, when `get_index` is expecting DDoc to be a ddoc's id. As a result view's compaction is crashing after `fabric:open_doc` call. This patch allows get_index to receive #doc record directly. This closes COUCH-2729 Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/commit/13fed1ed Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/tree/13fed1ed Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/diff/13fed1ed Branch: refs/heads/master Commit: 13fed1ed28976aa1ed3fc92d30336ea53d837894 Parents: e15bed8 Author: Eric Avdey <e...@eiri.ca> Authored: Thu Jun 25 18:42:14 2015 -0300 Committer: Eric Avdey <e...@eiri.ca> Committed: Thu Jun 25 18:42:14 2015 -0300 ---------------------------------------------------------------------- src/couch_index_server.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/13fed1ed/src/couch_index_server.erl ---------------------------------------------------------------------- diff --git a/src/couch_index_server.erl b/src/couch_index_server.erl index b8c29f0..4b60a39 100644 --- a/src/couch_index_server.erl +++ b/src/couch_index_server.erl @@ -67,7 +67,10 @@ validate(DbName, DDoc) -> get_index(Module, #db{name = <<"shards/", _/binary>> = DbName}, DDoc) -> - get_index(Module, DbName, DDoc); + case is_record(DDoc, doc) of + true -> get_index(Module, DbName, DDoc, nil); + false -> get_index(Module, DbName, DDoc) + end; get_index(Module, <<"shards/", _/binary>> = DbName, DDoc) -> {Pid, Ref} = spawn_monitor(fun() -> exit(fabric:open_doc(mem3:dbname(DbName), DDoc, [ejson_body]))