Skip to content

Switch from pg_local to pg#14825

Draft
mkuratczyk wants to merge 6 commits intomainfrom
remove-pg_local
Draft

Switch from pg_local to pg#14825
mkuratczyk wants to merge 6 commits intomainfrom
remove-pg_local

Conversation

@mkuratczyk
Copy link
Copy Markdown
Contributor

@mkuratczyk mkuratczyk commented Oct 27, 2025

pg_local is based on the pg2 module, which got removed
from Erlang/OTP years ago. It was replaced by the more
efficient pg module, so let's use it directly.

We use node-local scopes and single-item groups so that
(de)registration is fast, but we can list all connections/channels
(by listing all groups in the scope).

@mergify mergify Bot added the make label Oct 27, 2025
@mkuratczyk mkuratczyk force-pushed the remove-pg_local branch 2 times, most recently from 7998fc2 to 669513b Compare October 27, 2025 13:42
@michaelklishin michaelklishin added this to the 4.3.0 milestone Oct 27, 2025
@michaelklishin
Copy link
Copy Markdown
Collaborator

To add a bit of context here.

Process groups can be used in many ways but specifically in RabbitMQ they were used for tracking of exclusive queues on an AMQP 0-9-1 connection, so that when a connection terminates, all exclusive queues (if any) on it would be terminated very shortly after.

RabbitMQ Stream Protocol does not allow clients to declare exclusive streams, so it likely can avoid using process groups entirely. And so can most protocol readers.

@mkuratczyk mkuratczyk force-pushed the remove-pg_local branch 2 times, most recently from 4292012 to b88adbb Compare October 30, 2025 13:41
acogoluegnes added a commit to rabbitmq/rabbitmq-stream-java-client that referenced this pull request Nov 4, 2025
And no longer a function available in the stream plugin.

References rabbitmq/rabbitmq-server#14825
@mkuratczyk mkuratczyk force-pushed the remove-pg_local branch 2 times, most recently from 9480a9f to cf1d779 Compare February 23, 2026 11:05
@michaelklishin michaelklishin modified the milestones: 4.3.0, 4.4.0 Apr 20, 2026
@mkuratczyk mkuratczyk force-pushed the remove-pg_local branch 2 times, most recently from 336a003 to 54e87d7 Compare April 30, 2026 12:49
mkuratczyk and others added 5 commits April 30, 2026 15:16
This function was not called from anywhere
and was the only place that expected stream
connections to be registered in pg_local.
pg_local is based on the pg2 module, which got removed from Erlang/OTP years ago. It was replaced by the more efficient pg module, so use it directly for AMQP 0-9-1 channels, TCP and non-AMQP connection tracking, and related tests.

We use node-local scopes and single-item groups so that (de)registration is fast, but we can list all connections and channels by listing all groups in the scope.

rabbit_direct still uses pg_local for one more commit; the next commit moves it to a local ETS table because pg cannot represent those peers in all deployment topologies (see that commit message).
pg only allows registering processes that are node local.
Direct connections pass the client pid, which can be remote.
Therefore, here we switch from pg_local to ETS, instead of pg.
The metadata can take a few milliseconds to reflect a node is down, so
the test code must consider a connection failure and test another node.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants