This is an automated email from the ASF dual-hosted git repository. jan pushed a commit to branch auto-delete-3-plus-shard-move in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 82182b5322509addff30bfa851d20d1ad9a0fc03 Author: Robert Newson <[email protected]> AuthorDate: Mon Jun 23 15:34:25 2025 +0100 store range directly in shard-sync docs --- src/fabric/src/fabric_drop_seq.erl | 5 ++--- src/mem3/src/mem3_rpc.erl | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/fabric/src/fabric_drop_seq.erl b/src/fabric/src/fabric_drop_seq.erl index 7b471f218..7b35cc3b1 100644 --- a/src/fabric/src/fabric_drop_seq.erl +++ b/src/fabric/src/fabric_drop_seq.erl @@ -280,12 +280,11 @@ gather_drop_seq_info_fun( {PeerCheckpoints, ShardSyncHistory0} = Acc ) -> {Props} = Doc#doc.body, - case couch_util:get_value(<<"dbname">>, Props) of + case couch_util:get_value(<<"range">>, Props) of undefined -> %% not yet upgraded with new property {ok, Acc}; - DbName -> - Range = mem3:range(DbName), + Range -> {[{_SrcNode, History}]} = couch_util:get_value(<<"history">>, Props), KeyFun = fun({Item}) -> {Range, binary_to_existing_atom(couch_util:get_value(<<"source_node">>, Item)), diff --git a/src/mem3/src/mem3_rpc.erl b/src/mem3/src/mem3_rpc.erl index b00eb5637..6bfd9e6f3 100644 --- a/src/mem3/src/mem3_rpc.erl +++ b/src/mem3/src/mem3_rpc.erl @@ -140,12 +140,19 @@ save_checkpoint_rpc(DbName, Id, SourceSeq, NewEntry0, History0) -> ] ++ NewEntry0 }, Body = - {[ - {<<"dbname">>, DbName}, - {<<"seq">>, SourceSeq}, - {<<"target_uuid">>, couch_db:get_uuid(Db)}, - {<<"history">>, add_checkpoint(NewEntry, History0)} - ]}, + { + case DbName of + <<"shards/", _/binary>> -> + [{<<"range">>, mem3:range(DbName)}]; + _Else -> + [] + end ++ + [ + {<<"seq">>, SourceSeq}, + {<<"target_uuid">>, couch_db:get_uuid(Db)}, + {<<"history">>, add_checkpoint(NewEntry, History0)} + ] + }, Doc = #doc{id = Id, body = Body}, rexi:reply( try couch_db:update_doc(Db, Doc, []) of
