Commit Graph

30445 Commits

Author SHA1 Message Date
Loïc Hoguin c0c2c2fbd9
Fix OTP-27 Dialyzer errors in rabbitmq_trust_store 2024-09-30 12:35:42 +02:00
Loïc Hoguin aa43139192
Fix OTP-27 Dialyzer errors in trust_store_http 2024-09-30 12:35:42 +02:00
Loïc Hoguin ec95c1a88d
rabbit_common: Remove 'cover' related code from 'rabbit_misc'
This is very old code that is likely no longer used. Removing
it helps avoid depending on cover.
2024-09-30 12:35:42 +02:00
Loïc Hoguin 861943835f
Fix OTP-27 Dialyzer errors in rabbit_common 2024-09-30 12:35:42 +02:00
Loïc Hoguin 85e358642b
Fix OTP-27 Dialyzer errors in rabbit 2024-09-30 12:35:42 +02:00
Loïc Hoguin 5086553bdd
make: Correct rabbitmq_prelaunch/rabbitmq_stream_common deps 2024-09-30 12:35:42 +02:00
Loïc Hoguin 5e3942478f
amqp10_common: Don't dialyze tests or from source by default 2024-09-30 12:35:42 +02:00
Loïc Hoguin 9f8c17f587
make: Fix build errors for apps that have rabbit in TEST_DEPS
We want them to install CLI scripts only for the test build,
otherwise Dialyzer or others will fail in a clean run.
2024-09-30 12:35:42 +02:00
Loïc Hoguin f95c87082a
make: Include rabbitmq_cli ebin in code path only if in deps 2024-09-30 12:35:42 +02:00
Loïc Hoguin f4a24c7f16
make: Run rabbitmq_mqtt tests via parallel-ct 2024-09-30 12:35:41 +02:00
David Ansari f002029ebd
Do not open WebMQTT connection in MQTT plugin 2024-09-30 12:35:41 +02:00
Loïc Hoguin ddab3d523f
mqtt tests: Move v5 web_mqtt tests out of rabbitmq_mqtt 2024-09-30 12:35:41 +02:00
Loïc Hoguin 690b830e43
mqtt tests: Move web_mqtt tests out of rabbitmq_mqtt
The shared test suite was renamed only for clarity, but the
Web-MQTT test suites were renamed out of necessity: since
we are now adding the MQTT test directory to the code path
we need test suites to have different names to avoid
conflicts. We can't (easily) addpath only for this test suite
either since CT hooks don't call functions in a predictable
enough manner; it would always be hacky.
2024-09-30 12:35:41 +02:00
Loïc Hoguin f4f375c6a9
Use Make in CI
This is a proof of concept that mostly works but is missing
some tests, such as rabbitmq_mqtt or rabbitmq_cli. It also
doesn't apply to mixed version testing yet.
2024-09-30 12:35:41 +02:00
Loïc Hoguin 645942cf95
make: Move dep_osiris in rabbitmq-components.mk
Otherwise some plugins can't build if we try to run tests
directly after checkout. This is because the plugins
depend on osiris as well as rabbit, but there is no
dep_osiris defined in the plugin itself.
2024-09-30 12:35:41 +02:00
Loïc Hoguin 30a8de3287
rabbit tests: Delete some temporary files to reduce log sizes 2024-09-30 12:35:41 +02:00
Loïc Hoguin 14fe08152f
Merge feature_flags_with_unpriveleged_user_SUITE back in ff_SUITE
On GH Actions we run as an unprivileged user by default.
2024-09-30 12:35:41 +02:00
David Ansari 36a84f4cde Fix function_clause
Fixes https://github.com/rabbitmq/rabbitmq-server/issues/12398

To repro this crash:
1. Start RabbitMQ v3.13.7 with feature flag message_containers disabled:
```
make run-broker TEST_TMPDIR="$HOME/scratch/rabbit/test" RABBITMQ_FEATURE_FLAGS=quorum_queue,implicit_default_bindings,virtual_host_metadata,maintenance_mode_status,user_limits,feature_flags_v2,stream_queue,classic_queue_type_delivery_support,classic_mirrored_queue_version,stream_single_active_consumer,direct_exchange_routing_v2,listener_records_in_ets,tracking_records_in_ets
```
In the Management UI
2. Create a quorum queue with x-delivery-limit=10
3. Publish a message to this queue.
4. Requeue this message two times.
5. ./sbin/rabbitmqctl enable_feature_flag all
6. Stop the node
7. git checkout v4.0.2
8. make run-broker TEST_TMPDIR="$HOME/scratch/rabbit/test"
9. Again in the Management UI, Get Message with Automatic Ack leads to above crash:

```
[error] <0.1185.0> ** Reason for termination ==
[error] <0.1185.0> ** {function_clause,
[error] <0.1185.0>        [{mc_compat,set_annotation,
[error] <0.1185.0>             [delivery_count,2,
[error] <0.1185.0>              {basic_message,
[error] <0.1185.0>                  {resource,<<"/">>,exchange,<<>>},
[error] <0.1185.0>                  [<<"qq1">>],
[error] <0.1185.0>                  {content,60,
[error] <0.1185.0>                      {'P_basic',undefined,undefined,
[error] <0.1185.0>                          [{<<"x-delivery-count">>,long,2}],
[error] <0.1185.0>                          2,undefined,undefined,undefined,undefined,undefined,
[error] <0.1185.0>                          undefined,undefined,undefined,undefined,undefined},
[error] <0.1185.0>                      none,none,
[error] <0.1185.0>                      [<<"m1">>]},
[error] <0.1185.0>                  <<230,146,94,58,177,125,64,163,30,18,177,132,53,207,69,103>>,
[error] <0.1185.0>                  true}],
[error] <0.1185.0>             [{file,"mc_compat.erl"},{line,61}]},
[error] <0.1185.0>         {rabbit_fifo_client,add_delivery_count_header,2,
[error] <0.1185.0>             [{file,"rabbit_fifo_client.erl"},{line,228}]},
[error] <0.1185.0>         {rabbit_fifo_client,dequeue,4,
[error] <0.1185.0>             [{file,"rabbit_fifo_client.erl"},{line,211}]},
[error] <0.1185.0>         {rabbit_queue_type,dequeue,5,
[error] <0.1185.0>             [{file,"rabbit_queue_type.erl"},{line,755}]},
[error] <0.1185.0>         {rabbit_misc,with_exit_handler,2,
[error] <0.1185.0>             [{file,"rabbit_misc.erl"},{line,526}]},
[error] <0.1185.0>         {rabbit_channel,handle_method,3,
[error] <0.1185.0>             [{file,"rabbit_channel.erl"},{line,1257}]},
[error] <0.1185.0>         {rabbit_channel,handle_cast,2,
[error] <0.1185.0>             [{file,"rabbit_channel.erl"},{line,629}]},
[error] <0.1185.0>         {gen_server2,handle_msg,2,[{file,"gen_server2.erl"},{line,1056}]}]}
```

The mc annotation `delivery_count` is a new mc annotation specifically
used in the header section of AMQP 1.0 messages:
https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-header

Hence, we can ignore this annotation for the old `#basic_message{}`.
2024-09-30 11:35:22 +02:00
Arnaud Cogoluègnes 788879969e
Merge pull request #12391 from rabbitmq/anon-term-errors
Comply with §2.2.2 of Anonymous Terminus extension
2024-09-27 09:24:47 +02:00
Michael Klishin cf0a4e8e11
Merge pull request #12390 from rabbitmq/issue-12374
Remove duplicate stats keys in quorum queues
2024-09-27 01:49:58 -04:00
Michael Klishin b815902585 Make it possible to override the license line in the startup banner
This is for Tanzu RabbitMQ, nothing changes for
the open source edition.
2024-09-26 23:45:17 -04:00
David Ansari 6863ae14dd Comply with §2.2.2 of Anonymous Terminus extension
Comply with section 2.2.2 Routing Errors:
https://docs.oasis-open.org/amqp/anonterm/v1.0/cs01/anonterm-v1.0-cs01.html#doc-routingerrors
2024-09-26 16:45:18 +02:00
Diana Parra Corbacho d860efaccc Remove duplicate stats keys in quorum queues
Messages, messages_ready and messages_unacknowledged are duplicated
during management stats collection, resulting in internal errors
when sorting queues in the management UI.
These should not be part of rabbit_core_metrics:queue_stats/2
2024-09-26 12:52:08 +02:00
Michael Klishin ea5673e4db
Merge pull request #12386 from stefanmoser/main
rabbitmqadmin v1: add default-queue-type to vhost declaration
2024-09-25 16:58:45 -04:00
Michael Klishin d31e930218
Merge pull request #12385 from rabbitmq/dependabot/maven/deps/rabbitmq_stream_management/test/http_SUITE_data/main/junit.jupiter.version-5.11.1
build(deps-dev): bump junit.jupiter.version from 5.11.0 to 5.11.1 in /deps/rabbitmq_stream_management/test/http_SUITE_data
2024-09-25 16:58:15 -04:00
Michael Klishin 855414d30c
Merge pull request #12384 from rabbitmq/dependabot/maven/deps/rabbitmq_stream/test/rabbit_stream_SUITE_data/main/junit.jupiter.version-5.11.1
build(deps-dev): bump junit.jupiter.version from 5.11.0 to 5.11.1 in /deps/rabbitmq_stream/test/rabbit_stream_SUITE_data
2024-09-25 16:58:07 -04:00
Michael Klishin 9f444b6927
Merge pull request #12383 from rabbitmq/dependabot/maven/deps/rabbitmq_mqtt/test/java_SUITE_data/main/org.junit.jupiter-junit-jupiter-5.11.1
build(deps-dev): bump org.junit.jupiter:junit-jupiter from 5.11.0 to 5.11.1 in /deps/rabbitmq_mqtt/test/java_SUITE_data
2024-09-25 16:58:00 -04:00
Stefan Moser c3f218d1b7 add default-queue-type to vhost declaration 2024-09-25 13:21:14 -07:00
dependabot[bot] 3d1bac4d1d
build(deps-dev): bump junit.jupiter.version
Bumps `junit.jupiter.version` from 5.11.0 to 5.11.1.

Updates `org.junit.jupiter:junit-jupiter-engine` from 5.11.0 to 5.11.1
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.11.0...r5.11.1)

Updates `org.junit.jupiter:junit-jupiter-params` from 5.11.0 to 5.11.1
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.11.0...r5.11.1)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-type: direct:development
  update-type: version-update:semver-patch
- dependency-name: org.junit.jupiter:junit-jupiter-params
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-25 18:40:56 +00:00
dependabot[bot] 0ddb303d54
build(deps-dev): bump junit.jupiter.version
Bumps `junit.jupiter.version` from 5.11.0 to 5.11.1.

Updates `org.junit.jupiter:junit-jupiter-engine` from 5.11.0 to 5.11.1
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.11.0...r5.11.1)

Updates `org.junit.jupiter:junit-jupiter-params` from 5.11.0 to 5.11.1
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.11.0...r5.11.1)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-type: direct:development
  update-type: version-update:semver-patch
