Commit Graph

47648 Commits

Author SHA1 Message Date
kjnilsson 4421c3680e dockerignore deps 2021-03-18 15:04:39 +00:00
kjnilsson a57b8e354d AMQP 1.0 plugin: upgrade .NET test dependency 2021-03-17 13:55:21 +00:00
kjnilsson cbf0107605 Stream coordinator bug fix
Fix issue where a deleted replica could be restarted if the leader went
down whilst the replica was still running it's start phase.
2021-03-17 13:54:28 +00:00
Michael Klishin f3969f57a3
rabbitmq_sharding README updates 2021-03-17 14:26:31 +03:00
kjnilsson 6c66d814d7 Mgmt agent: format stream queue type 2021-03-16 17:38:10 +00:00
kjnilsson 9d83e0c5d9 Add logging to config decryption test
To possibly get a bit more information on failure reasons on GH Actions.
2021-03-16 16:28:41 +00:00
Philip Kuryloski 9ad1837168 Adjust secondary umbrella fetch
relative to changes in rabbitmq-components.mk in master of rabbitmq-server
2021-03-16 15:08:45 +01:00
Michael Klishin dfc43faf59
Merge pull request #2898 from rabbitmq/dockerfile-otp-24
erl_interface is required in OTP-24+
2021-03-16 15:28:09 +03:00
kjnilsson 4922c32e7c Update dotnet SDK version for dockerimages 2021-03-16 11:22:14 +00:00
Karl Nilsson 1b7379d266
Merge pull request #2876 from rabbitmq/stream-coord-refactor
Stream Coordinator refactor
2021-03-16 11:10:44 +00:00
Loïc Hoguin 314eb3f4d7
erl_interface is required in OTP-24+ 2021-03-16 12:01:30 +01:00
kjnilsson eb91d50fd4 stream coordinator fall back to consistent query 2021-03-16 09:01:56 +00:00
Michael Klishin fa2830edcd
Merge pull request #2891 from rabbitmq/mk-adapt-to-latest-stomp.py
STOMP: adapt Python test suite to stomp.py 6.x
2021-03-13 06:11:22 +03:00
Michael Klishin ca201bbd7d
STOMP: upgrade Python suite(s) to stomp.py 6.x 2021-03-13 06:08:27 +03:00
Michael Klishin 6598dafe90
STOMP: add a runner to transactions.py 2021-03-13 06:00:10 +03:00
Michael Klishin 38762cdcd2
Merge pull request #2890 from rabbitmq/mk-await-onlinequorum-plus-one-in-single-node-clusters
Make 'rabbitmq-queues await_online_quorum_plus_one' a no-op for single node clusters
2021-03-13 00:50:06 +03:00
Michael Klishin 2fcb282633
Make 'rabbitmq-queues await_online_quorum_plus_one' a no-op for single node clusters
since it does not make sense in that case
2021-03-13 00:47:23 +03:00
Michael Klishin 8b203e316e
Sync rabbitmq-components.mk in a few more places 2021-03-12 19:58:51 +03:00
Michael Klishin 33ca5837ab
Merge pull request #2888 from rabbitmq/additional_plugins
Add ADDITIONAL_PLUGINS variable
2021-03-12 18:37:50 +03:00
Michael Klishin 29a7e52263
Merge pull request #2887 from rabbitmq/erlang_ls
erlang_ls config file for better dev experience
2021-03-12 18:37:06 +03:00
Arnaud Cogoluègnes e46216b5a8 Check PID on leader lookup in stream plugin
To make sure the PID is alive, as the mnesia record can stale after a
failure.

Make also the local PID lookup in the stream coordinator do a consistent
query over the cluster if the PID is not alive.

Co-authored-by: Karl Nilsson <kjnilsson@users.noreply.github.com>
2021-03-12 15:04:40 +00:00
kjnilsson 3a26cf8654 Stream coordinator: handle commands for unknown streams
To avoid crashing.
2021-03-12 15:04:40 +00:00
kjnilsson 1709208105 Throw resource error when no local stream member
As well as some additional tests
2021-03-12 15:04:40 +00:00
dcorbacho e19aca8075 Use right map fields to compute streams info 2021-03-12 15:04:40 +00:00
Arnaud Cogoluègnes e80db9d46a Adapt stream plugin after coordinator refactoring
Do not use mnesia record for topology info, use coordinator instead.
2021-03-12 15:04:35 +00:00
kjnilsson 7fa3f6b6e1 Stream Coordinator: primitive backoff
Sleep for 5s after a failure due to a node being down before reporting
back to stream coordinator (which will immediately retry).

