You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2015/06/02 21:35:37 UTC
[06/50] couch commit: updated refs/heads/2080-port-cors-to-chttpd to
529339b
Fix bulk_delete_create
Fix the case when document with the same id is deleted and created in
a single bulk transaction.
COUCHDB-2547
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/3776aa3b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/3776aa3b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/3776aa3b
Branch: refs/heads/2080-port-cors-to-chttpd
Commit: 3776aa3bd55a5f39d402992c9a58ed5c06413c96
Parents: 51eec4a
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Authored: Thu Feb 5 11:26:41 2015 -0800
Committer: ILYA Khlopotov <ii...@ca.ibm.com>
Committed: Tue Feb 10 11:07:13 2015 -0800
----------------------------------------------------------------------
src/couch_doc.erl | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/3776aa3b/src/couch_doc.erl
----------------------------------------------------------------------
diff --git a/src/couch_doc.erl b/src/couch_doc.erl
index 6fc9b09..d152a2a 100644
--- a/src/couch_doc.erl
+++ b/src/couch_doc.erl
@@ -273,12 +273,7 @@ max_seq(Tree, UpdateSeq) ->
to_doc_info_path(#full_doc_info{id=Id,rev_tree=Tree,update_seq=FDISeq}) ->
RevInfosAndPath = [
- {#rev_info{
- deleted = Leaf#leaf.deleted,
- body_sp = Leaf#leaf.ptr,
- seq = Leaf#leaf.seq,
- rev = {Pos, RevId}
- }, Path} || {Leaf, {Pos, [RevId | _]} = Path} <-
+ {rev_info(Node), Path} || {_Leaf, Path} = Node <-
couch_key_tree:get_all_leafs(Tree)
],
SortedRevInfosAndPath = lists:sort(
@@ -291,6 +286,20 @@ to_doc_info_path(#full_doc_info{id=Id,rev_tree=Tree,update_seq=FDISeq}) ->
RevInfos = [RevInfo || {RevInfo, _Path} <- SortedRevInfosAndPath],
{#doc_info{id=Id, high_seq=max_seq(Tree, FDISeq), revs=RevInfos}, WinPath}.
+rev_info({#leaf{} = Leaf, {Pos, [RevId | _]}}) ->
+ #rev_info{
+ deleted = Leaf#leaf.deleted,
+ body_sp = Leaf#leaf.ptr,
+ seq = Leaf#leaf.seq,
+ rev = {Pos, RevId}
+ };
+rev_info({#doc{} = Doc, {Pos, [RevId | _]}}) ->
+ #rev_info{
+ deleted = Doc#doc.deleted,
+ body_sp = undefined,
+ seq = undefined,
+ rev = {Pos, RevId}
+ }.
is_deleted(#full_doc_info{rev_tree=Tree}) ->
is_deleted(Tree);