Commit Graph

24667 Commits

Author SHA1 Message Date
Arnaud Cogoluègnes ab2c565b49
Merge pull request #3423 from rabbitmq/streams-sort-partitions
Sort stream partitions using binding parameter
2021-09-15 14:56:17 +02:00
Arnaud Cogoluègnes faee72552a
Polish test 2021-09-15 11:56:53 +02:00
Arnaud Cogoluègnes 4bbed58352
Add Bazel rule for rabbit_stream_utils_SUITE 2021-09-15 11:38:17 +02:00
Arnaud Cogoluègnes 5b83dceb87
Return only streams for partition-related commands
The stream partition metadata is based on bindings,
so we make sure to return only streams from the binding
information.
2021-09-15 11:33:04 +02:00
Arnaud Cogoluègnes b140395864
Fall back to HOSTNAME(1) in stream Java test suite
In case the Java way fails (only on new CI).
2021-09-15 10:36:27 +02:00
Arnaud Cogoluègnes 04a0653571
Sort stream partitions using binding parameter
If present. To make the partition order stable.
2021-09-14 18:02:22 +02:00
Gabriele Santomaggio 23d0e4d458 Add counters on detail pages
closes https://github.com/rabbitmq/rabbitmq-server/issues/3416
2021-09-14 17:26:05 +02:00
Gabriele Santomaggio 756282b056 Add counters on detail pages
closes https://github.com/rabbitmq/rabbitmq-server/issues/3416
2021-09-14 17:25:34 +02:00
Gabriele Santomaggio 346adc86af Add counters on detail pages
closes https://github.com/rabbitmq/rabbitmq-server/issues/3416
2021-09-14 17:18:49 +02:00
Loïc Hoguin dfe0f4b0a6
Clear federation before deleting message_flow queues
Without this change the test could take a very long time to
cleanup the queues and finish because of a race condition
between the queue deletion and the federation link being
restarted and declaring the queue again.

(The test bidirectional was renamed to message_flow to better
 represent what it is doing.)
2021-09-14 14:46:36 +02:00
Arnaud Cogoluègnes 3f1b228dcc
Merge pull request #3394 from rabbitmq/rabbitmq-server-3389-stream-publishers-in-queue-page
Display stream publishers in queue management page
2021-09-14 08:11:53 +02:00
Michael Klishin c8d483809e
Resolve a missed conflict 2021-09-13 20:33:11 +03:00
Michael Klishin f79bc1c935
Merge branch 'master' into stream-reader-close-in-terminate
Conflicts:
	deps/rabbitmq_stream/src/rabbit_stream_reader.erl
2021-09-13 20:27:58 +03:00
Arnaud Cogoluègnes 8f207e3c5f
Make stream protocol route command return several streams
We expect to have 1 stream for each routing key, but
as binding can return several queues for a given key we
let that possibility open in the stream protocol.
2021-09-13 17:53:25 +02:00
Arnaud Cogoluègnes b0ec9ff64c
Adapt stream publisher list view to connection/queue context
References #3389
2021-09-13 16:31:06 +02:00
Arnaud Cogoluègnes 39a51772c6
Add extension into dispatcher block code
This is necessary to make sure the extension addition is actually
done in case of refresh of the queue page.

References #3389
2021-09-13 15:17:49 +02:00
Karl Nilsson 9e4506041d fix build warnings 2021-09-13 11:38:41 +01:00
Karl Nilsson 135575b3ff Stream reader: close osiris logs and sockets in terminate
Instead of injecting it into varios places inside the code.

When the osiris log is closed it will decrement the global "readers"
counter which is why it is much safer to do this in terminate.
2021-09-13 11:23:35 +01:00
Loïc Hoguin 09c8cd4f98
Increase classic queue shutdown timeout
A value that is too low will prevent the index from shutting
down in time when there are many queues. This leads to the
process being killed and on the next RabbitMQ restart a
(potentially very long) dirty recovery is needed.

The value of 10 minutes was chosen to mirror the shutdown
timeout of the message store. Since both queues and message
store need to have shut down gracefully in order to have
a clean restart it makes sense to use the same value.

