Commit Graph

300 Commits

Author SHA1 Message Date
Diana Parra Corbacho 5f0981c5a3
Allow to use Khepri database to store metadata instead of Mnesia
[Why]

Mnesia is a very powerful and convenient tool for Erlang applications:
it is a persistent disc-based database, it handles replication accross
multiple Erlang nodes and it is available out-of-the-box from the
Erlang/OTP distribution. RabbitMQ relies on Mnesia to manage all its
metadata:

* virtual hosts' properties
* intenal users
* queue, exchange and binding declarations (not queues data)
* runtime parameters and policies
* ...

Unfortunately Mnesia makes it difficult to handle network partition and,
as a consequence, the merge conflicts between Erlang nodes once the
network partition is resolved. RabbitMQ provides several partition
handling strategies but they are not bullet-proof. Users still hit
situations where it is a pain to repair a cluster following a network
partition.

[How]

@kjnilsson created Ra [1], a Raft consensus library that RabbitMQ
already uses successfully to implement quorum queues and streams for
instance. Those queues do not suffer from network partitions.

We created Khepri [2], a new persistent and replicated database engine
based on Ra and we want to use it in place of Mnesia in RabbitMQ to
solve the problems with network partitions.

This patch integrates Khepri as an experimental feature. When enabled,
RabbitMQ will store all its metadata in Khepri instead of Mnesia.

This change comes with behavior changes. While Khepri remains disabled,
you should see no changes to the behavior of RabbitMQ. If there are
changes, it is a bug. After Khepri is enabled, there are significant
changes of behavior that you should be aware of.

Because it is based on the Raft consensus algorithm, when there is a
network partition, only the cluster members that are in the partition
with at least `(Number of nodes in the cluster ÷ 2) + 1` number of nodes
can "make progress". In other words, only those nodes may write to the
Khepri database and read from the database and expect a consistent
result.

For instance in a cluster of 5 RabbitMQ nodes:
* If there are two partitions, one with 3 nodes, one with 2 nodes, only
  the group of 3 nodes will be able to write to the database.
* If there are three partitions, two with 2 nodes, one with 1 node, none
  of the group can write to the database.

Because the Khepri database will be used for all kind of metadata, it
means that RabbitMQ nodes that can't write to the database will be
unable to perform some operations. A list of operations and what to
expect is documented in the associated pull request and the RabbitMQ
website.

This requirement from Raft also affects the startup of RabbitMQ nodes in
a cluster. Indeed, at least a quorum number of nodes must be started at
once to allow nodes to become ready.

To enable Khepri, you need to enable the `khepri_db` feature flag:

    rabbitmqctl enable_feature_flag khepri_db

When the `khepri_db` feature flag is enabled, the migration code
performs the following two tasks:
1. It synchronizes the Khepri cluster membership from the Mnesia
   cluster. It uses `mnesia_to_khepri:sync_cluster_membership/1` from
   the `khepri_mnesia_migration` application [3].
2. It copies data from relevant Mnesia tables to Khepri, doing some
   conversion if necessary on the way. Again, it uses
   `mnesia_to_khepri:copy_tables/4` from `khepri_mnesia_migration` to do
   it.

This can be performed on a running standalone RabbitMQ node or cluster.
Data will be migrated from Mnesia to Khepri without any service
interruption. Note that during the migration, the performance may
decrease and the memory footprint may go up.

Because this feature flag is considered experimental, it is not enabled
by default even on a brand new RabbitMQ deployment.

More about the implementation details below:

In the past months, all accesses to Mnesia were isolated in a collection
of `rabbit_db*` modules. This is where the integration of Khepri mostly
takes place: we use a function called `rabbit_khepri:handle_fallback/1`
which selects the database and perform the query or the transaction.
Here is an example from `rabbit_db_vhost`:

* Up until RabbitMQ 3.12.x:

        get(VHostName) when is_binary(VHostName) ->
            get_in_mnesia(VHostName).

* Starting with RabbitMQ 3.13.0:

        get(VHostName) when is_binary(VHostName) ->
            rabbit_khepri:handle_fallback(
              #{mnesia => fun() -> get_in_mnesia(VHostName) end,
                khepri => fun() -> get_in_khepri(VHostName) end}).

This `rabbit_khepri:handle_fallback/1` function relies on two things:
1. the fact that the `khepri_db` feature flag is enabled, in which case
   it always executes the Khepri-based variant.
4. the ability or not to read and write to Mnesia tables otherwise.

