Commit Graph

24893 Commits

Author SHA1 Message Date
Luke Bakken 555c7efa27
read term file using with_handle/1 2021-12-20 12:36:08 +05:00
Luke Bakken bc1a912af8
Use `raw` option for `file:read_file_info/2` to work around win32 mem leak erlang/otp#5527 2021-12-20 12:36:08 +05:00
Luke Bakken 6a01d80ebe
Fix win32 memory leak by using `raw` file operations. Not ideal but this
skips all file servers.
2021-12-20 12:36:08 +05:00
Loïc Hoguin c3d3f89ca8
Fix log level when halting the VM
When switching from lager to logger a mistake was made and
the list of applications remaining when the node stops was
made to log at error level instead of info.

https://github.com/rabbitmq/rabbitmq-server/commit/cdcf602749a#diff-5d9f448b943b2c77af7822440fc8df8af02bf2001d1c51a484413f69cad37a62L473-R486
2021-12-20 12:36:08 +05:00
Luke Bakken 8260f4cc04
Make health checks less resource intensive
Alternative to #3893

Also see VESC-1015
2021-12-20 12:36:06 +05:00
polaris-alioth fa2c5ab0e9
Code style rectification 2021-12-20 14:49:00 +08:00
polaris-alioth 6431584a10 Prevent creating unnamed policy when loading definition 2021-12-19 12:52:26 +08:00
Karl Nilsson d72719a1ce Stream coordinator: avoid mnesia update process crashing after delete
If a delete happens shortly after a declare or other stream change
there is a chance the mnesia update process that is spawned will crash
when the amqqueue record cannot be recovered from durable storage.

This isn't harmful but does pollute the logs.
2021-12-17 14:41:24 +00:00
Philip Kuryloski 249e8c853c Adjust the way rabbit_fifo.hrl is referenced in rabbit_fifo_SUITE
For erlang_ls convenience
2021-12-16 16:41:15 +01:00
dcorbacho 08b78aa2d7 Optimise user declare/update/import by reducing the number of operations
User, tags and hashed password can be inserted/updated at once,
increasing the performance of the storage backend - mnesia.
2021-12-14 15:35:47 +01:00
Michael Klishin ebd79836c1 Revisit operator policy merging rules for boolean fields
For booleans, we can prefer the operator policy value
unconditionally, without any safety implications.

Per discussion with @binarin @pjk25

(cherry picked from commit 6edb7396fd)
2021-12-10 19:48:16 +00:00
Arnaud Cogoluègnes 1bcca0745e
Increase timeout in stream test
Some CI environment may need a bit more time.
2021-12-10 12:08:02 +01:00
Arnaud Cogoluègnes 4c397c54fa
Use AssertJ conditions in Java stream test suite 2021-12-10 11:52:54 +01:00
Arnaud Cogoluègnes bd4771addb
Return appropriate response when stream leader not available
Fixes #3874
2021-12-10 10:58:48 +01:00
Arnaud Cogoluègnes 8f40e534ed
Bump Java test dependencies in stream test suites 2021-12-10 09:18:22 +01:00
Loïc Hoguin 1b0eb9a4a3
Fix case where confirms may not be sent
A channel that first sends a mandatory publish before enabling
confirms mode may not receive confirms for messages published
after that. This is because the publish_seqno was increased
also for mandatory publishes even if confirms were disabled.
But the mandatory feature has nothing to do with publish_seqno.

The issue exists since at least
38e5b687de

