Commit Graph

1145 Commits

Author SHA1 Message Date
Philip Kuryloski f932c3e0bc bump a test timeout 2021-09-28 11:27:45 +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
Philip Kuryloski d6399bbb5b
Mixed version testing in bazel (#3200)
Unlike with gnu make, mixed version testing with bazel uses a package-generic-unix for the secondary umbrella rather than the source. This brings the benefit of being able to mixed version test releases built with older erlang versions (even though all nodes will run under the single version given to bazel)

This introduces new test labels, adding a `-mixed` suffix for every existing test. They can be skipped if necessary with `--test_tag_filters` (see the github actions workflow for an example)

As part of the change, it is now possible to run an old release of rabbit with rabbitmq_run rule, such as:

`bazel run @rabbitmq-server-generic-unix-3.8.17//:rabbitmq-run run-broker`
2021-07-19 14:33:25 +02:00
Philip Kuryloski 8a339aae6c Fixup rabbitmq_federation:queue_SUITE for mixed version testing 2021-07-13 18:05:04 +02:00
Philip Kuryloski 8f9de08de7 Also assert no missing suites for all other deps 2021-07-12 18:05:55 +02:00
Philip Kuryloski 8421100008 Use bazel-erlang semi-automatic suite sharding 2021-07-09 10:05:16 +02:00
Philip Kuryloski 973a8c5189 Adjustments to hopefully make rabbitmq_federation suite less flaky
and print more informative errors in a failure case
2021-07-05 11:26:56 +02:00
Philip Kuryloski a3c97d491f Update additional test skipping for 3.8/3.9 mixed versions 2021-06-25 11:17:46 +02:00
Philip Kuryloski ee5c16e866 Marking of flaky tests 2021-06-24 13:45:23 +02:00
Philip Kuryloski c234a5f37d Additional flaky test adjustments in bazel 2021-06-24 10:46:29 +02:00
Philip Kuryloski 8c7e7e0656 Revert "Default all `rabbitmq_integration_suite` to flaky in bazel"
This reverts commit 70cb8147b2.
2021-06-23 20:53:14 +02:00
Philip Kuryloski 70cb8147b2 Default all `rabbitmq_integration_suite` to flaky in bazel
Most tests that can start rabbitmq nodes have some chance of
flaking. Rather than chase individual flakes for now, this commit
changes the default (though it can still be overriden, as is the case
for config_scheme_SUITE in many places, since I have yet to see that
particular suite flake).
2021-06-21 16:10:38 +02:00
Philip Kuryloski d8c4c0a887 Adjustments for the way @bazel-erlang shards tests 2021-06-21 13:13:21 +02:00
Michael Klishin 40b7e001b4
Queue args won't be set for all suites, be more defensive 2021-06-16 23:39:02 +08:00
Michael Klishin 62e24460b3
Avoid conflicting queue declarations from tests
this is important now that different federation sides
use queues of different types in the mixed group.
2021-06-16 22:32:44 +08:00
Michael Klishin 57ef42f732
Compile 2021-06-16 21:07:38 +08:00
dcorbacho 77e253e7c7 Support mixed queue type federation links 2021-06-16 13:49:16 +02:00
Karl Nilsson c9026daecc test case 2021-06-16 13:49:16 +02:00
Philip Kuryloski 30f9a95b9f Add dialyze for remaning tier-1 plugins 2021-06-01 10:19:10 +02:00
Philip Kuryloski 1af7d7e6c2 Mark //deps/rabbitmq_federation:queue_SUITE as flaky in bazel 2021-05-25 17:00:50 +02:00
Philip Kuryloski 98e71c45d8 Perform xref checks on many tier-1 plugins 2021-05-21 12:03:22 +02:00
Philip Kuryloski c13c2af614 Bazel file refactoring 2021-05-11 12:03:27 +02:00
Philip Kuryloski 6edf06dcdd Refactor rabbitmq_federation bazel 2021-05-11 11:22:36 +02:00
Philip Kuryloski 072a1c0462 Refactor and dedupe .bazel file content 2021-04-16 10:22:44 +02:00
Philip Kuryloski afbedd654e Shard rabbitmq_federation:queue_SUITE by group 2021-04-13 15:38:21 +02:00
Philip Kuryloski 078c897d2a Add rabbitmq_federation to bazel 2021-04-13 11:45:09 +02:00
Philip Kuryloski 388654c542
Add a partial Bazel build (#2938)
Adds WORKSPACE.bazel, BUILD.bazel & *.bzl files for partial build & test with Bazel. Introduces a build-time dependency on https://github.com/rabbitmq/bazel-erlang
2021-03-29 11:01:43 +02:00
Philip Kuryloski a63f169fcb Remove duplicate rabbitmq-components.mk and erlang.mk files
Also adjust the references in rabbitmq-components.mk to account for
post monorepo locations
2021-03-22 15:40:19 +01:00
kjnilsson 52f745dcde Update rabbitmq-components.mk
use v1.x branch of ra
2021-03-18 15:14:40 +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
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
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 f6e8320fc9
Merge branch 'otp-24-ranch' 2021-03-10 07:37:51 +03:00
dcorbacho 61f7b2a723 Update to ranch 2.0 2021-03-08 23:11:05 +01:00
Michael Klishin 8f2e4edcdf
Remove two now unused functions
Follow-up to #2868
2021-03-05 07:17:06 +03:00
dcorbacho b9836cc3b2 Remove federation_up/0 check
Decorators are only executed if the plugin is enabled (registered in
rabbit_queue_decorator), thus initialising the links through `startup`.
There is no obvious way for a fed link to start if the plugin isn't running,
so this check can be removed.
2021-03-04 21:53:43 +01:00
dcorbacho 00510fe84b Await for links to start/fail to start on test suite 2021-03-04 17:36:03 +01:00
Michael Klishin b6c4831e75
Bump Lager to 3.9.1 2021-03-04 04:36:39 +03:00
dcorbacho ac43136653
Use scope on pg groups and skip `go` call from the app
`rabbit_federation_queue_link:go()` and the exchange equivalent are asynchronous (cast).
They are luckily executed after the links are started by the decorators, and probably
most of the time they find the links up and ready to `go`. However, this might not always
be the case. The retry introduced on the previous commit that is triggered by the link itself
once if finds that federation is down, guarantees that the `go` will be handled by the link
process. Thus, the calls to rabbit_federation_queue_link:go() and rabbit_federation_exchange_link:go()
can be removed from the app.
2021-03-04 04:06:41 +03:00
Michael Klishin 3a73dadb61
Retry if we could not start links because the plugin wasn't yet running
Per discussion with @dcorbacho.
2021-03-04 04:06:41 +03:00
Michael Klishin be11d6087d
Synchronize federation_up/0 logic for both link types 2021-03-04 04:06:41 +03:00
Michael Klishin ad47eba2fa
pg2 => pg for OTP 24 compatibility
there is still one failing queue federation test.
2021-03-04 04:06:40 +03:00
Loïc Hoguin 66ac1bf5e9
Bump observer_cli to 1.6.1
More responsive when the system is overloaded with file calls.
2021-03-01 21:55:27 +03:00
Michael Klishin 8fe3df9343
Upgrade Lager to 3.9.0 for OTP 24 compatibility
`lager_util:expand_path/1` use changes are
due to erlang-lager/lager#540
2021-02-26 00:52:15 +03:00
Michael Klishin 3430906ad8
Be more defensive when removing federated queue links
if terminate_child/2 above fails, so will delete_child/2.

(cherry picked from commit 315d162d3a)
2021-02-25 23:16:57 +03:00
Michael Klishin a2f98f25e9
Merge pull request #2804 from rabbitmq/rabbitmq-server-2756
Add federation support for quorum queues
2021-02-25 19:10:15 +03:00
Michael Klishin f73e851f9c
Bump observer_cli to 1.6.0 2021-02-24 12:53:55 +03:00
Michael Klishin a5098b28a7
Bump Lager to 3.8.2 for OTP 24 compatibility 2021-02-24 12:53:30 +03:00
dcorbacho 8592291afa Fix notify_decorators and policy notifications 2021-02-21 22:56:06 +01:00
Michael Klishin d0506cc225
Add a single channel mode-specific test 2021-02-20 10:32:24 +03:00