Related: c40c2628a9
2021-09-13 10:59:30 +02:00
Karl Nilsson 239e136480
Merge pull request #3397 from rabbitmq/handle-connection-closures-in-stream-reader
Handle closed connections in stream reader
2021-09-10 16:03:04 +01:00
Karl Nilsson 3b1714cbe3 formatting 2021-09-10 15:26:26 +01:00
Karl Nilsson f10db03b4d Gracefully terminate stream reaader
when the client forcefully terminates TCP connection

Also improve logging.
2021-09-10 15:24:29 +01:00
Philip Kuryloski 16a22f0424
Merge pull request #3401 from rabbitmq/ranch-21-bazel
Use Ranch 2.1.0 in bazel build
2021-09-10 15:16:10 +02:00
Arnaud Cogoluègnes b5700751cf
Add HTTP endpoint for stream publishers
References #3389
2021-09-10 15:14:09 +02:00
Michal Kuratczyk 624767281f Enable metrics collection in run_tests
Proposed `min-masters` implementation relies on metrics so they need to
be collected during queue_master_location tests.
2021-09-10 14:51:11 +02:00
Philip Kuryloski 5fd9d1f638 Use Ranch 2.1.0 in bazel build
Matches 063d32626d
2021-09-10 14:46:36 +02:00
Michael Klishin 13ac078746
Merge pull request #3398 from rabbitmq/rabbitmq-server-3390
Revisit two rabbitmq.conf validators
2021-09-10 13:53:37 +03:00
Michael Klishin 3248895ec9
Revisit two rabbitmq.conf validators
* max_message_size had an off-by-one error and unfortunate naming
 * classic mirrored queue batch size was not validating the size in messages.
   The limit of over 2B messages did not make much sense. 1M is a still very
   high but a more reasonable upper bound

Fixes #3390
2021-09-10 13:16:21 +03:00
Karl Nilsson d6301a3e11 Handle closed connections in stream reader
and throw and stop gracefully.
2021-09-10 10:15:59 +01:00
Arnaud Cogoluègnes 0038573f89
Display stream publishers in queue management page
If the queue is a stream. WIP, currently all the stream publishers
are listed, a new publishers per stream endpoint is required.

References #3389
2021-09-09 17:41:38 +02:00
Loïc Hoguin 0a2bde4ab1
Use the new function ranch_proxy_header:to_connection_info/1 2021-09-09 13:15:08 +02:00
Michael Klishin d01b01663b
CLI: introduce :tanzu as a new scope 2021-09-09 13:06:57 +03:00
Karl Nilsson 3513fa0ea8 rabbitmq_stream formatting 2021-09-09 09:45:13 +01:00
Philip Kuryloski 2b6296c4e2 Mark //deps/rabbitmq_mqtt:cluster_SUITE as flaky 2021-09-08 11:53:05 +02:00
Philip Kuryloski efe8da4d41 Allow the rabbit_ct_config_schema helper to work on v3.8 & v3.9
by checking for the presence of lager on the code path as a marker
distinguising rabbit versions
2021-09-07 14:47:51 +02:00
Paweł Chmielowski 6af41527f1 Fix some edge cases in handling ssl information from PROXY protocol
When we fail to parse name of cipher suite from PROXY protocol
just say that no ssl is used, instead of trying to fill that
with data from connection between proxy and our server.
2021-09-06 19:36:42 +02:00
Michael Klishin f493529fec
Add a note on replicated queue types 2021-09-05 16:51:30 +03:00
Michael Klishin f6c8380be5
rabbit_vhost: handle imported tags that are atom lists 2021-09-03 18:38:47 +03:00
Federico Caprari 2246727428
Fix store offset parameters
As you can see 860333a088/deps/rabbitmq_stream_common/src/rabbit_stream_core.erl (L239)

