Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Streaming Replication 7th] Replication Mode Messages Handling #58

Merged
merged 8 commits into from
Sep 10, 2022

Conversation

osaxma
Copy link
Contributor

@osaxma osaxma commented Sep 10, 2022

This PR includes the following changes/additions:

  • Modify MessageFramer to handle replication messages with added tests
  • Added a logical replication test but for now it cannot work on the CI (but can be ran locally)
    • the test itself has comments on the reason.

I'll submit a final PR after this to update changelogs, version, and readme.

LogicalReplicationMessage parseLogicalReplicationMessage(Uint8List bytesList) {
/// Tries to check if the [XLogDataMessage.bytes] is a [LogicalReplicationMessage]
/// If so, it'll return
XLogDataMessage tryParseLogicalReplicationMessage(XLogDataMessage message) {
Copy link
Owner

Choose a reason for hiding this comment

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

In my experience tryX usually returns T?: either T if successful, or null if not. This method seems to be better places on the XLogDataMessage (either directly or through an extension method) and named cast or castToLogicalReplication, especially if those message have a LogicalReplicationMessage interface or superclass. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch and I totally agree with you.

I added XLogDataMessage.parse and made tryParseLogicalReplicationMessage returns LogicalReplicationMessage?. Let me know if it looks better.

Copy link
Owner

Choose a reason for hiding this comment

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

looks good, thank you!

@isoos isoos merged commit 4ba7680 into isoos:master Sep 10, 2022
@osaxma osaxma deleted the replication_mode_message_handling branch September 10, 2022 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants