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:48 UTC
(couchdb) 11/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 59b838eebaf42288a3ffcb4f93ab721c60148ed3
Author: Robert Newson <rn...@apache.org>
AuthorDate: Mon Mar 3 20:57:51 2025 +0000
wip
---
src/fabric/src/fabric_drop_seq.erl | 48 ++++++++++++++++++++++----------------
1 file changed, 28 insertions(+), 20 deletions(-)
diff --git a/src/fabric/src/fabric_drop_seq.erl b/src/fabric/src/fabric_drop_seq.erl
index 956386f40..98c8b4542 100644
--- a/src/fabric/src/fabric_drop_seq.erl
+++ b/src/fabric/src/fabric_drop_seq.erl
@@ -1,4 +1,4 @@
--module(fabric_drop_seq2).
+-module(fabric_drop_seq).
-include_lib("mem3/include/mem3.hrl").
-include_lib("couch/include/couch_db.hrl").
@@ -12,25 +12,33 @@ go(DbName) ->
{ok, {PeerCheckpoints, ShardSyncHistory}} = parse_local_docs(DbName),
- Expanded = maps:fold( fun({Range, SrcNode}, {Uuid, Seq}, Acc1) ->
- OtherNodes = maps:get(Range, RangeToNodes, []) -- [SrcNode],
- lists:foldl(fun(TgtNode, Acc2) ->
- History = maps:get({Range, SrcNode, TgtNode}, ShardSyncHistory, []),
- case
- lists:search(
- fun({SourceUuid, SourceSeq, _TargetUuid, _TargetSeq}) ->
- Uuid == SourceUuid andalso SourceSeq =< Seq
- end,
- History
- )
- of
- {value, {_SourceUuid, _SourceSeq, TargetUuid, TargetSeq}} ->
- Acc2#{{Range, TgtNode} => {TargetUuid, TargetSeq}};
- false ->
- Acc2
- end
- end, Acc1, OtherNodes)
- end, PeerCheckpoints, PeerCheckpoints),
+ Expanded = maps:fold(
+ fun({Range, SrcNode}, {Uuid, Seq}, Acc1) ->
+ OtherNodes = maps:get(Range, RangeToNodes, []) -- [SrcNode],
+ lists:foldl(
+ fun(TgtNode, Acc2) ->
+ History = maps:get({Range, SrcNode, TgtNode}, ShardSyncHistory, []),
+ case
+ lists:search(
+ fun({SourceUuid, SourceSeq, _TargetUuid, _TargetSeq}) ->
+ Uuid == SourceUuid andalso SourceSeq =< Seq
+ end,
+ History
+ )
+ of
+ {value, {_SourceUuid, _SourceSeq, TargetUuid, TargetSeq}} ->
+ Acc2#{{Range, TgtNode} => {TargetUuid, TargetSeq}};
+ false ->
+ Acc2
+ end
+ end,
+ Acc1,
+ OtherNodes
+ )
+ end,
+ PeerCheckpoints,
+ PeerCheckpoints
+ ),
Workers = lists:map(
fun(#shard{} = Shard) ->