There is the stream name and not the subscription id in this message.
2021-09-01 22:13:07 +02:00
Jean-Sébastien Pédron ef9eee8229
rabbit_boot_state: Fix style bug 2021-09-01 12:24:02 +02:00
Jean-Sébastien Pédron 409dc0e52a
rabbit_boot_state: Support Xterm titlebar update
With this change and if the RabbitMQ node is running on Unix and accepts
input, the titlebar of an Xterm-compatible terminal emulator will show a
few details about the running node. Specifically, it will indicate the
name of the node and the version of RabbitMQ.
2021-09-01 12:23:58 +02:00
Jean-Sébastien Pédron b95d540669
rabbitmq_cli: Fix `maintenance_mode_status` feature flag name
... in testsuite.

This didn't really affect the testsuite because all feature flags are
enabled earlier if I understand correctly.
2021-09-01 11:30:48 +02:00
Jean-Sébastien Pédron 745e42ac0f
Merge pull request #3338 from rabbitmq/enable-single_line-logging-from-env-var
Logging: Add `single_line` flag support to $RABBITMQ_LOG
2021-09-01 11:27:57 +02:00
Arnaud Cogoluègnes 902fa429dd
Use awaitMatch to check global counters
Assertion fails on CI environment.
2021-09-01 09:51:06 +02:00
Jean-Sébastien Pédron 689c56cb04
Logging: Add `single_line` flag support to $RABBITMQ_LOG
A user could already enable single-line logging (the `single_line`
option of `logger_formatter` or RabbitMQ internal formatters) from the
configuration file. For example:

    log.console.formatter.single_line = on

With this patch, the option can be enabled from the `$RABBITMQ_LOG`
environment variable as well:

    make run-broker RABBITMQ_LOG=+single_line
2021-09-01 09:31:54 +02:00
Gerhard Lazu 6a1faa6fd6
Keep checking that replica recovered in rabbit_stream_queue
Rather than sleeping for 6 seconds, we want to check that replica
recovered multiple times within 30 seconds, and either eventually
succeed, or fail if this does not recover within 30 seconds, the default
await_condition time interval.

Pair: @kjnilsson

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2021-08-31 17:02:21 +01:00
Karl Nilsson c240ec2985
Fix function_clause error in stream reader
When the server initiate connection close.
2021-08-31 15:29:16 +01:00
Karl Nilsson c016567359
stream coordinator: further logging improvements
Also increased the tick timeout to avoid checking for new rabbit nodes
to auto add too often.

Also increased sleep times for nodedowns to retry less often.
2021-08-31 15:29:16 +01:00
Karl Nilsson b59d87d90e
Tidy up some stream coordinator warning logs
Some logs used ~p to format a full stack trace. Given these warnings are emitted during
any nodedown this unnecessarily pollutes the logs. Trimmed using ~W instead.
2021-08-31 15:29:16 +01:00
Karl Nilsson 9092de1e32
Stream coordinator: only return tail info if osiris app is started
This ensures that only nodes that are ready to host stream members
are included in the election. This avoids continuous restart attempts
when the rabbit application is stopped.
2021-08-31 15:29:16 +01:00
Gerhard Lazu 6c0ba03d61
Test that we start from 0 publishers & consumers
Pair: @kjnilsson

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2021-08-31 15:29:16 +01:00
Gerhard Lazu 0ecf3d4eeb
Test stream publisher & consumer counters
Pair: @kjnilsson

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2021-08-31 15:29:16 +01:00
Gerhard Lazu dad0025088
Perform stream reader cleanup in terminate
Otherwise metrics will not get cleaned up correctly when processes crash.

It's also tidier to do this in a single place, in terminate/3