stream coordinator: correct command type spec

tidy up

fix rabbit_fifo_prop tests

stream coord: add function for member state query
2021-03-12 15:03:47 +00:00
kjnilsson bb3e0a7674 Move stream coordinator unit tests into ct suite 2021-03-12 15:03:10 +00:00
kjnilsson 9fb2e6d2dd Stream Coordinator refactor 2021-03-12 15:03:08 +00:00
Loïc Hoguin d5e3bdd623
Add ADDITIONAL_PLUGINS variable
This allows including additional applications or third party
plugins when creating a release, running the broker locally,
or just building from the top-level Makefile.

To include Looking Glass in a release, for example:

$ make package-generic-unix ADDITIONAL_PLUGINS="looking_glass"

A Docker image can then be built using this release and will
contain Looking Glass:

$ make docker-image

Beware macOS users! Applications such as Looking Glass include
NIFs. NIFs must be compiled in the right environment. If you
are building a Docker image then make sure to build the NIF
on Linux! In the two steps above, this corresponds to Step 1.

To run the broker with Looking Glass available:

$ make run-broker ADDITIONAL_PLUGINS="looking_glass"

This commit also moves Looking Glass dependency information
into rabbitmq-components.mk so it is available at all times.
2021-03-12 12:29:28 +01:00
Michal Kuratczyk 8d4800a0e7 erlang_ls config file for better dev experience 2021-03-12 11:53:16 +01:00
Michael Klishin 2517aec971
Squash a compiler warning introduced in #2878 2021-03-12 10:27:43 +03:00
Michael Klishin 32814fb664
STOMP: continue modernizing stomp.py test suites 2021-03-12 09:31:39 +03:00
Michael Klishin bc769343bb
STOMP: stomp.py suite cosmetics 2021-03-12 07:31:52 +03:00
Michael Klishin a5cd08394e
STOMP: further stomp.py suite modernization steps 2021-03-12 07:25:15 +03:00
Michael Klishin 17cb24deb4
Rename a STOMP test suite 2021-03-12 07:25:15 +03:00
Michael Klishin 403955989a
Merge pull request #2886 from rabbitmq/mk-fix-mqtt-machine-logging-typo
MQTT: correct a typo in mqtt_machine
2021-03-12 06:03:25 +03:00
Michael Klishin 91964db0e6
MQTT: correct a typo in mqtt_machine
Introduced in #2861
2021-03-12 05:33:03 +03:00
Michael Klishin 846ffed9e9
Merge pull request #2885 from ansd/flip-conditions
Avoid network calls
2021-03-12 05:30:59 +03:00
Michael Klishin 0801b61e8f
STOMP: run Python tests on Python 3 2021-03-11 22:03:29 +03:00
David Ansari 18ba5b803f Avoid unnecessary network calls
by flipping the two list comprehension conditions.
If not is_local_to_node, then is_down will not be evaluated.
This saves (R-1) * Q network calls every 2 minutes where R is the number
of replicas per quorum queue and Q is the number of quorum queues in the
RabbitMQ cluster.
2021-03-11 16:29:05 +01:00
Jean-Sébastien Pédron 132dee6516
Merge pull request #2861 from rabbitmq/use-builtin-logger
Switch from Lager to the new Erlang Logger API for logging
2021-03-11 15:46:21 +01:00
Michael Klishin 97ff62d3b2
Drop trailing newlines from logged messages where possible
Lager strips trailing newline characters but OTP logger with the default
formatter adds a newline at the end. To avoid unintentional multi-line log
messages we have to revisit most messages logged.

Some log entries are intentionally multiline, others
are printed to stdout directly: newlines are required there
for sensible formatting.
2021-03-11 15:17:37 +01:00
Michael Klishin b67c030953
Use Cuttlefish master for now
it no longer depends on Lager
2021-03-11 15:17:37 +01:00
Jean-Sébastien Pédron 0867200195
rabbitmq_peer_discovery_{common,consul}: Switch to Logger macros
... from `rabbit_log:*` calls.

Many rabbitmq_peer_discovery_consul testcases are executed outside of a
RabbitMQ server node. When we had Lager `parse_transform` enabled, calls
to `rabbit_log` were converted to something which happened to not break
when executed outside of RabbitMQ.

Now that `rabbit_log` calls are kept (there is no `parse_transform`),
the missing dependency to rabbit_common in the common_test node surfaces
nad hilights the breakage which has always been there.

