Commit Graph

69 Commits

Author SHA1 Message Date
Arnaud Cogoluègnes d1aab61566
Prevent blocked groups in stream SAC with fine-grained status
A boolean status in the stream SAC coordinator is not enough to follow
the evolution of a consumer. For example a former active consumer that
is stepping down can go down before another consumer in the group is
activated, letting the coordinator expect an activation request that
will never arrive, leaving the group without any active consumer.

This commit introduces 3 status: active (formerly "true"), waiting
(formerly "false"), and deactivating. The coordinator will now know when
a deactivating consumer goes down and will trigger a rebalancing to
avoid a stuck group.

This commit also introduces a status related to the connectivity state
of a consumer. The possible values are: connected, disconnected, and
presumed_down. Consumers are by default connected, they can become
disconnected if the coordinator receives a down event with a
noconnection reason, meaning the node of the consumer has been
disconnected from the other nodes. Consumers can become connected again when
their node joins the other nodes again.

Disconnected consumers are still considered part of a group, as they are
expected to come back at some point. For example there is no rebalancing
in a group if the active consumer got disconnected.

The coordinator sets a timer when a disconnection occurs. When the timer
expires, corresponding disconnected consumers pass into the "presumed
down" state. At this point they are no longer considered part of their
respective group and are excluded from rebalancing decision. They are expected
to get removed from the group by the appropriate down event of a
monitor.

So the consumer status is now a tuple, e.g. {connected, active}. Note
this is an implementation detail: only the stream SAC coordinator deals with
the status of stream SAC consumers.

2 new configuration entries are introduced:
 * rabbit.stream_sac_disconnected_timeout: this is the duration in ms of the
   disconnected-to-forgotten timer.
 * rabbit.stream_cmd_timeout: this is the timeout in ms to apply RA commands
   in the coordinator. It used to be a fixed value of 30 seconds. The
   default value is still the same. The setting has been introduced to
   make integration tests faster.

Fixes #14070
2025-06-17 11:56:20 +02:00
wrobell 75278ddf21 Remove Bloom filter data section for message delivery command
Also update OsirisChunk entry to reflect current state.
2024-06-22 13:34:37 +01:00
Michael Klishin 698cdc5275 More editing #11329 2024-05-26 18:26:12 -04:00
Michael Klishin 936499c48a Stream protocol doc: unit24 => uint24 #11329 2024-05-26 18:24:39 -04:00
Michael Klishin 28193daf08 Stream protocol doc: wording 2024-05-26 18:21:26 -04:00
wrobell 75bf2a9ef5 Add filtering information to the documentation of RabbitMQ Stream protocol document
1. Link to up-to-date version of code describing Osiris chunk.
2. Update `Deliver` command description with Bloom filter entries.
3. Add information about use of `Publish` command with filter value. The
   hint about use of version 1 or 2 is based on the Java client
   implementation.
2024-05-26 22:25:46 +01:00
Arnaud Cogoluègnes a81f40966a
Remove stream resource section
Files are no longer available.
2024-04-02 18:09:23 +02: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 15f93f338c
Add super stream creation/deletion commands in spec 2023-11-13 10:30:24 +01: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
Alex Blease 8443c761ee
Include UnsubscribeResponse in stream protocol 2023-05-15 10:44:46 +01:00
David Ansari b4871e2b83
Update PROTOCOL.adoc 2023-03-21 11:58:50 +01: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
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 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
Arnaud Cogoluègnes 0c848ab29d
Fix stream command name
For consistency and to make link work.
2022-07-29 13:46:00 +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 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 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
Victor Gaiva 4b0b92631b
Update PROTOCOL.adoc
Fix missing ResponseCode in type definition.
2022-05-16 21:15:40 -03:00
Arnaud Cogoluègnes d5ae62b1a9
Handle single active consumer registration
WIP. Uses a simple in-memory coordinator for now.
No failover yet.

References #3753
2022-05-09 10:52:20 +02:00
Arnaud Cogoluègnes 1c57c69df2
Mention strings are UTF8-encoded in stream protocol 2022-02-17 16:13:40 +01: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
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
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
wrobell 08c417fdb7 Use hex values in RabbitMQ Streams protocol description
The protocol documentation uses decimal values for error and request key
codes.

Let's use hex values instead. This helps when looking at a request and
its response - 0x0006 and 0x8006 vs. 6 and 32774.

