You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2025/03/03 21:00:41 UTC
(couchdb) 04/11: wip
This is an automated email from the ASF dual-hosted git repository.
rnewson pushed a commit to branch auto-delete-3
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit e8ca9123317ba5f5317d80230c96df300d886c39
Author: Robert Newson <rn...@apache.org>
AuthorDate: Mon Feb 24 13:53:02 2025 +0000
wip
---
src/fabric/src/fabric_drop_seq.erl | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/fabric/src/fabric_drop_seq.erl b/src/fabric/src/fabric_drop_seq.erl
index 4dd31339f..8b2eacf4d 100644
--- a/src/fabric/src/fabric_drop_seq.erl
+++ b/src/fabric/src/fabric_drop_seq.erl
@@ -53,7 +53,7 @@ parse_peer_doc(#doc{} = Doc, Acc) ->
{Props} = Doc#doc.body,
Type = couch_util:get_value(<<"type">>, Props),
case Type of
- <<"peer_checkpoint">> ->
+ <<"_peer_checkpoint">> ->
UpdateSeq = couch_util:get_value(<<"update_seq">>, Props),
maps:merge_with(fun combine_peers/3, decode_seq(UpdateSeq), Acc);
_Else ->
@@ -62,10 +62,16 @@ parse_peer_doc(#doc{} = Doc, Acc) ->
parse_shard_sync_doc(#doc{id = <<"_local/shard-sync-", _/binary>>} = Doc, Acc) ->
{Props} = Doc#doc.body,
- {History0} = couch_util:get_value(<<"history">>, Props),
- {_, History1} = lists:unzip(History0),
- History2 = [[maps:from_list(I) || {I} <- H] || H <- History1],
- [History2 | Acc];
+ {[{_Node, History}]} = couch_util:get_value(<<"history">>, Props),
+ L = [
+ {couch_util:get_value(<<"source_node">>, Item),
+ couch_util:get_value(<<"source_uuid">>, Item),
+ couch_util:get_value(<<"source_seq">>, Item),
+ couch_util:get_value(<<"target_node">>, Item),
+ couch_util:get_value(<<"target_uuid">>, Item),
+ couch_util:get_value(<<"target_seq">>, Item)
+ } || {Item} <- History],
+ L ++ Acc;
parse_shard_sync_doc(_Doc, Acc) ->
Acc.
@@ -73,8 +79,8 @@ decode_seq(OpaqueSeq) ->
Decoded = fabric_view_changes:decode_seq(OpaqueSeq),
lists:foldl(
fun
- ({_Node, Range, {Seq, Uuid, Node}}, Acc) ->
- Acc#{{Node, Range, Uuid} => Seq};
+ ({_Node, _Range, {Seq, Uuid, Node}}, Acc) ->
+ Acc#{{Node, Uuid} => Seq};
({_Node, _Range, _Seq}, Acc) ->
Acc
end,