summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Davis <mcarsondavis@gmail.com>2023-02-14 13:12:26 -0600
committerDiana Parra Corbacho <dparracorbac@vmware.com>2023-05-12 11:31:16 +0200
commit4721b075669773da413c2b55ff172e4f34aba571 (patch)
treeaf82c893dbc1bd44a67acc58b3c03cb4a83ba81b
parentafaba075839d8d8a3b5740b86e069c191bfbec01 (diff)
downloadrabbitmq-server-git-4721b075669773da413c2b55ff172e4f34aba571.tar.gz
Upgrade Khepri to the latest main
The latest changes on Khepri main fix some issues: * Projections are re-initialized when khepri_machine restarts, even if the register_projection commands have been snapshotted. This fixes ETS errors and shutdowns that could happen if the rabbit was restarted after performing many (4096+) database operations. * Deleting a subtree in the store by deleting the root of the subtree now correctly recursively deletes records out of any projections register to watch the deleted nodes. In the rabbit app, this fixes some failing cases in the bindings_SUITE and resolves a TODO in rabbit_db_binding.
-rw-r--r--MODULE.bazel4
-rw-r--r--bazel/BUILD.khepri13
-rw-r--r--deps/rabbit/src/rabbit_db_binding.erl7
3 files changed, 16 insertions, 8 deletions
diff --git a/MODULE.bazel b/MODULE.bazel
index 801469aed2..6686b0228f 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -242,8 +242,8 @@ erlang_package.hex_package(
erlang_package.git_package(
name = "khepri",
build_file = "@rabbitmq-server//bazel:BUILD.khepri",
- # sha256 = "7fae3112cea737bc64d5ff51c1b79a7f30f13ed3d11c565d2a6966ea5aa40473",
- version = "0.6.0",
+ commit = "e8f38b60e28a3e31af2b7dd5248514c508af7d0a",
+ repository = "rabbitmq/khepri",
)
erlang_package.hex_package(
diff --git a/bazel/BUILD.khepri b/bazel/BUILD.khepri
index 317877ea03..bbc5364a44 100644
--- a/bazel/BUILD.khepri
+++ b/bazel/BUILD.khepri
@@ -82,6 +82,7 @@ erlang_bytecode(
"include/khepri.hrl",
"src/khepri_machine.hrl",
"src/khepri_payload.hrl",
+ "src/khepri_tree.hrl",
],
app_name = "khepri",
erlc_opts = "//:erlc_opts",
@@ -95,6 +96,7 @@ erlang_bytecode(
"include/khepri.hrl",
"src/khepri_machine.hrl",
"src/khepri_payload.hrl",
+ "src/khepri_tree.hrl",
],
app_name = "khepri",
erlc_opts = "//:erlc_opts",
@@ -135,6 +137,7 @@ erlang_bytecode(
"src/khepri_cluster.hrl",
"src/khepri_machine.hrl",
"src/khepri_payload.hrl",
+ "src/khepri_tree.hrl",
],
app_name = "khepri",
erlc_opts = "//:erlc_opts",
@@ -154,6 +157,7 @@ erlang_bytecode(
"src/khepri_payload.hrl",
"src/khepri_projection.hrl",
"src/khepri_ret.hrl",
+ "src/khepri_tree.hrl",
"src/khepri_tx.hrl",
],
app_name = "khepri",
@@ -195,6 +199,7 @@ erlang_bytecode(
"src/khepri_machine.hrl",
"src/khepri_payload.hrl",
"src/khepri_projection.hrl",
+ "src/khepri_tree.hrl",
],
app_name = "khepri",
erlc_opts = "//:erlc_opts",
@@ -232,6 +237,7 @@ erlang_bytecode(
"src/khepri_machine.hrl",
"src/khepri_payload.hrl",
"src/khepri_ret.hrl",
+ "src/khepri_tree.hrl",
"src/khepri_tx.hrl",
],
app_name = "khepri",
@@ -249,6 +255,7 @@ erlang_bytecode(
"src/khepri_machine.hrl",
"src/khepri_payload.hrl",
"src/khepri_ret.hrl",
+ "src/khepri_tree.hrl",
"src/khepri_tx.hrl",
],
app_name = "khepri",
@@ -330,6 +337,7 @@ filegroup(
"src/khepri_payload.hrl",
"src/khepri_projection.hrl",
"src/khepri_ret.hrl",
+ "src/khepri_tree.hrl",
"src/khepri_tx.hrl",
],
)
@@ -346,7 +354,10 @@ filegroup(
filegroup(
name = "licenses",
- srcs = [],
+ srcs = [
+ "LICENSE-Apache-2.0",
+ "LICENSE-MPL-2.0",
+ ],
)
filegroup(
diff --git a/deps/rabbit/src/rabbit_db_binding.erl b/deps/rabbit/src/rabbit_db_binding.erl
index b7d737c8b1..36c9a9e22f 100644
--- a/deps/rabbit/src/rabbit_db_binding.erl
+++ b/deps/rabbit/src/rabbit_db_binding.erl
@@ -777,11 +777,8 @@ delete_all_for_exchange_in_khepri(X = #exchange{name = XName}, OnlyDurable, Remo
delete_for_source_in_khepri(#resource{virtual_host = VHost, name = Name}) ->
Path = khepri_routes_path() ++ [VHost, Name],
{ok, Bindings} = khepri_tx:get_many(Path ++ [rabbit_khepri:if_has_data_wildcard()]),
- %% ok = khepri_tx:delete(Path),
- maps:fold(fun(P, Set, Acc) ->
- %% TODO projections are not updated if we just use the previous
- %% delete of the root path. Let's keep it like this for now...
- ok = khepri_tx:delete(P),
+ ok = khepri_tx:delete(Path),
+ maps:fold(fun(_P, Set, Acc) ->
sets:to_list(Set) ++ Acc
end, [], Bindings).