Repository: couchdb-fabric Updated Branches: refs/heads/master 205064aa5 -> eb6978438
Include conflicts parameter in doc_options When a keys array is passed to _all_docs, fabric translates this to individual open_doc calls. The conflicts=true query parameter is specified as a view-level option and is not, by default, parsed as an option that should be passed to open_doc. As a workaround, explicitly copy the view-level conflict parameter into the document options before open_doc is called. An alternative approach would be to address this when the query parameters are parsed, setting conflicts=true in both #mrargs and detail of fabric, I elected to make the change here instead. Fixes #COUCHDB-3264 Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/8dcc3fb1 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/8dcc3fb1 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/8dcc3fb1 Branch: refs/heads/master Commit: 8dcc3fb175807ac18a3d7c1fc95364910ee8969e Parents: 863b8d9 Author: Will Holley <[email protected]> Authored: Tue Jan 3 09:54:30 2017 +0000 Committer: Will Holley <[email protected]> Committed: Tue Jan 3 10:37:15 2017 +0000 ---------------------------------------------------------------------- src/fabric_view_all_docs.erl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/8dcc3fb1/src/fabric_view_all_docs.erl ---------------------------------------------------------------------- diff --git a/src/fabric_view_all_docs.erl b/src/fabric_view_all_docs.erl index 90ff128..2ba6f0d 100644 --- a/src/fabric_view_all_docs.erl +++ b/src/fabric_view_all_docs.erl @@ -54,14 +54,19 @@ go(DbName, Options, QueryArgs, Callback, Acc0) -> #mrargs{ direction = Dir, include_docs = IncludeDocs, - doc_options = Doc_Options, + doc_options = DocOptions0, limit = Limit, + conflicts = Conflicts, skip = Skip, keys = Keys0 } = QueryArgs, {_, Ref0} = spawn_monitor(fun() -> exit(fabric:get_doc_count(DbName)) end), + DocOptions1 = case Conflicts of + true -> [conflicts|DocOptions0]; + _ -> DocOptions0 + end, SpawnFun = fun(Key) -> - spawn_monitor(?MODULE, open_doc, [DbName, Options ++ Doc_Options, Key, IncludeDocs]) + spawn_monitor(?MODULE, open_doc, [DbName, Options ++ DocOptions1, Key, IncludeDocs]) end, MaxJobs = all_docs_concurrency(), Keys1 = case Dir of
