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/04/23 13:50:20 UTC

(couchdb) branch auto-delete-3 updated: ensure subtype is in doc id

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


The following commit(s) were added to refs/heads/auto-delete-3 by this push:
     new d661c5525 ensure subtype is in doc id
d661c5525 is described below

commit d661c552584108984fb08d64d105ba2400b1f516
Author: Robert Newson <rn...@apache.org>
AuthorDate: Wed Apr 23 14:41:45 2025 +0100

    ensure subtype is in doc id
---
 src/couch_mrview/src/couch_mrview_util.erl |  2 +-
 src/dreyfus/src/dreyfus_index.erl          |  2 +-
 src/fabric/src/fabric_drop_seq.erl         | 10 ++++++----
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/couch_mrview/src/couch_mrview_util.erl b/src/couch_mrview/src/couch_mrview_util.erl
index c20a6a6ce..f0e708722 100644
--- a/src/couch_mrview/src/couch_mrview_util.erl
+++ b/src/couch_mrview/src/couch_mrview_util.erl
@@ -1362,4 +1362,4 @@ peer_checkpoint_id(#mrst{} = State) ->
     Hash = couch_util:encodeBase64Url(
         crypto:hash(sha256, [atom_to_binary(node()), $0, State#mrst.db_name])
     ),
-    <<"mrview-", Sig/binary, "-", Hash/binary>>.
+    <<Sig/binary, "-", Hash/binary>>.
diff --git a/src/dreyfus/src/dreyfus_index.erl b/src/dreyfus/src/dreyfus_index.erl
index b1caf3e59..717dd85bf 100644
--- a/src/dreyfus/src/dreyfus_index.erl
+++ b/src/dreyfus/src/dreyfus_index.erl
@@ -435,4 +435,4 @@ peer_checkpoint_id(DbName, Sig0) ->
     Hash = couch_util:encodeBase64Url(
         crypto:hash(sha256, [atom_to_binary(node()), $0, DbName])
     ),
-    <<"search-", Sig1/binary, "-", Hash/binary>>.
+    <<Sig1/binary, "-", Hash/binary>>.
diff --git a/src/fabric/src/fabric_drop_seq.erl b/src/fabric/src/fabric_drop_seq.erl
index 883ddc363..5ad5c395e 100644
--- a/src/fabric/src/fabric_drop_seq.erl
+++ b/src/fabric/src/fabric_drop_seq.erl
@@ -302,7 +302,9 @@ create_peer_checkpoint_doc_if_missing(DbName, Subtype, Source, PeerId, UpdateSeq
     is_binary(UpdateSeq)
 ->
     {_, Ref} = spawn_monitor(fun() ->
-        case fabric:open_doc(mem3:dbname(DbName), peer_checkpoint_id(PeerId), [?ADMIN_CTX]) of
+        case
+            fabric:open_doc(mem3:dbname(DbName), peer_checkpoint_id(Subtype, PeerId), [?ADMIN_CTX])
+        of
             {ok, _} ->
                 ok;
             {not_found, _} ->
@@ -353,7 +355,7 @@ peer_checkpoint_doc(PeerId, Subtype, Source, UpdateSeq) when
     is_binary(PeerId), is_binary(Subtype), is_binary(Source), is_binary(UpdateSeq)
 ->
     #doc{
-        id = peer_checkpoint_id(PeerId),
+        id = peer_checkpoint_id(Subtype, PeerId),
         body =
             {[
                 {<<"type">>, <<"peer-checkpoint">>},
@@ -364,8 +366,8 @@ peer_checkpoint_doc(PeerId, Subtype, Source, UpdateSeq) when
             ]}
     }.
 
-peer_checkpoint_id(PeerId) ->
-    <<?LOCAL_DOC_PREFIX, "peer-checkpoint-", PeerId/binary>>.
+peer_checkpoint_id(Subtype, PeerId) ->
+    <<?LOCAL_DOC_PREFIX, "peer-checkpoint-", Subtype/binary, "-", PeerId/binary>>.
 
 pack_seq(DbName, UpdateSeq) ->
     DbUuid = couch_util:with_db(DbName, fun(Db) -> couch_db:get_uuid(Db) end),