Calls to `rabbit_log` are now replaced with Logger macros and this works
again, even in the context of the common_test node.
2021-03-11 15:17:36 +01:00
Jean-Sébastien Pédron cdcf602749
Switch from Lager to the new Erlang Logger API for logging
The configuration remains the same for the end-user. The only exception
is the log root directory: it is now set through the `log_root`
application env. variable in `rabbit`. People using the Cuttlefish-based
configuration file are not affected by this exception.

The main change is how the logging facility is configured. It now
happens in `rabbit_prelaunch_logging`. The `rabbit_lager` module is
removed.

The supported outputs remain the same: the console, text files, the
`amq.rabbitmq.log` exchange and syslog.

The message text format slightly changed: the timestamp is more precise
(now to the microsecond) and the level can be abbreviated to always be
4-character long to align all messages and improve readability. Here is
an example:

    2021-03-03 10:22:30.377392+01:00 [dbug] <0.229.0> == Prelaunch DONE ==
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>  Starting RabbitMQ 3.8.10+115.g071f3fb on Erlang 23.2.5
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>  Licensed under the MPL 2.0. Website: https://rabbitmq.com

The example above also shows that multiline messages are supported and
each line is prepended with the same prefix (the timestamp, the level
and the Erlang process PID).

JSON is also supported as a message format and now for any outputs.
Indeed, it is possible to use it with e.g. syslog or the exchange. Here
is an example of a JSON-formatted message sent to syslog:

    Mar  3 11:23:06 localhost rabbitmq-server[27908] <0.229.0> - {"time":"2021-03-03T11:23:06.998466+01:00","level":"notice","msg":"Logging: configured log handlers are now ACTIVE","meta":{"domain":"rabbitmq.prelaunch","file":"src/rabbit_prelaunch_logging.erl","gl":"<0.228.0>","line":311,"mfa":["rabbit_prelaunch_logging","configure_logger",1],"pid":"<0.229.0>"}}

For quick testing, the values accepted by the `$RABBITMQ_LOGS`
environment variables were extended:
  * `-` still means stdout
  * `-stderr` means stderr
  * `syslog:` means syslog on localhost
  * `exchange:` means logging to `amq.rabbitmq.log`

`$RABBITMQ_LOG` was also extended. It now accepts a `+json` modifier (in
addition to the existing `+color` one). With that modifier, messages are
formatted as JSON intead of plain text.

The `rabbitmqctl rotate_logs` command is deprecated. The reason is
Logger does not expose a function to force log rotation. However, it
will detect when a file was rotated by an external tool.

From a developer point of view, the old `rabbit_log*` API remains
supported, though it is now deprecated. It is implemented as regular
modules: there is no `parse_transform` involved anymore.

In the code, it is recommended to use the new Logger macros. For
instance, `?LOG_INFO(Format, Args)`. If possible, messages should be
augmented with some metadata. For instance (note the map after the
message):

    ?LOG_NOTICE("Logging: switching to configured handler(s); following "
                "messages may not be visible in this log output",
                #{domain => ?RMQLOG_DOMAIN_PRELAUNCH}),

Domains in Erlang Logger parlance are the way to categorize messages.
Some predefined domains, matching previous categories, are currently
defined in `rabbit_common/include/logging.hrl` or headers in the
relevant plugins for plugin-specific categories.

At this point, very few messages have been converted from the old
`rabbit_log*` API to the new macros. It can be done gradually when
working on a particular module or logging.

The Erlang builtin console/file handler, `logger_std_h`, has been forked
because it lacks date-based file rotation. The configuration of
date-based rotation is identical to Lager. Once the dust has settled for
this feature, the goal is to submit it upstream for inclusion in Erlang.
The forked module is calld `rabbit_logger_std_h` and is based
`logger_std_h` in Erlang 23.0.
2021-03-11 15:17:36 +01:00
Michael Klishin a7387b9a1f
Squash two more warnings on Erlang 24 2021-03-11 15:16:51 +01:00
Michael Klishin cca6b22720
This message arguably belongs to the channel category
Since it documents something that happens to channels.
There are other messages that document the fact that
this connection is being closed.
2021-03-11 08:20:11 +03:00
Michael Klishin d7e1336741
rabbitmq-diagnostics remote_shell: squash a compiler warning 2021-03-11 04:12:23 +03:00
Gerhard Lazu 5ac24dd2be
Make start-cluster work when run in the top-level
Subsequent nodes fail to start since ports are already in use. This
makes it possible to start multiple nodes locally with all plugins
enabled.

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2021-03-10 13:15:44 +00:00
Michael Klishin 570eb509c2
Naming 2021-03-10 07:45:49 +03:00