Pair: @kjnilsson

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2021-08-31 15:29:15 +01:00
Arnaud Cogoluègnes 8dc024089c
Bump dependencies in Java stream tests 2021-08-31 08:32:53 +02:00
Philip Kuryloski 09fb5c5321 Skip additional tests in mixed versions
The tests in question won't pass consistently as they are at the mercy
of how the quorum queue is placed across the mixed version nodes
2021-08-30 17:17:25 +02:00
Michael Klishin 83f007be54
Merge pull request #3341 from rabbitmq/local-exclusive-queues
Always place exclusive queues on the local node
2021-08-28 09:54:49 +03:00
Michael Klishin 3b4b4dc222
Exclude roundtrip definition import cases from mixed version runs
References #3333
2021-08-26 19:10:11 +03:00
Michael Klishin 54f7b6d77c
Re-format two definition import input files 2021-08-26 19:03:14 +03:00
Michael Klishin 42a3dfa81b
Exclude the #3333 test case from mixed version runs 2021-08-26 17:25:07 +03:00
Michal Kuratczyk d3dcd48ea5 Always place exclusive queues on the local node
Prior to this change, exclusive queues have been subject to the queue
location process, just like other queues. Therefore, if
queue_master_locator was not client-local and x-queue-master-locator was
not set to client-local, an exclusive queue was likely to be located on
a different node than the connection it is exclusive to.  This is
suboptimal and may lead to inconsistencies when the queue's node goes
down while the connection's node is still up.
2021-08-26 13:05:55 +02:00
Michael Klishin 2e61f51773
Commit definition import case16 file 2021-08-24 04:41:51 +03:00
Michael Klishin 6f97707dac
Definition import: correctly import vhost metadata 2021-08-24 04:41:04 +03:00
Michael Klishin 6bf4a99f58
Update a mock expectation 2021-08-21 00:53:42 +03:00
Michael Klishin 59ebb83506
rabbitmq_aws: drop trailing dot in some log messages 2021-08-21 00:45:07 +03:00
Bilal Acar 4d96d4099c
Started using function heads 2021-08-21 00:45:07 +03:00
Bilal Acar ca018ef110
Addressing PR comments 2021-08-21 00:45:07 +03:00
Bilal Acar 50f9bcf504
Adding retries to AWS API calls
Adding retries to AWS API calls
2021-08-21 00:45:07 +03:00
Michael Klishin 11760f95bd
Don't run #3319 assertions in mixed version clusters 2021-08-19 23:03:09 +03:00
Jean-Sébastien Pédron 0b1942bdc0
rabbit_{connection,channel}_tracking: Fix race condition in list()
The table might not exist yet (or is already gone) between the time
rabbit_nodes:all_running() runs and returns a specific node, and
mnesia:dirty_match_object() is called for that node's table.

This seems to happen frequently in CI.
2021-08-19 16:45:24 +02:00
Michael Klishin f5fe419892
Make PUT /api/vhosts/{name} update tags and/or description 2021-08-18 19:07:25 +03:00
Michael Klishin ea75297bf8
Merge pull request #3312 from rabbitmq/alarms-metric1
Expose alarms as Prometheus metrics
2021-08-17 22:16:30 +03:00
Michael Klishin 47b20e8f7c
Prometheus: alarm-related metric naming 2021-08-17 20:58:24 +03:00
Michael Klishin 6a0058fe7c
Introduce TLS-related rabbitmq.conf settings for definition import
currently only used by the HTTPS mechanism but can be used by
any other.
2021-08-17 20:42:53 +03:00
Ilya Khaprov 9fed915192
Add alarms prometheus collector.
close #2653
2021-08-16 20:32:29 +02:00
Michael Klishin f3a5235408
Refactor definition import to allow for arbitrary sources
The classic local filesystem source is still supported
using the same traditional configuration key, load_definitions.

Configuration schema follows peer discovery in spirit:

 * definitions.import_backend configures the mechanism to use,
   which can be a module provided by a plugin
 * definitions.* keys can be defined by plugins and contain any
   keys a specific mechanism needs

For example, the classic local filesystem source can now be
configured like this:

``` ini
definitions.import_backend = local_filesystem
definitions.local.path = /path/to/definitions.d/definition.json
```

``` ini
definitions.import_backend = https
definitions.https.url = https://hostname/path/to/definitions.json
```

HTTPS may require additional configuration keys related to TLS/x.509
peer verification. Such extra keys will be added as the need for them
becomes evident.

