-
Notifications
You must be signed in to change notification settings - Fork 1k
Add getters to BinlogSyncer #916
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
Closed
+21
−0
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b.currGset
is not "synchronized to downsteam" GTID set, it just a "synchronized to BinlogSyncer" one. Maybe the function comment can describe it as "the GTID set that BinlogSyncer is fully fetched".GetEvent
is FIFO and there are backlog event inBinlogStreamer.ch
. I thinkGetSyncedGTIDSet
is meaningless to caller.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback!
GetSyncedGTIDSet
serve a useful purpose?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetSyncedGTIDSet
does not mean those things.BinlogSyncer
or stop writing in upstream MySQL? I think some events may stuck in-flight in the network between MySQL andBinlogSyncer
. So you can't make sure it's flushed. A better way is check events fromGetEvent
and record the GTID related event manually.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Close()
thenStartSync(...)
. Are you suggesting skipping overBinlogSyncer
in general and usingBinlogStreamer
directly to make sure I have a consistent stream of events?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you use the
BinlogStreamer
? I assume that you have a goroutine reading binlog events fromGetEvent
and process them. And your usage ist1: the application has processed many binlog events.
t2: somehow you want to close the
BinlogStreamer
and restart it later, so record the GTID set using the new gettert3: now close the
BinlogStreamer
and do some stufft4: start
BinlogStreamer
from the GTID set and the application continues.There's a problem in above workflow. There are residue binlogevents in
BinlogStreamer.ch
that are skipped, because they have not been processed in the time <= t1 and the GTID set get in t2 is larger than them.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks for finding this problem. When
needStop
is true, the event is not sent tos.ch
soBinlogSyncer
should not ACKI still recommend you type cast the
event
s get fromevent, err := streamer.GetEvent(ctx)
and get the GTID set from some events likeXIDEvent
. Theevent
is really the stuff the caller has written to disk so the GTID set has the same meaning. The new getter does not have the same meaning consideringBinlogSyncer
has inner channel buffer, it's error-prone to have extra action to match the two GTID set.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the MySQL documentation:
Is achieving parity with the MySQL protocol a goal here? The asynchronous ordering of these two events in this library appears to violate that behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a requirement for MySQL relay log, not this package. If you want to implement the behaviour like MySQL relay log, more adjustment should be made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right okay. We have that requirement so I'm going to close this PR and see how we can implement that invariant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you, by the way, for your attention and responsiveness