Commit Graph

65 Commits

Author SHA1 Message Date
David Ansari 18e8c1d5f8 Require all stable feature flags added up to 3.13.0
Since feature flag `message_containers` introduced in 3.13.0 is required in 4.0,
we can also require all other feature flags introduced in or before 3.13.0
and remove their compatibility code for 4.0:

* restart_streams
* stream_sac_coordinator_unblock_group
* stream_filtering
* stream_update_config_command
2024-07-11 11:20:26 +02:00
Rin Kuryloski 5debebfaf3 Use rules_elixir to build the cli without mix
Certain elixir-native deps are still build with mix, but this can be
corrected later
2024-06-18 14:50:34 +02:00
David Ansari dda1c500da Require feature flag message_containers
as it is required for Native AMQP 1.0 in 4.0.

Remove compatibility code.
2024-04-04 15:11:31 +02:00
David Ansari 697ffc2b1a Use 3.13.1 as secondary umbrella
for mixed version tests
2024-04-03 17:51:53 +02:00
Rin Kuryloski ac6142e24d Label main as 4.0.0 in bazel build 2024-03-04 10:13:59 +01:00
Jean-Sébastien Pédron cc18c8b141
rabbitmq_prelaunch: Adapt Makefiles and Bazel files after the move 2023-12-08 14:42:53 +01:00
David Ansari c914e43097 Do not enable OTP feature at runtime
Since Erlang/OTP 26:
```
OTP-18445
Application(s):
erts, stdlib
It is no longer necessary to enable a feature in the runtime system in order to load modules that are using it.
It is sufficient to enable the feature in the compiler when compiling it.
That means that to use feature maybe_expr in Erlang/OTP 26, it is sufficient to enable it during compilation.
In Erlang/OTP 27, feature maybe_expr will be enabled by default, but it will be possible to disable it.
```
2023-10-27 09:26:31 +02:00
Rin Kuryloski d5386e0a90 Resolve additional sources for coverage 2023-10-17 11:22:36 -04:00
Rin Kuryloski 231465f35e Use rules_erlang 3.13.1
This version of rules_erlang adds coverage support

Bazel has sort of standardized on lcov for coverage, so that is what
we use.

Example:
1. `bazel coverage //deps/rabbit:eunit -t-`
2. `genhtml --output genhtml "$(bazel info
output_path)/_coverage/_coverage_report.dat"`
3. `open genhtml/index.html`

Multiple tests can be run with results aggregated, i.e. `bazel
coverage //deps/rabbit:all -t-`

Running coverage with RBE has a lot of caveats,
https://bazel.build/configure/coverage#remote-execution, so the above
commands won't work as is with RBE.
2023-10-17 11:22:36 -04:00
Rin Kuryloski c6672b9dea Use the latest 3.12.x for the secondary umbrella 2023-09-21 09:35:49 +02:00
Rin Kuryloski eb94a58bc9 Add a workflow to compare the bazel/erlang.mk output
To catch any drift between the builds
2023-05-15 13:54:14 +02:00
Rin Kuryloski 3e83c9755a Simplify the reference to RABBITMQ_RUN in bazel in integration tests 2023-04-25 20:49:58 +02:00
Rin Kuryloski 8de8f59d47 Use gazelle generated bazel files
Bazel build files are now maintained primarily with `bazel run
gazelle`. This will analyze and merge changes into the build files as
necessitated by certain code changes (e.g. the introduction of new
modules).

In some cases there hints to gazelle in the build files, such as `#
gazelle:erlang...` or `# keep` comments. xref checks on plugins that
depend on the cli are a good example.
2023-04-17 18:13:18 +02:00
Rin Kuryloski f827490171
Merge pull request #7286 from rabbitmq/rin/add-v3.12.x-references
Add additional v3.12.x references
2023-02-14 18:28:51 +01:00
Rin Kuryloski 06c5593fe7 Use 3.13.0 as the default version in bazel for this branch 2023-02-14 16:36:37 +01:00
Alexey Lebedeff 949b53543d Fix all dependencies for the dialyzer
This is the latest commit in the series, it fixes (almost) all the
problems with missing and circular dependencies for typing.