Before the feature flag is enabled, or during the migration, the
function will try to execute the Mnesia-based variant. If it succeeds,
then it returns the result. If it fails because one or more Mnesia
tables can't be used, it restarts from scratch: it means the feature
flag is being enabled and depending on the outcome, either the
Mnesia-based variant will succeed (the feature flag couldn't be enabled)
or the feature flag will be marked as enabled and it will call the
Khepri-based variant. The meat of this function really lives in the
`khepri_mnesia_migration` application [3] and
`rabbit_khepri:handle_fallback/1` is a wrapper on top of it that knows
about the feature flag.

However, some calls to the database do not depend on the existence of
Mnesia tables, such as functions where we need to learn about the
members of a cluster. For those, we can't rely on exceptions from
Mnesia. Therefore, we just look at the state of the feature flag to
determine which database to use. There are two situations though:

* Sometimes, we need the feature flag state query to block because the
  function interested in it can't return a valid answer during the
  migration. Here is an example:

        case rabbit_khepri:is_enabled(RemoteNode) of
            true  -> can_join_using_khepri(RemoteNode);
            false -> can_join_using_mnesia(RemoteNode)
        end

* Sometimes, we need the feature flag state query to NOT block (for
  instance because it would cause a deadlock). Here is an example:

        case rabbit_khepri:get_feature_state() of
            enabled -> members_using_khepri();
            _       -> members_using_mnesia()
        end

Direct accesses to Mnesia still exists. They are limited to code that is
specific to Mnesia such as classic queue mirroring or network partitions
handling strategies.

Now, to discover the Mnesia tables to migrate and how to migrate them,
we use an Erlang module attribute called
`rabbit_mnesia_tables_to_khepri_db` which indicates a list of Mnesia
tables and an associated converter module. Here is an example in the
`rabbitmq_recent_history_exchange` plugin:

    -rabbit_mnesia_tables_to_khepri_db(
       [{?RH_TABLE, rabbit_db_rh_exchange_m2k_converter}]).

The converter module  — `rabbit_db_rh_exchange_m2k_converter` in this
example  — is is fact a "sub" converter module called but
`rabbit_db_m2k_converter`. See the documentation of a `mnesia_to_khepri`
converter module to learn more about these modules.

[1] https://github.com/rabbitmq/ra
[2] https://github.com/rabbitmq/khepri
[3] https://github.com/rabbitmq/khepri_mnesia_migration

See #7206.

Co-authored-by: Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com>
Co-authored-by: Diana Parra Corbacho <dparracorbac@vmware.com>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2023-09-29 16:00:11 +02:00
GitHub d79c8a5051 Adopt otp 26.1.1 2023-09-29 03:06:09 +00:00
Karl Nilsson 882e0c1749 Ra 2.7.0
This includes a new ra:key_metrics/1 API that is more available
than parsing the output of sys:get_status/1.

the rabbit_quorum_queue:status/1 function has been ported to use
this API instead as well as now inludes a few new fields.
2023-09-28 11:46:39 -04:00
Rin Kuryloski a482edcaa7
Merge pull request #8341 from rabbitmq/rin/use-3.12.0-rc.3-for-mixed-versions
Use 3.12.6 for the secondary umbrella
2023-09-22 11:38:11 +02:00
Rin Kuryloski c6672b9dea Use the latest 3.12.x for the secondary umbrella 2023-09-21 09:35:49 +02:00
GitHub 6b1635d323 Adopt elixir 1.15.6 2023-09-21 03:05:05 +00:00
Rin Kuryloski 75eb0621fc Use OTP 26.1 as OTP 26 in CI 2023-09-20 15:33:34 +02:00
Rin Kuryloski 90f9656ee7 Use seshat from our bzlmod registry
0.6.1 matches the version currently used in osiris
2023-09-20 12:07:44 +02:00
Michael Klishin ed88e3820d
Merge pull request #9418 from rabbitmq/osiris-1.6.6
Osiris 1.6.7
2023-09-15 10:07:54 -04:00
Karl Nilsson 739214bc3f osiris 1.6.7 2023-09-15 11:26:02 +01:00
Karl Nilsson 19ab8824ce Osiris 1.6.6
This version contains a bit more error handling during replica start
to avoid logging process crashes during RabbitMQ shutdown.

rabbit_stream_queue: avoid double local pid query

When starting a new consumer. Also move some metrics
registration a bit later when we know we are likely to succeed.
2023-09-15 10:13:29 +01:00
Rin Kuryloski c0ce9f1cb0 Use the latest rules_erlang 2023-09-13 15:22:52 +02:00
Rin Kuryloski a79a704f5c Match ra version between bazel and make 2023-09-12 15:36:58 +02:00
GitHub d050775473 Adopt otp 25.3.2.6 2023-09-08 03:07:54 +00:00
Rin Kuryloski 5100a5936a Use our fork of BCR for erlang specific packages
This avoids waiting for the bazel team to merge PRs
2023-09-04 15:02:17 +02:00
Rin Kuryloski b3a3921e11 Use orisis 1.6.4 directly from git
bypassing BCR until
https://github.com/bazelbuild/bazel-central-registry/pull/873 is
merged, at which point this commit can be reverted
2023-08-31 10:03:34 +02:00
Karl Nilsson 5ca9a25894 osiris 1.6.4
This includes a fix for a race condition when the commit index known
by a stream replica is higher than what is fully written locally.
2023-08-30 11:15:54 +01:00
Rin Kuryloski 23c6054133 Use the new module name for osiris on BCR 2023-08-21 09:43:51 +02:00
Rin Kuryloski 3253fe433b Use ra 2.6.3 from BCR 2023-08-21 09:43:29 +02:00
GitHub 9f1fc8587b Adopt otp 25.3.2.5 2023-08-16 03:12:48 +00:00
Rin Kuryloski ac3d0251c7 Use osiris from Bazel Central Repository
osiris 1.6.3 is identical to 1.6.2, but we needed a new version for
the sake of the BCR publish

this makes osiris a native bzlmod dependency
2023-08-15 14:49:24 +02:00
Rin Kuryloski ee85344ddc Remove pre-generated .app files in cowboy, cowlib & ranch
As they won't be replaced in the bazel build, the way that they are
with erlang.mk and this causes build divergence
2023-08-15 09:06:32 +02:00
Rin Kuryloski e80910015c Use rules_erlang 3.11.4 that adds optional_applications to .app
To match (somewhat) recent erlang.mk changes
2023-08-15 09:06:32 +02:00
Michael Klishin dbd319f5f8 Bump Osiris to 1.6.2, references #8616
In #8616, Osiris was bumped to 1.6.0 but
`BUILD.bazel` in the repo still reported the version as 1.5.1.

That created a fair amount of confusion.
2023-08-13 12:28:22 +04:00
GitHub 042c72271f Adopt otp 25.3.2.5 2023-08-01 03:05:54 +00:00
Rin Kuryloski 7c38e8e4c4 Use rules_erlang 3.11.3
Which contains a fix for tests on windows
2023-07-18 18:15:43 +02:00
GitHub 029570c0c7 Adopt otp 25.3.2.4 2023-07-18 03:14:06 +00:00
Michal Kuratczyk 805f6793cc
Ra 2.6.3
Improved long log recovery:
faster and lower memory usage.

more info:
https://github.com/rabbitmq/ra/pull/385
2023-07-13 16:46:35 +02:00
Rin Kuryloski ca1806dbcd
Check additional applications when comparing bazel and make results (#8209)
* Check additional applications when comparing bazel and make results

* Sync bazel/make for amqp_client

* Do not fail-fast in build system comparison

* promethus -> prometheus

* Regenerate BUILD.redbug

* When comparing build systems & .app files ignore empty 'registered'

It's listed as a required key in
https://www.erlang.org/doc/man/app.html, but the same docs state the
default is "[]". It seems to ignore it if it's empty.

* Copy bazel/BUILD.osiris from BUILD.bazel in the osiris repo

Normally it would be generated with `bazel run gazelle-update-repos --
-args osiris@1.5.1=github.com/rabbitmq/osiris@v1.5.1`, but in this
case we just want to match it's compilation with erlang.mk with some
manual tweaks.

* Use elixir 1.15, otherwise mix format fails

* Sync bazel/make for rabbitmq_web_dispatch, rabbitmq_management_agent
2023-07-12 17:26:16 +02:00
GitHub 9bce76dc59 Adopt otp 25.3.2.3 2023-07-05 03:27:44 +00:00
Rin Kuryloski 1be7b00e70 Use the latest rules_erlang 2023-07-04 17:45:50 +02:00
Rin Kuryloski 8cf0adb6ad Use elixir 1.15.2 2023-07-04 17:45:50 +02:00
Rin Kuryloski 9c66e73266 Patch amqp dep for elixir 1.15 2023-07-04 17:45:32 +02:00
Rin Kuryloski 662f6ceeb4 Bump x509 dep to 0.8.7 for elixir 1.15.x compatibility 2023-07-04 17:45:32 +02:00
Rin Kuryloski 21978a3234 Add elixir 1.15 and use with otp 26 2023-07-04 17:43:47 +02:00
GitHub c3d77c43cf Adopt otp 25.3.2.3 2023-06-30 03:10:32 +00:00
Michal Kuratczyk 4d9e8ed07b
adopt OTP 26.0.2 2023-06-29 14:49:34 +02:00
David Ansari 2270a30af0 Point emqtt to rabbitmq/emqtt:master
emqtt repos:
emqx/emqtt PR #196 is based on rabbitmq:otp-26-compatibility
emqx/emqtt PR #198 is based on ansd:master
rabbitmq/master contains both of these 2 PRs cherry-picked.

rabbitmq-server repos:
main branch points emqtt to rabbitmq:otp-26-compatibility
mqtt5 branch points emqtt to rabbitmq:master

Therefore, the current mqtt5 branch is OTP 26 compatible and can support
multiple subscription identifiers.
2023-06-21 17:14:08 +01:00
Karl Nilsson 8d459944e0 Osiris v1.6.0
This version contains support for the new chunk filtering feature
(not implemented in this PR).

Also some improvements to replica init failures.
2023-06-20 10:43:10 +01:00
Karl Nilsson 84f43bc8f1 Ra 2.6.2
Includes minor fixes and improvements such as:

* Don't overwrite Ra member config file in place to avoid potential
corruption scenario
* Make logging unicode compatible
* Optimisation to avoid spawning node connector process on ra member init
when nodes are already connected.
* Catch recovery failures in the Ra WAL rather than crashing hard.
2023-06-19 14:45:20 +01:00
GitHub 2d7ed73f95 Adopt otp 26.0.1 2023-06-13 10:31:39 +02:00
GitHub c81778d379 Adopt otp 25.3.2.2 2023-06-08 03:09:38 +00:00
GitHub 22fffd458c Adopt otp 25.3.2.1 2023-05-31 03:21:40 +00:00
Rin Kuryloski 218db9e21b Add looking_glass 2023-05-30 10:10:42 +02:00
Michal Kuratczyk fb3655610c
Update CSV to 3.0.5;; remove unused dep 2023-05-26 18:04:42 +02:00
Rin Kuryloski 0d859415c7
Merge pull request #8298 from rabbitmq/rin/latest-rules-erlang
Use the latest rules_erlang
2023-05-24 15:07:56 +02:00
Rin Kuryloski 5c4c0a2d64 Use the latest rules_erlang
which should restore `gazelle-update-repos` to a working state again
2023-05-24 10:11:57 +02:00
Rin Kuryloski ad03e31543 Add bazel build info for syslog dep
This allows building `@syslog//:erlang_app` on windows
2023-05-23 17:15:28 +02:00
GitHub 84791ee4ec Adopt elixir 1.14.5 2023-05-23 03:04:42 +00:00
Michal Kuratczyk 0ec6ccc903
OTP26.0-rc3 -> final; OTP master is 27 2023-05-22 08:38:03 +02:00
Rin Kuryloski 56aab34fb5 Use erlang 26.0 instead of rc3 in bazel 2023-05-17 15:45:26 +02:00
Rin Kuryloski 6fe4ba18dd Use the latest rules_erlang 2023-05-16 14:11:57 +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 dad871e86c Update rules_pkg to 0.9.1 2023-05-12 12:45:01 +02:00
Rin Kuryloski 92b0a81c60 Use rules_erlang 3.10.0 2023-05-12 08:41:01 +02:00
Michael Klishin c9c6730cc5 Pin Ra to 2.6.1 2023-05-12 01:48:47 +04:00
Michael Klishin 441a77f6d0 Pin Ra to 2.6.0-pre.1 2023-05-11 23:25:58 +04:00
GitHub 817808b9ef Adopt otp 25.3.2 2023-05-06 03:05:31 +00:00
Michael Klishin 2d51c8c99b Bump Osiris to 1.5.1 2023-05-05 00:09:45 +04:00
Michal Kuratczyk 48086bfec9
Bump credentials_obfuscation to 3.4.0 2023-05-04 15:31:01 +02:00
Loïc Hoguin e6e68fcb0b
Update Cowboy to 2.10.0 for OTP-26
We already were using Cowlib 2.12.1 and therefore were
compatible with OTP-26. This simply updates Cowboy to
the version that depends on Cowlib 2.12.1.
2023-04-28 15:34:12 +02:00
GitHub 13d5bb2329 Adopt otp 25.3.1 2023-04-28 03:14:13 +00:00
Michal Kuratczyk cff2c65302
Use emqtt from the otp-26-compatibility branch 2023-04-26 11:06:23 +02:00
Michal Kuratczyk 858ed1bff6
Switch to an emqtt fork/branch for OTP26
This change should be reverted once emqx/emqtt is OTP26 compatible.
Our fork/branch isn't either at this point, but at least partially
works. Let's use this branch for now to uncover server-side OTP26
incompatibilities (and continue working on OTP26 support for emqtt of
course).
2023-04-26 11:06:23 +02:00
GitHub 1b8c4b258d Adopt elixir 1.14.4 2023-04-26 07:12:03 +00:00
Rin Kuryloski 09af4fdd25 Use rules_erlang 3.9.14 2023-04-25 16:15:36 +02:00
Rin Kuryloski 854d01d9a5 Restore the original -include_lib statements from before #6466
since this broke erlang_ls

requires rules_erlang 3.9.13
2023-04-20 12:40:45 +02:00
Rin Kuryloski 2bb0b42c85 Add OTP 26.0-rc3 config to bazel 2023-04-14 18:23:33 +02:00
Rin Kuryloski 42268d8c75 Use rules_erlang 3.9.12 which has the new plt attrs 2023-04-14 11:41:37 +02:00
Rin Kuryloski 12153ed823 Fetch github.com/hexpm/hex via bzlmod
This fixes a visibility issue when a bazel module depends on
rabbitmq-server
2023-04-13 09:45:28 +02:00
Rin Kuryloski f09b31e8c5
Fetch all cli deps with bazel (#7875)
* Fetch all prod cli deps with bazel

This avoids issues with hex and OTP 26, and is needed for offline
bazel builds anyway

* Fetch test cli deps with bazel

* mix format
2023-04-12 16:27:32 +04:00
Michael Klishin ac89309a9c
Merge pull request #7846 from rabbitmq/stream-at-most-once-dead-lettering
Streams: make at-most-once dead lettering work
2023-04-05 19:42:26 +04:00
Arnaud Cogoluègnes 70af1c4607
Merge pull request #7827 from rabbitmq/qq-return-crash
Quorum queues: avoid potential crash when returning message.
2023-04-05 16:56:55 +02:00
Karl Nilsson e7d7f6f225 Streams: make at-most-once dead lettering to work
Previously osiris did not support uncorrelated writes which means
we could not use a "stateless" queue type delivery and these were
silently dropped.

This had the impact that at-most-once dead letter was not possible
where the dead letter target is a stream.

This change bumps the osiris version that has the required API
to allow for uncorrelated writes (osiris:write/2).

Currently there is no feature flag to control this as osiris writer
processes just logs and drops any messages they don't understand.
2023-04-05 15:34:22 +01:00
Arnaud Cogoluègnes cdf4ec5944
Use Ra 2.5.1 2023-04-05 15:37:20 +02:00
Michael Klishin b26b371f21
Merge pull request #7821 from rabbitmq/lh-update-ct-helper
Update ct_helper
2023-04-04 21:52:46 +04:00
Karl Nilsson 01f6d0fc19 Quorum queues: avoid potential crash when returning message.
Returns reaching a Ra member that used to be leader but now has stepped
down would cause that follower to crash and restart.

This commit avoids this scenario as well as giving the return commands
a good chance of being resent to the new leader in a timeley manner.
(see the Ra release for this).
2023-04-04 16:02:26 +01:00
Loïc Hoguin 53c6d19434
Update ct_helper
Since ct_helper removes erl_make_certs some tests needed
to be updated to use public_key:pkix_test_data/1 instead.
2023-04-04 13:01:33 +02:00
Loïc Hoguin 31a84183e5
Update Cowlib to 2.12.1
This fixes a compilation error with OTP-26.
2023-04-04 09:19:00 +02:00
Michael Davis fb48d4623c bazel: Pin ct_helper 2023-03-30 21:13:32 +04:00
Rin Kuryloski 8b08bff908 Remove "dev_dependency = True" from erlang_dev_package in MODULE
deps/rabbitmq_ct_helpers depends on proper and meck, so unfortunately
if proper and meck are marked as dev dependencies, bazel modules
depending on rabbitmq-server cannot build it

Another way of putting it is that they are not actually "dev"
dependencies of for all components that rabbitmq-server exposes
2023-03-16 08:45:57 +01:00
Rin Kuryloski eba1d531c9 Fetch cli prod deps via bazel or erlang.mk instead of mix
In preparation for offline bazel builds
2023-03-14 23:11:36 +01:00
Karl Nilsson 36c2417bac Ra 2.5.0
This Ra release includes improvements to Ra server GC behaviour when receiving a lot
of low priority commands with large binary payloads (e.g. quorum queue messages).

Practically this allows quorum queues to accept large amounts of messages in a more predicatble and performant manner.

This change also removes ra_file_handle cache that was used as a bridge between ra file operations and RabbitMQ io metrics. Lots of components in RabbitMQ such as streams and CQv2s do not record io metrics in the previous manner due to overhead incurred for every file io operation. These metrics are better inspected at the OS level anyway.
2023-03-09 14:20:21 +00:00
Rin Kuryloski 3ebfa257e2 Add OTP 25.3 to the build and CI matrix as otp-max 2023-03-08 15:21:27 +01:00
GitHub e6b781c14b Adopt elixir 1.13.4 2023-03-02 03:11:34 +00:00
Rin Kuryloski 778ee998a6 Further annotate test deps with new rules_erlang 3.9.9 features 2023-02-28 16:47:02 +01:00
Rin Kuryloski faaf78bbed Mark test deps as dev_dependency in MODULE.bazel
This keeps other modules depending on rabbitmq-server from inheriting
these deps
2023-02-28 12:44:45 +01:00
Karl Nilsson 59a9069fba Update Ra to 2.4.9
This Ra release
    * Omproves election availability in certain mixed versions failure
      scenarios
    * Optimises segment reference compaction which may becomes expensive
      in quorum queues with very long backlogs
    * Various log message improvements and level tweaks
    * Better cleans up machine monitor records after quorum queue rebalancing
2023-02-22 08:26:34 +00:00
David Ansari bf2a97a20a Bump emqx/emqtt to 1.8.2 2023-02-21 17:25:19 +01:00
GitHub 209a815af7 Adopt otp 25.2.3 2023-02-18 03:05:21 +00:00
Rin Kuryloski 2dc0236101 Regenerate bazel/BUILD.eetcd with the latest rules_erlang
`bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
hex.pm/eetcd@0.3.6`

Related to #7196
2023-02-15 15:35: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
Rin Kuryloski 8a7e43e11a enable maybe expression in all tests 2023-02-07 16:36:08 +01:00
David Ansari 2d0826c335 Add OAuth 2.0 MQTT system test
Add a test that rabbitmq_auth_backend_oauth2 works with MQTT.

See https://github.com/rabbitmq/rabbitmq-oauth2-tutorial#mqtt-protocol
2023-02-03 14:08:51 +00:00
Rin Kuryloski bdb2046185
Add rabbitmq_cli dialyze to bazel (#7066)
* Add rabbitmq_cli dialyze to bazel

and fix a number of warnings

Because we stop mix from recompiling rabbit_common in bazel, many
unknown functions are reported, so this dialyzer analysis is somewhat
incomplete.

* Use erlang dialyzer for rabbitmq_cli rather than mix dialyzer

Since this resolves all of the rabbit functions, there are far fewer
unknown functions.

Requires yet to be released rules_erlang 3.9.2

* Temporarily use pre-release rules_erlang

So that checks can run on this PR without a release

* Fix additional dialyzer warnings in rabbitmq_cli

* rabbitmq_cli: mix format

* Additional fixes for ignored return values

* Revert "Temporarily use pre-release rules_erlang"

This reverts commit c16b5b6815.

* Use rules_erlang 3.9.2
2023-01-31 15:05:52 +01:00
GitHub 463682242e Adopt otp 25.2.2 2023-01-31 03:06:46 +00:00
Michael Klishin bed4519995
Bump Thoas to 1.0.0 2023-01-27 13:58:52 -05:00
Rin Kuryloski 352db2e036 Reference BUILD.lib_name files with full label in MODULE.bazel
This allows the files to be resolved, if another repo depends on this
one
2023-01-27 16:41:30 +01:00
GitHub be2e99123f Adopt otp 25.2.1 2023-01-26 03:11:45 +00:00
Rin Kuryloski 2c7b37d7af
Use gazelle for external erlang deps (#6935)
* Add gazelle for use with update-repos command

* Use explicit BUILD.app_name files for erlang app deps

This allows us to remove the duplicate definitions in
workspace_helpers.bzl

These files are generated with gazelle. For instance:
BUILD.ra is generated with `bazel run gazelle -- update-repos
--verbose --build_files_dir=bazel hex.pm/ra@2.4.6`

Running gazelle this way will modify the WORKSPACE file, as gazelle
does not yet support MODULE.bazel files. Such changes to the WORKSPACE
can be dropped, and should not be committed. It may also update the
`moduleindex.yaml` file. Changes to `moduleindex.yaml` should be
committed.

However
* skip the explicit bazel/BUILD.osiris file, as osiris already contains the file in its repo
* skip the explict BUILD.inet_tcp_proxy_dist file, since the repo already contains a bazel BUILD.bazel file
  gazelle command: `bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
inet_tcp_proxy_dist=github.com/rabbitmq/inet_tcp_proxy@master`
* jose is imported with `bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
jose=github.com/michaelklishin/erlang-jose@d63c1c5c8f9c1a4f1438e234b886de8607a0034e`

* Move the bats dep directly to WORKSPACE, drop workspace_helpers.bzl

* Use bzlmod in windows tests
2023-01-25 09:41:56 +01:00
Alexey Lebedeff 183a260290 Fix all dialyzer warnings in peer discovery plugins 2023-01-23 22:32:06 +00:00
Michael Klishin 7ace097f5b
Merge pull request #6932 from rabbitmq/bump-otp-25.1
Adopt otp 25.1.2.1
2023-01-19 08:04:15 -06:00
Michal Kuratczyk b8691b720b
Merge pull request #6862 from rabbitmq/small-chunks-opts
Move nopush to reader to try to better make use of packets
2023-01-19 09:01:24 +01:00
GitHub 20ff35eef8 Adopt otp 25.1.2.1 2023-01-19 03:06:50 +00:00
GitHub 7a4a8db4b9 Adopt otp 25.2.1 2023-01-18 03:06:33 +00:00
Rin Kuryloski 2cd020a0da rules_erlang 3.9.0 compatibility
the elixir toolchain uses some private apis, and needed updating to
match internal changes in rules_erlang
2023-01-17 17:08:09 +01:00
Karl Nilsson 83880154de Streams: Move nopush to reader to try to combine small chunks into larger IP packets.
Also change consumer credit top-ups to delay calling send_chunks until there is a "batch"
of credit to consume. Most clients at the time of writing send single credit updates after receiving each chunk so here we won't enter the send loop unless there are more than half the initial credits available.

osiris v1.4.3
2023-01-17 14:01:42 +00:00
Michal Kuratczyk 510415f8b9
Update prometheus.erl to 4.10.0
Since 4.10.0 was released specifically to address an issue we
encountered in RabbitMQ integration with prometheus.erl, new test was
added to validate this functionality in the future.
2023-01-13 10:24:41 +01:00
GitHub 453c45fe80 Adopt otp 25.1.2 2023-01-11 03:05:33 +00:00
Rin Kuryloski 06a330f553 format with buildifier 2023-01-05 12:39:25 +01:00
Luke Bakken f56557a53c
Pin to recon 2.5.3
https://github.com/ferd/recon/issues/102

Huzzah!
2022-12-23 11:13:40 -08:00
Karl Nilsson b1de79c9e0 Ra 2.4.6
This release includes improvements for paths containing unicode characters
and a stale read fix for the `ra:consistent_read/2` function.
2022-12-21 15:16:17 +00:00
GitHub ec4ce0ac17 Adopt elixir 1.13.4 2022-12-21 03:04:28 +00:00
Luke Bakken 943668c9b1 pin recon to cf5bfc290c6cdd46bea45ae4a6418e9802d511e5 2022-12-20 18:32:39 +00:00
Rin Kuryloski e799daa24e Use rules_erlang 3.8.5 2022-12-19 11:16:04 +01:00
Michael Klishin 571b1f5a1f
Merge pull request #6681 from rabbitmq/adopt-OTP-25.2
Adopt OTP 25.2
2022-12-16 01:38:21 +04:00
Michal Kuratczyk d78b8b3a2a
Adopt OTP 25.2 2022-12-15 11:08:21 +01:00
Arnaud Cogoluègnes d3caa1cdaa
Merge pull request #6440 from rabbitmq/stream-balancing
Streams rebalancing
2022-12-14 16:51:30 +01:00
Rin Kuryloski 27653f5130
Fix rules erlang version in WORKSPACE file
it did not match MODULE.bazel as it should
2022-12-14 14:12:13 +01:00
Michael Klishin 3d384838a7
Bump Ra to 2.4.5 2022-12-13 16:05:24 +04:00
Karl Nilsson b41476a5ff QQ: introduce configuration for mem table compression.
Mem table compression is configurable in Ra from v2.4.4 and reduces
peek ETS table use at a relatively small throughput penalty.
2022-12-07 16:04:17 +00:00
GitHub b33581763c Adopt otp 25.1.2 2022-12-06 03:06:08 +00:00
Rin Kuryloski 7bfc42abac Add deps info for ra when it is fetched from hex.pm
Currently ra is not published to hex.pm with the bazel files that are
available when fetched directly from github, so additional hints must
be provided in the MODULE.bazel for now
2022-12-05 15:04:36 +01:00
Karl Nilsson a0f3b6b452 Update Ra to 2.4.3
This release contains additional configuration parameters to control
Ra replication behaviour.
2022-12-05 11:25:58 +00:00
Karl Nilsson a2afb70fe7 Osiris v1.4.2
Multiple improvements around stream replication and optimisations
needed for reliable stream rebalancing.
2022-11-30 14:22:25 +00:00
Karl Nilsson 9736425fa5 Add restart_stream command to rabbitmq-streams
Also add epoch to stream_status output which requires osiris 1.4.1
2022-11-29 16:30:41 +00:00
Karl Nilsson ef5f2c0b47 Osiris 1.4.0
This includes:

* async replica initialisation - making definitions import
and bulk restarts faster.
* Faster end of stream handling - lowering cpu use in clusters
with many low throughput streams
* Makes osiris binary string friendly so that paths do not have to be lists
anymore.
* Periodic max_age retention evaluation. Streams with max_age retention settings
are now re-evaluated every 1hr to reclaim disk space for streams that are idle but
have segments that only have old message data. Before retention would only be evaluated
when streams were written to and a new segment was opened.
2022-11-21 10:04:22 +00:00
Rin Kuryloski d733c1d9d6 Remove unnecessary patch commands in bazel repos
When the version of osiris is a published version, there is no longer
a need to inject the git sha as its version. Other patches are no
longer needed now that osiris is caught up to the same rules_erlang
major.
2022-11-08 12:13:21 +01:00
Rin Kuryloski 712c9ad8f2 Adjust generated .app file for ra to include seshat as a dep
The quality of auto-detection of properities of a hex dependency was
improved with bzlmod, thus in the MODULE.bazel file, ra is handled
correctly with no hints. In WORKSPACE.bazel/workspace_helpers.bzl,
this not the case, so a full build_file_content is needed.

Bazel 6, due this month, takes bzlmod out of experimental status, so I
don't expect to close up the difference between the systems.

The easier solution is to publish ra to hex.pm with the BUILD.bazel
file included, as it exists in the ra source, and is correct,
eliminating the need for any auto-generation of it when
imported/referenced by rabbitmq-server
2022-11-08 08:45:36 +01:00
Michael Davis 24297f5e59
Bump Ra to 2.4.1 2022-11-07 18:40:58 -06:00
Michael Klishin 8ad1c8be5c
Bump credentials_obfuscation to 3.2.0 2022-11-08 03:35:33 +04:00
Michael Klishin a1cedeb859
Seshat 0.4.0 2022-11-08 02:45:06 +04:00
Michael Klishin 20b02321c3
Bump Osiris to 1.3.3 2022-11-08 02:39:38 +04:00
GitHub 331b78a913 Adopt otp 25.1.2 2022-11-05 03:37:18 +00:00
Karl Nilsson f17dd084da Upgrade osiris version to v1.3.2
Which contains an important fix that ensures seshat counter records
are cleaned up properly when the osiris log readers are closed.
2022-11-03 16:54:31 +00:00
Rin Kuryloski 7edfcd0b2a Remove trust_store_http from MODULE.bazel since it's an internal dep
Seems to have been an accidental result of conflict resolution in
fe13f69338
2022-11-03 10:11:40 +01:00
Rin Kuryloski 8136f01209 Mark @rbe as non-dev dependency
If it's a dev dependency, projects that depend on rabbitmq-server as a
bzlmod module cannot borrow rabbitmq-server's platform definitions, as
the rbe repo won't be visible to rabbitmq-server in such a scenario
2022-10-25 17:29:00 +02:00
GitHub ea18d7f2a6 Adopt otp 25.1.2 2022-10-25 03:58:07 +00: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 16300cc4ba Adopt rules_erlang 3.8.3
and apply corresponding changes to the elixir build
2022-10-18 15:57:51 +02:00
Rin Kuryloski 4122382111 Use rules_erlang 3.8.2 2022-10-14 10:47:35 +02:00
Rin Kuryloski 736d7d1bc2 Remove elixir 1.12 in a few other files 2022-10-11 17:46:15 +02:00
Michael Klishin 9cae4b5d4b
Drop Elixir 1.12 toolchain
All currently supported series require 1.13+
2022-10-11 14:56:59 +04:00
GitHub c4109d7854 Adopt elixir 1.14.1 2022-10-11 03:50:18 +00:00
Rin Kuryloski 18bccf5873 Remove erlang 23 from bazel build 2022-10-10 09:30:29 +02:00
Michael Klishin 567d32afe6
Merge pull request #6050 from rabbitmq/bump-otp-24.3
Adopt otp 24.3.4.6
2022-10-08 09:10:28 +04:00
GitHub bdcb55f81b Adopt otp 24.3.4.6 2022-10-08 03:31:45 +00:00
Luke Bakken 02e3e0046f
Upgrade cuttlefish to 3.1.0
Related to https://github.com/rabbitmq/opportunities/issues/207
2022-10-07 14:36:22 -07:00
GitHub b5ebd52e68 Adopt otp 25.1.1 2022-10-04 08:45:49 +00:00
Rin Kuryloski 702784ccd8 Use rules_erlang 3.7.2 2022-10-03 14:52:08 +02:00