The test case introduced focuses for multiple=false. The issue
also exists for multiple=true but it has a different impact:
sending multiple=true,delivery_tag=2 results in both messages
1 and 2 being acked, even if message 2 doesn't exist as far
as the client is concerned. If the message does exist
it might get confirmed earlier than it should have been. The
issue is a bigger problem the more mandatory messages were
sent before enabling confirms mode.
2021-12-08 15:53:47 +01:00
Michael Klishin 29763a9318
Merge pull request #3838 from rabbitmq/lukebakken/allow-compress-on-rotate
Add compress option for file rotation
2021-12-03 13:44:02 +03:00
Michael Klishin 8e2b92e75f
Merge pull request #3835 from rabbitmq/rabbitmq-server-3831
Extend log.file.rotation.date parser
2021-12-03 13:43:36 +03:00
Michael Klishin 65de676a01
Log rotation date spec: parse $H the same way Lager does 2021-12-03 13:22:37 +03:00
Arnaud Cogoluègnes b6f5b1c21a
Merge pull request #3842 from rabbitmq/rabbitmq-server-3841-stream-consumer-nested-record
Create configuration nested record in stream consumer record
2021-12-03 11:11:40 +01:00
Arnaud Cogoluègnes 854efb3e85
Declare variable for better formatting
References #3841
2021-12-03 10:59:45 +01:00
Arnaud Cogoluègnes 81b9632535
Create configuration nested record in stream consumer record
Only a couple of fields of the stream consumer record change
very frequently (credits and Osiris log reference), so this commit
introduces a nested record in the main consumer record that
contains the immutable fields. This potentially avoids producing
a lot of garbage, especially when the consumer state contains
several properties (consumer name, or single active consumer information
in the future).

Fixes #3841
2021-12-03 10:34:51 +01:00
Arnaud Cogoluègnes a0201f20d6
Merge pull request #3824 from rabbitmq/rabbitmq-server-3783-response-code-for-undefined-stored-offset
Return "no offset" (19) code when stored offset is undefined
2021-12-03 10:33:56 +01:00
Luke Bakken bf70e41c09
Add compress option for file rotation
Related to #3835

https://www.erlang.org/doc/man/logger_std_h.html
2021-12-02 15:10:06 -08:00
Michael Klishin 4e9bee8bab
rabbit_logger_std_h: make Dialyzer run 2021-12-02 19:30:05 +03:00
Michael Klishin 5cca024107
More log rotation date spec parser improvements
Note that Lager itself doesn't handle certain combinations:

 * $W0H45 is fine
 * $W0D1H45 fails with an error

but hopefully what we have now should be enough for
a minimalistic built-in log rotation feature.
2021-12-02 19:24:24 +03:00
Michael Klishin c5033b0cef
Extend log.file.rotation.date parser
to successfully parse all cases presented in Lager docs.

References #3831
2021-12-02 18:53:07 +03:00
Johan Rhodin 998d2aeea3
Match help box to correct item
before it was right after Auto expire
2021-12-01 14:01:19 -06:00
Arnaud Cogoluègnes 17d0ba9317
Return "no offset" (19) code when stored offset is undefined
Fixes #3783
2021-12-01 17:59:14 +01:00
Luke Bakken 9ff201c3ab
Remove flaky assertion
Thanks @kjnilsson
2021-12-01 06:57:25 -08:00
Michael Klishin b5aecbd3e5
Merge pull request #3804 from rabbitmq/qq-clean-properties-before-storage
QQ: remove decoded properties before storing messages
2021-12-01 17:00:58 +03:00
Michael Klishin 3be3569fd7
Merge pull request #3814 from rabbitmq/stream-declare-size
Query total number of messages on stream leader on queue.declare
2021-11-30 19:53:25 +03:00
Michael Klishin be525c2ebe
Compile from scratch 2021-11-30 18:11:17 +03:00
Michael Klishin f7d32d69f8 Introduce a new CLI tool (scope), rabbitmq-tanzu
For Tanzu (commercial) plugins to attach their commands to instead of
polluting rabbitmqctl.

