summaryrefslogtreecommitdiff
path: root/apps/couch/src
diff options
context:
space:
mode:
authorRobert Newson <robert.newson@cloudant.com>2011-09-28 21:19:15 +0100
committerRobert Newson <robert.newson@cloudant.com>2011-09-28 21:20:19 +0100
commitfc0d25038c76a654ba4a093b6f51949a4821488b (patch)
tree7ac3fe05d0e7faccbc3f23925b1e611128b31b41 /apps/couch/src
parent24e1156db042fbcb6a054601f2c18f367ed5389e (diff)
parent89a5c28775f24f2706f443c76afa3edf9df78ce4 (diff)
Merge 1.1.x because Paul Davis kept his important bug fix super secret while I was slaving away on this merge for two days.
Diffstat (limited to 'apps/couch/src')
-rw-r--r--apps/couch/src/couch_doc.erl8
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/couch/src/couch_doc.erl b/apps/couch/src/couch_doc.erl
index 827015db..63ac0892 100644
--- a/apps/couch/src/couch_doc.erl
+++ b/apps/couch/src/couch_doc.erl
@@ -302,7 +302,7 @@ to_doc_info(FullDocInfo) ->
{DocInfo, _Path} = to_doc_info_path(FullDocInfo),
DocInfo.
-max_seq(Tree) ->
+max_seq(Tree, UpdateSeq) ->
FoldFun = fun({_Pos, _Key}, Value, _Type, MaxOldSeq) ->
case Value of
{_Deleted, _DiskPos, OldTreeSeq} ->
@@ -313,9 +313,9 @@ max_seq(Tree) ->
MaxOldSeq
end
end,
- couch_key_tree:fold(FoldFun, 0, Tree).
+ couch_key_tree:fold(FoldFun, UpdateSeq, Tree).
-to_doc_info_path(#full_doc_info{id=Id,rev_tree=Tree}) ->
+to_doc_info_path(#full_doc_info{id=Id,rev_tree=Tree,update_seq=FDISeq}) ->
RevInfosAndPath =
[{#rev_info{deleted=Del,body_sp=Bp,seq=Seq,rev={Pos,RevId}}, Path} ||
{#leaf{deleted=Del, ptr=Bp, seq=Seq},{Pos, [RevId|_]}=Path} <-
@@ -328,7 +328,7 @@ to_doc_info_path(#full_doc_info{id=Id,rev_tree=Tree}) ->
end, RevInfosAndPath),
[{_RevInfo, WinPath}|_] = SortedRevInfosAndPath,
RevInfos = [RevInfo || {RevInfo, _Path} <- SortedRevInfosAndPath],
- {#doc_info{id=Id, high_seq=max_seq(Tree), revs=RevInfos}, WinPath}.
+ {#doc_info{id=Id, high_seq=max_seq(Tree, FDISeq), revs=RevInfos}, WinPath}.