Also, when looking at output of protocol analysis tools like Wireshark,
a hexadecimal value will be printed, for example:

    "Nov  1, 2021 23:05:19.395825508 GMT","60216,5552","00000009000600010000000701"
    "Nov  1, 2021 23:05:19.396069528 GMT","5552,60216","0000000a80060001000000070001"

Above, we can visually identify delete publisher request and response
(0x0006 and 0x8006) and easily match them in the documentation of the
protocol.

Finally, above argument applies to logging as it is common to log
hex values, not decimal.
2021-11-02 18:31:30 +00:00
wrobell e74823d68c Fix use of "RabbitMQ Streams" in protocol documentation
The following RabbitMQ page uses "RabbitMQ Streams" or "streams",
therefore use it in the protocol documentation as well

    https://blog.rabbitmq.com/posts/2021/07/rabbitmq-streams-overview
2021-10-29 19:06:06 +01:00
wrobell 57ff5dbf4a Fix RabbitMQ Streams protocol documentation
1. Response for publisher declaration request does not contain
   publisher id.

2. Add mechanism entry to the details of SASL handshake request.

3. SASL handshake response contains list of mechanisms, not just single
   mechanism.
2021-10-28 17:53:22 +01:00
Arnaud Cogoluègnes 8f207e3c5f
Make stream protocol route command return several streams
We expect to have 1 stream for each routing key, but
as binding can return several queues for a given key we
let that possibility open in the stream protocol.
2021-09-13 17:53:25 +02:00
Federico Caprari 2246727428
Fix store offset parameters
As you can see 860333a088/deps/rabbitmq_stream_common/src/rabbit_stream_core.erl (L239)

There is the stream name and not the subscription id in this message.
2021-09-01 22:13:07 +02:00
Karl Nilsson f38c023aa8
Correct Publish frame docs 2021-07-21 09:13:55 +01:00
Gabriele Santomaggio 71c355c963
Fix links 2021-07-20 17:42:56 +02:00
Gabriele Santomaggio de0f7952e9 Add resources link
to client guide line and streams internals
2021-07-20 09:55:25 +02:00
Arnaud Cogoluègnes 7cb2645283
Replace commit with store for offset persistence
In stream protocol. Commit have a strong consistency connotation,
which is not actually enforced by the offset persistence
mechanism.
2021-07-08 10:32:04 +02:00
Arnaud Cogoluègnes dcd65572a0
Remove correlation ID from commit_offset
In stream protocol. commit_offset is asynchronous and does
not expect a response, so the correlation ID is not required.
2021-06-10 15:21:38 +02:00
Arnaud Cogoluègnes 8f8e08a9a9
Send advertised host and port in open
More secure than in peer properties frame, which is just
at the beginning of the connection opening.
2021-05-21 13:03:38 +02:00
Arnaud Cogoluègnes c15805b472
Fix stream protocol open origin
Client, not server.
2021-05-19 12:34:35 +02:00
Arnaud Cogoluègnes 7adac7a71b
Add subscription properties to stream protocol 2021-05-19 12:26:30 +02:00
Arnaud Cogoluègnes a807027adf
Use unsigned ints in stream protocol, when appropriate 2021-02-26 11:59:16 +01:00
Arnaud Cogoluègnes 9f0bec8def
Start constants at 1 for stream plugin 2021-02-26 11:48:45 +01:00
Arnaud Cogoluègnes 768a61792e
Use MSB in keys to distinguish requests/responses
In stream protocol.
2021-02-26 11:03:36 +01:00
Arnaud Cogoluègnes d70b55aa0c
Add route and partitions command to stream plugin
For publishing to super streams.
2021-02-25 17:22:42 +01:00
Arnaud Cogoluègnes 047e87137c
No global response code for metadata in stream protocol 2021-02-22 15:24:24 +01:00
Arnaud Cogoluègnes 9696861181
Fix stream protocol documentation after review 2021-02-22 15:19:58 +01:00
Arnaud Cogoluègnes b61be1e409
Mention stream protocol responses can have extra info 2021-02-22 11:42:34 +01:00
Arnaud Cogoluègnes a559c79b8c
Add response codes to stream protocol page 2021-01-18 14:25:24 +01:00
Arnaud Cogoluègnes 0d73b58be0
Re-order stream command constants
The order is more usage-oriented.
2021-01-18 11:25:21 +01:00
Arnaud Cogoluègnes 59bc60fe36
Add query publisher sequence 2020-11-26 10:02:13 +01:00