Pair: @pjk25
(cherry picked from commit 6e0f2436fa)
2021-11-30 14:54:09 +00:00
dcorbacho 5e9664f9e7 Query total number of messages on stream leader on queue.declare 2021-11-30 15:09:30 +01:00
Michael Klishin 051e504f8e
Merge pull request #3805 from tomyouyou/deativate_limit_of_qpid
To deactivate limit of all QPids when the limiter has been changed from 'limit' to 'unlimit'.
2021-11-30 15:22:18 +03:00
Michael Klishin c9109e0dc1
Merge pull request #3806 from rabbitmq/rabbitmq-server-3803
tcp_listener: avoid logging listener arguments on shutdown
2021-11-29 19:33:13 +03:00
Michael Klishin 9e351c50e9
Log message wording 2021-11-29 18:24:19 +03:00
Michael Klishin 75767faf3c
Simplify tcp_listener argument obfuscation
Per suggestions from @lhoguin
2021-11-29 15:01:53 +03:00
Michael Klishin 53eb1edf19
tcp_listener: only set credential obfuscation secret if necessary 2021-11-28 21:49:59 +03:00
Michael Klishin 71d6366069
tcp_listener: avoid logging listener arguments on shutdown
Closes #3803
2021-11-28 17:11:35 +03:00
tomyouyou 50160a0232
To deactivate limit of all QPids when the limiter has been changed from 'limit' to 'unlimit'.
Otherwise, the QPids will still to ask limiter whether it can be sent before delivering.
This will degrade performance, especially when the limiter and QPid are on different nodes.

When 'can_send' is deactivated, the test results are as follows:
id: test-100147-150, time: 400.016s, sent: 17654 msg/s, returned: 0 msg/s, confirmed: 17658 msg/s, nacked: 0 msg/s, received: 17663 msg/s, min/median/75th/95th/99th consumer latency: 1775/5899/6486/7369/8440 μs, confirm latency: 2171/5581/6127/7026/7911 μs
test stopped (Reached time limit)
id: test-100147-150, sending rate avg: 17630 msg/s
id: test-100147-150, receiving rate avg: 17630 msg/s

When limiter and QPid are on the same node and 'can_send' is activated, the test results are as follows:
id: test-095229-474, time: 400.015s, sent: 13246 msg/s, returned: 0 msg/s, confirmed: 13247 msg/s, nacked: 0 msg/s, received: 13245 msg/s, min/median/75th/95th/99th consumer latency: 3777/7316/8345/10447/11392 μs, confirm latency: 4074/7308/8257/10336/11341 μs
test stopped (Reached time limit)
id: test-095229-474, sending rate avg: 13317 msg/s
id: test-095229-474, receiving rate avg: 13317 msg/s

we have seen, for the message rate, the test showed a 24% drop.
2021-11-27 20:30:04 +08:00
Luke Bakken f10e9c3d0e
Update rabbit_quorum_queue.erl
Very small spelling change
2021-11-26 12:12:51 -08:00
Karl Nilsson 92ed64eb22 QQ: remove decoded properties before storing messages
We're also typically storing the encoded properties as well.
We only really need one. e.g. an enqueue command with a 2 byte payload
serialises to 290 bytes compared to 463. A nice saving.
2021-11-26 16:33:59 +00:00
David Ansari 45f69f8829 Add missing Ra commands to the log
Before this commit, the tests were not including any settle, return, or
discard Ra commands.

Do not pattern match against 'ra_event' because nowadays:
_Opts = [local, ra_event]
2021-11-26 16:16:45 +01:00
Michael Klishin eb5a5f654e
Merge pull request #3800 from tomyouyou/stop_stats
To stop collect_statistics when rabbitmq_management_agent has been disabled
2021-11-25 18:41:09 +03:00
Michael Klishin d8a4d4cc4f
Merge pull request #3746 from rabbitmq/lukebakken/gh-3729
Fix case where quorum queue consumer is cancelled while message is about to be delivered
2021-11-25 15:14:42 +03:00
tomyouyou 0e640da5a1
To stop collect_statistics when rabbitmq_management has been disabled.
After stopping the 'rabbitmq_management', these statistics tables are still being refreshed.
2021-11-25 17:37:58 +08:00
Michael Klishin ce497a5b52
Merge pull request #3798 from wrobell/rabbitmq-streams-doc-protocol-timestamp
Link to most recent description of Osiris chunk format
2021-11-24 21:48:07 +03:00
wrobell 07dc62af7c Link to most recent description of Osiris chunk format
The most recent description of Osiris chunk format does not reference
the timestamp field to be "posix-ish" anymore. This was bit misleading
as it is Erlang's system time.

