Skip to content

fix: add system message to signal replication ready#1962

Merged
filipecabaco merged 4 commits into
mainfrom
fix/add-system-message-replication-connection
Jun 23, 2026
Merged

fix: add system message to signal replication ready#1962
filipecabaco merged 4 commits into
mainfrom
fix/add-system-message-replication-connection

Conversation

@filipecabaco

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Sends a new message when replication connection starts. We only send when we receive the keep alive or a write message from the replication slot.

@filipecabaco filipecabaco force-pushed the fix/add-system-message-replication-connection branch 2 times, most recently from d5b46ee to 3b3d1b0 Compare June 15, 2026 16:51

@edgurgel edgurgel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this will only publish once right? If you join after ReplicationConnection has already started streaming it would be nice to also find out that it's replicating. Do we want to include this into the join payload that we return as well?

@filipecabaco

Copy link
Copy Markdown
Member Author

oh shit yes you are right... 🤦‍♂️

Comment thread lib/realtime/tenants/replication_connection.ex Outdated
@filipecabaco filipecabaco requested a review from edgurgel June 18, 2026 17:39
@filipecabaco filipecabaco force-pushed the fix/add-system-message-replication-connection branch 2 times, most recently from 8fda18f to 3e84184 Compare June 18, 2026 17:40
Comment thread lib/realtime_web/channels/realtime_channel.ex Outdated
@filipecabaco filipecabaco force-pushed the fix/add-system-message-replication-connection branch 2 times, most recently from f6dd192 to 74e045b Compare June 19, 2026 14:33
@blacksmith-sh

This comment has been minimized.

@filipecabaco filipecabaco force-pushed the fix/add-system-message-replication-connection branch 2 times, most recently from 2ea543f to dbfe3f2 Compare June 19, 2026 21:58
@filipecabaco

Copy link
Copy Markdown
Member Author

I changed the approach and followed something similar to what we do for postgres changes where the channel will be the one checking.

the usage of syn and pubsub can actually lead to a race condition that would mean losing this message so it would be quite bad to handle and just increases complexity to be sure things work as expected

cc @edgurgel

@edgurgel edgurgel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving but I think this new option should be under broadcast options and not on the top level. ReplicationConnection only serves broadcast messages from realtime.messages

@filipecabaco filipecabaco force-pushed the fix/add-system-message-replication-connection branch from 0f20d8f to 850bc8b Compare June 23, 2026 10:19
@filipecabaco filipecabaco merged commit 4f445ce into main Jun 23, 2026
65 of 74 checks passed
@filipecabaco filipecabaco deleted the fix/add-system-message-replication-connection branch June 23, 2026 12:05
@realtime-release-bot

Copy link
Copy Markdown

🎉 This PR is included in version 2.111.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

2 participants