Commit Graph

642 Commits

Author SHA1 Message Date
Arnaud Cogoluègnes 739928153e
Add --binding-keys to add_super_stream command
It is meant to replace --routing-keys, which
is still available but not documented anymore.

This is to be consistent with AMQP 0.9.1 terminology.
2023-11-15 14:00:07 +01:00
Arnaud Cogoluègnes 5e1155c523
Fix function spec 2023-11-13 16:30:37 +01:00
Arnaud Cogoluègnes 22698a4adc
Simplify maybe block 2023-11-13 15:55:08 +01:00
Arnaud Cogoluègnes 2eb9b5f87b
Make sure partitions and binding keys counts are equal 2023-11-13 15:48:23 +01:00
Arnaud Cogoluègnes 9beda5702e
Use "binding key" lingo for super stream creation
Instead of "routing key".
2023-11-13 14:54:45 +01:00
Arnaud Cogoluègnes 809e97fd38
Use maybe syntax for super stream management permissions 2023-11-13 10:30:26 +01:00
Arnaud Cogoluègnes 043ddcba95
Add super stream creation/deletion test 2023-11-13 10:30:25 +01:00
Arnaud Cogoluègnes d04ccdb0ce
Return correct frame name 2023-11-13 10:30:25 +01:00
Arnaud Cogoluègnes 388608143d
Add super stream add/delete protocol commands 2023-11-13 10:30:25 +01:00
Arnaud Cogoluègnes 15f93f338c
Add super stream creation/deletion commands in spec 2023-11-13 10:30:24 +01:00
dependabot[bot] c3676c6c79
Bump org.apache.maven.plugins:maven-surefire-plugin
Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.2.1 to 3.2.2.
- [Release notes](https://github.com/apache/maven-surefire/releases)
- [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.2.1...surefire-3.2.2)

---
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>
2023-11-07 18:30:48 +00:00
Iliia Khaprov c577e04b73 Remove POODLE check, we are in the future 2023-11-01 10:53:27 +01:00
David Ansari fb18ddf42c Deduplicate code 2023-10-25 15:58:13 +02:00
dependabot[bot] feaeea2f2e
Bump org.apache.maven.plugins:maven-surefire-plugin
Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.1.2 to 3.2.1.
- [Release notes](https://github.com/apache/maven-surefire/releases)
- [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.1.2...surefire-3.2.1)

---
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>
2023-10-24 18:22:19 +00:00
Michael Klishin 55bd90c0e4
Merge pull request #9187 from rabbitmq/update-secret
Update secret on the stream protocol
2023-10-23 19:46:52 -04:00
Arnaud Cogoluègnes c04d324b9f
Fix list_stream_consumer_groups validation
It had been broken in a refactoring to squash
dialyzer warnings.
2023-10-10 16:44:05 +02:00
Arnaud Cogoluègnes 65d381ef6c
Polish list_stream_tracking
Correct output when there is no line, fix usage, formatting.
2023-10-10 10:57:48 +02:00
Arnaud Cogoluègnes b541be658e
Use tracking_value for column header 2023-10-10 09:14:24 +02:00
Arnaud Cogoluègnes dc5a63dfbd
Fix command file name 2023-10-10 09:14:24 +02:00
Arnaud Cogoluègnes cfa7c26760
Add command to Bazel configuration 2023-10-10 09:14:23 +02:00
Arnaud Cogoluègnes 048a4998ed
Add list_stream_tracking 2023-10-10 09:14:23 +02:00
Arnaud Cogoluègnes 944b34e4e0 Add pid and node columns to list_stream_connections
Fixes #9555
2023-09-30 14:59:25 -04:00
Arnaud Cogoluègnes db65caa91f Add node column to list_stream_publishers/consumers
Fixes #9582
2023-09-30 14:59:25 -04:00
Arnaud Cogoluègnes 07d7f09a60
Fix a couple for dialyzer warnings 2023-09-28 17:44:55 +02:00
Arnaud Cogoluègnes 289fc51def
Monitor members to the same stream in stream connection
This commit change makes sure that different members
of the same stream are monitored in a given connection.
A connection can use the stream leader for a publisher
and a replica for a consumer, if the replica crashes
for some reason, the connection must detect it and
send a metadata notification to the client.

Note that client connections should still use different
connections for publishers and consumers.
2023-09-28 17:09:29 +02:00
Arnaud Cogoluègnes e22fcd70fe
Make MC conversion function return ok or error 2023-09-18 18:32:59 +02:00
Karl Nilsson 119f034406
Message Containers (#5077)
This PR implements an approach for a "protocol (data format) agnostic core" where the format of the message isn't converted at point of reception.

Currently all non AMQP 0.9.1 originating messages are converted into a AMQP 0.9.1 flavoured basic_message record before sent to a queue. If the messages are then consumed by the originating protocol they are converted back from AMQP 0.9.1. For some protocols such as MQTT 3.1 this isn't too expensive as MQTT is mostly a fairly easily mapped subset of AMQP 0.9.1 but for others such as AMQP 1.0 the conversions are awkward and in some cases lossy even if consuming from the originating protocol.

This PR instead wraps all incoming messages in their originating form into a generic, extensible message container type (mc). The container module exposes an API to get common message details such as size and various properties (ttl, priority etc) directly from the source data type. Each protocol needs to implement the mc behaviour such that when a message originating form one protocol is consumed by another protocol we convert it to the target protocol at that point.

The message container also contains annotations, dead letter records and other meta data we need to record during the lifetime of a message. The original protocol message is never modified unless it is consumed.

This includes conversion modules to and from amqp, amqpl (AMQP 0.9.1) and mqtt.


COMMIT HISTORY:

* Refactor away from using the delivery{} record

In many places including exchange types. This should make it
easier to move towards using a message container type instead of
basic_message.

Add mc module and move direct replies outside of exchange

Lots of changes incl classic queues

Implement stream support incl amqp conversions

simplify mc state record

move mc.erl

mc dlx stuff

recent history exchange

Make tracking work

But doesn't take a protocol agnostic approach as we just convert
everything into AMQP legacy and back. Might be good enough for now.

Tracing as a whole may want a bit of a re-vamp at some point.

tidy

make quorum queue peek work by legacy conversion

dead lettering fixes

dead lettering fixes

CMQ fixes

rabbit_trace type fixes

fixes

fix

Fix classic queue props

test assertion fix

feature flag and backwards compat

Enable message_container feature flag in some SUITEs

Dialyzer fixes

fixes

fix

test fixes

Various

Manually update a gazelle generated file

until a gazelle enhancement can be made
https://github.com/rabbitmq/rules_erlang/issues/185

Add message_containers_SUITE to bazel

and regen bazel files with gazelle from rules_erlang@main

Simplify essential proprty access

Such as durable, ttl and priority by extracting them into annotations
at message container init time.

Move type

to remove dependenc on amqp10 stuff in mc.erl

mostly because I don't know how to make bazel do the right thing

add more stuff

Refine routing header stuff

wip

Cosmetics

Do not use "maybe" as type name as "maybe" is a keyword since OTP 25
which makes Erlang LS complain.

* Dedup death queue names

* Fix function clause crashes

Fix failing tests in the MQTT shared_SUITE:
A classic queue message ID can be undefined as set in
fbe79ff47b/deps/rabbit/src/rabbit_classic_queue_index_v2.erl (L1048)

Fix failing tests in the MQTT shared_SUITE-mixed:
When feature flag message_containers is disabled, the
message is not an #mc{} record, but a #basic_message{} record.

* Fix is_utf8_no_null crash

Prior to this commit, the function crashed if invalid UTF-8 was
provided, e.g.:
```
1> rabbit_misc:is_valid_shortstr(<<"😇"/utf16>>).
** exception error: no function clause matching rabbit_misc:is_utf8_no_null(<<216,61,222,7>>) (rabbit_misc.erl, line 1481)
```

* Implement mqtt mc behaviour

For now via amqp translation.

This is still work in progress, but the following SUITEs pass:
```
make -C deps/rabbitmq_mqtt ct-shared t=[mqtt,v5,cluster_size_1] FULL=1
make -C deps/rabbitmq_mqtt ct-v5 t=[mqtt,cluster_size_1] FULL=1
```

* Shorten mc file names

Module name length matters because for each persistent message the #mc{}
record is persisted to disk.

```
1> iolist_size(term_to_iovec({mc, rabbit_mc_amqp_legacy})).
30
2> iolist_size(term_to_iovec({mc, mc_amqpl})).
17
```

This commit renames the mc modules:
```
ag -l rabbit_mc_amqp_legacy | xargs sed -i 's/rabbit_mc_amqp_legacy/mc_amqpl/g'
ag -l rabbit_mc_amqp | xargs sed -i 's/rabbit_mc_amqp/mc_amqp/g'
ag -l rabbit_mqtt_mc | xargs sed -i 's/rabbit_mqtt_mc/mc_mqtt/g'
```

* mc: make deaths an annotation + fixes

* Fix mc_mqtt protocol_state callback

* Fix test will_delay_node_restart

```
make -C deps/rabbitmq_mqtt ct-v5 t=[mqtt,cluster_size_3]:will_delay_node_restart FULL=1
```

* Bazel run gazelle

* mix format rabbitmqctl.ex

* Ensure ttl annotation is refelected in amqp legacy protocol state

* Fix id access in message store

* Fix rabbit_message_interceptor_SUITE

* dializer fixes

* Fix rabbit:rabbit_message_interceptor_SUITE-mixed

set_annotation/3 should not result in duplicate keys

* Fix MQTT shared_SUITE-mixed

Up to 3.12 non-MQTT publishes were always QoS 1 regardless of delivery_mode.
75a953ce28/deps/rabbitmq_mqtt/src/rabbit_mqtt_processor.erl (L2075-L2076)
From now on, non-MQTT publishes are QoS 1 if durable.
This makes more sense.

The MQTT plugin must send a #basic_message{} to an old node that does
not understand message containers.

* Field content of 'v1_0.data' can be binary

Fix
```
bazel test //deps/rabbitmq_mqtt:shared_SUITE-mixed \
    --test_env FOCUS="-group [mqtt,v4,cluster_size_1] -case trace" \
    -t- --test_sharding_strategy=disabled
```

* Remove route/2 and implement route/3 for all exchange types.

This removes the route/2 callback from rabbit_exchange_type and
makes route/3 mandatory instead. This is a breaking change and
will require all implementations of exchange types to update their
code, however this is necessary anyway for them to correctly handle
the mc type.

stream filtering fixes

* Translate directly from MQTT to AMQP 0.9.1

* handle undecoded properties in mc_compat

amqpl: put clause in right order

recover death deatails from amqp data

* Replace callback init_amqp with convert_from

* Fix return value of lists:keyfind/3

* Translate directly from AMQP 0.9.1 to MQTT

* Fix MQTT payload size

MQTT payload can be a list when converted from AMQP 0.9.1 for example

First conversions tests

Plus some other conversion related fixes.

bazel

bazel

translate amqp 1.0 null to undefined

mc: property/2 and correlation_id/message_id return type tagged values.

To ensure we can support a variety of types better.

The type type tags are AMQP 1.0 flavoured.

fix death recovery

mc_mqtt: impl new api

Add callbacks to allow protocols to compact data before storage

And make readable if needing to query things repeatedly.

bazel fix

* more decoding

* tracking mixed versions compat

* mc: flip default of `durable` annotation to save some data.

Assuming most messages are durable and that in memory messages suffer less
from persistence overhead it makes sense for a non existent `durable`
annotation to mean durable=true.

* mc conversion tests and tidy up

* mc make x_header unstrict again

* amqpl: death record fixes

* bazel

* amqp -> amqpl conversion test

* Fix crash in mc_amqp:size/1

Body can be a single amqp-value section (instead of
being a list) as shown by test
```
make -C deps/rabbitmq_amqp1_0/ ct-system t=java
```
on branch native-amqp.

* Fix crash in lists:flatten/1

Data can be a single amqp-value section (instead of
being a list) as shown by test
```
make -C deps/rabbitmq_amqp1_0 ct-system t=dotnet:roundtrip_to_amqp_091
```
on branch native-amqp.

* Fix crash in rabbit_writer

Running test
```
make -C deps/rabbitmq_amqp1_0 ct-system t=dotnet:roundtrip_to_amqp_091
```
on branch native-amqp resulted in the following crash:
```
crasher:
  initial call: rabbit_writer:enter_mainloop/2
  pid: <0.711.0>
  registered_name: []
  exception error: bad argument
    in function  size/1
       called as size([<<0>>,<<"Sw">>,[<<160,2>>,<<"hi">>]])
       *** argument 1: not tuple or binary
    in call from rabbit_binary_generator:build_content_frames/7 (rabbit_binary_generator.erl, line 89)
    in call from rabbit_binary_generator:build_simple_content_frames/4 (rabbit_binary_generator.erl, line 61)
    in call from rabbit_writer:assemble_frames/5 (rabbit_writer.erl, line 334)
    in call from rabbit_writer:internal_send_command_async/3 (rabbit_writer.erl, line 365)
    in call from rabbit_writer:handle_message/2 (rabbit_writer.erl, line 265)
    in call from rabbit_writer:handle_message/3 (rabbit_writer.erl, line 232)
    in call from rabbit_writer:mainloop1/2 (rabbit_writer.erl, line 223)
```
because #content.payload_fragments_rev is currently supposed to
be a flat list of binaries instead of being an iolist.

This commit fixes this crash inefficiently by calling
iolist_to_binary/1. A better solution would be to allow AMQP legacy's #content.payload_fragments_rev
to be an iolist.

* Add accidentally deleted line back

* mc: optimise mc_amqp internal format

By removint the outer records for message and delivery annotations
as well as application properties and footers.

* mc: optimis mc_amqp map_add by using upsert

* mc: refactoring and bug fixes

* mc_SUITE routingheader assertions

* mc remove serialize/1 callback as only used by amqp

* mc_amqp: avoid returning a nested list from protocol_state

* test and bug fix

* move infer_type to mc_util

* mc fixes and additiona assertions

* Support headers exchange routing for MQTT messages

When a headers exchange is bound to the MQTT topic exchange, routing
will be performend based on both MQTT topic (by the topic exchange) and
MQTT User Property (by the headers exchange).

This combines the best worlds of both MQTT 5.0 and AMQP 0.9.1 and
enables powerful routing topologies.

When the User Property contains the same name multiple times, only the
last name (and value) will be considered by the headers exchange.

* Fix crash when sending from stream to amqpl

When publishing a message via the stream protocol and consuming it via
AMQP 0.9.1, the following crash occurred prior to this commit:
```
crasher:
  initial call: rabbit_channel:init/1
  pid: <0.818.0>
  registered_name: []
  exception exit: {{badmatch,undefined},
                   [{rabbit_channel,handle_deliver0,4,
                                    [{file,"rabbit_channel.erl"},
                                     {line,2728}]},
                    {lists,foldl,3,[{file,"lists.erl"},{line,1594}]},
                    {rabbit_channel,handle_cast,2,
                                    [{file,"rabbit_channel.erl"},
                                     {line,728}]},
                    {gen_server2,handle_msg,2,
                                 [{file,"gen_server2.erl"},{line,1056}]},
                    {proc_lib,wake_up,3,
                              [{file,"proc_lib.erl"},{line,251}]}]}
```

This commit first gives `mc:init/3` the chance to set exchange and
routing_keys annotations.
If not set, `rabbit_stream_queue` will set these annotations assuming
the message was originally published via the stream protocol.

* Support consistent hash exchange routing for MQTT 5.0

When a consistent hash exchange is bound to the MQTT topic exchange,
MQTT 5.0 messages can be routed to queues consistently based on the
Correlation-Data in the PUBLISH packet.

* Convert MQTT 5.0 User Property

* to AMQP 0.9.1 headers
* from AMQP 0.9.1 headers
* to AMQP 1.0 application properties and message annotations
* from AMQP 1.0 application properties and message annotations

* Make use of Annotations in mc_mqtt:protocol_state/2

mc_mqtt:protocol_state/2 includes Annotations as parameter.
It's cleaner to make use of these Annotations when computing the
protocol state instead of relying on the caller (rabbitmq_mqtt_processor)
to compute the protocol state.

* Enforce AMQP 0.9.1 field name length limit

The AMQP 0.9.1 spec prohibits field names longer than 128 characters.
Therefore, when converting AMQP 1.0 message annotations, application
properties or MQTT 5.0 User Property to AMQP 0.9.1 headers, drop any
names longer than 128 characters.

* Fix type specs

Apply feedback from Michael Davis

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Add mc_mqtt unit test suite

Implement mc_mqtt:x_header/2

* Translate indicator that payload is UTF-8 encoded

when converting between MQTT 5.0 and AMQP 1.0

* Translate single amqp-value section from AMQP 1.0 to MQTT

Convert to a text representation, if possible, and indicate to MQTT
client that the payload is UTF-8 encoded. This way, the MQTT client will
be able to parse the payload.

If conversion to text representation is not possible, encode the payload
using the AMQP 1.0 type system and indiate the encoding via Content-Type
message/vnd.rabbitmq.amqp.

This Content-Type is not registered.
Type "message" makes sense since it's a message.
Vendor tree "vnd.rabbitmq.amqp" makes sense since merely subtype "amqp" is not
registered.

* Fix payload conversion

* Translate Response Topic between MQTT and AMQP

Translate MQTT 5.0 Response Topic to AMQP 1.0 reply-to address and vice
versa.

The Response Topic must be a UTF-8 encoded string.

This commit re-uses the already defined RabbitMQ target addresses:
```
"/topic/"     RK        Publish to amq.topic with routing key RK
"/exchange/"  X "/" RK  Publish to exchange X with routing key RK
```

By default, the MQTT topic exchange is configure dto be amq.topic using
the 1st target address.

When an operator modifies the mqtt.exchange, the 2nd target address is
used.

* Apply PR feedback

and fix formatting

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* tidy up

* Add MQTT message_containers test

* consistent hash exchange: avoid amqp legacy conversion

When hashing on a header value.

* Avoid converting to amqp legacy when using exchange federation

* Fix test flake

* test and dialyzer fixes

* dialyzer fix

* Add MQTT protocol interoperability tests

Test receiving from and sending to MQTT 5.0 and
* AMQP 0.9.1
* AMQP 1.0
* STOMP
* Streams

* Regenerate portions of deps/rabbit/app.bzl with gazelle

I'm not exactly sure how this happened, but gazell seems to have been
run with an older version of the rules_erlang gazelle extension at
some point. This caused generation of a structure that is no longer
used. This commit updates the structure to the current pattern.

* mc: refactoring

* mc_amqpl: handle delivery annotations

Just in case they are included.

Also use iolist_to_iovec to create flat list of binaries when
converting from amqp with amqp encoded payload.

---------

Co-authored-by: David Ansari <david.ansari@gmx.de>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Co-authored-by: Rin Kuryloski <kuryloskip@vmware.com>
2023-08-31 11:27:13 +01:00
Marcial Rosales b715a4d07c Update secret via sasl_authentication frame 2023-08-25 11:32:24 +01:00
Arnaud Cogoluègnes c594c77049
Adapt stream Java tests to client 0.12.0 snapshot
After changes for
https://github.com/rabbitmq/rabbitmq-stream-java-client/issues/333.
2023-07-17 11:04:25 +02:00
Arnaud Cogoluègnes 6ed8b30780
Merge pull request #8848 from rabbitmq/dependabot/maven/deps/rabbitmq_stream/test/rabbit_stream_SUITE_data/main/com.diffplug.spotless-spotless-maven-plugin-2.37.0
Bump spotless-maven-plugin from 2.24.0 to 2.37.0 in /deps/rabbitmq_stream/test/rabbit_stream_SUITE_data
2023-07-13 17:25:10 +02:00
dependabot[bot] dfc2ee65d8
Bump spotless-maven-plugin
Bumps [spotless-maven-plugin](https://github.com/diffplug/spotless) from 2.24.0 to 2.37.0.
- [Changelog](https://github.com/diffplug/spotless/blob/main/CHANGES.md)
- [Commits](https://github.com/diffplug/spotless/compare/lib/2.24.0...lib/2.37.0)

---
updated-dependencies:
- dependency-name: com.diffplug.spotless:spotless-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-13 15:17:08 +00:00
dependabot[bot] 18d36662df
Bump junit.jupiter.version
Bumps `junit.jupiter.version` from 5.9.0 to 5.9.3.

Updates `junit-jupiter-engine` from 5.9.0 to 5.9.3
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.9.0...r5.9.3)

Updates `junit-jupiter-params` from 5.9.0 to 5.9.3
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.9.0...r5.9.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>
2023-07-13 15:17:02 +00:00
Arnaud Cogoluègnes 742c8ed994
Use stream Java client 0.11.0 in test suites
Just temporarily. This removes the need to use
a snapshot repository, which makes dependabot fail.

There's also a stream Java client update with
internal breaking changes, so we'll come back
to the latest snapshot once the tests are updated.
2023-07-13 17:12:51 +02:00
Arnaud Cogoluègnes 7bc26154b5
Add stream filtering feature flag 2023-07-10 15:21:53 +02:00
Arnaud Cogoluègnes 065844a6d6
Support stream-filter-size-bytes in stream protocol 2023-07-10 15:21:53 +02:00
Arnaud Cogoluègnes 58dc8b9d40
Add test for stream filtering 2023-07-10 15:21:52 +02:00
Arnaud Cogoluègnes 62c83b0b9d
Use "filter."-shaped subscription properties
To set filter values in stream protocol.
2023-07-10 15:21:52 +02:00
Arnaud Cogoluègnes 9f06fb7db9
Add support for stream filtering
WIP.
2023-07-10 15:21:52 +02:00
dependabot[bot] 6f3398a49a
Bump logback-classic
Bumps [logback-classic](https://github.com/qos-ch/logback) from 1.2.11 to 1.2.12.
- [Commits](https://github.com/qos-ch/logback/compare/v_1.2.11...v_1.2.12)

---
updated-dependencies:
- dependency-name: ch.qos.logback:logback-classic
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-30 15:32:16 +00:00
dependabot[bot] 14c43d6c30
Bump maven-compiler-plugin
Bumps [maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.10.1 to 3.11.0.
- [Release notes](https://github.com/apache/maven-compiler-plugin/releases)
- [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.10.1...maven-compiler-plugin-3.11.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-30 15:07:23 +00:00
Arnaud Cogoluègnes b39088ab87
Merge pull request #8721 from rabbitmq/dependabot/maven/deps/rabbitmq_stream/test/rabbit_stream_SUITE_data/main/org.apache.maven.plugins-maven-surefire-plugin-3.1.2
Bump maven-surefire-plugin from 2.22.2 to 3.1.2 in /deps/rabbitmq_stream/test/rabbit_stream_SUITE_data
2023-06-30 17:06:24 +02:00
dependabot[bot] e568bb6f9a
Bump maven-surefire-plugin
Bumps [maven-surefire-plugin](https://github.com/apache/maven-surefire) from 2.22.2 to 3.1.2.
- [Release notes](https://github.com/apache/maven-surefire/releases)
- [Commits](https://github.com/apache/maven-surefire/compare/surefire-2.22.2...surefire-3.1.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-30 14:02:53 +00:00
dependabot[bot] 2a19ba07c2
Bump assertj-core in /deps/rabbitmq_stream/test/rabbit_stream_SUITE_data
Bumps assertj-core from 3.23.1 to 3.24.2.

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-30 14:02:31 +00:00
Arnaud Cogoluègnes 1315f5c26c
Bump Google Java Format 2023-06-30 10:03:56 +02:00
David Ansari 66fe9630b5 Add Message Expiry Interval for retained messages
MQTT v5 spec:
"If the current retained message for a Topic expires, it is discarded
and there will be no retained message for that topic."

This commit also supports Message Expiry Interval for retained messages
when a node is restarted.
Therefore, the insertion timestamp needs to be stored on disk.
Upon recovery, the Erlang timers are re-created.
2023-06-21 17:14:08 +01:00
Michael Klishin 55442aa914 Replace @rabbitmq.com addresses with rabbitmq-core@groups.vmware.com
Don't ask why we have to do it. Because reasons!
2023-06-20 15:40:13 +04:00
Arnaud Cogoluègnes 6c14d736ab
Polish authentication in stream reader 2023-06-06 13:04:35 +02:00
Arnaud Cogoluègnes 21347490f9
Fix SASL external authentication in stream plugin 2023-06-06 11:08:02 +02:00
Rin Kuryloski eb94a58bc9 Add a workflow to compare the bazel/erlang.mk output
To catch any drift between the builds
2023-05-15 13:54:14 +02:00
Alex Blease 8443c761ee
Include UnsubscribeResponse in stream protocol 2023-05-15 10:44:46 +01:00
Rin Kuryloski a944439fba Replace globs in bazel with explicit lists of files
As this is preferred in rules_erlang 3.9.14
2023-04-25 17:29:12 +02:00
Michal Kuratczyk d04b3afe9b verify_none in a couple of tests 2023-04-24 13:11:44 +00:00
Rin Kuryloski 854d01d9a5 Restore the original -include_lib statements from before #6466
since this broke erlang_ls

requires rules_erlang 3.9.13
2023-04-20 12:40:45 +02:00
Michael Klishin c0ed80c625
Merge pull request #6466 from rabbitmq/gazelle
Use gazelle for some maintenance of bazel BUILD files
2023-04-19 09:33:44 +04:00
Rin Kuryloski 8de8f59d47 Use gazelle generated bazel files
Bazel build files are now maintained primarily with `bazel run
gazelle`. This will analyze and merge changes into the build files as
necessitated by certain code changes (e.g. the introduction of new
modules).

In some cases there hints to gazelle in the build files, such as `#
gazelle:erlang...` or `# keep` comments. xref checks on plugins that
depend on the cli are a good example.
2023-04-17 18:13:18 +02:00
Michael Klishin 0f8a5899de
Merge branch 'main' into otp26-compatibility 2023-04-17 14:23:21 +04:00
Rin Kuryloski 8a7eee6a86 Ignore warnings when building plt files for dependencies
As we don't generally care if a dependency has warnings, only the
target
2023-04-17 10:09:24 +02:00
Michal Kuratczyk dcc24fce1c
Set `{verify, verify_none}` in rabbit_stream_SUITE 2023-04-13 14:37:19 +02:00
Arnaud Cogoluègnes ac20b90a05 Squash Dialyzer warning 2023-04-04 19:32:57 +04:00
Arnaud Cogoluègnes 4a669e1450 Fix field type definition
References #7743
2023-04-04 19:32:57 +04:00
Arnaud Cogoluègnes 763acc2fad Introduce timeout for stream server-side requests
The stream plugin can send frames to a client connection
and expect a response from it. This is used currently
for the consumer_update frame (single active consumer feature).
There was no timeout mechanism so far, so a slow or blocked
application could prevent a group of consumers to move on.

This commit introduces a timeout mechanism: if the expected
response takes too long to arrive, the server assumes the
connection is blocked and closes it.

The default timeout is 60 seconds but it can be changed by setting
the request_timeout parameter of the rabbitmq_stream application.

Note the mechanism does not enforce the exact duration of the timeout,
as a timer is set for the first request and re-used for other requests.
With bad timing, a request can time out after twice as long
as the set-up timeout.

References #7743
2023-04-04 19:32:57 +04:00
Arnaud Cogoluègnes 63d1ed9dfb Add meck to SAC coordinator test dependencies
And squash a dialyzer warning.
2023-04-04 19:32:57 +04:00
Arnaud Cogoluègnes 70538c587f Unblock group of consumers on super stream partition
A group of consumers on a super stream can end up blocked
without an active consumer. This can happen with consumer
churn: one consumer gets removed, which makes the active
consumer passive, but the former active consumer never
gets to know because it has been removed itself.

This commit changes the structure of the messages the SAC
coordinator sends to consumer connections, to embed enough
information to look up the group and to instruct it to choose
a new active consumer when the race condition mentioned above
comes up.

Because of the changes in the structure of messages, a feature
flag is required to make sure the SAC coordinator starts
sending the new messages only when all the nodes have been upgraded.

References #7743
2023-04-04 19:32:57 +04:00
David Ansari b4871e2b83
Update PROTOCOL.adoc 2023-03-21 11:58:50 +01:00
Arnaud Cogoluègnes e9f2fa41ce
Take credits for inactive stream subscription
Not taking the credits can starve the subscription,
making it permanently under its credit send limit.

The subscription then never dispatches messages when
it becomes active again.

This happens in an active-inactive-active cycle, especially
with slow consumers.
2023-03-16 11:59:58 +01:00
David Ansari 4d7403cb62 Delete rabbit_stream_SUITE setup steps
since these feature flags became required in 3.12.
2023-02-15 17:01:59 +00:00
Michael Klishin d0dc951343
Merge pull request #7058 from rabbitmq/add-node-lists-functions-to-clarify-intent
rabbit_nodes: Add list functions to clarify which nodes we are interested in
2023-02-13 23:06:50 -03:00
Michael Klishin 054381a99b
Merge pull request #7269 from rabbitmq/ff-stream_queue
Remove compatibility for feature flag stream_queue
2023-02-13 22:35:08 -03:00
David Ansari 575f4e78bc Remove compatibility for feature flag stream_queue
Remove compatibility code for feature flag `stream_queue`
because this feature flag is required in 3.12.

See #7219
2023-02-13 15:31:40 +00:00
Jean-Sébastien Pédron d65637190a
rabbit_nodes: Add list functions to clarify which nodes we are interested in
So far, we had the following functions to list nodes in a RabbitMQ
cluster:
* `rabbit_mnesia:cluster_nodes/1` to get members of the Mnesia cluster;
  the argument was used to select members (all members or only those
  running Mnesia and participating in the cluster)
* `rabbit_nodes:all/0` to get all members of the Mnesia cluster
* `rabbit_nodes:all_running/0` to get all members who currently run
  Mnesia

Basically:
* `rabbit_nodes:all/0` calls `rabbit_mnesia:cluster_nodes(all)`
* `rabbit_nodes:all_running/0` calls `rabbit_mnesia:cluster_nodes(running)`

We also have:
* `rabbit_node_monitor:alive_nodes/1` which filters the given list of
  nodes to only select those currently running Mnesia
* `rabbit_node_monitor:alive_rabbit_nodes/1` which filters the given
  list of nodes to only select those currently running RabbitMQ

Most of the code uses `rabbit_mnesia:cluster_nodes/1` or the
`rabbit_nodes:all*/0` functions. `rabbit_mnesia:cluster_nodes(running)`
or `rabbit_nodes:all_running/0` is often used as a close approximation
of "all cluster members running RabbitMQ". This list might be incorrect
in times where a node is joining the clustered or is being worked on
(i.e. Mnesia is running but not RabbitMQ).

With Khepri, there won't be the same possible approximation because we
will try to keep Khepri/Ra running even if RabbitMQ is stopped to
expand/shrink the cluster.

So in order to clarify what we want when we query a list of nodes, this
patch introduces the following functions:
* `rabbit_nodes:list_members/0` to get all cluster members, regardless
  of their state
* `rabbit_nodes:list_reachable/0` to get all cluster members we can
  reach using Erlang distribution, regardless of the state of RabbitMQ
* `rabbit_nodes:list_running/0` to get all cluster members who run
  RabbitMQ, regardless of the maintenance state
* `rabbit_nodes:list_serving/0` to get all cluster members who run
  RabbitMQ and are accepting clients

In addition to the list functions, there are the corresponding
`rabbit_nodes:is_*(Node)` checks and `rabbit_nodes:filter_*(Nodes)`
filtering functions.

The code is modified to use these new functions. One possible
significant change is that the new list functions will perform RPC calls
to query the nodes' state, unlike `rabbit_mnesia:cluster_nodes(running)`.
2023-02-13 12:58:40 +01:00
David Ansari 2f76102603 Remove compatibility for flag stream_single_active_consumer
Remove compatibility code for feature flag `stream_single_active_consumer`
because this feature flag is `required` in 3.12.

See https://github.com/rabbitmq/rabbitmq-server/pull/7219
2023-02-13 11:52:25 +00:00
David Ansari 5045fce6de Require all feature flags introduced before 3.11.1
RabbitMQ 3.12 requires feature flag `feature_flags_v2` which got
introduced in 3.11.0 (see
https://github.com/rabbitmq/rabbitmq-server/pull/6810).

Therefore, we can mark all feature flags that got introduced in 3.11.0
or before 3.11.0 as required because users will have to upgrade to
3.11.x first, before upgrading to 3.12.x

The advantage of marking these feature flags as required is that we can
start deleting any compatibliy code for these feature flags, similarly
as done in https://github.com/rabbitmq/rabbitmq-server/issues/5215

This list shows when a given feature flag was first introduced:

```
classic_mirrored_queue_version 3.11.0
stream_single_active_consumer 3.11.0
direct_exchange_routing_v2 3.11.0
listener_records_in_ets 3.11.0
tracking_records_in_ets 3.11.0

empty_basic_get_metric 3.8.10
drop_unroutable_metric 3.8.10
```

In this commit, we also force all required feature flags in Erlang
application `rabbit` to be enabled in mixed version cluster testing
and delete any tests that were about a feature flag starting as disabled.

Furthermore, this commit already deletes the callback (migration) functions
given they do not run anymore in 3.12.x.

All other clean up (i.e. branching depending on whether a feature flag
is enabled) will be done in separate commits.
2023-02-08 16:00:03 +00:00
David Ansari 79c12b60bc Use maybe expression instead of messy patterns
This commit is pure refactoring making the code base more maintainable.

Replace rabbit_misc:pipeline/3 with the new OTP 25 experimental maybe
expression because
"Frequent ways in which people work with sequences of failable
operations include folds over lists of functions, and abusing list
comprehensions. Both patterns have heavy weaknesses that makes them less
than ideal."
https://www.erlang.org/eeps/eep-0049#obsoleting-messy-patterns

Additionally, this commit is more restrictive in the type spec of
rabbit_mqtt_processor state fields.
Specifically, many fields were defined to be `undefined | T` where
`undefined` was only temporarily until the first CONNECT packet was
processed by the processor.
It's better to initialise the MQTT processor upon first CONNECT packet
because there is no point in having a processor without having received
any packet.
This allows many type specs in the processor to change from `undefined |
T` to just `T`.
Additionally, memory is saved by removing the `received_connect_packet`
field from the `rabbit_mqtt_reader` and `rabbit_web_mqtt_handler`.
2023-02-07 16:36:08 +01:00
Alexey Lebedeff c7da0da8b8 Cleanup dialyzer calls
- Use the same base .plt everywhere, so there is no need to list
standard apps everywhere
- Fix typespecs: some typos and the use of not-exported types
2023-02-06 17:05:30 +01:00
Arnaud Cogoluègnes f558d80e3d
Activate stream delivery v2 correctly
As soon as v2 is supported, whatever the min supported
version is.
2023-01-31 16:49:48 +01:00
David Ansari 1f106fcd98 Fix wrong and add missing type specs 2023-01-25 17:13:54 +00:00
David Ansari 9c2f5975ea Support tracing in Native MQTT 2023-01-24 17:32:59 +00:00
David Ansari a8b69b43c1 Fix dialyzer issues and add function specs
Fix all dialyzer warnings in rabbitmq_mqtt and rabbitmq_web_mqtt.

Add more function specs.
2023-01-24 17:32:58 +00:00
David Ansari 56e97a9142 Fix MQTT in management plugin
1. Allow to inspect an (web) MQTT connection.
2. Show MQTT client ID on connection page as part of client_properties.
3. Handle force_event_refresh (when management_plugin gets enabled
   after (web) MQTT connections got created).
4. Reduce code duplication between protocol readers.
5. Display '?' instead of 'NaN' in UI for absent queue metrics.
6. Allow an (web) MQTT connection to be closed via management_plugin.

For 6. this commit takes the same approach as already done for the stream
plugin:
The stream plugin registers neither with {type, network} nor {type,
direct}.
We cannot use gen_server:call/3 anymore to close the connection
because the web MQTT connection cannot handle gen_server calls (only
casts).
Strictly speaking, this commit requires a feature flag to allow to force
closing stream connections from the management plugin during a rolling
update. However, given that this is rather an edge case, and there is a
workaround (connect to the node directly hosting the stream connection),
this commit will not introduce a new feature flag.
2023-01-24 17:30:10 +00:00
Rin Kuryloski 08d641a1a9 Fix dialyzer warnings revealed from previous commit 2023-01-19 17:29:29 +01:00
Rin Kuryloski b84e746ee9 Rework plt/dialyze for rabbitmqctl and plugins that depend on it
This allows us to stop ignorning undefined callback warnings

When mix compiles rabbitmqctl, it produces a 'consolidated' directory
alongside the 'ebin' dir. Some of the modules in consolidated are
intended to be used instead of those provided by elixir. We now handle
the conflicts properly in the bazel build.
2023-01-19 17:29:23 +01:00
Rin Kuryloski 1a9f3f4ffd
Merge pull request #6928 from rabbitmq/rin/use-new-rules_erlang-macros
Simplify BUILD files by using new macros from rules_erlang 3.9.0
2023-01-19 10:03:42 +01:00
Michal Kuratczyk b8691b720b
Merge pull request #6862 from rabbitmq/small-chunks-opts
Move nopush to reader to try to better make use of packets
2023-01-19 09:01:24 +01:00
Rin Kuryloski 5ef8923462 Avoid the need to pass package name to rabbitmq_integration_suite 2023-01-18 15:25:27 +01:00
Rin Kuryloski a317b30807 Use improved assert_suites2 macro from rules_erlang 3.9.0 2023-01-18 15:07:06 +01:00
Karl Nilsson 83880154de Streams: Move nopush to reader to try to combine small chunks into larger IP packets.
Also change consumer credit top-ups to delay calling send_chunks until there is a "batch"
of credit to consume. Most clients at the time of writing send single credit updates after receiving each chunk so here we won't enter the send loop unless there are more than half the initial credits available.

osiris v1.4.3
2023-01-17 14:01:42 +00:00
Alexey Lebedeff 2c4e4fb691 Fix all dialyzer warnings in rabbitmq_stream
There are some elixir-related messages about undefined functions, but
they don't produce warnings (yet).
2023-01-16 17:11:24 +01:00
Arnaud Cogoluègnes 3fea81a7ee
Remove console output 2023-01-04 15:56:49 +01:00
Arnaud Cogoluègnes d2443b5f49
Filter out nodes in maintenance in stream metadata
We don't want clients to try to connect to those.

Fixes #3370
2023-01-04 15:54:20 +01:00
Arnaud Cogoluègnes 79990e8eae
Format stream plugin code 2023-01-04 10:47:16 +01:00
Michael Klishin ec4f1dba7d
(c) year bump: 2022 => 2023 2023-01-01 23:17:36 -05:00
Arnaud Cogoluègnes c1ab6b42d4
Use assertMatch instead of assertEqual in test
Make test less fragile.
2022-11-17 15:52:01 +01:00
Karl Nilsson e4921503db Streams: close osiris log on unsubscribe
To ensure we clean up any log resources such as counter records.
2022-11-03 16:54:31 +00:00
Luke Bakken 7fe159edef
Yolo-replace format strings
Replaces `~s` and `~p` with their unicode-friendly counterparts.

```
git ls-files *.erl | xargs sed -i.ORIG -e s/~s>/~ts/g -e s/~p>/~tp/g
```
2022-10-10 10:32:03 +04:00
Aitor Pérez Cedres 1ce96c0ae5
Update Stream protocol document
As per conversation with @acogoluegnes, the frame `SaslHandshakeRequest` does not have a field `mechanism`. This field actually used in `SaslHandshakeResponse` and `SaslAuthenticateRequest` frames.
2022-10-05 17:28:59 +01:00
Michael Klishin 796902a5a5
Merge pull request #5961 from rabbitmq/rabbitmq-server-5956-stream-route-partitions-response-prefix
Fix keys for route and partitions responses
2022-10-03 17:32:56 +04:00
Arnaud Cogoluègnes c33e4ae3c6
Use leader locator "balanced" by default for add_super_stream
For the CLI, otherwise all the created individual streams end
up with their leader on the same node, whichi is not what we
want. "balanced" is a reasonable default and it can be overridden
anyway.
2022-10-03 11:53:06 +02:00
Arnaud Cogoluègnes 0c1eeab92b
Fix keys for route and partitions responses
These 2 responses were not using the `rabbit_stream_core` utilities
so they were not using the "prefix" for responses.

Fixes #5956
2022-10-03 09:42:40 +02:00
Michal Kuratczyk 2855278034
Migrate from supervisor2 to supervisor 2022-09-27 13:53:06 +02:00
Arnaud Cogoluègnes f92b2a3d7d
Complement rabbitmq-stream.8 with SAC and super streams 2022-09-23 09:57:42 +02:00
Ayanda Dube 767f0c9e4a Rename and fix rabbit_stream_metrics_gc childspec identifier from supervisor context 2022-09-12 23:32:01 +01:00
David Ansari b953b0f10e Stop sending stats to rabbit_event
Stop sending connection_stats from protocol readers to rabbit_event.
Stop sending queue_stats from queues to rabbit_event.
Sending these stats every 5 seconds to the event manager process is
superfluous because noone handles these events.

They seem to be a relict from before rabbit_core_metrics ETS tables got
introduced in 2016.

Delete test head_message_timestamp_statistics because it tests that
head_message_timestamp is set correctly in queue_stats events
although queue_stats events are used nowhere.
The functionality of head_message_timestamp itself is still tested in
deps/rabbit/test/priority_queue_SUITE.erl and
deps/rabbit/test/temp/head_message_timestamp_tests.py
2022-09-09 10:52:38 +00:00
Arnaud Cogoluègnes 20216ef3c1
Remove experimental warning in super stream commands 2022-09-06 15:42:12 +02:00
Arnaud Cogoluègnes fa528115b1
Bump dependencies in stream Java test 2022-08-10 09:56:58 +02:00
Michael Klishin 68969faf94
Streams: adapt tests to the latest Java stream client listener interface 2022-08-10 11:43:44 +04:00
Arnaud Cogoluègnes 26b4e6fa41
Use atom_to_binary/1 instead of rabbit_data_coercion 2022-08-08 18:09:58 +02:00
Arnaud Cogoluègnes 93c33f2423
Rename StreamInfo to StreamStats
Other changes: returns a map of int64, use the new osiris:get_stats/1 API.

References #5412
2022-08-08 18:02:51 +02:00
Arnaud Cogoluègnes f223845d43
Keep stream_* return codes
To keep compatibility with the Erlang client's users.

References #5412
2022-08-03 16:46:22 +02:00
Arnaud Cogoluègnes e587e9a8ef
Make process liveness check remote if necessary
References #5412
2022-08-03 15:52:38 +02:00
Arnaud Cogoluègnes 8687e73c7e
Add StreamInfo command to stream protocol
It returns general information on a stream, the first
and committed offsets for now.

Fixes #5412
2022-08-03 14:38:45 +02:00
Jean-Sébastien Pédron 6e9ee4d0da
Remove test code which depended on the `quorum_queue` feature flags
These checks are now irrelevant as the feature flag is required.
2022-08-01 12:41:30 +02:00
Jean-Sébastien Pédron 776b4323bd
Remove test code which depended on the `virtual_host_metadata` feature flags
These checks are now irrelevant as the feature flag is required.
2022-08-01 11:56:53 +02:00
David Ansari 32e118fada Remove test code which depended on feature flag implicit_default_bindings
The feature flag is required.

References #5215.
2022-07-29 15:03:26 +00:00
Arnaud Cogoluègnes 0c848ab29d
Fix stream command name
For consistency and to make link work.
2022-07-29 13:46:00 +02:00
Jean-Sébastien Pédron 5b98d7d2a2
Remove test code which depended on the `maintenance_mode_status` feature flags
These checks are now irrelevant as the feature flag is required.
2022-07-29 11:51:52 +02:00
Jean-Sébastien Pédron 32049cd256
Remove test code which depended on the `user_limits` feature flags
These checks are now irrelevant as the feature flag is required.
2022-07-29 11:04:48 +02:00
Jean-Sébastien Pédron dd6b52d3f2
rabbit_stream: Use rabbit_feature_flags, not `rabbit_ff_registry`
`rabbit_ff_registry` is an internal module of the feature flags
subsystem, it is not meant to be called outside of it. In particular, it
may lead to crashes very difficult to debug when a feature flag is
enabled. The reason is that this module is compiled and reloaded at
runtime, so the module may disappear for a small period of time. Another
reason is that a process calling `rabbit_ff_registry` may hold that
module, preventing the feature flags subsystem from performing its task.

The correct public API to query the state of a feature flag is
`rabbit_feature_flags:is_enabled/1`. It will always return a boolean. If
the feature flag being queried is in `state_changing` state, this
function takes care of waiting for the outcome.

See #5018.
2022-07-28 14:12:41 +02:00
Arnaud Cogoluègnes 5402aab71a
Get committed offset from log state
No need of an extra argument in the sendfile callback.

References #5307
2022-07-26 17:39:55 +02:00
Arnaud Cogoluègnes ecda90de93
Remove a couple of unnecessary ++ 2022-07-26 17:07:34 +02:00
Arnaud Cogoluègnes 95f3fdef19
Use "committed offset" instead of "last committed offset"
References #5307
2022-07-26 11:37:46 +02:00
Arnaud Cogoluègnes 9795727b9f
Include last committed offset in "deliver" stream command
Fixes #5307
2022-07-25 16:15:04 +02:00
Arnaud Cogoluègnes ac74cdbf36
Add exchange command versions declaration
References #5308

Conflicts:
	deps/rabbitmq_stream/docs/PROTOCOL.adoc
2022-07-25 16:15:04 +02:00
Arnaud Cogoluègnes 67aac95f3e
Add exchange command versions command to stream plugin
References #5308
2022-07-25 16:15:03 +02:00
Arnaud Cogoluègnes a0a5bfaa4a
Fix consumer update key in command table 2022-07-22 09:40:45 +02:00
Arnaud Cogoluègnes b3a4df13c2
Remove "experimental" marker for SAC and super stream commands 2022-07-21 15:58:59 +02:00
Arnaud Cogoluègnes 37b43fb290
Lower log level on stream creation validation failure
No need to log an error when the arguments are not the same,
info is enough.
2022-07-05 12:18:27 +02:00
Gabriele Santomaggio 3ae0f732d6
Formatting
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
2022-07-01 16:03:22 +02:00
Gabriele Santomaggio a43ca47d95
Fix read frame_max and heartbeat parameters
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
2022-07-01 15:56:41 +02:00
David Ansari b2e821e772 Change normal connection close log level from warning to debug
This line gets logged when the client closes the connection to the
stream port before it authenticates successfully.

Some external load balancers for example connect to the stream port to
do health checks without sending any stream protocol frame.

This commits prevents the RabbitMQ log from being polluted.
2022-06-14 14:12:33 +02:00
Arnaud Cogoluègnes e44b65957d
Limit stream max segment size to 3 GB
Values too large can overflow the stream position field
in the index (32 bit int).
2022-06-10 11:45:57 +02:00
Philip Kuryloski a250a533a4 Remove elixir related -ignore_xref calls
As they are no longer necessary with xref2 and the erlang.mk updates
2022-06-09 23:18:40 +02:00
Philip Kuryloski 15a79466b1 Use the new xref2 macro from rules_erlang
That adopts the modern erlang.mk xref behaviour
2022-06-09 23:18:28 +02:00
Philip Kuryloski 327f075d57 Make rabbitmq-server work with rules_erlang 3
Also rework elixir dependency handling, so we no longer rely on mix to
fetch the rabbitmq_cli deps

Also:

- Specify ra version with a commit rather than a branch
- Fixup compilation options for erlang 23
- Add missing ra reference in MODULE.bazel
- Add missing flag in oci.yaml
- Reduce bazel rbe jobs to try to save memory
- Use bazel built erlang for erlang git master tests
- Use the same cache for all the workflows but windows
- Avoid using `mix local.hex --force` in elixir rules
  - Fetching seems blocked in CI, and this should reduce hex api usage in
    all builds, which is always nice
- Remove xref and dialyze tags since rules_erlang 3 includes them in
  the defaults
2022-06-08 14:04:53 +02:00
Loïc Hoguin dc70cbf281
Update Erlang.mk and switch to new xref code 2022-05-31 13:51:12 +02:00
Michael Klishin c1d328905e
Merge pull request #4898 from rabbitmq/streams-seq-lookup-fix
Use the leader node when looking up a publisher sequence.
2022-05-25 21:12:21 +04:00
Karl Nilsson 7e8d08471b Use the leader node when looking up a publisher sequence.
Else the replica may crash or at the very least return the incorrect result.
2022-05-25 15:04:43 +01:00
Karl Nilsson 5ede74b448 Move all rebar.config files into the root directory
Some tools such as nvim + erlang_ls sometimes change the cwd if
they encounter a rebar.config. Here we move all rebar.config files
into the root of the project to avoid this and also have a single
point for formatting configuration.
2022-05-18 09:37:38 +01:00
Victor Gaiva 4b0b92631b
Update PROTOCOL.adoc
Fix missing ResponseCode in type definition.
2022-05-16 21:15:40 -03:00
David Ansari 20677395cd Check queue and exchange existence with ets:member/2
This reduces memory usage and improves code readability.
2022-05-10 10:16:40 +00:00
Arnaud Cogoluègnes 68e8ae8673
Rename function for clarity
References #3753
2022-05-09 10:52:38 +02:00
Arnaud Cogoluègnes 8ccdd7b6f7
Move SAC API to SAC coordinator
As per @ansd's suggestion. This way the stream coordinator
does not have to know about the SAC commands.

References #3753
2022-05-09 10:52:38 +02:00
Arnaud Cogoluègnes f4e2a95e6c
Address code review comments for stream SAC
References #3753
2022-05-09 10:52:37 +02:00
Arnaud Cogoluègnes da8c23d7ce
Adapt clause to send_chunk new return type
References #3753
2022-05-09 10:52:36 +02:00
Arnaud Cogoluègnes 7415abe3b5
Log message if message update response code is not OK
References #3753
2022-05-09 10:52:36 +02:00
Arnaud Cogoluègnes ee79237bf6
Return error if SAC has no name
Single active consumer must have a name, which is used as the reference
for storing offsets and as the name of the group the consumer belongs
to in case the stream is a partition of a super stream.

References #3753
2022-05-09 10:52:36 +02:00
Arnaud Cogoluègnes 4cb814dd1c
Check consumer is actually a SAC on SAC event
And do not do anything if it's not.

References #3753
2022-05-09 10:52:35 +02:00
Arnaud Cogoluègnes adba97fe6e
Do not dispatch on credit request is consumer is inactive
A formerly active consumer can have in-flight credit
requests when it becomes inactive. This commit checks
the state of consumer on credit requests and make sure
not to dispatch messages if it's inactive.
2022-05-09 10:52:35 +02:00
Arnaud Cogoluègnes a1e92b82a0
Add active and activity_status to list_stream_consumers
References #3753
2022-05-09 10:52:33 +02:00
Arnaud Cogoluègnes ad29176723
Add active and activity_status flag to stream consumer metrics
Stream consumers can be active or not with SAC, so these 2 fields
are added to the stream metrics. This is the same as with
regular consumers.

References #3753
2022-05-09 10:52:33 +02:00
Arnaud Cogoluègnes cd22bef50c
Use feature flag public API
References #3753
2022-05-09 10:52:32 +02:00