Add link to Erlang system time documentation to the subscription command
description to avoid confusion about the timestamp field.
2021-11-24 18:34:55 +00:00
Alexey Lebedeff 7676ed9685 Use `rabbitmq_cluster_` prefix for cluster-wide metrics 2021-11-24 16:49:43 +01:00
Michael Klishin 4f09fd109c
quorum_queue_SUITE: bump some timeouts 2021-11-24 18:04:35 +03:00
Michael Klishin 6a08e143e9
quorum_queue_SUITE: drop a debug line 2021-11-24 16:47:20 +03:00
Michael Klishin 38d64a54b1
Wording 2021-11-24 14:19:57 +03:00
Michael Klishin a1c0cd3785
Wording 2021-11-24 14:02:10 +03:00
Alexey Lebedeff 6e3012aaf9 Add optional metrics for vhost and exchange count
These can make sense in some scenarios, e.g. when vhost/exchanges are
+created using self-service automation
2021-11-24 11:00:41 +01:00
Luke Bakken 6d545447b9
Fix quorum queue crash during consumer cancel with return
Fixes #3729
2021-11-23 08:59:47 -08:00
Michael Klishin e22e667a10
Do not count unroutable message in global totals 2021-11-23 16:37:46 +03:00
Michael Klishin 0f0da778d0
Merge pull request #3708 from rabbitmq/filter-out-queues-from-global-stats
Use a pattern to filter out some queues from global stats
2021-11-23 15:01:40 +03:00
Luke Bakken bd2858c208
Compile the regex 2021-11-22 08:30:17 -08:00
Fushan Wen 23d5073dcb Add systemd hardening parameters in rabbitmq-server.service.example
systemd offers various options to harden services. To see details please
visit https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
2021-11-19 19:06:21 +08:00
Philip Kuryloski 11fd866247 Add the bazel target :package-generic-unix
Which can be used to build the artifact with bazel
2021-11-18 14:38:41 +01:00
Michael Klishin 665d100e39
Merge pull request #3752 from rabbitmq/stream-flakes
Stream flake fixes
2021-11-18 15:37:56 +03:00
Michal Kuratczyk acf474e056 Fix cuttlefish config for oauth2
The structure of the signing_keys map should be `<<"id">> => {pem, <<"key">>}`.
Previously it was mapped directly as `<<"id">> => <<"key">>`.
2021-11-18 12:58:57 +01:00
Karl Nilsson 8542b54f7e Stream coordinator: only initialise queue record if stream id matches 2021-11-17 16:16:37 +00:00
Karl Nilsson 3b62665b34 Stream coordinator: log member deletions 2021-11-17 09:04:35 +00:00
dcorbacho a7c9b66653 Use own key to exclude queues 2021-11-16 16:53:17 +01:00
Luke Bakken 6aaf7ec597
Merge pull request #3740 from rabbitmq/rabbitmq-server-3739
Distribution listener settings support in rabbitmq.conf
2021-11-16 06:36:48 -08:00
Philip Kuryloski ae45ab54a5
Merge pull request #3738 from rabbitmq/cleanup-symlink-private-log-message
Fixup the "Failed to symlink private_log directory." error in bazel
2021-11-16 06:12:22 -08:00
Michael Klishin f47de00910
Merge pull request #3731 from rabbitmq/stream-mnesia-update
Stream coordinator: only update amqqueue record if stream id matches
2021-11-16 16:53:54 +03:00
Michael Klishin 8a30cf1c86
Distribution listener settings support in rabbitmq.conf
* distribution.listener.interface
 * distribution.listener.port_range.min
 * distribution.listener.port_range.max