- dependency-name: org.junit.jupiter:junit-jupiter-params
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-25 18:40:34 +00:00
dependabot[bot] 1db0d1f758
build(deps-dev): bump org.junit.jupiter:junit-jupiter
Bumps [org.junit.jupiter:junit-jupiter](https://github.com/junit-team/junit5) from 5.11.0 to 5.11.1.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.11.0...r5.11.1)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-25 18:34:34 +00:00
dependabot[bot] a25fcb46b2
build(deps-dev): bump org.junit.jupiter:junit-jupiter-params
Bumps [org.junit.jupiter:junit-jupiter-params](https://github.com/junit-team/junit5) from 5.11.0 to 5.11.1.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.11.0...r5.11.1)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-params
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-25 18:25:30 +00:00
David Ansari c0fbc1a805 Fix AMQP 1.0 shovel
The shovel violated the AMQP 1.0 spec by sending transfers with settled=true
under sender settle mode unsettled (in case of shovel ack-mode being
on-publish).
2024-09-25 18:06:22 +02:00
David Ansari 9d7ebf32a9 Enforce correct transfer settled flag
For messages published to RabbitMQ, RabbitMQ honors the transfer `settled`
field, no matter what value the sender settle mode was set to in the attach
frame.

Therefore, prior to this commit, a client could send a transfer with
`settled=true` even though sender settle mode was set to `unsettled` in the
attach frame.

This commit enforces that the publisher sets only transfer `settled` fields
that are valid with the spec.

If sender settle mode is:
* `unsettled`, the transfer `settled` flag must be `false`.
* `settled`, the transfer `settled` flag must be `true`.
* `mixed`, the transfer `settled` flag can be `true` or `false`.
2024-09-25 18:06:22 +02:00
David Ansari 1245119972 Delete unsupported setting
see https://github.com/rabbitmq/rabbitmq-server/pull/11999 for context
2024-09-25 17:53:35 +02:00
David Ansari 1e3f4e5db9 Emit histogram metric for received message sizes per protocol (#12342)
* Add global histogram metrics for received message sizes per-protocol

fixup: add new files to bazel

fixup: expose message_size_bytes as prometheus classic histogram type

`rabbit_msg_size_metrics` does not use `seshat` any more, but
`counters` directly.

fixup: add msg_size_metrics unit test

* Improve message size histogram

1.
Avoid unnecessary time series emitted for stream protocol
The stream protocol cannot observe message sizes.
This commit ensures that the following time series are omitted:
```
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="64"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="256"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="1024"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="4096"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="16384"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="65536"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="262144"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="1048576"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="4194304"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="16777216"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="67108864"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="268435456"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="+Inf"} 0
rabbitmq_global_message_size_bytes_count{protocol="stream"} 0
rabbitmq_global_message_size_bytes_sum{protocol="stream"} 0
```

This reduces the number of time series by 15.

2.
Further reduce the number of time series by reducing the number of
buckets. Instead of 13 bucktes, emit only 9 buckets. Buckets are not
free, each is an extra time series stored.

Prior to this commit:
```
curl -s -u guest:guest localhost:15692/metrics | ag message_size | wc -l
      92
```

After this commit:
```
curl -s -u guest:guest localhost:15692/metrics | ag message_size | wc -l
      57
```

3.
The emitted metric should be called
`rabbitmq_message_size_bytes_bucket` instead of `rabbitmq_global_message_size_bytes_bucket`.
The latter is poor naming. There is no need to use `global` in
the metric name given that this metric doesn't exist in the old flawed
aggregated metrics.

4.
This commit simplies module `rabbit_global_counters`.

5.
Avoid garbage collecting the 10-elements list of buckets per message
being received.

---------

Co-authored-by: Péter Gömöri <peter@84codes.com>
2024-09-25 09:00:44 -04:00
Lois Soto Lopez 8377eda336 Comment added label clause to clarify need for it 2024-09-25 11:04:25 +02:00
David Ansari 960808e6b2
Emit histogram metric for received message sizes per protocol (#12342)
* Add global histogram metrics for received message sizes per-protocol

fixup: add new files to bazel

fixup: expose message_size_bytes as prometheus classic histogram type

`rabbit_msg_size_metrics` does not use `seshat` any more, but
`counters` directly.

fixup: add msg_size_metrics unit test

* Improve message size histogram

1.
Avoid unnecessary time series emitted for stream protocol
The stream protocol cannot observe message sizes.
This commit ensures that the following time series are omitted:
```
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="64"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="256"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="1024"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="4096"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="16384"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="65536"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="262144"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="1048576"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="4194304"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="16777216"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="67108864"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="268435456"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="+Inf"} 0
rabbitmq_global_message_size_bytes_count{protocol="stream"} 0
rabbitmq_global_message_size_bytes_sum{protocol="stream"} 0
```

This reduces the number of time series by 15.

2.
Further reduce the number of time series by reducing the number of
buckets. Instead of 13 bucktes, emit only 9 buckets. Buckets are not
free, each is an extra time series stored.

Prior to this commit:
```
curl -s -u guest:guest localhost:15692/metrics | ag message_size | wc -l
      92
```

After this commit:
```
curl -s -u guest:guest localhost:15692/metrics | ag message_size | wc -l
      57
```

3.
The emitted metric should be called
`rabbitmq_message_size_bytes_bucket` instead of `rabbitmq_global_message_size_bytes_bucket`.
The latter is poor naming. There is no need to use `global` in
the metric name given that this metric doesn't exist in the old flawed
aggregated metrics.

4.
This commit simplies module `rabbit_global_counters`.

5.
Avoid garbage collecting the 10-elements list of buckets per message
being received.

---------

Co-authored-by: Péter Gömöri <peter@84codes.com>
2024-09-24 18:08:24 +02:00
Lois Soto Lopez 79f04c23f3 Avoid duplicate vhost label for prometh. queue-exchange metrics
Adds a specific clause on the
`prometheus_rabbitmq_core_metrics_collector:labels` function when the
associated metric item is a Queue + Exchange combo (`{Queue, Exchange}`)
2024-09-24 10:38:38 +02:00
Jean-Sébastien Pédron 8268a11eb2
Merge pull request #12357 from rabbitmq/fix-non-canonical-links
Fix non-canonical and broken links
2024-09-24 09:27:10 +02:00
Karl Nilsson 2ae4dbeb1a QQ: fix off-by-one bug in release cursor effects.
{release_cursor, Idx} effects promote checkpoints with an index
lower or _equal_ to the release cursor index. rabbit_fifo is emitting
the smallest active raft index instead which could cause the log to truncate
one index too many after a checkpoint promotion.
2024-09-23 17:20:17 +01:00
Jean-Sébastien Pédron 5158460cc6
rabbitmqctl.8: Point to 3.13.x mirroring guide
[Why]
Classic queue mirroring was removed from RabbitMQ 4.0.x.
2024-09-23 13:25:39 +02:00
Jean-Sébastien Pédron fe10cd88c3
rabbit/Makefile: Delete `.html` from local URL in manpages 2024-09-23 13:24:54 +02:00
Jean-Sébastien Pédron 89fc33a0f2
Use the new URLs of the `www.rabbitmq.com` website
They changed with the switch to Docusaurus. This avoids a redirect and
gives cleaner search results.
2024-09-23 11:34:54 +02:00
Jean-Sébastien Pédron e7784df169
Use the canonical `www.rabbitmq.com` domain
Using `rabbitmq.com` works and redirects to `www.rabbitmq.com`, but it
is preferable to use the canonical domain to have cleaner search
results.

This is important for manpages because we have an HTML copy in the
website.
2024-09-23 11:13:08 +02:00
Michael Klishin bf4d573110
Merge pull request #12348 from rabbitmq/cmq-silent-ff
Make rabbit_table:wait/2 silent when checking if cmq are used
2024-09-22 15:59:42 -04:00
David Ansari bddc54613f Decrease default MQTT Maximum Packet Size
Given that the default max_message_size got decreased from 128 MiB to 16
MiB in RabbitMQ 4.0 in https://github.com/rabbitmq/rabbitmq-server/pull/11455,
it makes sense to also decrease the default MQTT Maximum Packet Size from 256 MiB to 16 MiB.
Since this change was missed in RabbitMQ 4.0, it is scheduled for RabbitMQ 4.1.
2024-09-20 16:11:21 +02:00
Michael Klishin 2cc4b4381c
Merge pull request #12351 from rabbitmq/dependabot/maven/deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot_kotlin/main/org.springframework.boot-spring-boot-starter-parent-3.3.4
build(deps): bump org.springframework.boot:spring-boot-starter-parent from 3.3.3 to 3.3.4 in /deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot_kotlin
2024-09-19 17:08:47 -04:00
dependabot[bot] d6094b0f78
build(deps): bump org.springframework.boot:spring-boot-starter-parent
Bumps [org.springframework.boot:spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 3.3.3 to 3.3.4.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](https://github.com/spring-projects/spring-boot/compare/v3.3.3...v3.3.4)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-parent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-19 19:09:10 +00:00
dependabot[bot] ab34b17d98
build(deps): bump org.springframework.boot:spring-boot-starter-parent
Bumps [org.springframework.boot:spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 3.3.3 to 3.3.4.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](https://github.com/spring-projects/spring-boot/compare/v3.3.3...v3.3.4)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-parent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-19 19:00:40 +00:00
Diana Parra Corbacho 430a6b469b Make rabbit_table:wait/2 silent when checking if cmq are used 2024-09-19 17:23:28 +02:00
David Ansari b1eb354385 Strictly validate annotations 2024-09-18 12:42:27 +02:00
David Ansari cd600bef8b Fix modified annotations
```
<field name="message-annotations" type="fields"/>
```

Prior to this commit integration tests succeeded because both Erlang
client and RabbitMQ server contained a bug.

This bug was noticed by a Java client test suite.
2024-09-18 09:38:44 +02:00
Michael Klishin 47210c8307
cli enable_feature_flag: alias --experimental as --opt-in
--experimental is no longer particularly fair to Khepri,
which is not enabled by default because of its enormous
scope, and because once enabled, it cannot be disabled.

--opt-in would be a better name but --experimental
remains for backwards compatiblity.

When both are specified, we consider that the
user opts in if at least one of the flags is
set to true.
2024-09-17 19:08:28 -04:00
Michael Klishin 27dac87a20
Khepri feature flag: add a documentation URL
That links to the vNext version of the site for
now. In 4.0.x, we can change it to the vCurrent
version.
2024-09-17 03:38:26 -04:00
Michael Klishin 4805e31e37
Merge pull request #12317 from rabbitmq/md/khepri/mqtt-fixes
Handle database timeouts in MQTT queue deletion
2024-09-16 19:00:09 -04:00
Michael Davis a65ceb6372
rabbit_amqqueue: Catch exits when reading classic Q `consumers/1`
`delegate:invoke/2` catches errors but not exits of the delegate
process. Another process might query for a classic queue's consumers
while the classic queue is being deleted or otherwise terminating and
that would result in an exit of the calling process previously.
2024-09-16 14:43:27 -04:00
Michael Davis a9c48ef951
rabbit_mqtt_processor: Handle failures to delete a queue 2024-09-16 14:43:27 -04:00
Michael Davis 9627903716
rabbit_queue_type: Add `{error,timeout}` to delete/4 callback spec
This return value was already possible since a classic queue will return
it during termination if `rabbit_amqqueue:internal_delete/2` fails with
that value.

`rabbit_amqqueue:delete/4` already handles this value and converts it
into a protocol error and channel exit. The other caller (MQTT
processor) will be updated in a child commit.

This commit also replaces eager conversions to protocol errors in
rabbit_classic_queue, rabbit_quorum_queue and rabbit_stream_coordinator:
we should return `{error, timeout}` consistently and not hide it in
protocol errors.
2024-09-16 14:43:24 -04:00
dependabot[bot] 0d6916e3c5
build(deps-dev): bump com.rabbitmq:amqp-client
Bumps [com.rabbitmq:amqp-client](https://github.com/rabbitmq/rabbitmq-java-client) from 5.21.0 to 5.22.0.
- [Release notes](https://github.com/rabbitmq/rabbitmq-java-client/releases)
- [Commits](https://github.com/rabbitmq/rabbitmq-java-client/compare/v5.21.0...v5.22.0)

---
updated-dependencies:
- dependency-name: com.rabbitmq:amqp-client
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-16 18:42:53 +00:00
Diana Parra Corbacho 05f0e03c38 Quorum queues: unblock publishers when clearing max-length policy 2024-09-16 12:19:01 +02:00
Michal Kuratczyk ea976e5b86 Failing test for max-length policy deletion
Clearing a max-length policy doesn't unblock existing
publishers. When a new publisher connects, it can publish
to the queue.
2024-09-16 12:19:01 +02:00
Michael Klishin 4ec0f5e300
Merge pull request #12303 from rabbitmq/issue-1049
forget_cluster_node: delete all local classic queues when using Khepri store
2024-09-13 15:39:36 -04:00
Michael Klishin 731fb2fd15 container-id help message wording #12302 2024-09-13 15:12:17 -04:00
Michal Kuratczyk b64ebf1a91
Fix formatter crash
Before:
```
FORMATTER CRASH: {"Waiting for ~ts queues and streams to have quorum+1 replicas online.You can list them with `rabbitmq-diagnostics check_if_node_is_quorum_critical`","\t"}
```
After:
```
Waiting for 9 queues and streams to have quorum+1 replicas online. You can list them with `rabbitmq-diagnostics check_if_node_is_quorum_critical`
```
2024-09-13 18:09:08 +02:00
Michal Kuratczyk f0f7500f6a
Revert "Log errors from `ranch:handshake`" (#12304)
This reverts commit 620fff22f1.

It intoduced a regression in another area - a TCP health check,
such as the default (with cluster-operator) readinessProbe,
on a TLS-enabled instance would log a `rabbit_reader` crash
every few seconds:
```
tls-server-0 rabbitmq 2024-09-13 09:03:13.010115+00:00 [error] <0.999.0>   crasher:
tls-server-0 rabbitmq 2024-09-13 09:03:13.010115+00:00 [error] <0.999.0>     initial call: rabbit_reader:init/3
tls-server-0 rabbitmq 2024-09-13 09:03:13.010115+00:00 [error] <0.999.0>     pid: <0.999.0>
tls-server-0 rabbitmq 2024-09-13 09:03:13.010115+00:00 [error] <0.999.0>     registered_name: []
tls-server-0 rabbitmq 2024-09-13 09:03:13.010115+00:00 [error] <0.999.0>     exception error: no match of right hand side value {error, handshake_failed}
tls-server-0 rabbitmq 2024-09-13 09:03:13.010115+00:00 [error] <0.999.0>       in function  rabbit_reader:init/3 (rabbit_reader.erl, line 171)
```
2024-09-13 17:07:57 +02:00
David Ansari f78f14ab1d Display container-id in the UI and CLI 2024-09-13 17:05:46 +02:00
Michael Klishin a1893fb28a
Tweak a log message when all classic queues on a node are being removed 2024-09-13 10:52:11 -04:00
Diana Parra Corbacho 29bfaa9ac7 Test remove classic queues when node is removed 2024-09-13 15:01:24 +02:00
Michal Kuratczyk 1db3fd391a
Log when deleting all queues on a forgotten node 2024-09-13 14:48:35 +02:00
Diana Parra Corbacho 990e6d2dc7 forget_cluster_node: delete all local classic queues when using Khepri store
When a cluster node is removed, all classic queues hosted on it should be
removed. This was done for Mnesia but not for the new Khepri metadata store
2024-09-13 13:46:53 +02:00
Michael Klishin bc8d3fdf19
More copywriting tweaks around the Khepri feature flag
Per discussion with most of the core team.
2024-09-12 11:00:34 -04:00
Michael Klishin ad7c58abf1
Merge pull request #12286 from rabbitmq/mk-4.0-khepri-ff-wording
Tweak wording around experimental feature flags (Khepri)
2024-09-12 09:09:34 -04:00
Michael Klishin caad8a51a7
Merge pull request #12276 from rabbitmq/slow-vhost-deletion-many-permissions
Increase the timeout when batch deleting permissions
2024-09-12 09:09:07 -04:00
Diana Parra Corbacho 2981782161 cluster_minority_SUITE: use a timeout for vhost deletion 2024-09-12 08:34:44 +02:00
Michael Klishin 29fcb33a6b Tweak wording around experimental feature flags (Khepri)
This updates Khepri FF description to be more correct
and to the point.

It also tweaks the management UI copywriting so
that it does not recommend against the use of
Khepri in production as it is much more mature
in 4.0.
2024-09-11 20:35:42 -04:00
Michael Klishin 4fbb2efcae
Merge pull request #12270 from rabbitmq/su_aws/dont_use_default_openssl_dir
Use openssl.cnf config when generating new CSR
2024-09-11 17:03:43 -04:00
Michael Davis 4eee769b54
Merge pull request #12280 from rabbitmq/md/khepri/fence-init-timeout 2024-09-11 14:16:34 -05:00
Michael Davis 3afb379f0e
rabbit_khepri: Retry fence in init/1 in cases of timeout 2024-09-11 13:26:36 -04:00
Michael Davis 4f0da67420
Handle Khepri timeouts when attempting to delete crashed classic Qs 2024-09-11 13:10:10 -04:00
Michael Davis c37b192beb
Handle Khepri timeouts when deleting MQTT QOS0 queues 2024-09-11 12:18:13 -04:00
Michael Davis 09c8aacb55
minor: Delete duplicate "queue" in QQ deletion error message
`rabbit_misc:rs/1` formats as "queue '<name>' in vhost '<vhost>'" so the
extra "queue" can be removed.
2024-09-11 12:17:24 -04:00
Diana Parra Corbacho f849a605ee Increase the timeout when batch deleting permissions 2024-09-11 09:07:32 +02:00
Michael Klishin e48079381e amqp_client_SUITE: drop a non-essential flakey test
interference from other tests sometimes makes
it fail because there is more than one connection.

Compared to most other AMQP 1.0 tests, this one can be
dropped.
2024-09-10 14:01:33 -04:00
Simon Unge b2904404da Use openssl.cnf config when generating new CSR 2024-09-10 17:20:41 +00:00
Michael Davis fcb90e4016
rabbit_khepri: Add debug logs in khepri_db enable callback
Without these there is no indication of unregistering and registering
projections.
2024-09-10 13:06:38 -04:00
Michael Davis ac1696bb16
Merge pull request #12266 from rabbitmq/md/khepri/singular-projection-names 2024-09-10 11:30:46 -05:00
Michael Klishin 192426dc68
Merge pull request #12267 from rabbitmq/mgmt-remove-disk-io
Management UI: remove disk read and write metrics from overview page.
2024-09-10 11:43:55 -04:00
Loïc Hoguin aa56e1097f
Merge pull request #12264 from rabbitmq/loic-small-make-fixes
make: Fix regressions following make plugins cleanup
2024-09-10 17:06:43 +02:00
Karl Nilsson f37b9f3f20 MGMT: remove disk read and write metrics from overview page.
These metrics do not include most of the disk io that RabbitMQ does
so are effectively useless.
2024-09-10 15:52:25 +01:00
Michael Davis c363ae0add
Consistently use singular names for Khepri projections
Previously about half of the Khepri projection names were pluralized.
2024-09-10 10:37:36 -04:00
Michael Davis 43b7fc1e53
rabbit_khepri: Rename legacy projection unregistration function, add docs
This function is meant to remove any projections which were mistakenly
registered in 3.13.x rather than all existing projections.
2024-09-10 10:34:55 -04:00
Michael Klishin 0c2e589ce9
Merge pull request #12250 from rabbitmq/delivery-limit-disable
QQ: a delivery-limit of -1 disables the delivery limit.
2024-09-10 10:01:05 -04:00
Loïc Hoguin 4a118c25f9
make: Fix regressions following make plugins cleanup 2024-09-10 15:42:28 +02:00
Karl Nilsson 67304ab910 Update description of delivery limit in management UI.
To mention that the default can be set to unlimited if the delivery-limit
is set to -1.
2024-09-10 13:56:15 +01:00
Karl Nilsson e81feb556f QQ: a delivery-limit of -1 disables the delivery limit.
For cases where users want to live a bit more dangerously this commit
maps a delivery limit of -1 (or any negative value) such that it
disables the delivery limit and restores the 3.13.x behaviour.
2024-09-10 10:48:03 +01:00
Michael Davis ce729038d6
rabbit_khepri: "fence" during `init/1`
`khepri:fence/0,1,2` queries the leader's Raft index and blocks the
caller for the given (or default) timeout until the local member has
caught up in log replication to that index. We want to do this during
Khepri init to ensure that the local Khepri store is reasonably up to
date before continuing in the boot process and starting listeners.

This is conceptually similar to the call to `mnesia:wait_for_tables/2`
during `rabbit_mnesia:init/0` and should have the same effect.
2024-09-09 09:06:39 -04:00
Michael Davis e8d267591d
rabbit_khepri: Register projections during virgin `init/1`
This covers a specific case where we need to register projections not
covered by the enable callback of the `khepri_db` feature flag. The
feature flag may be enabled if a node has been part of a cluster which
enabled the flag, but the metadata store might be reset. Upon init the
feature flag will be enabled but the store will be empty and the
projections will not exist, so operations like inserting default data
will fail when asserting that a vhost exists for example.

This fixes the `cluster_management_SUITE:forget_cluster_node_in_khepri/1`
case when running the suite with `RABBITMQ_METADATA_STORE=khepri`, which
fails as mentioned above.

We could run projection registration always when using Khepri but once
projections are registered the command is idempotent so there's no need
to, and the commands are somewhat large.
2024-09-09 09:06:39 -04:00
Michael Davis 67031e3c3d
Ensure projections are registered in metadata_store_phase1_SUITE 2024-09-09 09:06:39 -04:00
Michael Davis a3ca1bba6c
Explicitly match skips when setting metadata store in CT
This causes a clearer error when the `enable_feature_flags/2` function
returns something not in the shape `ok | {skip, any()}`.
2024-09-09 09:06:39 -04:00
Michael Davis 72fab069f5
rabbit_khepri: Use `?STORE_ID` for projection registration functions
This is a cosmetic change. `?RA_CLUSTER_NAME` is equivalent but is used
for clustering commands. Commands sent via the `khepri`/`khepri_adv`
APIs consistently use the `?STORE_ID` macro instead.
2024-09-09 09:06:39 -04:00
Michael Davis 3353242693
rabbit_khepri: Remove projection registration from setup/0 2024-09-09 09:06:38 -04:00
Michael Davis 9741af4672
rabbit_khepri: Unregister all projections when enabling khepri_db ff 2024-09-09 09:06:38 -04:00
Michael Davis 89971d5698
rabbit_khepri: Add projection registration to khepri_db ff enable fun 2024-09-09 09:06:38 -04:00
Michael Davis 0e4e12da2e
rabbit_khepri: Avoid throws in `register_projection/0`
Previously this function threw errors. With this minor refactor we
return them instead so that `register_projection/0` is easier for
callers to work with. (In the child commit we will add another caller.)
2024-09-09 09:06:38 -04:00
David Ansari 7baff37f65 Simplify session reply frames
This commit is only refactoring.

To avoid confusion with reply and noreply gen_server return values, this
commit uses different return values for handle_frame/2.
2024-09-09 12:40:24 +02:00
David Ansari b2db6355bc Support handle-max
## What?
1. Support `handle-max` field in the AMQP 1.0 `begin` frame
2. Add a new setting `link_max_per_session` which defaults to 256.
3. Rename `session_max` to `session_max_per_connection`

 ## Why?
1. Operators might want to limit the number of links per session. A
   similar setting `consumer_max_per_channel` exists for AMQP 0.9.1.
2. We should use RabbitMQ 4.0 as an opportunity to set a sensible
   default as to how many links can be active on a given session simultaneously.
   The session code does iterate over every link in some scenarios (e.g.
   queue was deleted). At some point, it's better to just open 2nd
   session instead of attaching hundreds or thousands of links to a single session.
   A default `link_max_per_session` of 256 should be more than enough given
   that `session_max_per_connection` is 64. So, the defaults allow
   `256 * 64 = 16,384` links to be active on an AMQP 1.0 connection.
   (Operators might want to lower both defaults.)
3. The name is clearer given that we might introduce
   `session_max_per_node` in the future since
   `channel_max_per_node` exists for AMQP 0.9.1.

 ### Additional Context
> Link handles MAY be reused once a link is closed for both send and receive.

> To make it easier to monitor AMQP link attach frames, it is RECOMMENDED that
> implementations always assign the lowest available handle to this field.
2024-09-06 17:18:08 +02:00
David Ansari 4fe7adc39a Add test 2024-09-06 13:48:48 +00:00
Karl Nilsson c68c9a48c3 Fix message resend bug in rabbit_stream_queue 2024-09-06 14:34:37 +01:00
Michael Davis 2f6a0ced9b
Merge pull request #12214 from rabbitmq/md/simplify-vhost-exchange-deletion 2024-09-05 14:45:37 -05:00
David Ansari c2ce905797
Enforce AMQP 1.0 channel-max (#12221)
* Enforce AMQP 1.0 channel-max

Enforce AMQP 1.0 field `channel-max` in the `open` frame by introducing
a new more user friendly setting called `session_max`:
> The channel-max value is the highest channel number that can be used on the connection.
> This value plus one is the maximum number of sessions that can be simultaneously active on the connection.

We set the default value of `session_max` to 64 such that, by
default, RabbitMQ 4.0 allows maximum 64 AMQP 1.0 sessions per AMQP 1.0 connection.

More than 64 AMQP 1.0 sessions per connection make little sense.
See also https://www.rabbitmq.com/blog/2024/09/02/amqp-flow-control#session

Limiting the maximum number of sessions per connection can be useful to
protect against
* applications that accidentally open new sessions without ending old sessions
  (session leaks)
* too many metrics being exposed, for example in the future via the
  "/metrics/per-object" Prometheus endpoint with timeseries per session
  being emitted.

This commit does not make use of the existing `channel_max` setting
because:
1. Given that `channel_max = 0` means "no limit", there is no way for an
   operator to limit the number of sessions per connections to 1.
2. Operators might want to set different limits for maximum number of
   AMQP 0.9.1 channels and maximum number of AMQP 1.0 sessions.
3. The default of `channel_max` is very high: It allows using more than
   2,000 AMQP 0.9.1 channels per connection. Lowering this default might
   break existing AMQP 0.9.1 applications.

This commit also fixes a bug in the AMQP 1.0 Erlang client which, prior
to this commit used channel number 1 for the first session. That's wrong
if a broker allows maximum 1 session by replying with `channel-max = 0`
in the `open` frame. Additionally, the spec recommends:
> To make it easier to monitor AMQP sessions, it is RECOMMENDED that implementations always assign the lowest available unused channel number.

Note that in AMQP 0.9.1, channel number 0 has a special meaning:
> The channel number is 0 for all frames which are global to the connection and 1-65535 for frames that
refer to specific channels.

* Apply PR feedback
2024-09-05 17:45:27 +02:00
Michael Davis d98e0f2dd2
rabbitmq_event_exchange: Test for parameters in exchange deletion
With the change in the parent commit we no longer set and clear a
runtime parameter when deleting an exchange as part of vhost deletion.
We need to adapt the `audit_vhost_internal_parameter` test case to test
that the parameter is set and cleared when the exchange is deleted
instead.
2024-09-05 11:42:13 -04:00
Michael Davis 17f6a2aaf6
Transactionally delete all exchanges during vhost deletion
Currently we delete each exchange one-by-one which requires three
commands: the delete itself plus a put and delete for a runtime
parameter that acts as a lock to prevent a client from declaring an
exchange while it's being deleted. The lock is unnecessary during vhost
deletion because permissions are cleared for the vhost before any
resources are deleted.

We can use a transaction to delete all exchanges and bindings for a
vhost in a single command against the Khepri store. This minimizes the
number of commands we need to send against the store and therefore the
latency of the deletion.

In a quick test with a vhost containing only 10,000 exchanges (no
bindings, queues, users, etc.), this is an order of magnitude speedup:
the prior commit takes 22s to delete the vhost while with this commit
the vhost is deleted in 2s.
2024-09-05 11:42:13 -04:00
Michael Davis e02f232dff
rabbit_db_binding: Prefer khepri_tx_adv:delete_many/1 to delete bindings
Currently we use a combination of `khepri_tx:get_many/1` and then either
`khepri_tx:delete/1` or `khepri_tx:delete_many/1`. This isn't a
functional change: switching to `khepri_tx_adv:delete_many/1` is
essentially equivalent but performs the deletion and lookup all in one
command and one traversal of the tree. This should improve performance
when deleting many bindings in an exchange.
2024-09-05 11:42:13 -04:00
Jean-Sébastien Pédron 6af9625e63
rabbitmq_recent_history_exchange: Respect RABBITMQ_METADATA_STORE in system_SUITE 2024-09-05 15:31:35 +02:00
Jean-Sébastien Pédron 94b8689284
Reorganize data in the Khepri store
[Why]

The previous layout followed the flat structure we have in Mnesia:
* In Mnesia, we have tables named after each purpose (exchanges, queues,
  runtime parameters and so on).
* In Khepri, we had about the same but the table names were replaced by
  a tree node in the tree. We ended up with one tree node per purpose
  at the root of the tree.

Khepri implements a tree. We could benefit from this and organize data
to reflect their relationship in RabbitMQ.

[How]

Here is the new hierarchy implemented by this commit:

    rabbitmq
    |-- users
    |   `-- $username
    |-- vhosts
    |   `-- $vhost
    |       |-- user_permissions
    |       |   `-- $username
    |       |-- exchanges
    |       |   `-- $exchange
    |       |       |-- bindings
    |       |       |   |-- queue
    |       |       |   |   `-- $queue
    |       |       |   `-- exchange
    |       |       |       `-- $exchange
    |       |       |-- consistent_hash_ring_state
    |       |       |-- jms_topic
    |       |       |-- recent_history
    |       |       |-- serial
    |       |       `-- user_permissions
    |       |           `-- $username
    |       |-- queues
    |       |   `-- $queue
    |       `-- runtime_params
    |           `-- $param_name
    |-- runtime_params
    |   `-- $param_name
    |-- mirrored_supervisors
    |   `-- $group
    |       `-- $id
    `-- node_maintenance
        `-- $node

We first define a root path in `rabbit/include/khepri.hrl` as
`[rabbitmq]`. This could be anything, including an empty path.

All paths are constructed either from this root path definition (users
and vhosts paths do that), or from a parent resource's path (exchanges
and queues paths are based on a vhost path).
2024-09-05 15:31:29 +02:00
Jean-Sébastien Pédron 98c2cd03da
Merge pull request #11795 from rabbitmq/unify-khepri-paths-api
Unify Khepri paths API
2024-09-05 15:29:30 +02:00
David Ansari 21b9515c3b Use snake case instead of camel case 2024-09-05 15:13:27 +02:00
Jean-Sébastien Pédron 1383c0c415
rabbt_db: Unify Khepri paths API
[Why]

Currently, `rabbit_db_*` modules use and export the following kind of
functions to return the path to the resources they manage:

    khepri_db_thing:khepri_things_path(),
    khepri_db_thing:khepri_thing_path(Identifier).

Internally, `khepri_db_thing:khepri_thing_path(Identifier)` appends
`Identifier` to the list returned by
`khepri_db_thing:khepri_things_path()`. This works for the organization
of the records we have today in Khepri:

    |-- thing
    |   |-- <<"identifier1">>
    |   |   <<"identifier2">>
    `-- other_thing
	`-- <<"other_identifier1">>

However, with the upcoming organization that leverages the tree in
Khepri, identifiers may be in the middle of the path instead of a leaf
component. We may also put `other_thing` under `thing` in the tree.

That's why, we can't really expose a parent directory for `thing` and
`other_thing`. Therefore, `khepri_db_thing:khepri_things_path/0` needs
to go away. Only `khepri_db_thing:khepri_thing_path/1` should be
exported and used.

In addition to that, there are several places where paths are hard-coded
(i.e. their definition is duplicated).

[How]

The patch does exactly that. Uses of
`khepri_db_thing:khepri_things_path()` are generally replaced by
`rabbit_db_thing:khepri_thing_path(?KHEPRI_WILDCARD_STAR)`.

Places where the path definitions were duplicated are fixed too by
calling the path building functions.

In the future, for a resource that depends on another one, the
corresponding module will call the `rabbit_db_thing:khepri_thing_path/1`
for that other resource and build its path on top of that.
2024-09-05 13:58:04 +02:00
Jean-Sébastien Pédron bc416757e8
Bump Khepri from 0.14.0 to 0.15.0
Release notes:
https://github.com/rabbitmq/khepri/releases/tag/v0.15.0
2024-09-05 11:36:45 +02:00
Michael Klishin b9eebc4487
Merge pull request #12215 from rabbitmq/add-connection-duration-to-closing-message
Add connection duration to "closing AMQP connection..." msgs
2024-09-04 22:50:32 -04:00
Michael Klishin a866ad3fd5 Revert "Do not quote connection duration"
This reverts commit 4299e1ddc3.

It can contain spaces as it is formatted to human-readable
values such as '4m, 36s'
2024-09-04 22:02:49 -04:00
Michael Klishin 4299e1ddc3 Do not quote connection duration
It cannot contain spaces like username,
virtual host and user-provided connection
name can.
2024-09-04 21:33:38 -04:00
Michael Davis c0a1c0cded
Merge pull request #12148 from rabbitmq/md/raft-cluster-prometheus-tag 2024-09-04 15:38:22 -05:00
Luke Bakken 3440e374d0
Add connection duration to "closing AMQP connection..." msgs
A while back, @mkuratczyk noted that we keep the timestamp of when a
connection is established in the connection state and related ETS table.

This PR uses the `connected_at` timestamp to calculate the duration of
the connection, to make it easier to identify short-running connections
via the log files.
2024-09-04 11:54:55 -07:00
Marcial Rosales a1206dc801 Move selenium to the root of the repo 2024-09-04 14:59:58 +01:00
Marcial Rosales 77b63d6799 Run selenium test suite against 3-node cluster 2024-09-04 10:06:54 +01:00
Michael Klishin 94baa7cfd4
Merge pull request #11702 from rabbitmq/mqtt-extract-client-id-from-cert
Extract MQTT client_id from client certificate and propagate to authnz backends
2024-09-03 10:53:19 -04:00
Michael Klishin 606a65169f Style, wording 2024-09-03 01:31:44 -04:00
GitHub f95527d6b5 bazel run gazelle 2024-09-03 04:02:30 +00:00
Arnaud Cogoluègnes 56964a8f28
Merge pull request #12074 from rabbitmq/issue-11915
Cancel AMQP stream consumer when local stream member is deleted
2024-09-02 16:07:58 +02:00
Loïc Hoguin f0932e3d42
Merge pull request #11778 from rabbitmq/loic-make-it-big
Make cleanups and ct-master introduction
2024-09-02 13:54:39 +02:00
Loïc Hoguin 05b701b3f4
rabbit tests: Don't fail if rabbit already loaded
Seems that this can happen if multiple test suites are running
one after the other and a previous test suite did not clean up
perfectly.
2024-09-02 11:44:16 +02:00
Michael Klishin c831ae46d1
Fix a typo in rabbit_oauth2_config_SUITE, references #11965 2024-09-01 04:50:56 -04:00
Jean-Sébastien Pédron fa6d89212a
Merge pull request #12163 from rabbitmq/fix-node-state-after-failure-to-join-cluster
rabbit_db_cluster: Reset feature flags immediately after a failure to join
2024-08-31 13:38:46 +02:00
Michael Davis 512f8838fd
Add prometheus tags for raft_cluster to non-QQ raft metrics
By default Ra will use the cluster name as the metrics key. Currently
atom values are ignored by the prometheus plugin's tag rendering
functions, so if you have a QQ and Khepri running and request the
`/metrics/per-object` or `/metrics/detailed` endpoints you'll see values
that don't have labels set for the `ra_metrics` metrics:

    # TYPE rabbitmq_raft_term_total counter
    # HELP rabbitmq_raft_term_total Current Raft term number
    rabbitmq_raft_term_total{vhost="/",queue="qq"} 9
    rabbitmq_raft_term_total 10

With this change we map the name of the Ra cluster to a "raft_cluster"
tag, so instead an example metric might be:

    # TYPE rabbitmq_raft_term_total counter
    # HELP rabbitmq_raft_term_total Current Raft term number
    rabbitmq_raft_term_total{vhost="/",queue="qq"} 9
    rabbitmq_raft_term_total{raft_cluster="rabbitmq_metadata"} 10

This affects metrics for Khepri and the stream coordinator.
2024-08-30 12:41:37 -04:00
Jean-Sébastien Pédron bfc6f83306
rabbit_db_cluster: Reset feature flags immediately after a failure to join
[Why]
If a node failed to join a cluster, `rabbit` was restarted then the
feature flags were reset and the error returned. I.e., the error
handling was in a single place at the end of the function.

We need to reset feature flags after a failure because the feature flags
states were copied from the remote node just before the join.

However, resetting them after restarting `rabbit` was incorrect because
feature flags were initialized in a way that didn't match the rest of
the state. This led to crashes during the start of `rabbit`.

[How]
The feature flags are now reset after the failure to join but before
starting `rabbit`.

A new testcase was added to test this scenario.
2024-08-30 17:41:25 +02:00
Péter Gömöri 29a5e7965c Document request and connection timeout configs of the http auth backend 2024-08-30 17:13:04 +02:00
Michael Klishin ec0d24b706
Merge pull request #12182 from rabbitmq/use-dotnet-8.0
Update .NET to 8.0
2024-08-30 10:23:06 -04:00
Michal Kuratczyk 0885ba757a
Remove queue-version CQ argument
It is no longer possible to set the version
when declaring a queue/policy, since only v2 is supported.
2024-08-30 14:02:02 +02:00
Marcial Rosales 1abc4ed02f Extract client_id from client cert 2024-08-30 11:39:48 +01:00
Michal Kuratczyk 301424235c
Update .NET to 8.0 2024-08-30 08:42:53 +02:00
GitHub ef1ca774ff bazel run gazelle 2024-08-30 04:02:30 +00:00
Michael Klishin e03664def9
Merge pull request #12172 from rabbitmq/SimonUnge-fix_shovel_get
Minor fix: GET/HEAD method on non existing shovel crash
2024-08-29 17:15:00 -04:00
Simon Unge 16463e72cc Minor fix: GET/HEAD method on non existing shovel crash 2024-08-29 20:05:47 +00:00
Marcial Rosales 17ca51dcc5 Test merge signing keys when using oauth_providers 2024-08-29 15:19:03 +01:00
Loïc Hoguin a17fb13a03
make: Initial work on using ct_master to run tests
Because `ct_master` is yet another Erlang node, and it is used
to run multiple CT nodes, meaning it is in a cluster of CT
nodes, the tests that change the net_ticktime could not
work properly anymore. This is because net_ticktime must
be the same value across the cluster.

The same value had to be set for all tests in order to solve
this. This is why it was changed to 5s across the board. The
lower net_ticktime was used in most places to speed up tests
that must deal with cluster failures, so that value is good
enough for these cases.

One test in amqp_client was using the net_ticktime to test
the behavior of the direct connection timeout with varying
net_ticktime configurations. The test now mocks the
`net_kernel:get_net_ticktime()` function to achieve the
same result.
2024-08-29 15:23:31 +02:00
Loïc Hoguin c66e8740e8
rabbit tests: Redirect logs to ct always
Doing it on a per test suite basis leads to issues if multiple
suites try to configure it, and there's no cleanup performed
anyway.
2024-08-29 15:22:40 +02:00
Loïc Hoguin 7ad8e2856b
make: Restrict Erlang.mk plugin inclusion
This has no real impact on performance[1] but should
make it clear which application can run the broker
and/or publish to Hex.pm. In particular, applications
that we can't run the broker from will now give up
early if we try to.

Note that while the broker can't normally run from the
amqp_client application's directory, it can run from
tests and some of the tests start the broker.

[1] on my machine
2024-08-29 15:19:50 +02:00
Loïc Hoguin 445f3c9270
make: Move rabbitmq-early-test.mk to rabbitmq-early-plugin.mk
No real need to have two files, especially since it contains
only a few variable definitions. Plan is to only keep
separate files for larger features such as dist or run.
2024-08-29 15:19:50 +02:00
Loïc Hoguin 7421d4d15f
make: Additional cleanups 2024-08-29 15:19:50 +02:00
Loïc Hoguin d4222f8216
make: Remove emptied rabbitmq-tools.mk 2024-08-29 15:19:14 +02:00
Loïc Hoguin 7cb0c1b217
make: Refactor PROJECT_VERSION computation 2024-08-29 15:19:14 +02:00
Loïc Hoguin 48795d7cf3
make: Remove update-contributor-code-of-conduct target
The relevant files have been symlinked to the root file
for the past two years.
2024-08-29 15:19:14 +02:00
Loïc Hoguin d9d74d0964
make: Remove ct-logs-archive target
Hasn't been used for a long time.
2024-08-29 15:19:14 +02:00
Loïc Hoguin f3d0d4e113
make: Remove sync-gitremote sync-gituser targets
They are not useful for the monorepo.
2024-08-29 15:19:14 +02:00
Loïc Hoguin a5cfb1ea9a
make: Remove show-upstream-git-fetch-url and co
They haven't been necessary for quite some time.
2024-08-29 15:19:14 +02:00
Loïc Hoguin 4e8ad90cd0
make: Remove commits-since-release
This was only relevant before the monorepo.
2024-08-29 15:19:14 +02:00
Loïc Hoguin 31409e86b0
make: Remove show-branch target
Not useful in the monorepo.
2024-08-29 15:19:14 +02:00
Loïc Hoguin b8bcd5c27c
make: Remove sync-gitignore-from-main target
No longer relevant because of the monorepo
2024-08-29 15:19:14 +02:00
Loïc Hoguin e947e098bd
make: Remove rabbitmq-deps.mk related targets 2024-08-29 15:19:14 +02:00
Loïc Hoguin 7e7e6feb9d
make: Remove rabbitmq-tests.mk
Everything in this file seems to be dead code except
ct-slow/ct-fast, which have been replaced by their
equivalent in the rabbit Makefile.
2024-08-29 15:19:13 +02:00
Marcial Rosales 18bd43aa50 Improve formatting and add misisng test case 2024-08-29 12:44:49 +01:00
Marcial Rosales 72b6bbdb35 Add more test cases 2024-08-29 12:44:49 +01:00
Marcial Rosales 77e8172009 Support tokens without kid when using multiple resources 2024-08-29 12:44:49 +01:00
Michal Kuratczyk 8a03975ba7
Set the default vm_memory_high_watermark to 0.6 (#12161)
The default of 0.4 was very conservative even when it was
set years ago. Since then:
- we moved to CQv2, which have much more predictable memory usage than (non-lazy) CQv1 used to
- we removed CQ mirroring which caused large sudden memory spikes in some situations
- we removed the option to store message payload in memory in quorum queues

For the past two years or so, we've been running all our internal tests and benchmarks
using the value of 0.8 with no OOMkills at all (note: we do this on
Kubernetes where the Cluster Operators overrides the available memory
levaing some additional headroom, but effectively we are still using  more than
0.6 of memory).
2024-08-29 12:10:49 +02:00
Jean-Sébastien Pédron b6e8586657
Merge pull request #12131 from rabbitmq/filter-running-nodes-to-cluster-khepri
Khepri: Filter running nodes when selecting a node to cluster with
2024-08-29 10:33:55 +02:00
Michael Klishin 4fbfd9853a
Merge pull request #12153 from rabbitmq/cloudamqp-exchange_logging_unicode
Support unicode messages by exchange logging
2024-08-28 22:36:14 -04:00
Michael Klishin 585a8ffbfa
Merge pull request #12140 from rabbitmq/remove-unused-configs
Remove some dead code and configuration options
2024-08-28 20:06:29 -04:00
Péter Gömöri 065395e9b8 Hibernate 2 metrics gc processes
It was observed that `rabbit_core_metrics_gc` and
`rabbit_stream_metrics_gc` processes can grow to several MBs of
memory (probably because fetching the list of all queues). As they
execute infrequently (every 2 minutes by default) it can save some
memory to hibernate them in-between (similar to other similar
processes).
2024-08-28 19:41:27 +02:00
Jean-Sébastien Pédron 1656c61809
Khepri: Filter running nodes when selecting a node to cluster with
[Why]
So far, the code that selected the node to use as the "entry point" to
add the local node to a remote cluster assumed that all cluster members
were running and it picked the first node in the cluster members list.

If that node was stopped, the join would fail immediately, even if the
rest of the members were running fine.

[How]
Now the function filters out nodes that are unavailable or don't run the
expected Khepri store. Then it uses the resulting list as before.

The code returns an error if all nodes are stopped or unreachable.
2024-08-28 17:38:30 +02:00
Péter Gömöri 531d6d2922 Support unicode messages by exchange logging
Before this commit formatting the amqp body would crash and the log
message would not be published to the log exchange.

Before commit 34bcb911 it even crashed the whole exchange logging
handler which caused the log exchange to be deleted.
2024-08-28 17:33:17 +02:00
D Corbacho afa28cbdb3
Merge pull request #12118 from rabbitmq/issue-11985
MQTT and Streams: handle connection shutdown via CLI command gracefully
2024-08-28 14:27:19 +02:00
David Ansari 8c905b9009 Avoid crash in stream connection
1.
Prior to this commit, closing a stream connection via:
```
./sbin/rabbitmqctl close_all_user_connections guest enough
```
crashed the stream process as follows:
```
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>   crasher:
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>     initial call: rabbit_stream_reader:init/1
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>     pid: <0.1098.0>
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>     registered_name: []
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>     exception error: no function clause matching
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>                      rabbit_stream_reader:open({call,
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>                                                 {<0.1233.0>,
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>                                                  #Ref<0.519694519.1387790337.15898>}},
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>                                                {shutdown,<<"enough">>},
```

This commit fixes this crash.

2.
Both CLI commands and management plugin use the same way
to close MQTT, Web MQTT, and Stream connections: They all send a message
via `Pid ! {shutdown, Reason}` to the connection.

3.
This commit avoids making `rabbit` core app to know about
'Web MQTT'.

4
This commit simplifies rabbit_mqtt_reader by avoiding another
handle_call clause
2024-08-28 13:19:10 +02:00
David Ansari 69d407e6b6 Simplify test cases
1. Only run the CLI tests on a single node cluster. The shared_SUITE is
   already very big. Testing the same CLI commands against node-0 on a
   3-node cluster brings no benefit.
2. Move the two new CLI test cases in front of
   management_plugin_connection because they are similar in that all
   three tests close the MQTT connection.
3. There is no need to query the HTTP API for the two new CLI test
   cases.
4. There is no need to set keepalive in the two new CLI test cases.
2024-08-28 13:18:45 +02:00
Michal Kuratczyk 9b828c08b7
Remove HiPE 2024-08-28 09:18:28 +02:00
Michal Kuratczyk a48fcbaac1
Remove `autocluster` 2024-08-28 08:12:49 +02:00
Michal Kuratczyk f82f011d64
Remove classic_queue_default_version 2024-08-28 08:12:49 +02:00
Michal Kuratczyk b8b6d36b7b
Remove halt_on_upgrade_failure 2024-08-28 08:12:49 +02:00
Michal Kuratczyk fa221d8eca
Remove memory_monitor_interval 2024-08-28 08:12:49 +02:00
Michal Kuratczyk 116ab4f6fe
Remove memory_high_watermark_paging_ratio 2024-08-28 08:12:49 +02:00
dependabot[bot] 03cf6dadcb
Bump org.apache.maven.plugins:maven-surefire-plugin
Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/apache/maven-surefire/releases)
- [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.4.0...surefire-3.5.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-surefire-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-27 18:48:40 +00:00
Michael Klishin c8b93e12e2
Merge pull request #12132 from rabbitmq/dependabot/maven/deps/rabbitmq_mqtt/test/java_SUITE_data/main/org.apache.maven.plugins-maven-surefire-plugin-3.5.0
Bump org.apache.maven.plugins:maven-surefire-plugin from 3.4.0 to 3.5.0 in /deps/rabbitmq_mqtt/test/java_SUITE_data
2024-08-27 14:29:09 -04:00
dependabot[bot] e5885415b7
Bump org.apache.maven.plugins:maven-surefire-plugin
Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/apache/maven-surefire/releases)
- [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.4.0...surefire-3.5.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-surefire-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-27 18:19:05 +00:00
dependabot[bot] e3caab47af
Bump org.apache.maven.plugins:maven-surefire-plugin
Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/apache/maven-surefire/releases)
- [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.4.0...surefire-3.5.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-surefire-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-27 18:09:54 +00:00
Diana Parra Corbacho ea6ef17cc0 Mqtt: test close connection 2024-08-27 16:44:18 +02:00
Michael Davis 5b3ae230b7
Merge pull request #12082 from rabbitmq/md/khepri/db-queue-deletion 2024-08-27 07:47:06 -05:00
David Ansari 55e6d582c4 Incrase default rabbit.max_link_credit
from 128 to 170. See comments for rationale.

On an Ubuntu box, run
```
quiver //host.docker.internal//queues/my-quorum-queue --durable --count 100k --duration 10m --body-size 12 --credit 10000
```

Before this commit:
```
RESULTS

Count ............................................... 100,000 messages
Duration ............................................... 11.0 seconds
Sender rate ........................................... 9,077 messages/s
Receiver rate ......................................... 9,097 messages/s
End-to-end rate ....................................... 9,066 messages/s
```

After this commit:
```
RESULTS

Count ............................................... 100,000 messages
Duration ................................................ 6.2 seconds
Sender rate .......................................... 16,215 messages/s
Receiver rate ........................................ 16,271 messages/s
End-to-end rate ...................................... 16,166 messages/s
```

That's because more `#enqueue{}` Ra commands can be batched before
fsyncing.

So, this commit brings the performance of scenario "a single connection publishing to
a quorum queue with large number (>200) of unconfirmed publishes" in AMQP 1.0
closer to AMQP 0.9.1.
2024-08-27 12:08:46 +02:00
David Ansari 314d4e2722 Unskip mixed version tests
As described in the 4.0 release notes:
> RabbitMQ Shovels will be able connect to a RabbitMQ 4.0 node via AMQP 1.0 only when the Shovel runs on a RabbitMQ node >= 3.13.7.
2024-08-26 10:37:30 +02:00
Diana Parra Corbacho 494c1b8209 mqtt: handle connection shutdown
`{shutdown, Reason}` must be handled into handle_call and not handle_info
`rabbitmqctl close_all_user_connections` calls rabbit_reader which does
a call into the process, the same as rabbitmq_management
2024-08-26 09:44:39 +02:00
Michael Klishin 6b444ae907 Exclude this Khepri-specific test from mixed version cluster runs 2024-08-24 21:54:25 -04:00
Michael Klishin d7d1397d4b Update is_quorum_critical_test for #12133
Now the API endpoint can return Khepri as
a "queue" (or "stream") without the necessary
number of replicas online.

So don't expect the list to only have one element.
2024-08-24 21:25:29 -04:00
Michael Klishin f47daee915 Wording #12113 2024-08-24 19:07:09 -04:00
Michal Kuratczyk 6ca2022fcf await quorum+1 improvements
1. If khepri_db is enabled, rabbitmq_metadata is a critical component
2. When waiting for quorum+1, periodically log what doesn't have the
   quorum+1
   - for components: just list them
   - for queues: list how many we are waiting for and how to display
     them (because there could be a large number, logging that
     could be impractical or even dangerous)
3. make the tests signficantly faster by using a single group
2024-08-24 18:49:35 -04:00
Michael Klishin 96fc028352 Add a type spec 2024-08-24 18:25:44 -04:00
Michael Klishin 768b2f6925 Update HTTP API tests
This relaxes assert_list/2 assertion to
not require the size of an actually returned list element
to be exactly equal to the size of the expected one.

Sometimes it makes perfect sense to not assert on
every single key but only a subset, and with this
change, it now will be possible.

Individual tests may choose to assert on all
keys by listing them explicitly.
2024-08-24 14:50:37 -04:00
Michael Klishin c41c27de06 One more node-wide DQT test
References #11541 #11457 #11528
2024-08-24 05:50:20 -04:00
Michael Klishin 29051a8113 DQT: fall back to node-wide default
when virtual host does not have any metadata.

References #11541 #11457 #11528
2024-08-24 04:03:04 -04:00
Péter Gömöri 34bcb91159 Prevent exchange logging crash
Don't let the `log` callback of exchange_logging handler crash,
because in case of a crash OTP logger removes the exchange_logger
handler, which in turn deletes the log exchange and its bindings.

It was seen several times in production that the log exchange suddenly
disappears and without debug logging there is no trace of why.

With this commit `erlang:display` will print the reason and stacktrace
to stderr without using the logging infrastructure.
2024-08-23 00:28:10 +02:00
Michael Klishin 58d4e753ee
Merge pull request #12091 from rabbitmq/wal
Run with default wal_sync_method
2024-08-22 15:36:11 -04:00
Michael Klishin 5235b38156
Merge pull request #12095 from rabbitmq/dependabot/maven/deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot/main/org.springframework.boot-spring-boot-starter-parent-3.3.3
Bump org.springframework.boot:spring-boot-starter-parent from 3.3.2 to 3.3.3 in /deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot
2024-08-22 15:33:31 -04:00
Michael Klishin 0cab95a38d
Merge pull request #12094 from rabbitmq/dependabot/maven/deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot_kotlin/main/org.springframework.boot-spring-boot-starter-parent-3.3.3
Bump org.springframework.boot:spring-boot-starter-parent from 3.3.2 to 3.3.3 in /deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot_kotlin
2024-08-22 15:32:03 -04:00
dependabot[bot] 8d86a9f77f
Bump org.springframework.boot:spring-boot-starter-parent
Bumps [org.springframework.boot:spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 3.3.2 to 3.3.3.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](https://github.com/spring-projects/spring-boot/compare/v3.3.2...v3.3.3)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-parent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-22 19:01:54 +00:00
dependabot[bot] bba1bc526f
Bump org.springframework.boot:spring-boot-starter-parent
Bumps [org.springframework.boot:spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 3.3.2 to 3.3.3.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](https://github.com/spring-projects/spring-boot/compare/v3.3.2...v3.3.3)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-parent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-22 18:38:34 +00:00
dependabot[bot] e1130a491b
Bump kotlin.version
Bumps `kotlin.version` from 2.0.10 to 2.0.20.

Updates `org.jetbrains.kotlin:kotlin-test` from 2.0.10 to 2.0.20
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/v2.0.20/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v2.0.10...v2.0.20)

Updates `org.jetbrains.kotlin:kotlin-maven-allopen` from 2.0.10 to 2.0.20

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlin:kotlin-test
  dependency-type: direct:development
  update-type: version-update:semver-patch
- dependency-name: org.jetbrains.kotlin:kotlin-maven-allopen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-22 18:38:29 +00:00
Michael Klishin 9b6041d7f1
Merge pull request #12085 from rabbitmq/metadata_store_status-mnesia
Don't return khepri status when khperi_db is disabled
2024-08-22 13:30:20 -04:00
David Ansari ffefefba0f Run with default wal_sync_method
...which is `datasync`

RA never pre-allocates the WAL anymore unless explicitly configured to.
2024-08-22 16:24:07 +00:00
Michael Davis 4a8d01e79b
Handle rabbit_amqqueue:internal_delete/2 failures in quorum queues 2024-08-22 12:18:45 -04:00
Michael Davis 2302eb9a11
Handle rabbit_amqqueue:internal_delete/3 failures in classic queues
The design of `rabbit_amqqueue_process` makes this change challenging.
The old implementation of the handler of the `{delete,_,_,_}` command
simply stopped the process and any cleanup was done in `gen_server2`'s
`terminate` callback. This makes it impossible to pass any error back
to the caller if the record can't be deleted from the metadata store
before a timeout.

The strategy taken here slightly mirrors an existing
`{shutdown, missing_owner}` termination value which can be returned from
`init_it2/3`. We pass the `ReplyTo` for the call with the state. We then
optionally reply to this `ReplyTo` if it is set in `terminate_delete/4`
with the result of `rabbit_amqqueue:internal_delete/3`. So deletion of
a classic queue will terminate the process but may return an error to
the caller if the record can't be removed from the metadata store
before the timeout.
2024-08-22 12:17:44 -04:00
Michael Klishin 39679f58d9
Merge pull request #12073 from rabbitmq/osiris-1.8.3
Osiris v1.8.3
2024-08-22 12:17:37 -04:00
Diana Parra Corbacho 0061944e9c Cancel AMQP stream consumer when local stream member is deleted
The consumer reader process is gone and there is no way to recover
it as the node does not have a member of the stream anymore,
so it should be cancelled/detached.
2024-08-22 12:39:52 +02:00
Jean-Sébastien Pédron 363cc8586c
rabbit_khepri: Set `default_ra_system` Khepri setting
[Why]
It allows to restart Khepri using `khepri:start()`, e.g. from a shell.
2024-08-22 12:18:19 +02:00
Michal Kuratczyk b48d4bf29a
Don't return khepri status when khperi_db is disabled
When khepri_db feature flag is disabled, Khepri servers
are running but are not clustered. In this case `rabbit_khepri:status/0`
shows that all nodes are leaders, which is confusing and scary
(even though actually harmless). Instead, we now just print that mnesia
is in use.
2024-08-22 11:01:46 +02:00
Michael Davis a7d099de8c
cluster_minority_SUITE: Add a case for queue deletion 2024-08-21 16:23:48 -04:00
Michael Davis 0bb203e769
rabbit_db_queue: Add timeout error to delete/2 spec 2024-08-21 16:23:48 -04:00
Michael Davis 9774d8d833
minor: Use rabbit_misc:rs/1 formatting for stream delete failure msg
`rabbit_misc:rs/1` formats a string "queue {name} in vhost {vhost}" so
the "queue" and single quotes in the prior message can be removed.
2024-08-21 15:21:26 -04:00
Michael Klishin 1795306f3f HTTP API: make sure virtual host limits are returned as a JSON object
when no limits are set.

This is the classic empty proplist JSON serialization
problem in a relatively new place.
2024-08-21 15:13:53 -04:00
Karl Nilsson baa64102fd Osiris v1.8.3
This release contains fixes around certain recovery failures where
there are either orphaned segment files (that do not have a corresponding
index file) or index files that do not have a corresponding segment
file.
2024-08-21 08:48:58 +01:00
Jean-Sébastien Pédron 36aa94a994
Merge pull request #12065 from rabbitmq/list-exchange-names-from-khepri-projection
rabbit_db_exchange: List exchange names from Khepri projection
2024-08-21 09:09:02 +02:00
Simon Unge 782823fd39 bazel fixes 2024-08-20 23:55:11 -04:00
Simon Unge 5189adf144 Add qq status to mgmt api 2024-08-20 23:55:11 -04:00
Michael Klishin f8f0d33aa7
Merge pull request #12035 from rabbitmq/stream-mgmt-queue-page-tweaks
Management: Add segment count to stream queue page
2024-08-20 23:03:22 -04:00
Michael Davis dce8135d30
Add test cases for the '--experimental' flag 2024-08-20 16:23:17 -04:00
Michael Davis dc611dd45c
Non-zero exit code for failing to enable an experimental feature flag
With the prior behavior it can be unclear whether the text was a warning
and the feature flag was enabled anyways. We can use a non-zero exit
code and the `{:error, code, text}` return value to make it clear that
the flag wasn't enabled.
2024-08-20 16:03:29 -04:00
Michael Davis f0c0cf8052
enable_feature_flag CLI: Fix typo in usage message 2024-08-20 15:25:20 -04:00
Jean-Sébastien Pédron 20f2850875
rabbit_db_exchange: List exchange names from Khepri projection
[Why]
All other queries are based on projections, not direct queries to
Khepri. Using projections for exchange names should be faster and more
consistent with the rest of the module.

[How]
The Khepri query is replaced by an ETS query.
2024-08-20 17:35:34 +02:00
David Ansari 1c6f4be308 Rename quorum queue priority from "low" to "normal"
Rename the two quorum queue priority levels from "low" and "high" to "normal" and
"high". This improves user experience because the default priority level is low /
normal. Prior to this commit users were confused why their messages show
up as low priority. Furthermore there is no need to consult the docs to
know whether the default priority level is low or high.
2024-08-20 11:18:36 +02:00
Michael Klishin ca81b9110c
Merge pull request #12057 from rabbitmq/dependabot/maven/deps/rabbitmq_mqtt/test/java_SUITE_data/main/org.apache.maven.plugins-maven-surefire-plugin-3.4.0
Bump org.apache.maven.plugins:maven-surefire-plugin from 3.3.1 to 3.4.0 in /deps/rabbitmq_mqtt/test/java_SUITE_data
2024-08-19 15:45:19 -04:00
Michael Klishin 24b4371a2a
Merge pull request #11998 from rabbitmq/experimental-ff-safeguards
Make it hard to accidentally enable an experimental feature flag
2024-08-19 15:45:05 -04:00
dependabot[bot] 8147006c6d
Bump org.apache.maven.plugins:maven-surefire-plugin
Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.3.1 to 3.4.0.
- [Release notes](https://github.com/apache/maven-surefire/releases)
- [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.3.1...surefire-3.4.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-surefire-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-19 19:02:14 +00:00
dependabot[bot] 8c87c717ea
Bump org.apache.maven.plugins:maven-surefire-plugin
Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.3.1 to 3.4.0.
- [Release notes](https://github.com/apache/maven-surefire/releases)
- [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.3.1...surefire-3.4.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-surefire-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-19 18:42:03 +00:00
dependabot[bot] 12db37a2b2
Bump org.apache.maven.plugins:maven-surefire-plugin
Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.3.1 to 3.4.0.
- [Release notes](https://github.com/apache/maven-surefire/releases)
- [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.3.1...surefire-3.4.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-surefire-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-19 18:09:24 +00:00
Michal Kuratczyk 396ad7af1a Reject `--experimental all` 2024-08-19 13:41:37 -04:00
Michal Kuratczyk ddb117f810 `-f` -> `-e`; drop unneeded cases; typos
Also, remove the `undef` case which was only needed for
RabbitMQ 3.7 and older.
2024-08-19 13:41:37 -04:00
Michal Kuratczyk e3302f2f9a Rename --force to --experimental
Plus, a slightly more scary error message
2024-08-19 13:41:37 -04:00
Michal Kuratczyk 58e0c1600f Require --force to enable experimental FF 2024-08-19 13:41:37 -04:00
Michal Kuratczyk d9819bc534 Prevent accidentally enabling experimental FFs 2024-08-19 13:41:37 -04:00
David Ansari b105ca9877 Remove randomized_startup_delay_range config
For RabbitMQ 4.0, this commit removes support for the deprecated `rabbitmq.conf` settings
```
cluster_formation.randomized_startup_delay_range.min
cluster_formation.randomized_startup_delay_range.max
```

The rabbitmq/cluster-operator already removed these settings in
b81e0f9bb8
2024-08-19 14:34:32 +02:00
David Ansari 314ff387b1 Build map more efficiently
Call maps:from_list/1 once instead of iteratively adding key/value
associations to the map.
2024-08-19 12:09:20 +02:00
Michael Klishin d3ea7588a9 Remove a Shovel JSON formatting function that's no longer necessary
It's been eight years since 28060d517b
2024-08-18 01:22:40 -04:00
Michael Klishin 0c3862243e Shovel HTTP API: more tests for dynamic shovels 2024-08-18 00:24:32 -04:00
Michael Klishin b5961dafdc Closes #12040 2024-08-16 22:34:36 -04:00
Michael Davis 49c645a076
Fix rabbit_db_queue_SUITE:update_decorators case
This test called `rabbit_db_queue:update_decorators/1` which doesn't
exist - instead it can call `update_decorators/2` with an empty list.
This commit also adds the test to the `all_tests/0` list - it being
absent is why this wasn't caught before.
2024-08-16 13:27:29 -04:00
Michael Davis f80cd7d477
rabbit_db_queue: Remove unused `set_many/1`
This function was only used by classic mirrored queue code which was
removed in 3bbda5b.
2024-08-16 13:26:37 -04:00
Karl Nilsson 615d150b35 Management: Add segment count to stream queue page
Also improve the help message for the 'Messages' count.
2024-08-16 17:32:27 +01:00
Michael Klishin 7121b802e4
Merge pull request #12026 from rabbitmq/maintenance-revive-fixes
Fixes to rabbit_maintenance:revive/0
2024-08-16 12:15:21 -04:00
Michael Klishin f1d51e19f4
Merge pull request #12032 from rabbitmq/sasl-mechanisms-order
Maintain order of configured SASL mechanisms
2024-08-16 12:13:32 -04:00
David Ansari b6fbc0292a Maintain order of configured SASL mechanisms
RabbitMQ should advertise the SASL mechanisms in the order as
configured in `rabbitmq.conf`.

Starting RabbitMQ with the following `rabbitmq.conf`:
```
auth_mechanisms.1 = PLAIN
auth_mechanisms.2 = AMQPLAIN
auth_mechanisms.3 = ANONYMOUS
```

translates prior to this commit to:
```
1> application:get_env(rabbit, auth_mechanisms).
{ok,['ANONYMOUS','AMQPLAIN','PLAIN']}
```

and after this commit to:
```
1> application:get_env(rabbit, auth_mechanisms).
{ok,['PLAIN','AMQPLAIN','ANONYMOUS']}
```

In our 4.0 docs we write:
> The server mechanisms are ordered in decreasing level of preference.

which complies with https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-security-v1.0-os.html#type-sasl-mechanisms
2024-08-16 14:38:36 +02:00
Karl Nilsson c12d5a1b17
Merge pull request #11937 from rabbitmq/default-delivery-limit
QQ: introduce a default delivery limit
2024-08-16 12:55:46 +01:00
David Ansari 3e7f5a00e2 Fix AMQP 1.0 SASL CR Demo
```
switch_callback(State1, {frame_header, sasl}, 8);
```
was missing.

Tidy up various other small things.
2024-08-16 13:24:49 +02:00
Karl Nilsson 3a386f46d2 Show delivery-count on queue page for quorum queues.
To make it more visible that a default is in place.

Also added publisher count as it was easy to do so.
2024-08-16 10:32:45 +01:00
Karl Nilsson 2dcced6967 Maintenance mode: change revive to use quorum queue recovery function.
As this already does the job.
2024-08-16 10:05:53 +01:00
Karl Nilsson 8b2fccc659 Fix rabbit_amqqueue:list_local_followers/1
To ensure it only returns followers for queues that actually have
a local member.
2024-08-16 09:35:10 +01:00
Karl Nilsson daecdb07c2 QQ: introduce a delivery_limit default
If the delivery_limit of a quorum queue is not set by queue arg and/or
policy it will now be defaulted to 20.
2024-08-16 08:58:44 +01:00
GitHub 3e9cb1ed1b bazel run gazelle 2024-08-16 04:02:25 +00:00
Michael Klishin 178f9a962e
Merge pull request #11964 from rabbitmq/qq-checkpointing-tweaks
QQ: checkpointing frequency improvements
2024-08-15 20:49:24 -04:00
Michael Klishin 1fb70c7e95 Correct a couple of doc guide links 2024-08-15 16:04:46 -04:00
Michael Davis 9ca77f8efe
Remove max_in_memory_length/bytes from QQ config type
Also remove a resolved TODO about conversion for the `last_checkpoint`
field.
2024-08-15 15:44:28 -04:00
Michael Davis 140abd871a
Merge pull request #11980 from rabbitmq/md/khepri-minority-errors/queue-declaration 2024-08-15 14:26:08 -05:00
Michael Klishin 2058f449a1
Merge pull request #11999 from rabbitmq/sasl-anon
Add SASL mechanism ANONYMOUS
2024-08-15 13:12:41 -04:00
Michael Klishin 2f165e02f2 rabbitmq-upgrade revive: handle more errors
returned by Ra, e.g. when a replica cannot be
restarted because of a concurrent delete
or because a QQ was inserted into a schema data
store but not yet registered as a process on
the node.

References #12013.
2024-08-15 10:02:02 -04:00
David Ansari b09f2d4da3 Save a Cuttlefish translation 2024-08-15 15:00:09 +02:00
David Ansari ba14b158af Remove mqtt.default_user and mqtt.default_pass
This commit is a breaking change in RabbitMQ 4.0.

 ## What?
Remove mqtt.default_user and mqtt.default_pass
Instead, rabbit.anonymous_login_user and rabbit.anonymous_login_pass
should be used.

 ## Why?
RabbitMQ 4.0 simplifies anonymous logins.
There should be a single configuration place
```
rabbit.anonymous_login_user
rabbit.anonymous_login_pass
```
that is used for anonymous logins for any protocol.

Anonymous login is orthogonal to the protocol the client uses.
Hence, there should be a single configuration place which can then be
used for MQTT, AMQP 1.0, AMQP 0.9.1, and RabbitMQ Stream protocol.

This will also simplify switching to SASL for MQTT 5.0 in the future.
2024-08-15 10:58:48 +00:00
David Ansari d46f07c0a4 Add SASL mechanism ANONYMOUS
## 1. Introduce new SASL mechanism ANONYMOUS

 ### What?
Introduce a new `rabbit_auth_mechanism` implementation for SASL
mechanism ANONYMOUS called `rabbit_auth_mechanism_anonymous`.

 ### Why?
As described in AMQP section 5.3.3.1, ANONYMOUS should be used when the
client doesn't need to authenticate.

Introducing a new `rabbit_auth_mechanism` consolidates and simplifies how anonymous
logins work across all RabbitMQ protocols that support SASL. This commit
therefore allows AMQP 0.9.1, AMQP 1.0, stream clients to connect out of
the box to RabbitMQ without providing any username or password.

Today's AMQP 0.9.1 and stream protocol client libs hard code RabbitMQ default credentials
`guest:guest` for example done in:
* 0215e85643/src/main/java/com/rabbitmq/client/ConnectionFactory.java (L58-L61)
* ddb7a2f068/uri.go (L31-L32)

Hard coding RabbitMQ specific default credentials in dozens of different
client libraries is an anti-pattern in my opinion.
Furthermore, there are various AMQP 1.0 and MQTT client libraries which
we do not control or maintain and which still should work out of the box
when a user is getting started with RabbitMQ (that is without
providing `guest:guest` credentials).

 ### How?
The old RabbitMQ 3.13 AMQP 1.0 plugin `default_user`
[configuration](146b4862d8/deps/rabbitmq_amqp1_0/Makefile (L6))
is replaced with the following two new `rabbit` configurations:
```
{anonymous_login_user, <<"guest">>},
{anonymous_login_pass, <<"guest">>},
```
We call it `anonymous_login_user` because this user will be used for
anonymous logins. The subsequent commit uses the same setting for
anonymous logins in MQTT. Hence, this user is orthogonal to the protocol
used when the client connects.

Setting `anonymous_login_pass` could have been left out.
This commit decides to include it because our documentation has so far
recommended:
> It is highly recommended to pre-configure a new user with a generated username and password or delete the guest user
> or at least change its password to reasonably secure generated value that won't be known to the public.

By having the new module `rabbit_auth_mechanism_anonymous` internally
authenticate with `anonymous_login_pass` instead of blindly allowing
access without any password, we protect operators that relied on the
sentence:
> or at least change its password to reasonably secure generated value that won't be known to the public

To ease the getting started experience, since RabbitMQ already deploys a
guest user with full access to the default virtual host `/`, this commit
also allows SASL mechanism ANONYMOUS in `rabbit` setting `auth_mechanisms`.

In production, operators should disable SASL mechanism ANONYMOUS by
setting `anonymous_login_user` to `none` (or by removing ANONYMOUS from
the `auth_mechanisms` setting. This will be documented separately.
Even if operators forget or don't read the docs, this new ANONYMOUS
mechanism won't do any harm because it relies on the default user name
`guest` and password `guest`, which is recommended against in
production, and who by default can only connect from the local host.

 ## 2. Require SASL security layer in AMQP 1.0

 ### What?
An AMQP 1.0 client must use the SASL security layer.

 ### Why?
This is in line with the mandatory usage of SASL in AMQP 0.9.1 and
RabbitMQ stream protocol.
Since (presumably) any AMQP 1.0 client knows how to authenticate with a
username and password using SASL mechanism PLAIN, any AMQP 1.0 client
also (presumably) implements the trivial SASL mechanism ANONYMOUS.

Skipping SASL is not recommended in production anyway.
By requiring SASL, configuration for operators becomes easier.
Following the principle of least surprise, when an an operator
configures `auth_mechanisms` to exclude `ANONYMOUS`, anonymous logins
will be prohibited in SASL and also by disallowing skipping the SASL
layer.

 ### How?
This commit implements AMQP 1.0 figure 2.13.

A follow-up commit needs to be pushed to `v3.13.x` which will use SASL
mechanism `anon` instead of `none` in the Erlang AMQP 1.0 client
such that AMQP 1.0 shovels running on 3.13 can connect to 4.0 RabbitMQ nodes.
2024-08-15 10:58:48 +00:00
Karl Nilsson 0f1f27c1dd Qq: adjust checkpointing algo to something more like
it was in 3.13.x.

Also add a force_checkpoint aux command that the purge operation
emits - this can also be used to try to force a checkpoint
2024-08-15 11:54:18 +01:00
Michael Davis 8eef209791
Handle database timeouts in `rabbit_amqqueue:store_queue/1` 2024-08-14 15:11:28 -04:00
Michael Klishin cabe873348
Merge pull request #12011 from rabbitmq/dependabot/maven/deps/rabbitmq_stream/test/rabbit_stream_SUITE_data/main/junit.jupiter.version-5.11.0
Bump junit.jupiter.version from 5.10.3 to 5.11.0 in /deps/rabbitmq_stream/test/rabbit_stream_SUITE_data
2024-08-14 15:05:11 -04:00
Michael Klishin 9987817fc2
Merge pull request #12010 from rabbitmq/dependabot/maven/deps/rabbitmq_mqtt/test/java_SUITE_data/main/org.junit.jupiter-junit-jupiter-5.11.0
Bump org.junit.jupiter:junit-jupiter from 5.10.3 to 5.11.0 in /deps/rabbitmq_mqtt/test/java_SUITE_data
2024-08-14 15:05:03 -04:00
Michael Klishin 6dca81fad5
Merge pull request #12009 from rabbitmq/dependabot/maven/deps/rabbitmq_stream_management/test/http_SUITE_data/main/junit.jupiter.version-5.11.0
Bump junit.jupiter.version from 5.10.3 to 5.11.0 in /deps/rabbitmq_stream_management/test/http_SUITE_data
2024-08-14 15:04:55 -04:00
dependabot[bot] 843068c27a
Bump junit.jupiter.version
Bumps `junit.jupiter.version` from 5.10.3 to 5.11.0.

Updates `org.junit.jupiter:junit-jupiter-engine` from 5.10.3 to 5.11.0
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.3...r5.11.0)

Updates `org.junit.jupiter:junit-jupiter-params` from 5.10.3 to 5.11.0
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.3...r5.11.0)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-type: direct:development
  update-type: version-update:semver-minor
- dependency-name: org.junit.jupiter:junit-jupiter-params
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-14 18:54:16 +00:00
dependabot[bot] 93c6a28d06
Bump org.junit.jupiter:junit-jupiter
Bumps [org.junit.jupiter:junit-jupiter](https://github.com/junit-team/junit5) from 5.10.3 to 5.11.0.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.3...r5.11.0)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-14 18:36:10 +00:00
dependabot[bot] dc9a28cc2c
Bump junit.jupiter.version
Bumps `junit.jupiter.version` from 5.10.3 to 5.11.0.

Updates `org.junit.jupiter:junit-jupiter-engine` from 5.10.3 to 5.11.0
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.3...r5.11.0)

Updates `org.junit.jupiter:junit-jupiter-params` from 5.10.3 to 5.11.0
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.3...r5.11.0)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-type: direct:development
  update-type: version-update:semver-minor
- dependency-name: org.junit.jupiter:junit-jupiter-params
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-14 18:28:57 +00:00
dependabot[bot] d841b82b9e
Bump org.junit.jupiter:junit-jupiter-params
Bumps [org.junit.jupiter:junit-jupiter-params](https://github.com/junit-team/junit5) from 5.10.3 to 5.11.0.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.3...r5.11.0)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-params
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-14 18:28:18 +00:00
Michael Klishin 9f47ca5ddf
Merge pull request #12005 from rabbitmq/mk-initial-man-page-updates-for-4.0
Initial man page updates for 4.0
2024-08-14 12:54:46 -04:00
Michael Klishin 8fa7f3add0 Document man page sync with the new website 2024-08-14 12:53:51 -04:00
Michael Klishin 242b2243bb First man page updates for 4.0 2024-08-14 12:35:12 -04:00
Michael Klishin 1cbe373697
Merge pull request #12002 from rabbitmq/mk-ldap-password-tagging
LDAP: optional sensitive value tagging
2024-08-14 12:34:05 -04:00
David Ansari 60ae4d4eca
Support SASL mechanism EXTERNAL in Erlang AMQP 1.0 client (#11984)
* Support SASL mechanism EXTERNAL in Erlang AMQP 1.0 client

* Move test to plugin rabbitmq_auth_mechanism_ssl

In theory, there can be other plugin that offer SASL mechanism EXTERNAL.
Therefore, instead of adding a test dependency from app rabbit to app
rabbitmq_auth_mechanism_ssl, it's better to test this plugin specific
functionality directly in the plugin itself.
2024-08-14 18:18:00 +02:00
Michael Klishin 4ff90b4564 LDAP: update config_schema_SUITE expectations 2024-08-14 12:15:17 -04:00
Michael Klishin e51d3b8c52 Revert "Update deps/rabbitmq_management/selenium/test/authnz-msg-protocols/enabled_plugins"
This reverts commit 23ad641d9a.

It's not really necessary for the Selenium suites.
2024-08-14 12:05:02 -04:00
Michael Klishin 15fe108cc3 LDAP: allow tagged values to be used for sensitive settings
Plus a drive-by Dialyzer improvement.
2024-08-14 11:57:37 -04:00
Michael Klishin 23ad641d9a Update deps/rabbitmq_management/selenium/test/authnz-msg-protocols/enabled_plugins
Used by Selenium suites.
2024-08-14 11:56:35 -04:00
Michael Klishin 8ef8d18f5f
Merge pull request #11986 from rabbitmq/amqplain
Restrict username and password in AMQPLAIN
2024-08-13 21:33:46 -04:00
Michael Klishin dad09e6123
Merge pull request #11989 from rabbitmq/mk-encrypted-values-in-rabbitmq-conf
Make it possible to specify encrypted values in rabbitmq conf
2024-08-13 18:48:31 -04:00
Michael Klishin 8b90d4a27c Allow for tagged values for a few more rabbitmq.conf settings 2024-08-13 16:27:00 -04:00
Michael Klishin bd1e953b95 Configuration value encryption CLI commands: unconditionally print stack traces 2024-08-13 14:31:55 -04:00
Michael Klishin 9dc899441f Validation tests for the new command 2024-08-13 14:29:14 -04:00
Michael Klishin e1490c6d9c More CLI commands for tagged values 2024-08-13 14:26:02 -04:00
Michael Klishin c2fdd73c4b Secret encoding: refine CLI tools
'ctl encode' is unfortunately name and targets
advanced.config commands.

This introduce a command that targets 'rabbitmq.conf'
values and has a more specific name.

Eventually 'ctl encode' will be aliased and deprecated,
although we still do not have an aliasing mechanism
and it won't be in scope for 4.0.
2024-08-13 12:29:28 -04:00
Michael Davis 3f734ef560
Handle timeouts in transient queue deletion
Transient queue deletion previously caused a crash if Khepri was enabled
and a node with a transient queue went down while its cluster was in a
minority. We need to handle the `{error,timeout}` return possible from
`rabbit_db_queue:delete_transient/1`. In the
`rabbit_amqqueue:on_node_down/1` callback we log a warning when we see
this return.

We then try this deletion again during that node's
`rabbit_khepri:init/0` which is called from a boot step after
`rabbit_khepri:setup/0`. At that point we can return an error and halt
the node's boot if the command times out. The cluster is very likely to
be in a majority at that point since `rabbit_khepri:setup/0` waits for
a leader to be elected (requiring a majority).

This fixes a crash report found in the `cluster_minority_SUITE`'s
`end_per_group`.
2024-08-13 11:40:18 -04:00
Michael Davis 0dd26f0c52
rabbit_db_queue: Transactionally delete transient queues from Khepri
The prior code skirted transactions because the filter function might
cause Khepri to call itself. We want to use the same idea as the old
code - get all queues, filter them, then delete them - but we want to
perform the deletion in a transaction and fail the transaction if any
queues changed since we read them.

This fixes a bug - that the call to `delete_in_khepri/2` could return
an error tuple that would be improperly recognized as `Deletions` -
but should also make deleting transient queues atomic and fast.
Each call to `delete_in_khepri/2` needed to wait on Ra to replicate
because the deletion is an individual command sent from one process.
Performing all deletions at once means we only need to wait for one
command to be replicated across the cluster.

We also bubble up any errors to delete now rather than storing them as
deletions. This fixes a crash that occurs on node down when Khepri is
in a minority.
2024-08-13 11:40:18 -04:00
Michael Klishin 1c7e590495 Initial encrypted value support for rabbitmq.conf
This makes possible to specify an encrypted
value in rabbitmq.conf using a prefix.

For example, to specify a default user password
as an encrypted value:

``` ini
default_user = bunnies-444
default_pass = encrypted:F/bjQkteQENB4rMUXFKdgsJEpYMXYLzBY/AmcYG83Tg8AOUwYP7Oa0Q33ooNEpK9
```

``` erl
[
  {rabbit, [
      {config_entry_decoder, [
             {passphrase, <<"bunnies">>}
       ]}
    ]}
].
```
2024-08-13 10:34:52 -04:00
David Ansari 29437d0344 Restrict username and password in AMQPLAIN
Restrict both username and password in SASL mechanism AMQPLAIN to be a
binary.
2024-08-13 14:11:58 +02:00
Michael Davis 8889d40a92
Handle database timeouts when declaring queues
This fixes a case-clause crash in the logs in `cluster_minority_SUITE`.
When the database is not available `rabbit_amqqueue:declare/6,7` should
return a `protocol_error` record with an error message rather than a
hard crash. Also included in this change is the necessary changes to
typespecs: `rabbit_db_queue:create_or_get/1` is the first function to
return a possible `{error,timeout}`. That bubbles up through
`rabbit_amqqueue:internal_declare/3` and must be handled in each
`rabbit_queue_type:declare/2` callback.
2024-08-12 16:16:57 -04:00
Michael Davis f60a9b5e57
minor: Clean up error message for failure to declare stream queue
`rabbit_misc:rs/1` for a queue resource will print
`queue '<QName>' in vhost '<VHostName>'` so the "a queue" and
surrounding single quotes should be removed here.
2024-08-12 16:16:57 -04:00
Michael Davis d3752c4aaa
minor: Correct outdated spec for rabbit_amqqueue:lookup/1
The clause of the spec that allowed passing a list of queue name
resources is out of date: the guard prevents a list from ever matching.
2024-08-12 16:16:39 -04:00
Michael Davis d0da0b556a
Move Khepri DB init to `rabbit_khepri:init/0` 2024-08-12 14:16:50 -04:00
Michael Davis 053c871ffc
rabbit_db: Lower log level of Khepri members log line 2024-08-12 14:10:15 -04:00
David Ansari 10a309d82f
Log AMQP connection name and container-id (#11975)
* Log AMQP connection name and container-id

Fixes #11958

 ## What
Log container-id and connection name.
Example JSON log:
```
{"time":"2024-08-12 10:49:44.365724+02:00","level":"info","msg":"accepting AMQP connection [::1]:56754 -> [::1]:5672","pid":"<0.1164.0>","domain":"rabbitmq.connection"}
{"time":"2024-08-12 10:49:44.381244+02:00","level":"debug","msg":"User 'guest' authenticated successfully by backend rabbit_auth_backend_internal","pid":"<0.1164.0>","domain":"rabbitmq","connection":"[::1]:56754 -> [::1]:5672"}
{"time":"2024-08-12 10:49:44.381578+02:00","level":"info","msg":"AMQP 1.0 connection from container 'my container ID': user 'guest' authenticated and granted access to vhost '/'","pid":"<0.1164.0>","domain":"rabbitmq.connection","connection":"[::1]:56754 -> [::1]:5672","container_id":"my container ID"}
{"time":"2024-08-12 10:49:44.381654+02:00","level":"debug","msg":"AMQP 1.0 connection.open frame: hostname = localhost, extracted vhost = /, idle-time-out = {uint,\n                                                                                            30000}","pid":"<0.1164.0>","domain":"rabbitmq","connection":"[::1]:56754 -> [::1]:5672","container_id":"my container ID"}
{"time":"2024-08-12 10:49:44.386412+02:00","level":"debug","msg":"AMQP 1.0 created session process <0.1170.0> for channel number 0","pid":"<0.1164.0>","domain":"rabbitmq","connection":"[::1]:56754 -> [::1]:5672","container_id":"my container ID"}

{"time":"2024-08-12 10:49:46.387957+02:00","level":"debug","msg":"AMQP 1.0 closed session process <0.1170.0> with channel number 0","pid":"<0.1164.0>","domain":"rabbitmq","connection":"[::1]:56754 -> [::1]:5672","container_id":"my container ID"}
{"time":"2024-08-12 10:49:46.388201+02:00","level":"info","msg":"closing AMQP connection ([::1]:56754 -> [::1]:5672)","pid":"<0.1164.0>","domain":"rabbitmq.connection","connection":"[::1]:56754 -> [::1]:5672","container_id":"my container ID"}
```

If JSON logging is not used, this commit still includes the container-ID
once at info level:
```
2024-08-12 10:48:57.451580+02:00 [info] <0.1164.0> accepting AMQP connection [::1]:56715 -> [::1]:5672
2024-08-12 10:48:57.465924+02:00 [debug] <0.1164.0> User 'guest' authenticated successfully by backend rabbit_auth_backend_internal
2024-08-12 10:48:57.466289+02:00 [info] <0.1164.0> AMQP 1.0 connection from container 'my container ID': user 'guest' authenticated and granted access to vhost '/'
2024-08-12 10:48:57.466377+02:00 [debug] <0.1164.0> AMQP 1.0 connection.open frame: hostname = localhost, extracted vhost = /, idle-time-out = {uint,
2024-08-12 10:48:57.466377+02:00 [debug] <0.1164.0>                                                                                             30000}
2024-08-12 10:48:57.470800+02:00 [debug] <0.1164.0> AMQP 1.0 created session process <0.1170.0> for channel number 0

2024-08-12 10:48:59.472928+02:00 [debug] <0.1164.0> AMQP 1.0 closed session process <0.1170.0> with channel number 0
2024-08-12 10:48:59.473332+02:00 [info] <0.1164.0> closing AMQP connection ([::1]:56715 -> [::1]:5672)
```

 ## Why?
See #11958 and https://www.rabbitmq.com/docs/connections#client-provided-names

To provide a similar feature to AMQP 0.9.1 this commit uses container-id as sent by the client in the open frame.
> Examples of containers are brokers and client applications.

The advantage is that the `container-id` is mandatory. Hence, in AMQP 1.0, we can enforce the desired behaviour that we document on our website for AMQP 0.9.1:
> The name is optional; however, developers are strongly encouraged to provide one as it would significantly simplify certain operational tasks.

* Clarify that container refers to AMQP 1.0

Rename container_id to amqp_container and change log message such that
it's unambigious that the word "container" refers to AMQP 1.0 containers
(to reduce confusion with the meaning of "container" in Docker / Kubernetes).
2024-08-12 18:41:25 +02:00
GitHub 0cdd894f81 bazel run gazelle 2024-08-10 04:02:30 +00:00
Michael Davis 543bf76a74
Add `cluster_upgrade_SUITE` to check mixed-version upgrades
This suite uses the mixed version secondary umbrella as a starting
version for a cluster and then has a helper to upgrade the cluster to
the current code. This is meant to ensure that we can upgrade from the
previous minor.
2024-08-09 16:23:35 -04:00
GitHub 84be037e73 bazel run gazelle 2024-08-09 04:02:26 +00:00
David Ansari 28bd6d45dc Store incoming max_message_size in #incoming_link{}
This keeps functions pure and ensures that existing links do not break
if an operator were to dynamically change the server's max_message_size.

Each link now has a max_message_size:
* incoming links as determined by RabbitMQ config
* outgoing links as determined by the client
2024-08-08 18:21:21 +02:00
David Ansari 3e708bc99a Avoid persistent_term for credit config
Put credit configuration into session state to make functions pure.
Although these credit configurations are not meant to be dynamically
changed at runtime, prior to this commit it could happen that
persistent_term:get/1 returns different results across invocations
leading to bugs in how credit is granted and recorded.
2024-08-08 18:21:21 +02:00
Michael Klishin 9f82e46ea2
Merge pull request #11947 from rabbitmq/stomp-consumer-priorities
STOMP: add support for consumer priorities
2024-08-08 10:56:48 -04:00
David Ansari aeedad7b51 Fix test flake
Prior to this commit, test
```
ERL_AFLAGS="+S 2" make -C deps/rabbit ct-amqp_client t=cluster_size_3:detach_requeues_two_connections_quorum_queue
```
failed rarely locally, and more often in CI.
An instance of a failed test in CI is
https://github.com/rabbitmq/rabbitmq-server/actions/runs/10298099899/job/28502687451?pr=11945

The test failed with:
```
=== === Reason: {assertEqual,[{module,amqp_client_SUITE},
                               {line,2800},
                               {expression,"amqp10_msg : body ( Msg1 )"},
                               {expected,[<<"1">>]},
                               {value,[<<"2">>]}]}
  in function  amqp_client_SUITE:detach_requeues_two_connections/2 (amqp_client_SUITE.erl, line 2800)
```
because it could happen that Receiver1's credit top up to the quorum
queue is applied before Receiver0's credit top up such that Receiver1
gets enqueued to the ServiceQueue before Receiver0.
2024-08-08 14:20:05 +02:00
Michal Kuratczyk 31c6a079b1
STOMP: add support for consumer priorities
x-priority header allows to specify the consumer priority
2024-08-08 14:04:17 +02:00
Karl Nilsson 194d4ba2f5
Quorum queues v4 (#10637)
This commit contains the following new quorum queue features:

* Fair share high/low priorities
* SAC consumers honour consumer priorities
* Credited consumer refactoring to meet AMQP requirements.
* Use checkpoints feature to reduce memory use for queues with long backlogs
 * Consumer cancel option that immediately removes consumer and returns all pending messages.
 * More compact commands of the most common commands such as enqueue, settle and credit
 * Correctly track the delivery-count to be compatible with the AMQP spec
 * Support the "modified" AMQP 1.0 outcome better.

Commits:

* Quorum queues v4 scaffolding.

Create the new version but not including any changes yet.

QQ: force delete followers after leader has terminated.

Also try a longer sleep for mqtt_shared_SUITE so that the
delete operation stands a chance to time out and move on
to the forced deletion stage.

In some mixed machine version scenarios some followers will never
apply the poison pill command so we may as well force delete them
just in case.

QQ: skip test in amqp_client that cannot pass with mixed machine versions

QQ: remove dead code

Code relating to prior machine versions and state conversions.

rabbit_fifo_prop_SUITE fixes

* QQ: add v4 ff and new more compact enqueue command.

Also update rabbit_fifo_* suites to test more relevant code versions
where applicable.

QQ: always use the updated credit mode format

QQv4: use more compact consumer reference in settle, credit, return

This introudces a new type: consumer_key() which is either the consumer_id
or the raft index the checkout was processed at. If the consumer is
using one of the updated credit spec formats rabbit_fifo will use the
raft index as the primary key for the consumer such that the rabbit
fifo client can then use the more space efficient integer index
instead of the full consumer id in subsequent commands.

There is compatibility code to still accept the consumer id in
settle, return, discard and credit commands but this is slighlyt
slower and of course less space efficient.

The old form will be used in cases where the fifo client may have
already remove the local consumer state (as happens after a cancel).

Lots of test refactorings of the rabbit_fifo_SUITE to begin to use
the new forms.

* More test refactoring and new API fixes

rabbit_fifo_prop_SUITE refactoring and other fixes.


* First pass SAC consumer priority implementation.

Single active consumers will be activated if they have a higher priority
than the currently active consumer. if the currently active consumer
has pending messages, no further messages will be assigned to the
consumer and the activation of the new consumer will happen once
all pending messages are settled. This is to ensure processing order.

Consumers with the same priority will internally be ordered to
favour those with credit then those that attached first.

QQ: add SAC consumer priority integration tests

QQ: add check for ff in tests

* QQ: add new consumer cancel option: 'remove'

This option immediately removes and returns all messages for a
consumer instead of the softer 'cancel' option which keeps the
consumer around until all pending messages have been either
settled or returned.

This involves a change to the rabbit_queue_type:cancel/5 API
to rabbit_queue_type:cancel/3.

* QQ: capture checked out time for each consumer message.

This will form the basis for queue initiated consumer timeouts.

* QQ: Refactor to use the new ra_machine:handle_aux/5 API

Instead of the old ra_machine:handle_aux/6 callback.

* QQ hi/lo priority queue

* QQ: Avoid using mc:size/1 inside rabbit_fifo

As we dont want to depend on external functions for things that may
change the state of the queue.

* QQ bug fix: Maintain order when returning multiple

Prior to this commit, quorum queues requeued messages in an undefined
order, which is wrong.

This commit fixes this bug and requeues messages always in the order as
nacked / rejected / released by the client.

We ensure that order of requeues is deterministic from the client's
point of view and doesn't depend on whether the quorum queue soft limit
was exceeded temporarily.
So, even when rabbit_fifo_client batches requeues, the order as nacked
by the client is still maintained.

* Simplify

* Add rabbit_quorum_queue:file_handle* functions back.

For backwards compat.

* dialyzer fix

* dynamic_qq_SUITE: avoid mixed versions failure.

* QQ: track number of requeues for message.

To be able to calculate the correct value for the AMQP delivery_count
header we need to be able to distinguish between messages that were
"released" or returned in QQ speak and those that were returned
due to errors such as channel termination.

This commit implement such tracking as well as the calculation
of a new mc annotations `delivery_count` that AMQP makes use
of to set the header value accordingly.

* Use QQ consumer removal when AMQP client detaches

This enables us to unskip some AMQP tests.

* Use AMQP address v2 in fsharp-tests

* QQ: track number of requeues for message.

To be able to calculate the correct value for the AMQP delivery_count
header we need to be able to distinguish between messages that were
"released" or returned in QQ speak and those that were returned
due to errors such as channel termination.

This commit implement such tracking as well as the calculation
of a new mc annotations `delivery_count` that AMQP makes use
of to set the header value accordingly.

* rabbit_fifo: Use Ra checkpoints

* quorum queues: Use a custom interval for checkpoints

* rabbit_fifo_SUITE: List actual effects in ?ASSERT_EFF failure

* QQ: Checkpoints modifications

* fixes

* QQ: emit release cursors on tick for followers and leaders

else followers could end up holding on to segments a bit longer
after traffic stops.

* Support draining a QQ SAC waiting consumer

By issuing drain=true, the client says "either send a transfer or a flow frame".
Since there are no messages to send to an inactive consumer, the sending
queue should advance the delivery-count consuming all link-credit and send
a credit_reply with drain=true to the session proc which causes the session
proc to send a flow frame to the client.

* Extract applying #credit{} cmd into 2 functions

This commit is only refactoring and doesn't change any behaviour.

* Fix default priority level

Prior to this commit, when a message didn't have a priority level set,
it got enqueued as high prio.

This is wrong because the default priority is 4 and
"for example, if 2 distinct priorities are implemented,
then levels 0 to 4 are equivalent, and levels 5 to 9 are equivalent
and levels 4 and 5 are distinct."
Hence, by default a message without priority set, must be enqueued as
low prio.

* bazel run gazelle

* Avoid deprecated time unit

* Fix aux_test

* Delete dead code

* Fix rabbit_fifo_q:get_lowest_index/1

* Delete unused normalize functions

* Generate less garbage

* Add integration test for QQ SAC with consumer priority

* Improve readability

* Change modified outcome behaviour

With the new quorum queue v4 improvements where a requeue counter was
added in addition to the quorum queue delivery counter, the following
sentence from https://github.com/rabbitmq/rabbitmq-server/pull/6292#issue-1431275848
doesn't apply anymore:

> Also the case where delivery_failed=false|undefined requires the release of the
> message without incrementing the delivery_count. Again this is not something
> that our queues are able to do so again we have to reject without requeue.

Therefore, we simplify the modified outcome behaviour:
RabbitMQ will from now on only discard the message if the modified's
undeliverable-here field is true.

* Introduce single feature flag rabbitmq_4.0.0

 ## What?

Merge all feature flags introduced in RabbitMQ 4.0.0 into a single
feature flag called rabbitmq_4.0.0.

 ## Why?

1. This fixes the crash in
https://github.com/rabbitmq/rabbitmq-server/pull/10637#discussion_r1681002352
2. It's better user experience.

* QQ: expose priority metrics in UI

* Enable skipped test after rebasing onto main

* QQ: add new command "modify" to better handle AMQP modified outcomes.

This new command can be used to annotate returned or rejected messages.

This commit also retains the delivery-count across dead letter boundaries
such that the AMQP header delivery-count field can now include _all_ failed
deliver attempts since the message was originally received.

Internally the quorum queue has moved it's delivery_count header to
only track the AMQP protocol delivery attempts and now introduces
a new acquired_count to track all message acquisitions by consumers.

* Type tweaks and naming

* Add test for modified outcome with classic queue

* Add test routing on message-annotations in modified outcome

* Skip tests in mixed version tests

Skip tests in mixed version tests because feature flag
rabbitmq_4.0.0 is needed for the new #modify{} Ra command
being sent to quorum queues.

---------

Co-authored-by: David Ansari <david.ansari@gmx.de>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2024-08-08 08:48:27 +01:00
Simon Unge dd110f8443 Make sure Makefile output correct application config for shovel and federation prometheus 2024-08-08 01:26:49 -04:00
Michael Klishin ed7e79cf92 Rework shovel_prometheus and federation_prometheus plugins
to structure them like applications.

This updates Bazel files but not yet Make ones.
2024-08-08 01:26:49 -04:00
Simon Unge 2766122836 Move shovel prometheus to its own plugin 2024-08-08 01:26:49 -04:00
Karl Nilsson 7b5d339aec QQ: improve shrink_all to retry once if cluster change is not permitted.
This could happen if a leader election occurred just before the
the member removal was initiated. In particular this could
happen when stopping and forgetting an existing rabbit node.
2024-08-07 12:03:00 +01:00
Karl Nilsson e24bd06e71 QQ: refactor and improve leader detection code.
The leader returned in rabbit_quorum_queue:info/2 only ever queried
the pid field from the queue record when more up to date info could
have been available in the ra_leaderboard table.
2024-08-07 12:02:53 +01:00
David Ansari 9f61bebc23 Avoid returning leader info when leader is unknown
Prior to this commit, atom `undefined` was turned into a binary.
2024-08-06 22:46:40 +02:00
Michael Klishin e59e97fde2
Merge pull request #11923 from rabbitmq/dependabot/maven/deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot_kotlin/main/kotlin.version-2.0.10
Bump kotlin.version from 2.0.0 to 2.0.10 in /deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot_kotlin
2024-08-06 16:13:37 -04:00
David Ansari 8ba36492ad Reduce Khepri test flakes
Test case rabbit_mqtt_qos0_queue_kill_node flaked because after an
MQTT client subscribes on node 0, RabbitMQ returns success
and replicated the new binding to node 0 and node 1, but not
yet to node 2. Another MQTT client then publishes on node 2
without the binding being present yet on node 2, and the
message therefore isn't routed.

This commit attempts to eliminate this flake.
It adds a function to rabbit_ct_broker_helpers which waits until a given
node has caught up with the leader node.
We can reuse that function in future to eliminate more test flakes.
2024-08-06 22:01:17 +02:00
dependabot[bot] 538632cbfa
Bump kotlin.version
Bumps `kotlin.version` from 2.0.0 to 2.0.10.

Updates `org.jetbrains.kotlin:kotlin-test` from 2.0.0 to 2.0.10
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v2.0.0...v2.0.10)

Updates `org.jetbrains.kotlin:kotlin-maven-allopen` from 2.0.0 to 2.0.10

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlin:kotlin-test
  dependency-type: direct:development
  update-type: version-update:semver-patch
- dependency-name: org.jetbrains.kotlin:kotlin-maven-allopen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-06 18:56:09 +00:00
David Ansari f447986f8f Reuse timestamp in rabbit_message_interceptor
## What?
`mc:init()` already sets mc annotation `rts` (received timestamp).
This commit reuses this timestamp in `rabbit_message_interceptor`.

 ## Why?
`os:system_time/1` can jump forward or backward between invocations.
Using two different timestamps for the same meaning, the time the message
was received by RabbitMQ, can be misleading.
2024-08-06 11:11:41 +02:00
Michael Klishin dd3f2a6abe
Merge pull request #11900 from rabbitmq/mqtt-silent-close-delay 2024-08-05 14:27:04 -04:00
David Ansari 80ff6d0224 Close MQTT connection with delay when authentication fails
For consistency with other protocols (to protect from potential DoS attacks).
Wrong credentials and virtual host access errors trigger the delay.

References #11831

We keep the delay low when running tests. Otherwise,
```
make -C deps/rabbitmq_mqtt ct-auth
```
would run 3 minutes longer (with a SILENT_CLOSE_DELAY of 3 seconds).
2024-08-05 15:49:42 +00:00
Diana Parra Corbacho 647d65b8c8 Classic peer discovery: node list warnings
Log warnings when:
- Local node is not present. Even though we force it on the node
list, this will not work for other cluster nodes if they have
the same list.
- There are duplicated nodes
2024-08-05 10:07:14 +02:00
Michael Klishin 1f1d422fa2 rabbitmq_shovel is a runtime dependency of rabbitmq_prometheus now 2024-08-02 23:15:28 -04:00
Simon Unge 4c44ebd8eb Add dynamic and static promethues metric gauge 2024-08-02 22:19:20 +00:00
David Ansari 93d1ac9bb8 Speed up AMQP connection and session (de)registration
## What?

Prior to this commit connecting 40k AMQP clients with 5 sessions each,
i.e. 200k sessions in total, took 7m55s.

After to this commit the same scenario takes 1m37s.

Additionally, prior to this commit, disconnecting all connections and sessions
at once caused the pg process to become overloaded taking ~14 minutes to
process its mailbox.

After this commit, these same deregistrations take less than 5 seconds.

To repro:
```go

package main

import (
	"context"
	"log"
	"time"

	"github.com/Azure/go-amqp"
)

func main() {
	for i := 0; i < 40_000; i++ {
		if i%1000 == 0 {
			log.Printf("opened %d connections", i)
		}
		conn, err := amqp.Dial(
			context.TODO(),
			"amqp://localhost",
			&amqp.ConnOptions{SASLType: amqp.SASLTypeAnonymous()})
		if err != nil {
			log.Fatal("open connection:", err)
		}
		for j := 0; j < 5; j++ {
			_, err = conn.NewSession(context.TODO(), nil)
			if err != nil {
				log.Fatal("begin session:", err)
			}
		}
	}
	log.Println("opened all connections")
	time.Sleep(5 * time.Hour)
}
```

 ## How?

This commit uses separate pg scopes (that is processes and ETS tables) to register
AMQP connections and AMQP sessions. Since each Pid is now its own group,
registration and deregistration is fast.
2024-08-02 13:46:30 +02:00
Michael Klishin 0525ab06a0 rabbitmq.conf.example: mention log.file.rotation.* keys 2024-08-01 01:11:46 -04:00
David Ansari 0397035669 Add test for AMQP 1.0 clients using OAuth token 2024-07-31 12:05:22 +02:00
Michael Klishin f91498284e
Merge pull request #11867 from rabbitmq/mqtt-credential-expiration
Disconnect MQTT client when its credential expires
2024-07-30 21:10:12 -04:00
David Ansari d7f29426a8 Fix test flake
Sometimes in CI under Khepri, the test case errored with:
```
receiver_attached flushed: {amqp10_event,
                            {session,<0.396.0>,
                             {ended,
                              {'v1_0.error',
                               {symbol,<<"amqp:internal-error">>},
                               {utf8,
                                <<"stream queue 'leader_transfer_stream_credit_single' in vhost '/' does not have a running replica on the local node">>},
                               undefined}}}}
```
2024-07-30 21:05:25 +02:00
David Ansari 7fb78338c6 Disconnect MQTT client when its credential expires
Fixes https://github.com/rabbitmq/rabbitmq-server/discussions/11854
Fixes https://github.com/rabbitmq/rabbitmq-server/issues/11862

This commit uses the same approach as implemented for AMQP 1.0 and
Streams: When a token expires, RabbitMQ will close the connection.
2024-07-30 19:55:46 +02:00
David Ansari 4e3ff2c8ef Delete leftover code
This code should have been deleted as part of
https://github.com/rabbitmq/rabbitmq-server/pull/11642
2024-07-30 18:47:09 +02:00
David Ansari 9d9a69aed9 Make AMQP flow control configurable
Make the following AMQP 1.0 flow control variables configurable via
`advanced.config`:
* `max_incoming_window` (session flow control)
* `max_link_credit` (link flow control)
* `max_queue_credit` (link flow control)
2024-07-30 16:40:52 +02:00
David Ansari c771b2422a Make classic_queue_consumer_unsent_message_limit configurable
Similar to other RabbitMQ internal credit flow configurations such as
`credit_flow_default_credit` and `msg_store_credit_disc_bound`, this
commit makes the `classic_queue_consumer_unsent_message_limit`
configurable via `advanced.config`.

See https://github.com/rabbitmq/rabbitmq-server/pull/11822 for the
original motivation to make this setting configurable.
2024-07-29 22:48:48 +02:00
David Ansari ce915ae05a Fix quorum queue credit reply crash in AMQP session
Fixes #11841

PR #11307 introduced the invariant that at most one credit request between
session proc and quorum queue proc can be in flight at any given time.
This is not the case when rabbit_fifo_client re-sends credit
requests on behalf of the session proc when the quorum queue leader changes.

This commit therefore removes assertions which assumed only a single credit
request to be in flight.

This commit also removes field queue_flow_ctl.desired_credit
since it is redundant to field client_flow_ctl.credit
2024-07-28 12:34:41 +02:00
David Ansari d3109e9f09 Remove max_frame_size from AMQP writer
because the session process already splits frames that are too large
into smaller frames
2024-07-26 16:35:36 +02:00
David Ansari dde8e699a1 Report frame_max as integer
Resolves https://github.com/rabbitmq/rabbitmq-server/issues/11838
2024-07-26 16:35:36 +02:00
GitHub f011b54767 bazel run gazelle 2024-07-26 04:02:38 +00:00
Michael Klishin 4aaa1c410e
Merge pull request #11664 from rabbitmq/khepri-node-added-event
rabbit_node_monitor: use a leader query for cluster members on node_added event
2024-07-25 15:41:28 -04:00
Michael Klishin 29251a0a54
Merge pull request #11706 from rabbitmq/md/khepri-minority-errors/rabbit_db_vhost
Handle timeouts possible in Khepri minority in `rabbit_db_vhost`
2024-07-25 15:40:40 -04:00
Michael Klishin 5a56e326d9
Merge pull request #11741 from rabbitmq/retry-register-projections-during-boot
rabbit_khepri: Retry register_projections during boot
2024-07-25 15:39:15 -04:00
Arnaud Cogoluègnes c9951ec1f4
Close stream connection with delay in case of authentication failure
For consistency with other protocols (to protect from potential DoS
attacks). Wrong credentials and virtual host access errors trigger
the delay.
2024-07-25 17:00:36 +02:00
Michael Klishin 5161aea393 Shovel dynamic_SUITE: ignore one more harmless exception
when a socket is closed before a writer tries
to flush it.
2024-07-24 17:50:45 -04:00
Marcial Rosales 61c9cf2ce2 More clean up 2024-07-24 17:50:45 -04:00
Marcial Rosales ae17c6c86a Clean up 2024-07-24 17:50:45 -04:00
Marcial Rosales 86a0ebe1af First wait until shovel is terminated 2024-07-24 17:50:45 -04:00
Marcial Rosales 17e470e6eb Fix test 2024-07-24 17:50:45 -04:00
Marcial Rosales e2e92d3214 Support predeclared feature in static shovels 2024-07-24 17:50:45 -04:00
Marcial Rosales 55bc5a2920 Remove unnecessary function 2024-07-24 17:50:44 -04:00
Marcial Rosales c24756e505 Static shovels remain as they are 2024-07-24 17:50:44 -04:00
Marcial Rosales 48f1bc7507 Clean up 2024-07-24 17:50:44 -04:00
Marcial Rosales 42e42219b7 Configure plugin with topology.predeclared 2024-07-24 17:50:44 -04:00
Marcial Rosales a888c7b576 Test predeclared dest queue 2024-07-24 17:50:44 -04:00
Marcial Rosales 04164df6cf Test predeclared for queues in shovels 2024-07-24 17:50:44 -04:00
Marcial Rosales 5465b44332 Test predeclared for src 2024-07-24 17:50:44 -04:00
Michael Davis 4207faf433
Merge pull request #11785 from rabbitmq/md/khepri-minority-errors/rabbit_db_exchange
Handle timeouts possible in Khepri minority in `rabbit_db_exchange`
2024-07-24 12:11:17 -05:00
Michael Davis b56abeec12
Use `rabbit_misc:rs/1` on exchange resource records
This fixes a potential crash in `rabbit_amqp_amanegment` where we tried
to format the exchange resource as a string (`~ts`). The other changes
are cosmetic.
2024-07-24 11:32:33 -04:00
Michael Davis fb3154ba82
rabbit_channel: Fix formatting of error message for exchange deletion
Co-authored-by: David Ansari <david.ansari@gmx.de>
2024-07-24 11:19:31 -04:00
Karl Nilsson 1a9da90153
Merge pull request #11809 from rabbitmq/qq-system-recovery
QQ: use a dedicated function for queue recovery after Ra system restart.
2024-07-24 16:14:05 +01:00
Michael Davis 98616a0037
rabbit_amqp_management: Use HTTP code 503 for timeout errors
`rabbit_amqp_management` returns HTTP status codes to the client. 503
means that a service is unavailable (which Khepri is while it is in a
minority) so it's a more appropriate code than the generic 500
internal server error.
2024-07-24 11:13:17 -04:00
Michal Kuratczyk ae41f65c64
Fix rabbit_priority_queue:update_rates bug (#11814)
updates_rates fails after publishing a message to a queue
with priorities enabled.
2024-07-24 16:34:56 +02:00
Karl Nilsson 4863bc3b8f QQ: use a dedicated function for queue recovery after Ra system restart.
Previously we used the `registered` approach where all Ra servers that
have a registered name would be recovered. This could have unintended
side effects for queues that e.g. were deleted when not all members of
a quorum queueu were running when the queue was deleted. In this case
the Ra system would have recovered the members that were not deleted
which is not ideal as a dangling member would just sit and loop in
pre vote state and a future declaration of the queue may partially
fail.

Instead we rely on the meta data store for the truth about which
members should be restarted after a ra system restart.
2024-07-24 14:24:42 +01:00
David Ansari be6a7fec95 Fix test flake
Sometimes on Khepri the test failed with:
```
=== Ended at 2024-07-24 10:07:15
=== Location: [{gen_server,call,419},
              {amqpl_direct_reply_to_SUITE,rpc,226},
              {test_server,ts_tc,1793},
              {test_server,run_test_case_eval1,1302},
              {test_server,run_test_case_eval,1234}]
=== === Reason: {{shutdown,
                      {server_initiated_close,404,
                          <<"NOT_FOUND - no queue 'tests.amqpl_direct_reply_to.rpc.requests' in vhost '/'">>}},
                  {gen_server,call,
                      [<0.272.0>,
                       {call,
                           {'basic.get',0,
                               <<"tests.amqpl_direct_reply_to.rpc.requests">>,
                               false},
                           none,<0.246.0>},
                       infinity]}}
```

https://github.com/rabbitmq/rabbitmq-server/actions/runs/10074558971/job/27851173817?pr=11809
shows an instance of this flake.
2024-07-24 13:42:20 +02:00
David Ansari cdc5b886f8 Fix crash in consistent hash exchange
Prior to this commit, a crash occurred when a consistent hash exchange
got declared with a `hash-header` argument, but the publishing client
didn't set that header on the message.

This bug is present in RabbitMQ 3.13.0 - 3.13.6.

Fixes https://github.com/rabbitmq/rabbitmq-server/discussions/11671
2024-07-24 11:42:59 +02:00
Michael Klishin f4b80f4f9c
Merge pull request #11788 from rabbitmq/memory-breakdown-endpoint
Move memory breakdown metrics to new endpoint
2024-07-23 06:46:21 -04:00
Michal Kuratczyk 618f695645
Move memory breakdown metrics to new endpoint
Collecting them on a large system (tens of thousands of processes
or more) can be time consuming as we iterate over all processes.
By putting them on a separate endpoint, we make that opt-in
2024-07-23 10:17:37 +02:00
Michael Davis 52a0d70e15
Handle database timeouts when declaring exchanges
The spec of `rabbit_exchange:declare/7` needs to be updated to return
`{ok, Exchange} | {error, Reason}` instead of the old return value of
`rabbit_types:exchange()`. This is safe to do since `declare/7` is not
called by RPC - from the CLI or otherwise - outside of test suites, and
in test suites only through the CLI's `TestHelper.declare_exchange/7`.
Callers of this helper are updated in this commit.

Otherwise this commit updates callers to unwrap the `{ok, Exchange}`
and bubble up errors.
2024-07-22 16:02:03 -04:00
Michael Davis 96c60a2de4
Move 'for_each_while_ok/2' helper to rabbit_misc 2024-07-22 16:02:03 -04:00
Michael Davis 70595822e4
rabbit_db_exchange: Allow infinite timeout for serial updates in Khepri
It's unlikely that these operations will time out since the serial
number is always updated after some other transaction, for example
adding or deleting an exchange.

In the future we could consider moving the serial updates into those
transactions. In the meantime we can remove the possibility of timeouts
by giving the serial update unlimited time to finish.
2024-07-22 15:59:55 -04:00
Michael Davis e7489d2cb7
Handle database failures when deleting exchanges
A common case for exchange deletion is that callers want the deletion
to be idempotent: they treat the `ok` and `{error, not_found}` returns
from `rabbit_exchange:delete/3` the same way. To simplify these
callsites we add a `rabbit_exchange:ensure_deleted/3` that wraps
`rabbit_exchange:delete/3` and returns `ok` when the exchange did not
exist. Part of this commit is to update callsites to use this helper.

The other part is to handle the `rabbit_khepri:timeout()` error possible
when Khepri is in a minority. For most callsites this is just a matter
of adding a branch to their `case` clauses and an appropriate error and
message.
2024-07-22 15:59:55 -04:00
Michael Davis 80f599b001
rabbit_db_exchange: Reflect possible failure in update/2 spec 2024-07-22 15:59:44 -04:00
Michael Davis 83994501b5
rabbit_db_vhost: Bubble up database errors in delete/1
We need to bubble up the error through the caller
`rabbit_vhost:delete/2`. The CLI calls `rabbit_vhost:delete/2` and
already handles the `{error, timeout}` but the management UI needs an
update so that an HTTP DELETE returns an error code when the deletion
times out.
2024-07-22 15:55:57 -04:00
Michael Davis 2a86dde998
rabbit_db_vhost: Add `no_return()` to `update/2` spec
This function throws if the database fails to apply the transaction.
This function is only called by the `rabbit_vhost_limit` runtime
parameter module in its `notify/5` and `notify_clear/4` callbacks. These
callers have no way of handling this error but it should be very
difficult for them to face this crash: setting the runtime parameter
would need to succeed first which needs Khepri to be in majority. Khepri
would need to enter a minority between inserting/updating/deleting the
runtime parameter and updating the vhost. It's possible but unlikely.

In the future we could consider refactoring vhost limits to update the
vhost as the runtime parameter is changed, transactionally. I figure
that to be a very large change though so we leave this to the future.
2024-07-22 15:55:57 -04:00
Michael Davis 4fd77d5fbf
rabbit_db_vhost: Add `no_return()` to `set_tags/2` spec
`set_tags/2` throws for database errors. This is benign since it's
caught by the CLI (the only caller) and turned into a Khepri-specific
error.
2024-07-22 15:55:57 -04:00
Michael Davis 1695d390d9
rabbit_db_vhost: Add timeout error to `merge_metadata/2` spec
This error is already handled by the callers of
`rabbit_vhost:update_metadata/3` (the CLI) and `rabbit_vhost:put_vhost/6`
(see the parent commit) but was just missing from the spec.
2024-07-22 15:55:57 -04:00
Michael Davis 63b5100374
rabbit_definitions: Handle vhost creation failure
`rabbit_definitions:concurrent_for_all/4` doesn't pay any attention to
the return value of the `Fun`, only counting an error when it catches
`{error, E}`. So we need to `throw/1` the error from
`rabbit_vhost:put_vhost/6`.

The other callers of `rabbit_vhost:put_vhost/6` - the management UI and
the CLI (indirectly through `rabbit_vhost:add/2,3`) already handle this
error return.
2024-07-22 15:55:57 -04:00
Michael Davis e459ee5c77
rabbit_db_vhost: Declare no-return in create_or_get/3 spec
`create_or_get_in_khepri/2` throws errors like the
`rabbit_khepri:timeout_error()`. Callers of `create_or_get/3` like
`rabbit_vhost:do_add/3` and its callers handle the throw with a `try`/
`catch` block and return the error tuple, which is then handled by
their callers.
2024-07-22 15:55:57 -04:00
Michael Davis f1be7bacc2
Handle database failures when adding/removing bindings
This ensures that the call graph of `rabbit_db_binding:create/2` and
`rabbit_db_binding:delete/2` handle the `{error, timeout}` error
possible when Khepri is in a minority.
2024-07-22 14:16:39 -04:00
Michael Davis fe280280a4
rabbit_db_bindings: Explicitly mark exists_in_khepri tx as read-only
This is essentially a cosmetic change. Read-only transactions are done
with queries in Khepri rather than commands, like read-write
transactions. Local queries cannot timeout like commands so marking the
transaction as 'ro' means that we don't need to handle a potential
'{error, timeout}' return.
2024-07-22 14:16:39 -04:00
Michael Davis aace1b5377
Introduce a rabbit_khepri:timeout_error() error type 2024-07-22 14:16:39 -04:00
Gabriele Santomaggio e094a9bfc8
Merge pull request #11742 from rabbitmq/fix_catch_precodition_fail_management
Handle more failure types in the rabbitmqqueue:declare/6 when declaring a stream
2024-07-22 12:50:04 +02:00
David Ansari 909f0d814a Add test case
and remove inner case statement since we only want
rabbit_amqqueue:declare/6 to be protected.
2024-07-22 11:02:23 +02:00
Michael Davis 38cd40b31e
maintenance_mode_SUITE: Skip leadership transfer case on mnesia
This case only targets Khepri. Instead of setting the `metadata_store`
config option we should skip the test when the configured metadata
store is mnesia.
2024-07-19 15:28:25 -04:00
Michael Klishin e366b1ddd4 Make bazel test //deps/rabbit:dialyze pass 2024-07-19 14:22:16 -04:00
Karl Nilsson 42991f7838 Ra v2.13.3
This contains a fix in the ra_directory module to ensure
names can be deleted even when a Ra server has never been started
during the current node lifetime.

Also contains a small tweak to ensure the ra_directory:unregister_name
is called before deleting a Ra data directory which is less likely
to cause a corrupt state that will stop a Ra system from starting.
2024-07-19 18:47:27 +01:00
Arnaud Cogoluègnes eeb35d2688
Add stream replication port range in ini-style configuration
This is more straightforward than configuring Osiris in the advanced
configuration file.
2024-07-19 16:47:59 +02:00
Michael Klishin fa63e011f1
Merge pull request #11755 from rabbitmq/cloudamqp-prometheus-no-channel-label
Prometheus: some per-exchange/per-queue metrics aggregated per-channel (rebased)
2024-07-19 08:35:59 -04:00
Gabriele Santomaggio f9707530b0
Remove case args
Signed-off-by: Gabriele Santomaggio <g.santomaggio@gmail.com>
2024-07-19 08:26:27 +02:00
Michael Klishin 40903581ef Bump version to 4.0 in a few places 2024-07-19 01:21:30 -04:00
dependabot[bot] 2cb27b20b8 build(deps): bump org.springframework.boot:spring-boot-starter-parent
Bumps [org.springframework.boot:spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 3.3.1 to 3.3.2.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](https://github.com/spring-projects/spring-boot/compare/v3.3.1...v3.3.2)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-parent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-18 21:32:42 -04:00
Michael Klishin 0caea225c6 Assertions for #11743 2024-07-18 21:32:42 -04:00
Michael Klishin e9b5f52512 Prometheus: expose memory breakdown metrics
Closes #11743.
2024-07-18 21:32:42 -04:00
dependabot[bot] b807942df5 build(deps): bump org.springframework.boot:spring-boot-starter-parent
Bumps [org.springframework.boot:spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 3.3.1 to 3.3.2.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](https://github.com/spring-projects/spring-boot/compare/v3.3.1...v3.3.2)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-parent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-18 21:32:42 -04:00
Arnaud Cogoluègnes 834bed7446 MQTT auth_SUITE: terminate setup process
Configuring the mock authentication backend blocks
and generates an error in the test process when the
broker goes down. The error report makes the test fail
in some environments.

The process where the setup takes place must stay up
otherwise the ETS table used will go away.

This commit makes sure the broker-side authentication backend
setup returns at the end of the test. This way the calling
process terminates in a normal way.
2024-07-18 21:32:42 -04:00
Michael Klishin 625bb5f604
Merge pull request #11750 from rabbitmq/dependabot/maven/deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot/main/org.springframework.boot-spring-boot-starter-parent-3.3.2
build(deps): bump org.springframework.boot:spring-boot-starter-parent from 3.3.1 to 3.3.2 in /deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot
2024-07-18 15:48:06 -04:00
Michael Klishin e2af359238
Merge pull request #11746 from rabbitmq/mk-rabbitmq-server-11743
Prometheus: expose memory breakdown metrics
2024-07-18 15:47:21 -04:00
dependabot[bot] 5b3716323a
build(deps): bump org.springframework.boot:spring-boot-starter-parent
Bumps [org.springframework.boot:spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 3.3.1 to 3.3.2.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](https://github.com/spring-projects/spring-boot/compare/v3.3.1...v3.3.2)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-parent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-18 18:50:58 +00:00
Michael Klishin c361eddad9 Assertions for #11743 2024-07-18 14:36:19 -04:00
dependabot[bot] 1d31a436db
build(deps): bump org.springframework.boot:spring-boot-starter-parent
Bumps [org.springframework.boot:spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 3.3.1 to 3.3.2.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](https://github.com/spring-projects/spring-boot/compare/v3.3.1...v3.3.2)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-parent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-18 18:26:35 +00:00
Michael Klishin 5dad0f8c2a Prometheus: expose memory breakdown metrics
Closes #11743.
2024-07-18 14:18:10 -04:00
Diana Parra Corbacho cdff2ae66a Handle timeout_waiting_for_khepri_projections on cli commands 2024-07-18 16:08:21 +02:00
Gabriele Santomaggio 93946eeda0
Handle the rabbitmqqueue:declare
The rabbitmqqueue:declare is handled, and in case of known errors, the correct error code is sent back.

Signed-off-by: Gabriele Santomaggio <g.santomaggio@gmail.com>
2024-07-18 12:00:52 +02:00
Arnaud Cogoluègnes 58d835ba5d
MQTT auth_SUITE: terminate setup process
Configuring the mock authentication backend blocks
and generates an error in the test process when the
broker goes down. The error report makes the test fail
in some environments.

The process where the setup takes place must stay up
otherwise the ETS table used will go away.

This commit makes sure the broker-side authentication backend
setup returns at the end of the test. This way the calling
process terminates in a normal way.
2024-07-17 15:36:20 +02:00
Diana Parra Corbacho 992c260c56 Catch throw:timeout as returned from Khepri 0.14.0 2024-07-17 15:26:24 +02:00
Diana Parra Corbacho f257e1181f rabbit_khepri: Retry register_projections during boot
Gives some time to form a majority during the boot process,
allowing nodes to boot more easily
2024-07-17 13:17:33 +02:00
Lois Soto Lopez bb93e718c2 Prometheus: some per-exchange/per-queue metrics aggregated per-channel
Add copies of some per-object metrics that are labeled per-channel
aggregated to reduce cardinality. These metrics are valuable and
easier to process if exposed on per-exchange and per-queue basis.
2024-07-16 14:30:25 +02:00
Diana Parra Corbacho e856a6cc21 rabbit_mnesia: Emit notify_left_cluster from forget_cluster_node
This function is called directly from CLI commands, skipping the `rabbit_db_cluster` layer
2024-07-16 12:48:29 +02:00
Diana Parra Corbacho db03d8c6cb rabbit_db_cluster: generate left cluster notifications
They must be sent during reset and when leaving the cluster for
any metadata store
2024-07-16 12:48:29 +02:00
Diana Parra Corbacho 19a71d8d28 rabbit_node_monitor: use a leader query for cluster members on node_added event
If the membership hasn't been updated locally yet, the event is never generated
2024-07-16 12:48:29 +02:00
GitHub c3beec2d32 bazel run gazelle 2024-07-16 04:02:25 +00:00
Michael Klishin 69b6ed4a67
Merge pull request #11720 from SimonUnge/empty_body_json_decode
Handle empty HTTP body in response from AWS JSON
2024-07-15 19:40:32 -04:00
Simon Unge c32e0d647f Handle empty HTTP body in response (as some AWS 200 reponse will have an empty body for some reason) 2024-07-15 22:59:20 +00:00
Michael Klishin 5346339655 Squash two more deprecated CMQ-related CLI command warnings 2024-07-15 12:38:01 -04:00
Michael Klishin 8de26fbc03 Fix two warnings in a deprecated CMQ-related CLI command 2024-07-15 12:38:01 -04:00
Michal Kuratczyk 9debca24d8 Remove HA policy example from OpenStack script 2024-07-15 12:38:01 -04:00
Michal Kuratczyk e1b649c0c6 check_if_node_is_mirror_sync_critical is no-op
Make `check_if_node_is_mirror_sync_critical` a no-op
with a deprecation warning. Since this command is commonly used
as part of the node shutdown process (eg. by Cluster Operator),
making it a no-op instead of removing completly will make the
transition to 4.0 easier for users.
2024-07-15 12:38:01 -04:00
Michal Kuratczyk 6b1377163d Remove sync_queue and cancel_sync_queue from man page 2024-07-15 12:38:01 -04:00
Michael Klishin c34faf9e12
Merge pull request #11423 from rabbitmq/bump-oidc-client-ts
OAuth 2, breaking change: upgrade oidc-client-ts library to a new major
2024-07-15 12:11:47 -04:00
Karl Nilsson 131379a483 mc: increase utf8 scanning limit for longstr conversions.
The AMQP 0.9.1 longstr type is problematic as it can contain arbitrary
binary data but is typically used for utf8 by users.

The current conversion into AMQP avoids scanning arbitrarily large
longstr to see if they only contain valid utf8 by treating all
longstr data longer than 255 bytes as binary. This is in hindsight
too strict and thus this commit increases the scanning limit to
4096 bytes - enough to cover the vast majority of AMQP 0.9.1 header
values.

This change also conversts the AMQP binary types into longstr to
ensure that existing data (held in streams for example) is converted
to an AMQP 0.9.1 type most likely what the user intended.
2024-07-15 14:07:19 +02:00
Marcial Rosales ee52464ade Merge changes from main 2024-07-15 02:33:27 -04:00
Marcial Rosales 5b6d0ecb7e Do not test against UAA 2024-07-15 02:33:27 -04:00
Marcial Rosales b110be5cb7 Replace oidc-client-ts dependencies 2024-07-15 02:33:27 -04:00
Michael Klishin aeeb990e57
Merge pull request #11709 from rabbitmq/gazelle-main
bazel run gazelle
2024-07-13 01:49:50 -04:00
Michael Klishin 6f67a85ad9
Merge pull request #11705 from rabbitmq/amqp-consumer-priority
Support consumer priority in AMQP
2024-07-13 00:11:42 -04:00
GitHub e74ecff203 bazel run gazelle 2024-07-13 04:02:17 +00:00
Michael Klishin bd5e9fa2ac
Merge pull request #11700 from rabbitmq/md/khepri/projections-ets-try-catch
Use 'try'/'catch' rather than 'ets:whereis/1' for Khepri projections
2024-07-12 17:09:02 -04:00
David Ansari e6587c6e45 Support consumer priority in AMQP
Arguments
* `rabbitmq:stream-offset-spec`,
* `rabbitmq:stream-filter`,
* `rabbitmq:stream-match-unfiltered`
are set in the `filter` field of the `Source`.
This makes sense for these consumer arguments because:
> A filter acts as a function on a message which returns a boolean result
> indicating whether the message can pass through that filter or not.

Consumer priority is not really such a predicate.
Therefore, it makes more sense to set consumer priority in the
`properties` field of the `Attach` frame.

We call the key `rabbitmq:priority` which maps to consumer argument
`x-priority`.

While AMQP 0.9.1 consumers are allowed to set any integer data
type for the priority level, this commit decides to enforce an `int`
value (range -(2^31) to 2^31 - 1 inclusive).
Consumer priority levels outside of this range are not needed in
practice.
2024-07-12 20:31:01 +02:00
David Ansari 3863db3989 Fix queue type consumer arguments
see https://www.rabbitmq.com/blog/2023/10/24/stream-filtering-internals#bonus-stream-filtering-on-amqp

`x-credit` was used by the 3.13 AMQP 1.0 plugin
2024-07-12 16:58:40 +02:00
Michael Davis 9f255db90f
Use 'try'/'catch' rather than 'ets:whereis/1' for Khepri projections
`ets:whereis/1` adds some overhead - it's two ETS calls rather than one
when `ets:whereis/1` returns a table identifier. It's also not atomic:
the table could disappear between `ets:whereis/1` calls and the call to
read data from a projection. We replace all `ets:whereis/1` calls on
projection tables with `try`/`catch` and return default values when we
catch the `badarg` `error` which ETS emits when passed a non-existing
table name.

One special case though is `ets:info/2` which returns `undefined` when
passed a non-existing table names. That block is refactored to use a
`case` instead.
2024-07-12 10:35:29 -04:00
David Ansari d4ea90d777 Simplify
Protect only `rabbit_mqtt_processor:handle_queue_event/2` since only
that call might throw a `{send_failed, Reaso}`.
2024-07-12 14:40:35 +02:00
Michal Kuratczyk f398892bda
Deprecate queue-master-locator (#11565)
* Deprecate queue-master-locator

This should not be a breaking change - all validation should still pass
* CQs can now use `queue-leader-locator`
* `queue-leader-locator` takes precedence over `queue-master-locator` if both are used
* regardless of which name is used, effectively there are only two  values: `client-local` (default) or `balanced`
* other values (`min-masters`, `random`, `least-leaders`) are mapped to `balanced`
* Management UI no longer shows `master-locator` fields when declaring a queue/policy, but such arguments can still be used manually (unless not permitted)
* exclusive queues are always declared locally, as before
2024-07-12 13:22:55 +02:00
Michael Klishin 0700e1cdc4 Revert "Provide per-exchange/queue metrics w/out channelID"
This reverts commit 3ed2e30e3a.
2024-07-11 21:34:52 -04:00
Michael Klishin 2bd3a2d307 Revert "Update deps/rabbitmq_prometheus/src/collectors/prometheus_rabbitmq_core_metrics_collector.erl"
This reverts commit 64e0812ced.
2024-07-11 21:34:46 -04:00
Michael Klishin 6b1e003afe Revert "New metrics return on detailed only"
This reverts commit 1aec73b21c.
2024-07-11 21:34:40 -04:00
Michael Klishin 85a4b365d0 Revert "Use functions w/out _process as its more approp."
This reverts commit 4d592da5ef.
2024-07-11 21:34:34 -04:00
Michael Klishin 2ec9625f1b Revert "Update deps/rabbit/src/rabbit_core_metrics_gc.erl"
This reverts commit b5fb5c4f2c.
2024-07-11 21:34:28 -04:00
LoisSotoLopez 6b4e3225d3 Update deps/rabbit/src/rabbit_core_metrics_gc.erl
Co-authored-by: Péter Gömöri <gomoripeti@users.noreply.github.com>
2024-07-11 17:34:18 -04:00
Lois Soto Lopez 94e3b2ccaa Use functions w/out _process as its more approp. 2024-07-11 17:34:18 -04:00
Lois Soto Lopez 18e667fc8f New metrics return on detailed only
Make new metrics return on detailed only and adjust some of the
help messages.
2024-07-11 17:34:18 -04:00
LoisSotoLopez cb2de0d9ea Update deps/rabbitmq_prometheus/src/collectors/prometheus_rabbitmq_core_metrics_collector.erl
Co-authored-by: Péter Gömöri <gomoripeti@users.noreply.github.com>
2024-07-11 17:34:18 -04:00
Lois Soto Lopez ec5e258825 Provide per-exchange/queue metrics w/out channelID 2024-07-11 17:34:18 -04:00
Michael Klishin 0af892396a
Merge pull request #11680 from rabbitmq/dependabot/maven/deps/rabbitmq_mqtt/test/java_SUITE_data/main/org.apache.maven.plugins-maven-surefire-plugin-3.3.1
build(deps): bump org.apache.maven.plugins:maven-surefire-plugin from 3.3.0 to 3.3.1 in /deps/rabbitmq_mqtt/test/java_SUITE_data
2024-07-11 16:11:35 -04:00
Michael Klishin 337a199bf5
Merge pull request #11681 from rabbitmq/dependabot/maven/deps/rabbitmq_stream/test/rabbit_stream_SUITE_data/main/org.apache.maven.plugins-maven-surefire-plugin-3.3.1
build(deps): bump org.apache.maven.plugins:maven-surefire-plugin from 3.3.0 to 3.3.1 in /deps/rabbitmq_stream/test/rabbit_stream_SUITE_data
2024-07-11 16:11:26 -04:00
Michael Klishin e35663c706
Merge pull request #11676 from rabbitmq/rabbitmq-users-4AOwZrQyekI
Catch abrupt TCP closure when processing `queue_event`
2024-07-11 16:05:52 -04:00
dependabot[bot] b438af07c7
build(deps): bump org.apache.maven.plugins:maven-surefire-plugin
Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.3.0 to 3.3.1.
- [Release notes](https://github.com/apache/maven-surefire/releases)
- [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.3.0...surefire-3.3.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-surefire-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-11 18:46:08 +00:00
dependabot[bot] eaf24e6b1f
build(deps): bump org.apache.maven.plugins:maven-surefire-plugin
Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.3.0 to 3.3.1.
- [Release notes](https://github.com/apache/maven-surefire/releases)
- [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.3.0...surefire-3.3.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-surefire-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-11 18:40:32 +00:00
dependabot[bot] ca1933f74a
build(deps): bump org.apache.maven.plugins:maven-surefire-plugin
Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.3.0 to 3.3.1.
- [Release notes](https://github.com/apache/maven-surefire/releases)
- [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.3.0...surefire-3.3.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-surefire-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-11 18:10:25 +00:00
Luke Bakken 994008aa7f Catch abrupt TCP closure when processing `queue_event`
Reported here:
https://groups.google.com/g/rabbitmq-users/c/4AOwZrQyekI
2024-07-11 09:36:44 -07:00
Michael Davis 8c6b866fc5
Merge pull request #11667 from rabbitmq/md/khepri-projections-wrap-ets-calls
rabbit_db_*: Wrap `ets` calls to projections in `whereis/1` checks
2024-07-11 11:27:56 -05:00
David Ansari 1ca9b95952 Delete unnecessary function
as suggested by JSP in PR feedback
2024-07-11 11:20:26 +02:00
David Ansari e31df4cd01 Fix test case rebalance
This test case was wrongly skipped and therefore never ran.
2024-07-11 11:20:26 +02:00
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
Michael Davis 88c1ad2f6e
Adapt to new `{error, timeout}` return value in Khepri 0.14.0
See rabbitmq/khepri#256.
2024-07-10 16:07:43 -04:00
Michael Davis ae0663d7ca
Merge pull request #11663 from rabbitmq/md/ci/turn-off-mixed-version-khepri-tests
Turn off mixed version tests against Khepri
2024-07-10 15:07:07 -05:00
Michael Davis c490043484
rabbit_db_*: Wrap `ets` calls to projections in `whereis/1` checks
Projections might not be available in a mixed-version scenario where a
cluster has nodes which are all blank/uninitialized and the majority
of nodes run a version of Khepri with a new machine version while the
minority does not have the new machine version's code.

In this case, the cluster's effective machine version will be set to
the newer version as the majority of members have access to the new
code. The older version members will be unable to apply commands
including the `register_projection` commands that set up these ETS
tables. When these ETS tables don't exist, calls like `ets:tab2list/1`
or `ets:lookup/2` cause `badarg` errors.

We use default empty values when `ets:whereis/1` returns `undefined` for
a projection table name. Instead we could use local queries or leader
queries. Writing equivalent queries is a fair amount more work and the
code would be hard to test. `ets:whereis/1` should only return
`undefined` in the above scenario which should only be a problem in
our mixed-version testing - not in practice.
2024-07-10 14:24:27 -04:00
Michael Klishin 348ca6f5a7 amqpl_direct_reply_to_SUITE: use separate queue names to avoid interference 2024-07-10 13:48:38 -04:00
Michael Davis 95279a31ec
rabbitmq_consistent_hash_exchange: Remove shard count for test suite
Without buildbuddy for parallelization and with the change in the parent
commit to reduce the number of cases, the suite now runs fast enough
that sharding is counterproductive.
2024-07-10 13:46:22 -04:00
Michael Davis 56bbf3760d
Respect RABBITMQ_METADATA_STORE in clustering_recovery_SUITE 2024-07-10 13:46:22 -04:00
Michael Davis da83358a4a
Respect RABBITMQ_METADATA_STORE in consistent hash exchange suite 2024-07-10 13:46:22 -04:00
Michael Davis 0a4e5a9845
Respect RABBITMQ_METADATA_STORE in clustering_management_SUITE 2024-07-10 13:46:05 -04:00
Michael Davis ecb757554e
Skip cluster_minority_SUITE when RABBITMQ_METADATA_STORE is set to mnesia
This suite is only meant to run with Khepri as the metadata store.
Instead of setting this explicitly we can look at the configured
metadata store and conditionally skip the entire suite. This prevents
these tests from running twice in CI.
2024-07-10 13:46:05 -04:00
Michael Davis bda1f7cef6
Skip metadata_store_clustering_SUITE in mixed versions testing
Khepri is not yet compatible with mixed-version testing and this suite
only tests clustering when Khepri is the metadata store in at least some
of the nodes.
2024-07-10 13:46:05 -04:00
David Ansari 5deff457a0 Fix direct reply to crash when tracing is enabled
This commit fixes https://github.com/rabbitmq/rabbitmq-server/discussions/11662

Prior to this commit the following crash occurred when an RPC reply message entered
RabbitMQ and tracing was enabled:
```
** Reason for termination ==
** {function_clause,
       [{rabbit_trace,'-tap_in/6-fun-0-',
            [{virtual_reply_queue,
                 <<"amq.rabbitmq.reply-to.g1h2AA5yZXBseUAyNzc5NjQyMAAAC1oAAAAAZo4bIw==.+Uvn1EmAp0ZA+oQx2yoQFA==">>}],
            [{file,"rabbit_trace.erl"},{line,62}]},
        {lists,map,2,[{file,"lists.erl"},{line,1559}]},
        {rabbit_trace,tap_in,6,[{file,"rabbit_trace.erl"},{line,62}]},
        {rabbit_channel,handle_method,3,
            [{file,"rabbit_channel.erl"},{line,1284}]},
        {rabbit_channel,handle_cast,2,
            [{file,"rabbit_channel.erl"},{line,659}]},
        {gen_server2,handle_msg,2,[{file,"gen_server2.erl"},{line,1056}]},
        {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,241}]}]}
```

(Note that no trace message is emitted for messages that are delivered to
direct reply to requesting clients (neither in 3.12, nor in 3.13, nor
after this commit). This behaviour can be added in future when a direct
reply virtual queue becomes its own queue type.)
2024-07-10 18:14:35 +02:00
Jean-Sébastien Pédron e890b9d37f
rabbitmq_peer_discovery_{etcd,consul}: Fix error handling if Khepri is unsupported
[How]
We must check the return value of `rabbit_ct_broker_helpers:run_steps/2`
because it could ask that the testsuite/testgroup/testcase should be
skipped.
2024-07-10 14:24:19 +02:00
Jean-Sébastien Pédron 69858867c5
Merge pull request #11654 from rabbitmq/rabbitmq-server-11653
Take `-setcookie` argument into account for peer args
2024-07-10 11:10:25 +02:00
David Ansari 50116f0927 Require MQTT feature flags in 4.0
Require all MQTT feature flags and remove their compatibility code:
* delete_ra_cluster_mqtt_node
* rabbit_mqtt_qos0_queue
* mqtt_v5

These feature flags were introduced in or before 3.13.0.
2024-07-10 10:27:59 +02:00
Luke Bakken c3c4612efa
Take `-setcookie` argument into account for peer args
Fixes issue raised in discussion #11653

The user used the following env var:

```
RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="-setcookie FOOBARBAZ"
```

...and the cookie was not passed to the peer node for peer discovery.
2024-07-09 17:00:58 -07:00
Michael Klishin 6b6cf58af8
Merge pull request #11650 from rabbitmq/dependabot/maven/deps/rabbitmq_mqtt/test/java_SUITE_data/main/org.assertj-assertj-core-3.26.3
build(deps-dev): bump org.assertj:assertj-core from 3.26.0 to 3.26.3 in /deps/rabbitmq_mqtt/test/java_SUITE_data
2024-07-09 15:08:24 -04:00
dependabot[bot] b0b857b0a4
build(deps-dev): bump org.assertj:assertj-core
Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj) from 3.26.0 to 3.26.3.
- [Release notes](https://github.com/assertj/assertj/releases)
- [Commits](https://github.com/assertj/assertj/compare/assertj-build-3.26.0...assertj-build-3.26.3)

---
updated-dependencies:
- dependency-name: org.assertj:assertj-core
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-09 18:52:14 +00:00
dependabot[bot] 6b2d5573ba
build(deps-dev): bump org.assertj:assertj-core
Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj) from 3.26.0 to 3.26.3.
- [Release notes](https://github.com/assertj/assertj/releases)
- [Commits](https://github.com/assertj/assertj/compare/assertj-build-3.26.0...assertj-build-3.26.3)

---
updated-dependencies:
- dependency-name: org.assertj:assertj-core
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-09 18:45:56 +00:00
dependabot[bot] ab376c0b6b
build(deps-dev): bump org.assertj:assertj-core
Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj) from 3.26.0 to 3.26.3.
- [Release notes](https://github.com/assertj/assertj/releases)
- [Commits](https://github.com/assertj/assertj/compare/assertj-build-3.26.0...assertj-build-3.26.3)

---
updated-dependencies:
- dependency-name: org.assertj:assertj-core
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-09 18:06:42 +00:00
Artem Bilan 8b7ba05f32
Consistent Hash doc improvement
Mention in the docs that `hash-header` and `hash-property` are mutually exclusive.
2024-07-09 10:47:02 -04:00
David Ansari 6a989d3ea1 Add inter cluster AMQP 1.0 shovel test
Add tests which shovel messages via AMQP from an 3.13 cluster to a 4.0
cluster and vice versa.

This test ensures that a 3.13 AMQP 1.0 client can communicate with a 4.0
node, which isn't tested anywhere else since all other mixed version
tests use the new 4.0 AMQP 1.0 client.
2024-07-09 12:14:46 +02:00
David Ansari 37b1ffe244 Upgrade AMQP address format in tests
from v1 to v2.

We still use AMQP address format v1 when connecting to an old 3.13 node.
2024-07-08 13:23:50 +02:00
Michael Klishin 398c7de368
Merge pull request #11619 from rabbitmq/federation-definition-export
rabbit_definitions: ensure federation-upstream-set parameters are exported
2024-07-04 17:08:38 -04:00
Diana Parra Corbacho bb41a37364 Add new testsuite to app.bzl 2024-07-04 15:53:12 +02:00
Diana Parra Corbacho aa89307182 Use rabbit_data_coercion:to_map 2024-07-04 15:40:18 +02:00
David Ansari 19523876cd Make AMQP address v2 format user friendly
This commit is a follow up of https://github.com/rabbitmq/rabbitmq-server/pull/11604

This commit changes the AMQP address format v2 from
```
/e/:exchange/:routing-key
/e/:exchange
/q/:queue
```
to
```
/exchanges/:exchange/:routing-key
/exchanges/:exchange
/queues/:queue
```

Advantages:
1. more user friendly
2. matches nicely with the plural forms of HTTP API v1 and HTTP API v2

This plural form is still non-overlapping with AMQP address format v1.

Although it might feel unusual at first to send a message to `/queues/q1`,
if you think about `queues` just being a namespace or entity type, this
address format makes sense.
2024-07-04 14:33:05 +02:00
Diana Parra Corbacho a8dcca084a rabbit_definitions: ensure federation-upstream-set parameters are exported
These parameters are not proplists but a list of maps
2024-07-04 12:41:34 +02:00
Michael Klishin 588a1d3a9b rabbit_mgmt_http_SUITE: make users_test less dependent on test execution order 2024-07-03 23:27:27 -04:00
Michael Klishin 25f90f4f2a rabbit_mgmt_http_SUITE: update test suite shard count 2024-07-03 23:22:37 -04:00
Michael Klishin 98e31bb3f4 Split management HTTP API tests to reduce interference
Plus port a few other small test suite edits from
v3.13.x.
2024-07-03 23:15:01 -04:00
Michael Klishin 20aee3f09f
Merge pull request #11604 from rabbitmq/amqp-addr
Use different AMQP address format for v1 and v2
2024-07-03 19:32:05 -04:00
Michael Davis 427876b694
rabbit_runtime_parameters: Remove dead 'value_global/2', 'value/4'
`rabbit_runtime_parameters:value_global/2` was only used in
`rabbit_nodes:cluster_name/0` since near the beginning of the commit
history of the server and its usage was eliminated in 06932b9fcb
(#3085, released in v3.8.17+ and v3.9.0+).

`rabbit_runtime_parameters:value/4` doesn't appear to have been ever
used since it was introduced near the beginning of the commit history.
It may have been added just to mirror `value_global/2`'s interface.

Eliminating these dead functions allows us to also eliminate a somewhat
complicated function `rabbit_db_rtparams:get_or_set/2`.
2024-07-03 16:44:52 -04:00
David Ansari 7b18bd7a81 Enforce percent encoding
Partially copy file
https://github.com/ninenines/cowlib/blob/optimise-urldecode/src/cow_uri.erl
We use this copy because:
1. uri_string:unquote/1 is lax: It doesn't validate that characters that are
   required to be percent encoded are indeed percent encoded. In RabbitMQ,
   we want to enforce that proper percent encoding is done by AMQP clients.
2. uri_string:unquote/1 and cow_uri:urldecode/1 in cowlib v2.13.0 are both
   slow because they allocate a new binary for the common case where no
   character was percent encoded.
When a new cowlib version is released, we should make app rabbit depend on
app cowlib calling cow_uri:urldecode/1 and delete this file (rabbit_uri.erl).
2024-07-03 17:01:51 +02:00
David Ansari 0de9591050 Use different AMQP address format for v1 and v2
to distinguish between v1 and v2 address formats.

Previously, v1 and v2 address formats overlapped and behaved differently
for example for:
```
/queue/:queue
/exchange/:exchange
```

This PR changes the v2 format to:
```
/e/:exchange/:routing-key
/e/:exchange
/q/:queue
```
to distinguish between v1 and v2 addresses.

This allows to call `rabbit_deprecated_features:is_permitted(amqp_address_v1)`
only if we know that the user requests address format v1.

Note that `rabbit_deprecated_features:is_permitted/1` should only
be called when the old feature is actually used.

Use percent encoding / decoding for address URI format v2.
This allows to use any UTF-8 encoded characters including slashes (`/`)
in routing keys, exchange names, and queue names and is more future
safe.
2024-07-03 16:36:03 +02:00
GitHub db63067f1e bazel run gazelle 2024-07-02 04:02:31 +00:00
Karl Nilsson 7273c6846d
Merge pull request #11582 from rabbitmq/testfixes-glorious-testfixes-and-other-improvements-hurray
Various test improvements
2024-07-01 16:54:49 +01:00
Loïc Hoguin a561b45dcf
Merge pull request #11573 from rabbitmq/loic-more-make
Another make PR
2024-07-01 14:27:04 +02:00
Karl Nilsson 2b09891a77 Fix flake in rabbit_stream_queue_SUITE 2024-07-01 10:27:52 +01:00
Karl Nilsson 087d701b6e speed up policy_SUITE 2024-07-01 10:27:52 +01:00
Karl Nilsson a277713105 speed up limit and tracking* suites
By removing explicit meta data store groups.
2024-07-01 10:27:52 +01:00
Karl Nilsson b67f7292b5 remove explicit meta data store groups from bindings_SUITE 2024-07-01 10:27:52 +01:00
Karl Nilsson a5819bf41e Remove meta data store groups from publisher_confirms_parallel_SUITE 2024-07-01 10:27:52 +01:00
Karl Nilsson 6a655b6daa Fix test flake in publisher_confirms_parallel_SUITE
test `confirm_nack` had a race condition that mean either ack or nack
where likely outcomes. By stopping the queue before the publish we
ensure only nack is the valid outcome.
2024-07-01 10:27:52 +01:00
David Ansari 1bc1e4ae34 Remove HA failover for classic mirrored queue
This is a follow-up commit of what has been missed in
* https://github.com/rabbitmq/rabbitmq-server/pull/9815, and
* https://github.com/rabbitmq/rabbitmq-server/pull/11583
2024-07-01 11:18:01 +02:00
Michael Klishin e25e927f04
Merge pull request #11585 from rabbitmq/md/management/fix-error-message-from-vhost-timeout
Management UI: Fix internal_server_error args for put vhost failures
2024-07-01 00:23:33 -04:00
Simon Unge fa7d911391 Add logging for when limit is hit for vhost_max and components such as shovels and federations 2024-06-28 21:35:14 +00:00
Michael Klishin 447fac9feb
Merge pull request #11583 from rabbitmq/remove-cancel-on-ha-failover
Remove x-cancel-on-ha-failover
2024-06-28 16:04:05 -04:00
Michael Klishin 756d3578b6 rabbit_channel: fix a compilation warning 2024-06-28 12:54:48 -04:00
David Ansari 166e5d8a2f Bump AMQP.NET Lite to 2.4.11 2024-06-28 18:50:59 +02:00
Michael Davis 8f60b69cbc
Management UI: Fix internal_server_error args for put vhost failures
`rabbit_mgmt_util:internal_server_error/4` expects an atom or binary
and a string formattable term (`~ts`) as arguments but
`rabbit_mgmt_wm_vhost` passes charlists and any term. This can cause
a log formatter crash and an unexpected message in the management UI
when attempting to add a vhost while a cluster is in a minority with
Khepri enabled for example.

We can pass atoms for the `Error` parameter and binaries or strings for
the `Reason` parameter to fix both issues.
2024-06-28 12:26:49 -04:00
David Ansari 25bd2f9bf7
Merge pull request #11574 from rabbitmq/remove-consumer-api
Classic queue removes consumer
2024-06-28 17:24:12 +02:00
Diana Parra Corbacho 37ec060f7a Remove x-cancel-on-ha-failover 2024-06-28 17:11:37 +02:00
David Ansari c189af8857 Simplify
Also, notify decorators when requeuing due to consumer
removal causes the queue to become empty.
2024-06-28 15:38:21 +02:00
Loïc Hoguin bbfa066d79
Cleanup .gitignore files for the monorepo
We don't need to duplicate so many patterns in so many
files since we have a monorepo (and want to keep it).

If I managed to miss something or remove something that
should stay, please put it back. Note that monorepo-wide
patterns should go in the top-level .gitignore file.
Other .gitignore files are for application or folder-
specific patterns.
2024-06-28 12:00:52 +02:00
Michael Klishin 2a15f9cf01
Merge pull request #11577 from rabbitmq/dependabot/maven/deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot/main/org.junit.jupiter-junit-jupiter-params-5.10.3
build(deps-dev): bump org.junit.jupiter:junit-jupiter-params from 5.10.2 to 5.10.3 in /deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot
2024-06-27 15:10:43 -04:00
Michael Klishin f5c33904ca
Merge pull request #11579 from rabbitmq/dependabot/maven/deps/rabbitmq_mqtt/test/java_SUITE_data/main/org.junit.jupiter-junit-jupiter-5.10.3
build(deps-dev): bump org.junit.jupiter:junit-jupiter from 5.10.2 to 5.10.3 in /deps/rabbitmq_mqtt/test/java_SUITE_data
2024-06-27 15:10:36 -04:00
dependabot[bot] e85450388d
build(deps-dev): bump junit.jupiter.version
Bumps `junit.jupiter.version` from 5.10.2 to 5.10.3.

Updates `org.junit.jupiter:junit-jupiter-engine` from 5.10.2 to 5.10.3
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.2...r5.10.3)

Updates `org.junit.jupiter:junit-jupiter-params` from 5.10.2 to 5.10.3
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.2...r5.10.3)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-type: direct:development
  update-type: version-update:semver-patch
- dependency-name: org.junit.jupiter:junit-jupiter-params
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-27 18:52:29 +00:00
dependabot[bot] af2a944b86
build(deps-dev): bump org.junit.jupiter:junit-jupiter
Bumps [org.junit.jupiter:junit-jupiter](https://github.com/junit-team/junit5) from 5.10.2 to 5.10.3.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.2...r5.10.3)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-27 18:46:15 +00:00
dependabot[bot] 34c5fd8c82
build(deps-dev): bump org.junit.jupiter:junit-jupiter-params
Bumps [org.junit.jupiter:junit-jupiter-params](https://github.com/junit-team/junit5) from 5.10.2 to 5.10.3.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.2...r5.10.3)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-params
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-27 18:32:16 +00:00
dependabot[bot] b7e3cb3b28
build(deps-dev): bump junit.jupiter.version
Bumps `junit.jupiter.version` from 5.10.2 to 5.10.3.

Updates `org.junit.jupiter:junit-jupiter-engine` from 5.10.2 to 5.10.3
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.2...r5.10.3)

Updates `org.junit.jupiter:junit-jupiter-params` from 5.10.2 to 5.10.3
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.2...r5.10.3)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-type: direct:development
  update-type: version-update:semver-patch
- dependency-name: org.junit.jupiter:junit-jupiter-params
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-27 18:24:10 +00:00
David Ansari daf61c9653 Classic queue removes consumer
## What?

The rabbit_queue_type API has allowed to cancel a consumer.
Cancelling a consumer merely stops the queue sending more messages
to the consumer. However, messages checked out to the cancelled consumer
remain checked out until acked by the client. It's up to the client when
and whether it wants to ack the remaining checked out messages.

For AMQP 0.9.1, this behaviour is necessary because the client may
receive messages between the point in time it sends the basic.cancel
request and the point in time it receives the basic.cancel_ok response.

AMQP 1.0 is a better designed protocol because a receiver can stop a
link as shown in figure 2.46.
After a link is stopped, the client knows that the queue won't deliver
any more messages.
Once the link is stopped, the client can subsequently detach the link.

This commit extends the rabbit_queue_type API to allow a consumer being
immediately removed:
1. Any checked out messages to that receiver will be requeued by the
   queue. (As explained previously, a client that first stops a link
   by sending a FLOW with `link_credit=0` and `echo=true` and waiting
   for the FLOW reply from the server and settles any messages before
   it sends the DETACH frame, won't have any checked out messages).
2. The queue entirely forgets this consumer and therefore stops
   delivering messages to the receiver.

This new behaviour of consumer removal is similar to what happens when
an AMQP 0.9.1 channel is closed: All checked out messages to that
channel will be requeued.

 ## Why?

Removing the consumer immediately simplifies many aspects:
1. The server session process doesn't need to requeue any checked out
   messages for the receiver when the receiver detaches the link.
   Specifically, messages in the outgoing_unsettled_map and
   outgoing_pending queue don't need to be requeued because the queue
   takes care of requeueing any checked out messages.
2. It simplifies reasoning about clients first detaching and then
   re-attaching in the same session with the same link handle (the handle
   becomes available for re-use once a link is closed): This will result
   in the same RabbitMQ queue consumer tag.
3. It simplifies queue implementations since state needs to be hold and
   special logic needs to be applied to consumers that are only
   cancelled (basic.cancel AMQP 0.9.1) but not removed.
4. It makes the single active consumer feature safer when it comes to
   maintaning message order: If a client cancels consumption via AMQP
   0.9.1 basic.cancel, but still has in-flight checked out messages,
   the queue will activate the next consumer. If the AMQP 0.9.1 client
   shortly after crashes, messages to the old consumer will be requeued
   which results in message being out of order. To maintain message order,
   an AMQP 0.9.1 client must close the whole channel such that messages
   are requeued before the next consumer is activated.
   For AMQP 1.0, the client can either stop the link first (preferred)
   or detach the link directly. Detaching the link will requeue all
   messages before activating the next consumer, therefore maintaining
   message order. Even if the session crashes, message order will be
   maintained.

  ## How?

`rabbit_queue_type:cancel` accepts a spec as argument.
The new interaction between session proc and classic queue proc (let's
call it cancel API v2) must be hidden behind a feature flag.
This commit re-uses feature flag credit_api_v2 since it also gets
introduced in 4.0.
2024-06-27 19:50:36 +02:00
David Ansari 19670b625b Copy remove consumer API from qq-v4 2024-06-27 15:09:39 +02:00
Karl Nilsson 237d050341 remove .DS_Store 2024-06-27 10:51:39 +01:00
Loïc Hoguin 18f8ee1457
Merge pull request #11549 from rabbitmq/loic-make-cleanups
Various make cleanup/consolidation
2024-06-27 11:42:24 +02:00
David Ansari 53b20ec78a Fix amqp_client_SUITE flake
Fix the following sporadic failure:

```
=== === Reason: {assertMatch,
                     [{module,amqp_client_SUITE},
                      {line,446},
                      {expression,
                          "rabbitmq_amqp_client : delete_queue ( LinkPair , QName )"},
                      {pattern,"{ ok , # { message_count := NumMsgs } }"},
                      {value,{ok,#{message_count => 29}}}]}
  in function  amqp_client_SUITE:sender_settle_mode_mixed/1 (amqp_client_SUITE.erl, line 446)
 ```
The last message (30th) is send as settled.
It apparently happened that all messages up to 29 got stored.
The 29th message also got confirmed.
Subsequently the queue got deleted with only 29 ready messages.

Bumping NumbMsgs to 31 ensures that the last message is sent unsettled.
2024-06-27 08:57:53 +00:00
David Ansari eed48ef3ee Fix amqp_client_SUITE flake
Fix the following sporadich error in CI:
```
=== Location: [{amqp_client_SUITE,available_messages,3137},
              {test_server,ts_tc,1793},
              {test_server,run_test_case_eval1,1302},
              {test_server,run_test_case_eval,1234}]
=== === Reason: {assertEqual,
                     [{module,amqp_client_SUITE},
                      {line,3137},
                      {expression,"get_available_messages ( Receiver )"},
                      {expected,5000},
                      {value,0}]}
```

The client decrements the available variable from 1 to 0 when it
receives the transfer and sends a credit_exhausted event to the CT test
case proc. The CT test case proc queries the client session proc for available
messages, which is still 0. The FLOW frame from RabbitMQ to the client with the
available=5000 set could arrive shortly after.
2024-06-27 08:00:48 +00:00
David Ansari 6aa2de3f4f Avoid crash in test case
Avoid the following unexpected error in mixed version testing where
feature flag credit_api_v2 is disabled:
```
[error] <0.1319.0> Timed out waiting for credit reply from quorum queue 'stop' in vhost '/'. Hint: Enable feature flag credit_api_v2
[warning] <0.1319.0> Closing session for connection <0.1314.0>: {'v1_0.error',
[warning] <0.1319.0>                                             {symbol,<<"amqp:internal-error">>},
[warning] <0.1319.0>                                             {utf8,
[warning] <0.1319.0>                                              <<"Timed out waiting for credit reply from quorum queue 'stop' in vhost '/'. Hint: Enable feature flag credit_api_v2">>},
[warning] <0.1319.0>                                             undefined}
[error] <0.1319.0> ** Generic server <0.1319.0> terminating
[error] <0.1319.0> ** Last message in was {'$gen_cast',
[error] <0.1319.0>                            {frame_body,
[error] <0.1319.0>                                {'v1_0.flow',
[error] <0.1319.0>                                    {uint,283},
[error] <0.1319.0>                                    {uint,65535},
[error] <0.1319.0>                                    {uint,298},
[error] <0.1319.0>                                    {uint,4294967295},
[error] <0.1319.0>                                    {uint,1},
[error] <0.1319.0>                                    {uint,282},
[error] <0.1319.0>                                    {uint,50},
[error] <0.1319.0>                                    {uint,0},
[error] <0.1319.0>                                    undefined,undefined,undefined}}}
```

Presumably, the server session proc timed out receiving a credit reply from
the quorum queue because the test case deleted the quorum queue
concurrently with the client (and therefore also the server session
process) topping up link credit.

This commit detaches the link first and ends the session synchronously
before deleting the quorum queue.
2024-06-27 07:30:23 +00:00
Michael Klishin 083800809f
Merge pull request #11436 from rabbitmq/loic-remove-fhc
Remove most of the fd related FHC code
2024-06-26 15:19:49 -04:00
Michael Klishin de866b81cb
Merge pull request #11547 from rabbitmq/speed-up-rabbit-tests
Speed up rabbit tests suites
2024-06-26 15:15:06 -04:00
Michael Klishin 8ae8f733e5
Merge pull request #11567 from rabbitmq/osiris-v1.8.2
Osiris v1.8.2
2024-06-26 13:59:57 -04:00
Loïc Hoguin af49f5c526
make: Remove FAST_RUN_BROKER; make normal run-broker fast
The DIST step used rsync for copying files; changing this
to using cp/rm provides a noticeable speed boost.

Before this commit the situation was as follows. With
FAST_RUN_BROKER=1 we are pretty fast but don't benefit
from parallel make:

  make -C deps/rabbitmq_management run-broker FAST_RUN_BROKER=1
    2,04s user 1,57s system 90% cpu 4,016 total
  make -C deps/rabbitmq_management run-broker FAST_RUN_BROKER=1 -j8
    2,08s user 1,55s system 89% cpu 4,069 total

With FAST_RUN_BROKER=0 we are slow; on the other hand
we greatly benefit from parallel make:

  make -C deps/rabbitmq_management run-broker FAST_RUN_BROKER=0
    3,29s user 1,93s system 81% cpu 6,425 total
  make -C deps/rabbitmq_management run-broker FAST_RUN_BROKER=0 -j8
    3,36s user 1,90s system 142% cpu 3,695 total

The reason this method achieves such a result is because
the DIST step that takes a lot of time can be run in
parallel. In addition, this method results on only
the necessary plugins being available in the path,
therefore it doesn't discover unrelated plugins
during node startup, saving time.

By changing rsync to cp/rm, we get great results even
without parallel make:

  make -C deps/rabbitmq_management run-broker FAST_RUN_BROKER=0
    3,28s user 1,64s system 105% cpu 4,684 total
  make -C deps/rabbitmq_management run-broker FAST_RUN_BROKER=0 -j8
    3,27s user 1,65s system 135% cpu 3,640 total

We are within 1s of FAST_RUN_BROKER=1 by default, and
faster than FAST_RUN_BROKER=1 with parallel make. On
top of that, we greatly benefit when rebuilding as the
DIST files do not need to be rebuilt every time:

  make -C deps/rabbitmq_management run-broker FAST_RUN_BROKER=0
    2,94s user 1,40s system 107% cpu 4,035 total
  make -C deps/rabbitmq_management run-broker FAST_RUN_BROKER=0 -j8
    2,85s user 1,51s system 138% cpu 3,140 total

Therefore it only makes sense to remove FAST_RUN_BROKER,
and instead use the old method which is both more correct
and has more potential for optimisation.
2024-06-26 16:53:07 +02:00
David Ansari 2adcdc1a28 Attempt to de-flake
This commit attempts to remove the following flake:
```
{amqp_client_SUITE,server_closes_link,1113}
{badmatch,[<14696.3530.0>,<14696.3453.0>]}
```
by waiting after each test case until sessions were de-registered from
the 1st RabbitMQ node.
2024-06-26 15:57:26 +02:00
Karl Nilsson 8995e00d3f Osiris v1.8.2
* Use the latest method of building the RabbitMQ OCI in actions by @pjk25 in https://github.com/rabbitmq/osiris/pull/159
* Correctly handle case where replica exits in handle_continue. by @kjnilsson in https://github.com/rabbitmq/osiris/pull/160
* Add osiris.app.src file by @lukebakken in https://github.com/rabbitmq/osiris/pull/158
2024-06-26 14:19:16 +01:00
David Ansari dcb2fe0fd9 Fix message IDs settlement order
## What?

This commit fixes issues that were present only on `main`
branch and were introduced by #9022.

1. Classic queues (specifically `rabbit_queue_consumers:subtract_acks/3`)
   expect message IDs to be (n)acked in the order as they were delivered
   to the channel / session proc.
   Hence, the `lists:usort(MsgIds0)` in `rabbit_classic_queue:settle/5`
   was wrong causing not all messages to be acked adding a regression
   to also AMQP 0.9.1.
2. The order in which the session proc requeues or rejects multiple
   message IDs at once is important. For example, if the client sends a
   DISPOSITION with first=3 and last=5, the message IDs corresponding to
   delivery IDs 3,4,5 must be requeued or rejected in exactly that
   order.
   For example, quorum queues use this order of message IDs in
   34d3f94374/deps/rabbit/src/rabbit_fifo.erl (L226-L234)
   to dead letter in that order.

 ## How?

The session proc will settle (internal) message IDs to queues in ascending
(AMQP) delivery ID order, i.e. in the order messages were sent to the
client and in the order messages were settled by the client.

This commit chooses to keep the session's outgoing_unsettled_map map
data structure.

An alternative would have been to use a queue or lqueue for the
outgoing_unsettled_map as done in
* 34d3f94374/deps/rabbit/src/rabbit_channel.erl (L135)
* 34d3f94374/deps/rabbit/src/rabbit_queue_consumers.erl (L43)

Whether a queue (as done by `rabbit_channel`) or a map (as done by
`rabbit_amqp_session`) performs better depends on the pattern how
clients ack messages.

A queue will likely perform good enough because usually the oldest
delivered messages will be acked first.
However, given that there can be many different consumers on an AQMP
0.9.1 channel or AMQP 1.0 session, this commit favours a map because
it will likely generate less garbage and is very efficient when for
example a single new message (or few new messages) gets acked while
many (older) messages are still checked out by the session (but by
possibly different AMQP 1.0 receivers).
2024-06-26 13:35:41 +02:00
Karl Nilsson 1825f2be77 Fix flake in rabbit_stream_queue_SUITE 2024-06-26 09:32:08 +01:00
Loïc Hoguin a64d1e67fc
Remove looking_glass
It has largely been superseded by `perf`. It is no longer
generally useful. It can always be added to BUILD_DEPS for
the rare cases it is needed, or installed locally and
pointed to by setting its path to ERL_LIBS.
2024-06-26 09:56:46 +02:00
Karl Nilsson c36b56b626 speed up signal_handling_SUITE 2024-06-26 07:38:29 +01:00
Karl Nilsson d25017d8cf speed up rabbit_fifo_dlx_integration_SUITE slightly 2024-06-26 07:38:29 +01:00
Karl Nilsson e2767a750d further speed up quorum_queue_SUITE 2024-06-26 07:38:29 +01:00
Karl Nilsson e84cb65287 speed up dead_lettering_SUITE
By lowering tick intervals.
2024-06-26 07:38:29 +01:00
Karl Nilsson 3bb5030132 speed up queue_parallel_SUITE
By removing groups that test quorum configurations that are no
longer relevant.
2024-06-26 07:38:29 +01:00
Karl Nilsson 6843384c85 speed up metrics_SUITE 2024-06-26 07:38:29 +01:00
Karl Nilsson 7f0f632de7 dynamic_qq test tweak 2024-06-26 07:38:29 +01:00
Karl Nilsson 30c14e6f35 speed up product_info_SUITE
By running all tests in a single node rather than starting a new
one for each test.
2024-06-26 07:38:29 +01:00
Karl Nilsson 371b429ea1 speed up consumer_timeout_SUITE
By reducing consumer timeout and the receive timeout.
2024-06-26 07:38:29 +01:00
Karl Nilsson 25d79fa448 speed up rabbit_fifo_prop_SUITE
mostly by reducing the sizes of some properties as they can run
quite slowly in ci
2024-06-26 07:38:29 +01:00
Karl Nilsson f919fee7f1 speed up quorum_queues_SUITE
AFTER: gmake -C deps/rabbit ct-quorum_queue  6.15s user 4.25s system 2% cpu 6:25.29 total
2024-06-26 07:38:29 +01:00
Karl Nilsson 3551309baf speed up dynamic_qq_SUITE
BEFORE: time gmake -C deps/rabbit ct-dynamic_qq  1.92s user 1.44s system 2% cpu 2:23.56 total

AFTER: time gmake -C deps/rabbit ct-dynamic_qq  1.66s user 1.22s system 2% cpu 1:56.44 total
2024-06-26 07:38:29 +01:00
Karl Nilsson 13a1a7c7fe speed up rabbit_stream_queue_SUITE
Reduce the number of tests that are run for 2 nodes.

BEFORE: time gmake -C deps/rabbit ct-rabbit_stream_queue  7.22s user 5.72s system 2% cpu 8:28.18 total

AFTER time gmake -C deps/rabbit ct-rabbit_stream_queue  27.04s user 8.43s system 10% cpu 5:38.63 total
2024-06-26 07:38:29 +01:00
Loïc Hoguin 2b03233ac1
make: Remove rabbitmq-macros.mk
It hasn't been used for some time. If compare_version
becomes necessary again in the future, it's in the history.
2024-06-25 13:39:38 +02:00
Loïc Hoguin 9f15e978b1
make: Remove xrefr
It is no longer used by Erlang.mk.
2024-06-25 13:08:08 +02:00
Michael Klishin 34d3f94374 rabbitmq_tracing: test suite cosmetics
(cherry picked from commit de2656c76bec8159dfa1569bc9c387c9e85ab92d)
2024-06-24 16:13:41 -04:00
Michael Klishin 19f6e672fa Tracing: expose two more settings to rabbitmq.conf 2024-06-24 16:10:47 -04:00
Michael Klishin 118f1a4c86 Tracing: expose directory path setting as tracing.dir
in rabbitmq.conf.

Note that this does not include any tests because
the test would have to use a writeable directory,
and it is not obvious what kind of cross-platform
path that is not computed programmatically they
could use.

It's a trivial schema file that uses an existing
core validator => let's leave it as is.
2024-06-24 15:56:17 -04:00
Michael Klishin 6bc258e9ea
README: remove Erlang 22 and 23 status badges
Actions are visible enough on GitHub to not have to worry
about updating them.
2024-06-24 14:58:24 -04:00
David Ansari b524639e32 Remove dead code 2024-06-24 18:17:40 +02:00
Loïc Hoguin 7e9cac3d00
make: Remove Travis-specific targets/config
This should no longer be used.
2024-06-24 14:12:02 +02:00
Loïc Hoguin 881ebc6138
make: Remove ANT variables
This should no longer be used.
2024-06-24 14:06:48 +02:00
Loïc Hoguin 31310d2315
make: Simplify looking for DEPS_DIR
With the monorepo the dependencies are either correct
or are the parent directory (when we are in a rabbit
application in deps/).
2024-06-24 14:06:46 +02:00
Loïc Hoguin 2a64a0f6c8
Restore FD info in rabbitmqctl status
The FD limits are still valuable.

The FD used will still show some information during CQv1
upgrade to v2 so it is kept for now. But in the future
it will have to be reworked to query the system, or be
removed.
2024-06-24 12:07:51 +02:00