References #3249
2021-08-14 14:53:45 +03:00
Michael Klishin 1eacbaac15
Merge pull request #3299 from rabbitmq/add-env-vars-to-set-default-user-pass-vhost-and-erlang-cookie
Add support to override `default_{user,pass,vhost}` and the Erlang cookie from the environment
2021-08-11 23:06:46 +03:00
Michael Klishin 81780dc95e
Log a warning when Erlang cookie is overriden using an env variable
as it can be really difficult to troubleshoot such cookie changes
2021-08-11 20:34:38 +03:00
Jean-Sébastien Pédron d0b7a33a0f
Logging: Add comments explaining when burst limit is disabled
Follow-up to rabbitmq/rabbitmq-server#3298.
2021-08-11 16:56:21 +02:00
Jean-Sébastien Pédron bd39027d68
Add support for $RABBITMQ_ERLANG_COOKIE env var
It is the equivalent of the content of the Erlang cookie file. Note this
variable IS the cookie value, NOT the path to a cookie file.

If it is set, it will take precedence over the content of the Erlang
cookie file.

Fixes docker-library/rabbitmq#508.
2021-08-11 15:50:40 +02:00
Jean-Sébastien Pédron 46b8321bd9
Add support for $RABBITMQ_DEFAULT_{USER,PASS,VHOST} env vars
They are the equivalent of the `default_{user,pass,vhost}` configuration
settings. Each set environment variable will take precedence over its
configuration file counterpart.

Fixes docker-library/rabbitmq#508.
2021-08-11 15:50:40 +02:00
Jean-Sébastien Pédron 33c6cbf239
rabbit_env: Add $RABBITMQ_DEFAULT_{USER,PASS,VHOST} and $RABBITMQ_ERLANG_COOKIE vars
Those environment variables are unset by default. The default values are
set in the `rabbit` application environment and can be configured in the
configuration file. However, the environment variables will take
precedence over them respectively if they are set.
2021-08-11 15:50:36 +02:00
Alexey Lebedeff 1e8ba5bffc Use elixir itself to find its lib directory
This removes all the guesswork from the process. E.g. the old version
was not working with elixir from nixpkgs/NixOS.
2021-08-11 15:41:00 +02:00
Jean-Sébastien Pédron 2e955b0a50
Logging: Disable burst limit if the log level is set to `debug`
Otherwise, messages are being dropped, in particular during RabbitMQ
startup because of the amount of debug messages logged in that phase.

Burst limit is enabled again if the log level is set to `info` or
higher.
2021-08-11 15:32:39 +02:00
Gerhard Lazu 62d82e1660
Break down metrics by node in all RabbitMQ-Stream pie charts
Otherwise we won't be able to see which nodes are running "hot"

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2021-08-11 13:39:30 +01:00
Loïc Hoguin 8c019fb993
Merge pull request #3295 from rabbitmq/lh-test-dropwhile-restart-bug
Add tests for the regression introduced in #3041
2021-08-11 14:27:56 +02:00
Loïc Hoguin 24c25ab3cc
Add tests for the regression introduced in #3041 2021-08-11 12:50:04 +02:00
Michael Klishin 133e0ab72d
Manually apply rabbitmq/rabbitmq-website#1241 by @lushndm 2021-08-11 13:34:27 +03:00
Jean-Sébastien Pédron 51cfa4eb96
rabbit_boot_state: Wrap boot_state() type definition line
... to fit in 80 columns.
2021-08-10 15:12:05 +02:00
Jean-Sébastien Pédron 5a96d18aa2
systemd: Enclose status description inside quotes
... in the log message.
2021-08-10 15:12:05 +02:00
Jean-Sébastien Pédron 23c71b254f
systemd: Do not report "stopping" state to systemd
The problem is we only know about the state of the `rabbit` Erlang
application — when it is started and stopped. But we can't know the fate
of the Erlang VM, except if `rabbit:stop_and_halt()` is called. This
function is not called if `init:stop()` or a SIGTERM are used for
instance.