Closes #3739
2021-11-16 16:37:28 +03:00
Karl Nilsson bc7b339e7a Stream coordinator: only update amqqueue record if stream id matches
From the coordinator's POV each stream has a unique id consisting of the
vhost, queuename and a high resolution timestamp even if several stream ids
relate to the same queue record.

When performing the mnesia update the coordinator now checks that the current stream id
matches that of the update_mnesia action and does not change the queue record if
the stream id is not the same.

This should avoid "old" incarnations of a stream queue updating newer ones
with incorrect information.
2021-11-16 12:32:33 +00:00
Philip Kuryloski 3b48ebabf7 Fixup the "Failed to symlink private_log directory." error in bazel
While it doesn't cause any tests to fail, it's confusing to see it in
the logs
2021-11-16 13:25:53 +01:00
Philip Kuryloski e5a4907a60 Update exchange_SUITE timeouts
When the suite passes, it's about 120 seconds total, so 5 minutes per
case seems to be too much. Additionally, if the suite times out at the
bazel level, we get no logs, so the cause of the timeout is unclear.
2021-11-16 12:03:20 +01:00
dcorbacho 242cb539b3 Exclude queues from aggregated metrics in prometheus collector
Uses same exclusion pattern as the management agent
2021-11-16 10:23:39 +01:00
Luke Bakken 939673b31d
Merge pull request #3685 from rabbitmq/lukebakken/core-started-before-postlaunch-phase
Set core_started before running postlaunch phase
2021-11-15 07:04:25 -08:00
dcorbacho e299178471 Store collector pattern in process memory
Avoids multiple calls to `application:get_env` which can be very expensive.
Also limits filter to vhost_msg_stats, as queue_msg_stats are required for
individual queue metrics
2021-11-15 11:53:50 +01:00
Philip Kuryloski 1f7db0fa35 Update rabbit_ct_broker_helpers:force_vhost_failure/4 for erpc
https://www.erlang.org/doc/man/erpc.html#call-5
2021-11-15 10:53:10 +01:00
Michael Klishin 01f68b80c9
Merge pull request #3723 from wrobell/rabbitmq-streams-doc-protocol-deliver-fix
Fix description of "deliver" command in RabbitMQ Streams protocol documentation
2021-11-14 21:59:12 +03:00
wrobell b4f39031f6 Fix description of "deliver" command in RabbitMQ Streams protocol documentation
Add missing fields - chunk type, timestamp, trailer length and reserved.
The fields are added after looking at

    3fd348d225/src/main/java/com/rabbitmq/stream/impl/ServerFrameHandler.java (L267)
    https://github.com/qweeze/rstream/blob/master/rstream/schema.py#L376

Change type of "version" field - it shall be uint16 like in other
commands.
2021-11-14 14:51:35 +00:00
Michael Klishin 38982e2c67
Merge pull request #3714 from rabbitmq/mqtt-crash-log
Prevent crash logs when mqtt user is missing permissions
2021-11-13 04:28:57 +03:00
Karl Nilsson 7e4a33708b Stream coordinator: reset reply_to for delete_stream command
So that a reply is sent to the caller immediately after the command has
been processed as intended. Previously it was possible if reply_to was
already set that a reply never was sent to the caller and the caller
times out. This should improve some flakyness in the rabbit_stream_queue suite
as well.

Strictly this is a change that introduces indeterminism in the coordinator
state machine as during an upgrade different members may run different code
for this command. But as this state only affects side effects (replies) and
the state for the streams affected will shortly be removed this is very
unlikely to cause any real issues.
2021-11-12 17:27:34 +00:00
Alexey Lebedeff e0723d5e66 Prevent crash logs when mqtt user is missing permissions
Fixes #2941

This adds proper exception handlers in the right places. And tests
ensure that it indeed provides nice neat logs without large
stacktraces for every amqp operation.

