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

Add master server ID to BinaryLogClient. #319

Closed
wants to merge 2 commits into from

Conversation

burnison
Copy link

When the BinaryLogClient connects to a MySQL server, it's not
currently possible to identify to which server it has connected. When
connecting to a pool of replicas through a load balancer, for example, a
reconnect may mean the BinaryLogClient is connected to a different
MySQL server.

When using binary log file positions instead of GTIDs, this can be
critical: attempting to resume from the same binary log positions on a
different MySQL server may result in missed or duplicated events.
Similarly, not resuming from the same binary log positions when
reconnecting to the same server is wasteful and may result in longer
recovery/catch-up times.

This change adds the ability to get the equivalent of MASTER_SERVER_ID
from the BinaryLogClient. This can then be inspected within each of
the LifecycleListener events.

This pull request also includes a separate commit to fix an unrelated test.

The `BinaryLogClientIntegrationTest` class did not clean-up after
itself: it tried to create the `test_metameta` table unconditionally.
This test would then fail if the tests were run twice. I _believe_ that
this change keeps the original intent intact.
When the `BinaryLogClient` connects to a MySQL server, it's not
currently possible to identify to which server it has connected. When
connecting to a pool of replicas through a load balancer, for example, a
reconnect may mean the `BinaryLogClient` is connected to a different
MySQL server.

When using binary log file positions instead of GTIDs, this can be
critical: attempting to resume from the same binary log positions on a
different MySQL server may result in missed or duplicated events.
Similarly, not resuming from the same binary log positions when
reconnecting to the same server is wasteful and may result in longer
recovery/catch-up times.

This change adds the ability to get the equivalent of `MASTER_SERVER_ID`
from the `BinaryLogClient`. This can then be inspected within each of
the `LifecycleListener` events.
@osheroff
Copy link
Collaborator

merged into https://github.com/osheroff/mysql-binlog-connector-java, will release in fork

@bluebike
Copy link

@osheroff You are going to fork your fork permenent (if shyiko is not active here)??
.. how about things like better MariaDB support.
Seems to be that you fork/repo doesn't have Issues enabled...

@osheroff
Copy link
Collaborator

@bluebike yeah if shyiko doesn't come back I'll maintain my fork. Better mariaDB would be a welcome PR, but I don't have a production installation so I'd just be accepting contributions and such. My main goal is to keep this package maintained so that I can make modifications for Maxwell's needs...

I've opened up issues on my fork.

@hugodzy
Copy link

hugodzy commented Nov 3, 2021

nice

@burnison burnison closed this Jul 27, 2024
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.

4 participants