Commit Graph

59312 Commits

Author SHA1 Message Date
David Ansari dd3c56f602 Requeue at the front if filtering is enabled 2025-05-27 11:34:03 +02:00
David Ansari 2dc51e01fd Refactor consumer removal 2025-05-27 09:12:21 +02:00
David Ansari 2195807dc8 Add randomness for rotation 2025-05-27 09:12:21 +02:00
David Ansari 1ceefd3ef7 Avoid deep nesting 2025-05-27 09:12:21 +02:00
David Ansari 0425e7ad40 Add shortcut
Base cases are either service queue is empty or no messages to check out
2025-05-27 09:12:21 +02:00
David Ansari 3415b2c3fd Add AMQP property filter tests for QQs 2025-05-27 09:12:21 +02:00
David Ansari 5caa658c6a better naming 2025-05-27 09:12:21 +02:00
David Ansari ab7a5a63bb Emit live indexes 2025-05-27 09:12:21 +02:00
David Ansari c9694cadd0 Support filtering for untracked enqueues 2025-05-27 09:12:21 +02:00
David Ansari 7ef86f9f96 Support filters in quorum queues
## What?

Support for quorum queues:
* JMS message selectors
* AMQP property filter expressions on header and properties
  sections (as already supported in streams)
* message groups

 ## How?

* performance tests of different PoCs on
  https://github.com/ansd/message_selector_perf
* Message selector feature is enabled statically on the QQ via queue arg x-filter-enabled=true
* QQ holds application-properties and a subset of well defined fields of
  the header and properties sections in memory. The latter are defined
  by x-(filter-field-names).
* JMS spec: “For best performance, applications should only use message properties when they
  need to customize a message’s header. The primary reason for doing this is to support
  customized message selection.”
  Thefore it should be fine for the session to always include all application-properties
  in the Ra enqueue command.
* In the enqueue{} Ra command, provide a #{Key => Value} map
  * If the Key is atom(), it is a well defined header or properties field name
  * If the Key is binary(), it is an (arbitrary) application-properties key
* filter-field-names policy change takes effect for senders of new sessions
* For high prio or normal prio messages, instead of rabbit_fifo_q we use
  gb_trees
* each QQ consumer remembers its last scanned Ra index and continues
  scanning where it left off previously
* Ideally we need a skip list instead of gb_trees because it's simple, avoids O(n)
  rebalance, and could even append in O(1). However, this cannot be implemented in
  Erlang. A NIF would be one solution, but isn't interoperable.
* gb_trees rebalancing should be acceptable given that emitting all Ra live
  indexes requires O(N) space anyway
* Use another gb_trees for prompt message expiry
* Add/recommend limits for
  * max consumers per queue
  * max messages per queue
  * max metadata size per message
  The latter two provide an overall limit on memory usage.
* Round robin isn't guaranteed in all cases. However, this should be
  okay because JMS doesn't define how a broker should dispatch messages:
  > "Apart from the requirements of any message selectors, Jakarta
  Messaging does not define how messages are distributed between multiple
  consumers on the same queue."
* rabbit_quorum_queue parses the consumer arg JMS SQL expression.
  This way, it’s easy to create consumers with SQL expressions for AMQP 0.9.1 or STOMP, in addition to AMQP 1.0.
  Maybe prohibit though?
* JMS SQL expressions and grammar is declared declaraively
* leex is used to scan the SQL string into a flat structure of tokens.
* yecc parses this flat list of tokens into an Erlang expression tree,
  which is then provided to the QQ in the Ra #checkout{} command.
* QQ then does the simple matching logic by taking the already parsed
  SQL String (similar to module sjx_evaluator) and a map of keys to values.
* We keep the JMS selector matching and AMQP filter expression matching
  separate since they are both sufficiently simple.
* This keeps the state machine simple because both parsing of the SQL
  expression for the consumer and parsing the mc message fields for the
  enqueuer are both done outside the state machine.
* To keep the state machine deterministic, regexes are avoided for SQL 'LIKE'
  expressions. From OTP 28 release notes:
  "It is worth noting that the internal format produced by re:compile/2 has
  changed in Erlang/OTP 28. It cannot be reused across nodes or OTP versions."
  Holding compiled regexes in rabbit_fifo state is problematic because
 the snapshot can be sent to another node running a different OTP version.
* Support for quorum queues the same AMQP property filter expressions as
  for streams, that is application-properties and properties sections,
  i.e. the bare message headers.
  1. annotations (delivery-annotations, message-annotations, footer sections)
     can have complex types which makes filtering more complex
  2. filter expressions for streams support only properties and application-properties
  3. all JMS Headers and JMS Properties are mapped to one of AMQP header, properties,
     application-properties sections because JMS property values can only be simple types