Unnecessary checking for subscribe permissions on topic was dropped,
as `queue.bind` does exactly the same check. Topic permissions tests
were also added, and they indeed confirm that there was no change in
behaviour.

Ideally the same explicit topic permission check should be dropped for
publishing, but it's more complicated - so for now there only a
detailed comment in the source code explaining it.

A few other things were also optimized away:
- Using amqp client to test for queue existence
- Creating queues/starting consumptions too eagerly, even if not yet
  requested by client
2021-11-12 18:03:05 +01:00
Philip Kuryloski 115b951b9c
Merge pull request #3710 from rabbitmq/generate-rabbitmqadmin-cli-bazel
Generate the rabbitmqadmin cli under bazel
2021-11-12 07:24:37 -08:00
Michael Klishin 9fc298dffa
Merge pull request #3656 from rabbitmq/qq-messages-pending-fixes
Expose pending enqueues in quorum queue overview
2021-11-12 17:08:16 +03:00
Karl Nilsson bf6c747607 Expose pending enqueues in overview output to allow
debugging of situation where messages may be stuck.

Also cancel rabbit_fifo_client timer after message resend to avoid
resending them again when the timer triggers.
2021-11-12 13:37:15 +00:00
Michael Klishin 267558b9eb
Merge pull request #3676 from rabbitmq/qq-init-opts
Avoid slow mnesia transaction on QQ init
2021-11-12 15:52:02 +03:00
dcorbacho 055581f33d Use a pattern to filter out some queues from global stats
Some plugins might create internal queues that should not be accounted
for the total number of messages on the system. These can now be filtered
out using a regular expression on the queue name. Individual queue stats
are still available
2021-11-12 13:07:19 +01:00
Michael Klishin 25a08e6a54
Log it when a boot step finishes running 2021-11-12 14:20:06 +03:00
Philip Kuryloski 9c70b3220a Generate the rabbitmqadmin cli under bazel 2021-11-12 11:34:19 +01:00
Luke Bakken 223581f6fb
Set core_started before running postlaunch phase
Since the postlaunch phase is async there is a slight chance that rabbit_direct connections will not see core_started if attempted during postlaunch
2021-11-11 08:51:02 -08:00
Luke Bakken 13e62b0939
Merge pull request #3552 from rabbitmq/improve-amqp-10-stream-support
Improve consuming from a stream using AMQP 1.0
2021-11-11 06:29:47 -08:00
Michael Klishin 1b7a8f869e
Merge pull request #3587 from rabbitmq/prometheus-label-pre-render-optimization
Pre-render prometheus labels
2021-11-11 13:00:31 +03:00
Michael Klishin 8e180c581a
Use a for loop here because IE 11 does not support lambdas
Closes #3688
2021-11-11 00:31:32 +03:00
Sagi Sarussi eff5c063cb
Grammar 2021-11-10 15:31:06 +02:00
Karl Nilsson d2fde27b56 Avoid slow mnesia transaction on QQ init
As we only need to make sure the rabbit_queues table is populated
use a dirty write function that only does this instead. This could potentially
half recovery times for many QQ scenarios.
2021-11-10 09:10:55 +00:00
Philip Kuryloski e4505bea3d Use unique group names in rabbit_stream_SUITE
Technically duplicate names is supported by common test, but we have
seen it contribute to flakiness in our suite in practice

(cherry picked from commit 513446b6d1)
2021-11-09 13:52:41 +01:00
Alexey Lebedeff 8598c51579 Pre-render prometheus labels
This makes per-object metrics twice as fast.

Depends on https://github.com/deadtrickster/prometheus.erl/pull/137
2021-11-09 13:04:39 +01:00
Karl Nilsson e721ab291f Fix metric active value when consuming from a QQ
Introduced in 1c6e45257d
2021-11-08 14:28:42 +00:00
Karl Nilsson 3d7edcea92 Log recovery time by queue type 2021-11-08 11:07:41 +00:00