The only 2 unsolved problems are:

- `lg` dependency for `rabbit` - the problem is that it's the only
  dependency that contains NIF. And there is no way to make dialyzer
  ignore it - looks like unknown check is not suppressable by dialyzer
  directives. In the future making `lg` a proper dependency can be a
  good thing anyway.

- some missing elixir function in `rabbitmq_cli` (CSV, JSON and
  logging related).

- `eetcd` dependency for `rabbitmq_peer_discovery_etcd` - this one
  uses sub-directories in `src/`, which confuses dialyzer (or our bazel
  machinery is not able to properly handle it). I've tried the latest
  rules_erlang which flattens directory for .beam files, but it wasn't
  enough for dialyzer - it wasn't able to find core erlang files. This
  is a niche plugin and an unusual dependency, so probably not worth
  investigating further.
2023-02-13 17:37:44 +01:00
David Ansari 5045fce6de Require all feature flags introduced before 3.11.1
RabbitMQ 3.12 requires feature flag `feature_flags_v2` which got
introduced in 3.11.0 (see
https://github.com/rabbitmq/rabbitmq-server/pull/6810).

Therefore, we can mark all feature flags that got introduced in 3.11.0
or before 3.11.0 as required because users will have to upgrade to
3.11.x first, before upgrading to 3.12.x

The advantage of marking these feature flags as required is that we can
start deleting any compatibliy code for these feature flags, similarly
as done in https://github.com/rabbitmq/rabbitmq-server/issues/5215

This list shows when a given feature flag was first introduced:

```
classic_mirrored_queue_version 3.11.0
stream_single_active_consumer 3.11.0
direct_exchange_routing_v2 3.11.0
listener_records_in_ets 3.11.0
tracking_records_in_ets 3.11.0

empty_basic_get_metric 3.8.10
drop_unroutable_metric 3.8.10
```

In this commit, we also force all required feature flags in Erlang
application `rabbit` to be enabled in mixed version cluster testing
and delete any tests that were about a feature flag starting as disabled.

Furthermore, this commit already deletes the callback (migration) functions
given they do not run anymore in 3.12.x.

All other clean up (i.e. branching depending on whether a feature flag
is enabled) will be done in separate commits.
2023-02-08 16:00:03 +00:00
Rin Kuryloski 8a7e43e11a enable maybe expression in all tests 2023-02-07 16:36:08 +01:00
David Ansari af68fb4484 Decrease memory usage of queue_type state
Prior to this commit, 1 MQTT publisher publishing to 1 Million target
classic queues requires around 680 MB of process memory.

After this commit, it requires around 290 MB of process memory.

This commit requires feature flag classic_queue_type_delivery_support
and introduces a new one called no_queue_name_in_classic_queue_client.

Instead of storing the binary queue name 4 times, this commit now stores
it only 1 time.

The monitor_registry is removed since only classic queue clients monitor
their classic queue server processes.

The classic queue client does not store the queue name anymore. Instead
the queue name is included in messages handled by the classic queue
client.

Storing the queue name in the record ctx was unnecessary.

More potential future memory optimisations:
* When routing to destination queues, looking up the queue record,
  delivering to queue: Use streaming / batching instead of fetching all
  at once
* Only fetch ETS columns that are necessary instead of whole queue
  records
* Do not hold the same vhost binary in memory many times. Instead,
  maintain a mapping.
* Remove unnecessary tuple fields.
2023-01-24 17:29:07 +00:00
Rin Kuryloski b84e746ee9 Rework plt/dialyze for rabbitmqctl and plugins that depend on it
This allows us to stop ignorning undefined callback warnings

When mix compiles rabbitmqctl, it produces a 'consolidated' directory
alongside the 'ebin' dir. Some of the modules in consolidated are
intended to be used instead of those provided by elixir. We now handle
the conflicts properly in the bazel build.
2023-01-19 17:29:23 +01:00
Rin Kuryloski 5ef8923462 Avoid the need to pass package name to rabbitmq_integration_suite 2023-01-18 15:25:27 +01:00
Rin Kuryloski a317b30807 Use improved assert_suites2 macro from rules_erlang 3.9.0 2023-01-18 15:07:06 +01:00
Rin Kuryloski 1316f255d9 Improve finding of the location of the secondary umbrella
in integration tests
2023-01-17 17:08:09 +01:00
Jean-Sébastien Pédron c590db69a5
Bazel: Add `feature_flags_v2` to RABBITMQ_FEATURE_FLAGS
This is required for mixed-version testing where all nodes need to start
with the required feature flags enabled.
2023-01-10 16:38:24 +01:00
Alexey Lebedeff b51304d233 Bazel 6 compatibility
Directory name for tools in runfiles is a bit unpredictable. Maybe
there is a better way, but at least this should cover all the cases
that I've observed.

One unexpected consequence is that this directory name can contains `~`,
and it's not being properly escaped in `ct:pal` calls (causing
badarg's for `io:format/4`.
2022-12-21 20:40:24 +01:00
Michal Kuratczyk 453c768ef9
Disable warnings-as-errors in dbg mode
When starting the broker/cluster with `-c dbg`, warnings are no longer treated as errors.
This allows starting a broker/cluster to test a WIP change (eg with some
unused functions).
2022-11-22 09:21:23 +01:00
Rin Kuryloski 102e6cf964 Use @rules_erlang//:debug_build instead of //:debug_build
This avoids the need for modules depening on rabbitmq-server to
declare their own copy of it
2022-10-27 09:27:20 +02:00
Rin Kuryloski 4599f1c407
Merge pull request #6184 from rabbitmq/rin/global-flag-secondary-umbrella-config
Add a build flag for compiling with `-DTEST` in all deps/... apps
2022-10-20 09:38:59 +02:00
Rin Kuryloski 4cf410b268 Add a --test_build flag for building the broker for mixed versions 2022-10-19 13:51:49 +02:00
David Ansari 1f6ead8055 Make main branch use 3.11.2 as mixed version tests
The 3.11.2 artifact already got uploaded to AWS.
2022-10-19 10:56:22 +02:00
Rin Kuryloski e9c1e6b680 Bump the rabbitmq version on this branch to 3.12.0 (bazel)
To reduce cache misses, the bazel build uses a hard coded version. A
correct value is injected in releases.
2022-07-28 09:45:26 +02:00
Rin Kuryloski f67eaaae68 Use code compiled with -DTEST in mixed version testing
Also introduces an actions workflow to provide the necessary archives
referenced in secondary_umbrella.bzl
2022-07-26 20:29:33 +02:00
Jean-Sébastien Pédron 94dbf000d0
Bazel: Set $RABBITMQ_FEATURE_FLAGS to the list of required flags in 3.11.0
It was set to the empty string before to make sure no feature flags were
enabled out-of-the-box when starting a new RabbitMQ node.

With 3.11.0, several of them will become required and their
corresponding compatibility and migration code goes away. Therefore
older nodes must have them enabled in order to cluster successfully.

This change is only useful in 3.11.x. It must not be backported to older
release branches.
2022-07-22 18:07:10 +02:00
Rin Kuryloski 947e4836d3 Use 3.10.6 for mixed version testing
since master is effectively the v3.11.x branch at this point in time
2022-07-22 16:25:50 +02:00
Rin Kuryloski ba855445a2 Restore the mixed-ness of mixed version testing
When the fetch of the secondary umbrella was moved into bzlmod, this
changed its path at the time of test execution. Tests will now fail if
a secondary umbrella is specified for bazel, but does not exist. The
path is also corrected.
2022-07-21 12:04:41 +02:00
Philip Kuryloski 327f075d57 Make rabbitmq-server work with rules_erlang 3
Also rework elixir dependency handling, so we no longer rely on mix to
fetch the rabbitmq_cli deps

Also:

- Specify ra version with a commit rather than a branch
- Fixup compilation options for erlang 23
- Add missing ra reference in MODULE.bazel
- Add missing flag in oci.yaml
- Reduce bazel rbe jobs to try to save memory
- Use bazel built erlang for erlang git master tests
- Use the same cache for all the workflows but windows
- Avoid using `mix local.hex --force` in elixir rules
  - Fetching seems blocked in CI, and this should reduce hex api usage in
    all builds, which is always nice
- Remove xref and dialyze tags since rules_erlang 3 includes them in
  the defaults
2022-06-08 14:04:53 +02:00
David Ansari 4b62706357 Use UTF-8 in Bazel tests
Before this commit, on Ubuntu, even though locale and env variable was
set correctly:
```
$ locale
LANG=C.UTF-8
```

```
$ env | grep LANG
LANG=C.UTF-8
```

bazel tests were failing because that env variable does not get set in
the linux-sandbox:
```
bazel test //deps/rabbit:queue_parallel_SUITE
...
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8.
Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)

Timeout: 60.0 seconds ...
Listing queues for vhost / ...
name    messages        messages_ready  messages_unacknowledged
stream_queue_publish    1       1       0
a_queue_with_extra_bcc  3       3       0
queue_without_extra_bcc 1       1       0
queue_with_extra_bcc    1       1       0
extra.bcc       3       3       0
my_extra_bcc    1       1       0

Exit code: 0 (pid <0.1987.0>)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
rabbit_ct_broker_helpers:rabbitmqctl_list failed on line 1098
Reason: {badmatch,[<<"warning: the VM is running with "...>>,<<"Time...}
```

This commits sets UTF-8 in the Bazel test environment.
2022-05-09 09:48:56 +00:00
Philip Kuryloski 2dd9bde891 Bring over PROJECT_APP_EXTRA_KEYS values from make to bazel 2022-04-07 17:39:33 +02:00
Philip Kuryloski a22234f6eb Updates for rules_erlang 2.5.0
rabbitmq_cli uses some private rules_erlang apis that have changed in
the upcoming release

Additionally:
- Avoid including both standard and test versions of amqp_client in
integration test suites
- Eliminate most of the compilation order hints (explicit first_srcs)
in the bazel build
- Fix an include statement - in bazel, an app is not available to
itself as a library at compilation time
2022-04-07 14:54:37 +02:00
Philip Kuryloski 2172e8e810
Merge pull request #4207 from rabbitmq/use-assert_suites-from-rules_erlang
Use the assert_suites function from rules_erlang
2022-02-28 15:02:05 +01:00
Philip Kuryloski e8533a1fb8
Use rabbitmq 3.9 for mixed version testsing (#4208)
Use rabbitmq 3.9 for mixed version tests
2022-02-28 14:38:19 +01:00
Philip Kuryloski 4fd84349f2 Use the assert_suites function from rules_erlang
since it's the same implementation
2022-02-28 11:45:49 +01:00
Philip Kuryloski efcd881658 Use rules_erlang v2
bazel-erlang has been renamed rules_erlang. v2 is a substantial
refactor that brings Windows support. While this alone isn't enough to
run all rabbitmq-server suites on windows, one can at least now start
the broker (bazel run broker) and run the tests that do not start a
background broker process
2022-01-18 13:43:46 +01:00
Philip Kuryloski 70ef6b6984 Disable +deterministic in compilation_mode dbg under bazel
This allows compiling and reloading code from the erlang shell when
running the broker with `bazel run -c dbg broker`
2022-01-03 12:38:06 +01:00
Philip Kuryloski 11fd866247 Add the bazel target :package-generic-unix
Which can be used to build the artifact with bazel
2021-11-18 14:38:41 +01:00
Philip Kuryloski 9c70b3220a Generate the rabbitmqadmin cli under bazel 2021-11-12 11:34:19 +01:00
Philip Kuryloski 8c0eece3cd Adjustments for the latest bazel-erlang 2021-11-02 16:24:26 +01:00
Alexey Lebedeff 46df4f1689 Update makefiles/bazel to reflect CT helpers repo merge-in 2021-09-30 10:48:11 +02:00
Philip Kuryloski d2b032ff60 Use 3.8.22 in 3.8/3.9 mixed version testing 2021-09-21 16:36:32 +00:00
Philip Kuryloski 326f67b63e Mark a couple of bazel targets as testonly, that should have been 2021-07-19 16:03:59 +02:00