systemd is interested in the state of the system process (the Erlang
VM), not what's happening inside. But inside, we have multiple
situations where the Erlang application is stopped, but not the Erlang
VM. For instance:

    * When clustering, the Erlang application is stopped before the
      cluster is created or expanded. The application is restarted once
      done. This is controled either manually or using the peer
      discovery plugins.

    * The `pause_minority` or `pause_if_all_down` partition strategies
      both stop the Erlang application for an indefinite period of time,
      but RabbitMQ as a service is still up (even though it is managing
      its own degraded mode and no connections are accepted).

In both cases, the service is still running from the system's service
manager's point of view.

As said above, we can never tell "the VM is being terminated" with
confidence. We can only know about the Erlang application itself.
Therefore, it is best to report the latter as a systemd state
description, but not reporting the "STOPPING=1" state at all. systemd
will figure out itself that the Erlang VM exited anyway.

Before this change, we were reporting the "STOPPING=1" state to systemd
every time the Elang application was stopped. The problem was that
systemd expected the system process (the Erlang VM) to exit within a
configured period of time (90 seconds by default) or report that's it's
ready again ("READY=1"). This issue remained unnoticed when the cluster
was created/expanded because it probably happened within that time
frame. However, it was reported with the partition healing strategies
because the partition might last longer than 90 seconds. When this
happened, the Erlang VM was killed (SIGKILL) and the service restarted.

References #3262.
Fixes #3289.
2021-08-10 15:12:01 +02:00
Jean-Sébastien Pédron 47e0a5fb4c
Logging: Use `:` as the separator in verbosity mapping
This is the same separator as the field mapping. I don't remember why I
picked a different character... Now, it feels awkward and non-intuitive
for users.
2021-08-10 14:26:27 +02:00
Jean-Sébastien Pédron 29bab5935c
Logging: Always represent Epoch-based timestamps as integers
Before this change, seconds were represented as floats.
2021-08-10 13:33:52 +02:00
Jean-Sébastien Pédron c2ea12ba39
Merge pull request #3281 from rabbitmq/fix-epoch-timestamp-crash-in-json-logging
Logging: Fix crash when Epoch-based timestamps are used with JSON
2021-08-10 13:32:40 +02:00
Jean-Sébastien Pédron 6c8cf4c510
Logging: Fix crash when Epoch-based timestamps are used with JSON
The code was passing a number (the timestamp) to
unicode:characters_to_binary/1 which expects an iolist to convert to
UTF-8.

We now verify if we have a number before calling that function. If this
is a number (integer or float), we keep it as is because JSON supports
that type.
2021-08-10 12:34:11 +02:00
dcorbacho de7028979e
Unlink spawned processes once we're done
`EXIT` messages captured by ra polute the log.
The link is only needed to ensure no orphan processes are left behind,
so they can be safely unlinked once the work is done.

Maybe resizing cluster coordinator does not require linking, only
phases are problematic when a coordinator is stopped
2021-08-10 13:22:18 +03:00
Michael Klishin 8c1183b0fd
Ditto in rabbitmq_stream_management 2021-08-10 12:16:54 +03:00
Michael Klishin ace3ee9cd9
Bump Java stream client used in tests 2021-08-10 11:32:57 +03:00
Michael Klishin 36ad3a5b3d
Revert "CQ: don't deliver right before acking in the index"
This reverts commit 3ef858746c.

This change does not handle expired messages safely.

See https://github.com/rabbitmq/rabbitmq-server/discussions/3272.
2021-08-10 01:33:32 +03:00
Alexey Lebedeff 87532c4af4 Make test/development related makefile vars lazy
They were trying to run `hostname` and `which`, which produced a bunch
of error messages in a hermetic build environment.

And performance of those `shell` calls is not very important, as they
are caled just a few times during script runtime anyway (there is a
hack to make these lazy, but evaluating only once - but it's hardly
worth it).
2021-08-06 17:32:04 +02:00
Michael Klishin 49fd6b3e8d
Make sure 'rabbitmq-upgrade {drain, revive}' do not produce scary log messages
"scary" here means log messages that show up as "errors". Warnings
and info messages make more sense.

Per discussion with @mkuratczyk.
2021-08-05 16:26:13 +03:00