Skip to content

Fix re-sync from bad position #414

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
wants to merge 4 commits into from

Conversation

ianzapolsky
Copy link

This pull request fixes an issue where siddontang skips a transaction when re-connecting to the database after its connection is severed.

Ian Zapolsky and others added 4 commits April 22, 2019 16:01
@siddontang
Copy link
Collaborator

Thanks @ianzapolsky

CI failed.

if err != nil {
return errors.Trace(err)
if b.currGset == nil {
gset, err := ParseGTIDSet(MySQLFlavor, u.String())
Copy link
Collaborator

Choose a reason for hiding this comment

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

here b.currGset is a single gtid, not a full gtid set, right?

}
case *XIDEvent:
b.prevGset = b.currGset.Clone()
Copy link
Collaborator

@IANTHEREAL IANTHEREAL Aug 30, 2019

Choose a reason for hiding this comment

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

as ditto comment, b.currGset would miss some gtids

event.GSet = b.getGtidSet()
case *QueryEvent:
b.prevGset = b.currGset.Clone()
Copy link
Contributor

Choose a reason for hiding this comment

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

b.currGset may be nil, is it better to add a function like getGitdSet

@IANTHEREAL
Copy link
Collaborator

ping @ianzapolsky , thanks for your pr, please fix CI

@IANTHEREAL
Copy link
Collaborator

BTW, please also fix the issue

does this still have a problem with the Query event BEGIN in DML event sequences like following

| bin.000001 | 16597 | Gtid           |       101 |       16662 | SET @@SESSION.GTID_NEXT= '9afe121c-40c2-11e9-9ec7-0242ac110002:55'                                                                                                                                                                                                                                                                                                                                        |
| bin.000001 | 16662 | Query          |       101 |       16730 | BEGIN                                                                                                                                                                                                                                                                                                                                                                                                     |
| bin.000001 | 16730 | Table_map      |       101 |       16791 | table_id: 11993 (sharding1.t2)                                                                                                                                                                                                                                                                                                                                                                            |
| bin.000001 | 16791 | Update_rows    |       101 |       17277 | table_id: 11993 flags: STMT_END_F                                                                                                                                                                                                                                                                                                                                                                         |
| bin.000001 | 17277 | Xid            |       101 |       17308 | COMMIT /* xid=51083 */

Originally posted by @amyangfei in #416

gleonid added a commit to gleonid/go-mysql that referenced this pull request Sep 2, 2019
…ed transaction from the beginning

this is another stab at issues go-mysql-org#414 and go-mysql-org#416
@ianzapolsky
Copy link
Author

@gleonid has a good solution to this in #420. Let's go with that.

@siddontang
Copy link
Collaborator

thanks @ianzapolsky

I will close this PR.

@siddontang siddontang closed this Sep 4, 2019
siddontang pushed a commit that referenced this pull request Sep 9, 2019
…pted transaction (#420)

* on reconnect in the middle of transaction make sure to read interrupted transaction from the beginning
this is another stab at issues #414 and #416
ghost pushed a commit to actiontech/go-mysql that referenced this pull request Nov 26, 2020
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants