-
Notifications
You must be signed in to change notification settings - Fork 1k
application need to handle some fake rotate events #752
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
Comments
I think you're right but I'm not entirely sure that it's possible to start syncing from a position from a fake rotate event in all cases. For example, when client requests position at the end of a binlog file then the database sends fake rotate event with a position in new binlog file and I don't know if this new file really exists (assuming that nobody actually writes into the database so there are no "real" events to write into this file) and if we can actually save this position and use it to reconnect.
BTW, why has the application decided to ignore it? |
I have never seen a fake rotate event with a non-exist binglog file name. If there is one, can you show me? Let's assume mysql is using a binlog file A. When the slave sync binlog from A, and arrives at the end, the syncing should block and wait.
My application will sync mulitiple dababases via a single canal, and each database is synced independently, and to a different position. The positions are persisted independently for each databases. When the application begin to sync, it finds the oldest position from all databases, and start at that position. When a row event is handled, the event's position will be compared with each database's position. If the event's position is older, it will be ignored by that database. |
Yes, looks like it is impossible case. After sending fake rotate event, MySQL always opens this file. |
There is another resolution: canal pass all fake rotate events to applications, and applications decide to ignore or not. But this change may broke existing applications. |
I don't use canal so please correct me if you find something wrong (maybe break some expected API behaviour). In Lines 87 to 89 in 8206ccd
savePos and OnPosSynced ? (nextBinlogFile, 4) should be a valid position to start a binlog stream
|
Yes, I think it's OK. And if fake rotate events are handled as real ones in #753, both of |
Story:
Expected:
The application will handle fake rotate event (mysql-bin.000837, 4)
Actual:
The application didn't handle fake rotate event (mysql-bin.000837, 4)
Logs:
####Environment:
Server version: 10.1.48-MariaDB-0
I have read the following issues about fake rotate events:
#396
#406
In issue #396: the application handled the fake rorate event, and restarted, canal may restart sync in the middle of a transaction, which will result in the error of "no corresponding table map even"
In issue #406: since all fake rotate events are ignored, canal failed to keep the correct Pos.Name, and the application got the wrong Pos.Name
So, I get the following conclustion:
The application should ignore some fake rotate events while should not ignore others. Especially the following ones:
The fake roate events whose binlog filename changed exactly.
Actually, the fake rotate event (mysql-bin.000837, 4) has nothing different with real roate events.
@mefcorvi
@lintanghui
@csuzhangxc
The text was updated successfully, but these errors were encountered: