Skip to content

Commit

Permalink
Merge branch 'main' into cluster_wide_queue_limit_main
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin authored May 21, 2024
2 parents 39d1376 + f124bca commit c0cb080
Show file tree
Hide file tree
Showing 74 changed files with 2,293 additions and 1,377 deletions.
3 changes: 3 additions & 0 deletions .elp.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build_info]
apps = "deps/*"
deps = ""
7 changes: 6 additions & 1 deletion .github/workflows/gazelle-scheduled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
jobs:
bazel-run-gazelle:
name: bazel run gazelle
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
strategy:
max-parallel: 1
fail-fast: false
Expand All @@ -21,6 +21,11 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ matrix.target_branch }}
- name: Configure Erlang
uses: erlef/setup-beam@v1
with:
otp-version: 26.2
elixir-version: 1.15
- name: BAZEL RUN GAZELLE
run: |
bazel run gazelle
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/gazelle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ on:
jobs:
bazel-run-gazelle:
name: bazel run gazelle
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: CHECKOUT REPOSITORY
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.target_branch }}
- name: Configure Erlang
uses: erlef/setup-beam@v1
with:
otp-version: 26.2
elixir-version: 1.15
- name: BAZEL RUN GAZELLE
run: |
bazel run gazelle
Expand Down
12 changes: 6 additions & 6 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ erlang_config.internal_erlang_from_github_release(
erlang_config.internal_erlang_from_github_release(
name = "26_2",
extra_make_opts = ["-j 4"],
sha256 = "d537ff4ac5d8c1cb507aedaf7198fc1f155ea8aa65a8d83edb35c2802763cc28",
version = "26.2.2",
sha256 = "de155c4ad9baab2b9e6c96dbd03bf955575a04dd6feee9c08758beb28484c9f6",
version = "26.2.5",
)

erlang_config.internal_erlang_from_http_archive(
Expand Down Expand Up @@ -148,8 +148,8 @@ elixir_config.internal_elixir_from_github_release(

elixir_config.internal_elixir_from_github_release(
name = "1_15",
sha256 = "78bde2786b395515ae1eaa7d26faa7edfdd6632bfcfcd75bccb6341a18e8798f",
version = "1.15.7",
sha256 = "09e697ab13fc60f27adaba9b71f8793105acd4320a89b16be0ceb4a13426d779",
version = "1.15.8",
)

use_repo(
Expand Down Expand Up @@ -349,8 +349,8 @@ erlang_package.hex_package(
name = "ra",
build_file = "@rabbitmq-server//bazel:BUILD.ra",
pkg = "ra",
sha256 = "0c9c02e8db48a9ed8f9b56e3b105dc25c72fde01c3dc07e2dc4f0618545595cd",
version = "2.10.0",
sha256 = "ab0e53c69b6964b237d94a3ac8f2ae5ba5cdc2dc9ef73ef3731d85f0c01d35d0",
version = "2.10.1",
)

erlang_package.git_package(
Expand Down
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ http_file(

http_file(
name = "otp_src_26_2",
downloaded_file_path = "OTP-26.2.2.tar.gz",
sha256 = "93c09aa8814018c23d218ac68b2bcdba188e12086223fbfa08af5cc70edd7ee1",
urls = ["https://github.com/erlang/otp/archive/OTP-26.2.2.tar.gz"],
downloaded_file_path = "OTP-26.2.5.tar.gz",
sha256 = "d34b409cb5968ae47dd5a0c4f85b925d5601898d90788bbb08d514964a3a141d",
urls = ["https://github.com/erlang/otp/archive/OTP-26.2.5.tar.gz"],
)

new_git_repository(
Expand Down
3 changes: 2 additions & 1 deletion deps/oauth2_client/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ eunit(
name = "eunit",
compiled_suites = [
":test_oauth_http_mock_beam",
":test_oauth2_client_test_util_beam"],
":test_oauth2_client_test_util_beam",
],
target = ":test_erlang_app",
)

Expand Down
26 changes: 14 additions & 12 deletions deps/oauth2_client/app.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ def all_beam_files(name = "all_beam_files"):
)
erlang_bytecode(
name = "other_beam",
srcs = ["src/oauth2_client.erl",
"src/jwt_helper.erl"],
srcs = [
"src/jwt_helper.erl",
"src/oauth2_client.erl",
],
hdrs = [":public_and_private_hdrs"],
app_name = "oauth2_client",
dest = "ebin",
erlc_opts = "//:erlc_opts",
deps = [
"@jose//:erlang_app"
],
deps = ["@jose//:erlang_app"],
)

def all_test_beam_files(name = "all_test_beam_files"):
Expand All @@ -28,15 +28,15 @@ def all_test_beam_files(name = "all_test_beam_files"):
erlang_bytecode(
name = "test_other_beam",
testonly = True,
srcs = ["src/oauth2_client.erl",
"src/jwt_helper.erl"],
srcs = [
"src/jwt_helper.erl",
"src/oauth2_client.erl",
],
hdrs = [":public_and_private_hdrs"],
app_name = "oauth2_client",
dest = "test",
erlc_opts = "//:test_erlc_opts",
deps = [
"@jose//:erlang_app"
],
deps = ["@jose//:erlang_app"],
)

def all_srcs(name = "all_srcs"):
Expand All @@ -54,8 +54,10 @@ def all_srcs(name = "all_srcs"):

filegroup(
name = "srcs",
srcs = ["src/oauth2_client.erl",
"src/jwt_helper.erl"],
srcs = [
"src/jwt_helper.erl",
"src/oauth2_client.erl",
],
)
filegroup(
name = "private_hdrs",
Expand Down
10 changes: 7 additions & 3 deletions deps/rabbit/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,6 @@ rabbitmq_integration_suite(
rabbitmq_integration_suite(
name = "classic_queue_prop_SUITE",
size = "large",
shard_count = 6,
sharding_method = "case",
deps = [
"@proper//:erlang_app",
],
Expand Down Expand Up @@ -399,7 +397,13 @@ rabbitmq_integration_suite(
additional_beam = [
":test_queue_utils_beam",
],
shard_count = 7,
shard_count = 8,
)

rabbitmq_integration_suite(
name = "message_containers_deaths_v2_SUITE",
size = "medium",
shard_count = 1,
)

rabbitmq_integration_suite(
Expand Down
9 changes: 9 additions & 0 deletions deps/rabbit/app.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2228,3 +2228,12 @@ def test_suite_beam_files(name = "test_suite_beam_files"):
erlc_opts = "//:test_erlc_opts",
deps = ["//deps/amqp10_common:erlang_app", "//deps/rabbitmq_amqp_client:erlang_app"],
)
erlang_bytecode(
name = "message_containers_deaths_v2_SUITE_beam_files",
testonly = True,
srcs = ["test/message_containers_deaths_v2_SUITE.erl"],
outs = ["test/message_containers_deaths_v2_SUITE.beam"],
app_name = "rabbit",
erlc_opts = "//:test_erlc_opts",
deps = ["//deps/amqp_client:erlang_app", "//deps/rabbitmq_ct_helpers:erlang_app"],
)
36 changes: 22 additions & 14 deletions deps/rabbit/include/mc.hrl
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
-type death_key() :: {SourceQueue :: rabbit_misc:resource_name(), rabbit_dead_letter:reason()}.
-type death_anns() :: #{first_time := non_neg_integer(), %% the timestamp of the first
last_time := non_neg_integer(), %% the timestamp of the last
ttl => OriginalExpiration :: non_neg_integer()}.
-record(death, {exchange :: OriginalExchange :: rabbit_misc:resource_name(),
routing_keys = [] :: OriginalRoutingKeys :: [rabbit_types:routing_key()],
count = 0 :: non_neg_integer(),
anns :: death_anns()}).

-record(deaths, {first :: death_key(),
last :: death_key(),
records = #{} :: #{death_key() := #death{}}}).


%% good enough for most use cases
-define(IS_MC(Msg), element(1, Msg) == mc andalso tuple_size(Msg) == 5).

Expand All @@ -26,3 +12,25 @@
-define(ANN_RECEIVED_AT_TIMESTAMP, rts).
-define(ANN_DURABLE, d).
-define(ANN_PRIORITY, p).

-define(FF_MC_DEATHS_V2, message_containers_deaths_v2).

-type death_key() :: {SourceQueue :: rabbit_misc:resource_name(), rabbit_dead_letter:reason()}.
-type death_anns() :: #{%% timestamp of the first time this message
%% was dead lettered from this queue for this reason
first_time := pos_integer(),
%% timestamp of the last time this message
%% was dead lettered from this queue for this reason
last_time := pos_integer(),
ttl => OriginalTtlHeader :: non_neg_integer()}.

-record(death, {exchange :: OriginalExchange :: rabbit_misc:resource_name(),
routing_keys :: OriginalRoutingKeys :: [rabbit_types:routing_key(),...],
%% how many times this message was dead lettered from this queue for this reason
count :: pos_integer(),
anns :: death_anns()}).

-record(deaths, {first :: death_key(), % redundant to mc annotations x-first-death-*
last :: death_key(), % redundant to mc annotations x-last-death-*
records :: #{death_key() := #death{}}
}).
4 changes: 2 additions & 2 deletions deps/rabbit/priv/schema/rabbit.schema
Original file line number Diff line number Diff line change
Expand Up @@ -2553,8 +2553,8 @@ end}.

{translation, "rabbit.classic_queue_default_version",
fun(Conf) ->
case cuttlefish:conf_get("classic_queue.default_version", Conf, 1) of
1 -> 1;
case cuttlefish:conf_get("classic_queue.default_version", Conf, 2) of
1 -> cuttlefish:invalid("Classic queues v1 are no longer supported");
2 -> 2;
_ -> cuttlefish:unset()
end
Expand Down
Loading

0 comments on commit c0cb080

Please sign in to comment.