Skip to content

Commit 0d3edce

Browse files
committed
rabbit_khepri: Rename misleading adv_delete() to adv_delete_many()
[Why] This wrapper was calling `khepri_adv:delete_many()`, not `khepri_adv:delete()` as the name was suggesting. They are not the same function and have not the same behaviour. This led to a performance issue with the branch that replaces the "delete queue" transaction by a simple delete (#14902) that was related to this confusion. [How] The wrapper is renamed to reflect the Khepri API being called. While here, add a `rabbit_khepri:adv_delete()` wrapper that calls the similarily named Khepri API.
1 parent 7f84e2e commit 0d3edce

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

deps/rabbit/src/rabbit_db_rtparams.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ do_delete(Key) ->
239239
delete_vhost(VHostName) when is_binary(VHostName) ->
240240
Pattern = khepri_vhost_rp_path(
241241
VHostName, ?KHEPRI_WILDCARD_STAR, ?KHEPRI_WILDCARD_STAR),
242-
case rabbit_khepri:adv_delete(Pattern) of
242+
case rabbit_khepri:adv_delete_many(Pattern) of
243243
{ok, NodePropsMap} ->
244244
RTParams =
245245
maps:fold(

deps/rabbit/src/rabbit_khepri.erl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156

157157
delete/1, delete/2,
158158
adv_delete/1, adv_delete/2,
159+
adv_delete_many/1, adv_delete_many/2,
159160
clear_payload/1, clear_payload/2,
160161

161162
transaction/1, transaction/2, transaction/3,
@@ -1251,6 +1252,13 @@ adv_delete(PathPattern) ->
12511252
adv_delete(PathPattern, #{}).
12521253

12531254
adv_delete(PathPattern, Options) ->
1255+
Options1 = maps:merge(?DEFAULT_COMMAND_OPTIONS, Options),
1256+
khepri_adv:delete(?STORE_ID, PathPattern, Options1).
1257+
1258+
adv_delete_many(PathPattern) ->
1259+
adv_delete_many(PathPattern, #{}).
1260+
1261+
adv_delete_many(PathPattern, Options) ->
12541262
Options1 = maps:merge(?DEFAULT_COMMAND_OPTIONS, Options),
12551263
khepri_adv:delete_many(?STORE_ID, PathPattern, Options1).
12561264

0 commit comments

Comments
 (0)