-
Notifications
You must be signed in to change notification settings - Fork 1k
on reconnect in the middle of transaction make sure to reread interrupted transaction #420
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
on reconnect in the middle of transaction make sure to reread interrupted transaction #420
Conversation
…ed transaction from the beginning this is another stab at issues go-mysql-org#414 and go-mysql-org#416
} | ||
|
||
advanceCurrentGtidSet := func(gtid string) error { | ||
if b.currGset == nil { |
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.
initially currGset
is nil, while prevGset
is set
purpose of b.currGset = b.prevGset.Clone()
to once allocate memory for currGset
so b.currGset.Update
call on line 749 can be made
case *QueryEvent: | ||
event.GSet = b.getGtidSet() | ||
event.GSet = getCurrentGtidSet() |
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.
getCurrentGtidSet
is a replacement for BinlogSyncer.getGtidSet()
a. getCurrentGtidSet
returns currGset
if set
b. it became local function to emphasize scope of usage
I have reviewed this and it is a better version of what I initially submitted in #414. Let's merge this ASAP |
PTAL @GregoryIan |
@@ -733,33 +733,61 @@ func (b *BinlogSyncer) parseEvent(s *BinlogStreamer, data []byte) error { | |||
// Some events like FormatDescriptionEvent return 0, ignore. | |||
b.nextPos.Pos = e.Header.LogPos | |||
} | |||
|
|||
getCurrentGtidSet := func() GTIDSet { |
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.
can we move these two functions to outside?
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.
we can, however having those functions local emphasizes that they are used/called only in scope of parseEvent
.
0be9111
to
697f001
Compare
…pted transaction (go-mysql-org#420) * on reconnect in the middle of transaction make sure to read interrupted transaction from the beginning this is another stab at issues go-mysql-org#414 and go-mysql-org#416
this is another stab at issues #414 and #416
on reconnect in the middle of transaction make sure to read interrupted transaction from the beginning
summary of proposed solution:
prevGset
,currGset
onBinlogSyncer
prevGset
GTIDEvent
/MariadbGTIDEvent
advance
prevGset
(assigncurrGset
value)advance
currGset
to value extracted from binlogXIDEvent
/QueryEvent
always usecurrGset