TODOs:
* new Ra state machine version
* Add some configurable limit for max metadata size per message to hold in memory.
  Could be configured by x-filter-max-in-memory-bytes-per-msg.
  rabbit_fifo_client could then estimate the memory overhead can directly reject the message if too large.
  Keeps the state machine simple.
  Rejecting the message is fast.
  Saves resources: no need to write it too the log.
2025-05-27 09:12:12 +02:00
David Ansari 3d60aa650f Fix determinism bugs
Define map iteration order.

Prior to this commit map iteration order was undefined and could
therefore be different on different versions of Erlang/OTP leading to
non-determinism on different QQ members. For example, different QQ
members could potentially return messages in a different order.
2025-05-27 09:11:21 +02:00
Michael Klishin 4c34155886
Merge pull request #13947 from rabbitmq/ik-rabbit_ct_hook
Trigger a 4.2.x alpha release build / trigger_alpha_build (push) Waiting to run Details
Test (make) / Build and Xref (1.17, 26) (push) Waiting to run Details
Test (make) / Build and Xref (1.17, 27) (push) Waiting to run Details
Test (make) / Test (1.17, 27, khepri) (push) Waiting to run Details
Test (make) / Test (1.17, 27, mnesia) (push) Waiting to run Details
Test (make) / Test mixed clusters (1.17, 27, khepri) (push) Waiting to run Details
Test (make) / Test mixed clusters (1.17, 27, mnesia) (push) Waiting to run Details
Test (make) / Type check (1.17, 27) (push) Waiting to run Details
Run rabbit_ct_hook before cth_styledout so that removing default logger handler works
2025-05-26 21:03:06 +04:00
Iliia Khaprov 6b528e2caf
Replace ct:pal with ct:log in select places 2025-05-26 16:57:41 +02:00
Iliia Khaprov 8512a4459b
Hardcode rabbit_ct_hook and cth_styledout inside our ct_master_fork.
Helps cleaning-up/coloring stdout for parallel targets
TODO: there are obvious races for different nodes outputs
In the next iteration I hope to implement cursor tracking for each node
2025-05-26 16:57:40 +02:00
Iliia Khaprov 8dcad8a4fd
Run rabbit_ct_hook for management, and mqtt 2025-05-26 16:57:40 +02:00
Iliia Khaprov - VMware by Broadcom 5ed2fbe2b6
Merge pull request #13955 from rabbitmq/ik-qq-reconciliation-followup
QQ Reconciliator - implement handle_info/2 for the event subscriber
2025-05-26 16:09:02 +02:00
Iliia Khaprov 458dc89614
QQ Reconciliator - implement handle_info/2 for the event subscriber to avoid warnings 2025-05-26 14:43:32 +02:00
Michael Klishin 7289487702
Merge pull request #13946 from rabbitmq/ik-qq-reconiliation
Trigger a 4.2.x alpha release build / trigger_alpha_build (push) Waiting to run Details
Test (make) / Build and Xref (1.17, 26) (push) Waiting to run Details
Test (make) / Build and Xref (1.17, 27) (push) Waiting to run Details
Test (make) / Test (1.17, 27, khepri) (push) Waiting to run Details
Test (make) / Test (1.17, 27, mnesia) (push) Waiting to run Details
Test (make) / Test mixed clusters (1.17, 27, khepri) (push) Waiting to run Details
Test (make) / Test mixed clusters (1.17, 27, mnesia) (push) Waiting to run Details
Test (make) / Type check (1.17, 27) (push) Waiting to run Details
QQ member reconciliation: switch to gen_event events instead of hardcoded triggers
2025-05-26 08:13:28 +04:00
Iliia Khaprov 77477dee6e
Run rabbit_ct_hook before cth_styledout, so that default logger handler properly removed
As a follow-up to my GChat thread about removing default logger handler to clean CT stdout, I was looking at
injecting logger config with undefined default handler to ct_run. It is possible but breaks cth_styledout - no
nice green things whatsoever. Then I found rabbit_ct_hook which calls redirect_logger_to_ct_logs which in turn
calls logger:remove_handler(default) apparently with zero effect! To cut story short - turned out rabbit_ct_hook
must run before cth_styledout for remove_handler line to have any effect
2025-05-25 18:59:40 +02:00
Michael Klishin a71d0f93d0
More test comment wording 2025-05-25 14:44:03 +04:00
Michael Klishin 940e58c051
Test comment wording 2025-05-25 14:42:01 +04:00
Michael Klishin b527fc31ed
Merge pull request #13942 from rabbitmq/dependabot/maven/deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot/main/prod-deps-801db9dc1e
Test (make) / Build and Xref (1.17, 26) (push) Waiting to run Details
Test (make) / Build and Xref (1.17, 27) (push) Waiting to run Details
Test (make) / Test (1.17, 27, khepri) (push) Waiting to run Details
Test (make) / Test (1.17, 27, mnesia) (push) Waiting to run Details
Test (make) / Test mixed clusters (1.17, 27, khepri) (push) Waiting to run Details
Test (make) / Test mixed clusters (1.17, 27, mnesia) (push) Waiting to run Details
Test (make) / Type check (1.17, 27) (push) Waiting to run Details
Test Authentication/Authorization backends via mutiple messaging protocols / selenium (chrome, 1.17.3, 27.3) (push) Has been cancelled Details
Test Authentication/Authorization backends via mutiple messaging protocols / summary-selenium (push) Has been cancelled Details
[skip ci] Bump the prod-deps group across 2 directories with 1 update
2025-05-25 13:29:59 +04:00
Iliia Khaprov 1e4460459a
QQ Reconciliator - add comments to SUITE, add new group for explicit triggers tests 2025-05-24 23:56:11 +02:00
Iliia Khaprov d47d7f9160
QQ Reconciliator - switch to Logger 2025-05-24 23:34:46 +02:00
Iliia Khaprov 8ea452d54f
QQ Reconciliator - move hardcoded triggers to events subscription 2025-05-24 23:34:46 +02:00
dependabot[bot] 395d3fd04c
[skip ci] Bump the prod-deps group across 2 directories with 1 update
Bumps the prod-deps group with 1 update in the /deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot directory: [org.springframework.boot:spring-boot-starter-parent](https://github.com/spring-projects/spring-boot).
Bumps the prod-deps group with 1 update in the /deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot_kotlin directory: [org.springframework.boot:spring-boot-starter-parent](https://github.com/spring-projects/spring-boot).


Updates `org.springframework.boot:spring-boot-starter-parent` from 3.4.5 to 3.5.0
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](https://github.com/spring-projects/spring-boot/compare/v3.4.5...v3.5.0)

Updates `org.springframework.boot:spring-boot-starter-parent` from 3.4.5 to 3.5.0
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](https://github.com/spring-projects/spring-boot/compare/v3.4.5...v3.5.0)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-parent
  dependency-version: 3.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: prod-deps
- dependency-name: org.springframework.boot:spring-boot-starter-parent
  dependency-version: 3.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: prod-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-24 18:14:17 +00:00
Michael Klishin 5f1bef6141
Merge pull request #13548 from rabbitmq/rabbitmq-server-13175-mk
Trigger a 4.2.x alpha release build / trigger_alpha_build (push) Has been cancelled Details
Test (make) / Build and Xref (1.17, 26) (push) Has been cancelled Details
Test (make) / Build and Xref (1.17, 27) (push) Has been cancelled Details
Test (make) / Test (1.17, 27, khepri) (push) Has been cancelled Details
Test (make) / Test (1.17, 27, mnesia) (push) Has been cancelled Details
Test (make) / Test mixed clusters (1.17, 27, khepri) (push) Has been cancelled Details
Test (make) / Test mixed clusters (1.17, 27, mnesia) (push) Has been cancelled Details
Test (make) / Type check (1.17, 27) (push) Has been cancelled Details
For 4.1.x, by @aaron-seo: introduce a command that would force QQs to take a checkpoint and truncate its segments
2025-05-23 07:11:40 +04:00
Michael Klishin bf8fd69ba4
Merge pull request #13932 from cloudamqp/cq_index_v2_bounds_test
Trigger a 4.2.x alpha release build / trigger_alpha_build (push) Waiting to run Details
Test (make) / Build and Xref (1.17, 26) (push) Waiting to run Details
Test (make) / Build and Xref (1.17, 27) (push) Waiting to run Details
Test (make) / Test (1.17, 27, khepri) (push) Waiting to run Details
Test (make) / Test (1.17, 27, mnesia) (push) Waiting to run Details
Test (make) / Test mixed clusters (1.17, 27, khepri) (push) Waiting to run Details
Test (make) / Test mixed clusters (1.17, 27, mnesia) (push) Waiting to run Details
Test (make) / Type check (1.17, 27) (push) Waiting to run Details
Test Management UI with Selenium / selenium (chrome, 1.17.3, 27.3) (push) Has been cancelled Details
Add tests for rabbit_classic_queue_index_v2:bounds/2
2025-05-23 06:05:59 +04:00
Michael Klishin 87b966ef0c
Merge pull request #13930 from rabbitmq/ik-observer-cli-plugins-as-boot-steps
Add CQ and QQ Observer CLI plugins from boot steps
2025-05-23 05:07:03 +04:00
Michael Klishin 510d2ca0ab
Merge pull request #13931 from rabbitmq/fix-selenium-issue
Fix selenium issue closing popup warning dialog since recent upgrade
2025-05-23 03:22:44 +04:00
Diana Parra Corbacho 0c2b6a1cb3 Force checkpoint in all members 2025-05-22 15:52:41 +02:00
Michael Klishin 7d3292cedd quorum_queue_SUITE: keep Raft state logging in force_checkpoint_on_queue 2025-05-22 15:09:57 +02:00
Michael Klishin d17b085653 Quorum queue machine: do not publish certain state records
we can use log state in tests.
2025-05-22 15:09:55 +02:00
Michael Klishin d54fee2e7a Update a #13175 test to not use private Ra machine state
(cherry picked from commit e49acf956c806849068f543f282683978ca5a385)
2025-05-22 15:09:25 +02:00
Aaron Seo 6a78e9f7ba Add timeout to rpc call for force_checkpoint
(cherry picked from commit 4439150e50)
2025-05-22 15:09:25 +02:00
Aaron Seo fa310864d7 Fix force_checkpoint tests and CLI command
(cherry picked from commit 12bf3e094e)

Conflicts:
	deps/rabbit/src/rabbit_quorum_queue.erl
2025-05-22 15:09:23 +02:00
Aaron Seo 0d3dfd9695 Add force checkpoint functions for quorum queues and command line tool
(cherry picked from commit b54ab1d5e5)
2025-05-22 14:58:12 +02:00
Péter Gömöri ec455d5cff Fix comment about CQ v1->v2 index recovery 2025-05-22 14:05:44 +02:00
Péter Gömöri 55e3c458c2 Add tests for rabbit_classic_queue_index_v2:bounds/2 2025-05-22 14:05:44 +02:00
Iliia Khaprov 2d029649a2
Add CQ and QQ Observer CLI plugins from boot steps
Do not hard code them, also preserve user-provided plugins list
Type fix by @kura
2025-05-22 10:58:35 +02:00
Marcial Rosales 27b3e21554 Fix issue related to popup warning
And in particular locating the span#close button
2025-05-22 10:08:22 +02:00
Michael Klishin 6dd7447b92
Merge pull request #13929 from rabbitmq/queue-checks
Trigger a 4.2.x alpha release build / trigger_alpha_build (push) Has been cancelled Details
Test (make) / Build and Xref (1.17, 26) (push) Has been cancelled Details
Test (make) / Build and Xref (1.17, 27) (push) Has been cancelled Details
Test (make) / Test (1.17, 27, khepri) (push) Has been cancelled Details
Test (make) / Test (1.17, 27, mnesia) (push) Has been cancelled Details
Test (make) / Test mixed clusters (1.17, 27, khepri) (push) Has been cancelled Details
Test (make) / Test mixed clusters (1.17, 27, mnesia) (push) Has been cancelled Details
Test (make) / Type check (1.17, 27) (push) Has been cancelled Details
Test Management UI with Selenium / selenium (chrome, 1.17.3, 27.3) (push) Has been cancelled Details
Use more idiomatic `maybe` feature
2025-05-21 21:51:43 +04:00
Michael Klishin dfa06d91ca
Merge pull request #13928 from rabbitmq/sac-policy
Delete single-active-consumer policy
2025-05-21 19:59:18 +04:00
David Ansari 3189686510 Add maybe_expr feature for OTP 26
GitHub action Build and Xref on OTP 26 errored with:
```
src/rabbit_quorum_queue.erl:252:9: syntax error before: ok
%  252|         ok ?= rabbit_queue_type_util:check_auto_delete(Q),
%     |         ^
```
2025-05-21 17:48:51 +02:00
David Ansari 4a3752a87f Use more idiomatic `maybe` feature 2025-05-21 17:32:04 +02:00
David Ansari 90e7e1065c Delete single-active-consumer policy
`single-active-consumer` shouldn't be listed under `unsupported_policies` for quorum
queues and streams because it isn't a valid policy in the first place, see
https://www.rabbitmq.com/docs/consumers#sac-cannot-be-enabled-with-a-policy
2025-05-21 17:11:16 +02:00
Michael Klishin 1679d0ced0
Merge pull request #13925 from rabbitmq/bump-up-chromedriver
Bump up chrome driver
2025-05-21 18:21:52 +04:00
Michael Klishin 6e0ba8e9ff
Merge pull request #13924 from rabbitmq/remove-unused-channel-field
Remove unused field in channel record.
2025-05-21 18:20:20 +04:00
Marcial Rosales a028db8156 Briefly explain how to start a second rabbitmq server
interactively
2025-05-21 15:50:29 +02:00
Marcial Rosales 44dd282ed4 Eliminate flake around listing live amqp connections 2025-05-21 15:15:35 +02:00