Skip to content

How about skip Fake rotate Event When connection resumed #126

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

Open
sean-k1 opened this issue Oct 25, 2023 · 7 comments
Open

How about skip Fake rotate Event When connection resumed #126

sean-k1 opened this issue Oct 25, 2023 · 7 comments

Comments

@sean-k1
Copy link

sean-k1 commented Oct 25, 2023

@osheroff
debezium/debezium#4959

debezium users When the connection to the Mysql database is lost, a fake Rotate Event occurs in communication with the master.
so they got Fake Rotate Event. These issues are causing inconvenience to users in debezium.

What do you think about ignoring the fake rotate event in this project?

https://mariadb.com/kb/en/fake-rotate_event/
https://github.com/go-mysql-org/go-mysql/blob/3a75f6a26d8819c2a88629e54c7de0b7698ae05c/replication/backup.go#L59

@Naros
Copy link
Collaborator

Naros commented Oct 25, 2023

To be clear @sean-k1, this isn't an issue for MySQL but rather precisely for MariaDB, correct?

@sean-k1
Copy link
Author

sean-k1 commented Oct 25, 2023

@Naros No. this issue is related with Mysql and Maraidb,

If the binlogfile is filled to size by max_binlog_size, the
a rotate Event is fired at the end of the current binlogfile,
then a fake rotate Event is occured at the beginning of the next binlogfile.

This means that the first event when communicating with the master will be a rotate event.
The fake rotate event is occured because we are requesting a next(new) binlogfile from the master, and the same is when the connection to the database is lost.

My current understanding is this.

check this one. My env is Mysql 8.0

스크린샷 2023-10-25 오후 9 26 57 스크린샷 2023-10-25 오후 9 26 33

@sean-k1
Copy link
Author

sean-k1 commented Oct 31, 2023

@Naros Did you check this one?

@Naros
Copy link
Collaborator

Naros commented Dec 1, 2023

Hi @sean-k1, I'm on the fence with this one.

In particular, is there a scenario where a client getting this fake event may be using it for some processing? If we exclude it generally from the event stream, that could break that compatibility.

Looking at the source for both MariaDB and MySQL, the LOG_EVENT_ARTIFICIAL_F flag is only ever used for this specific fake ROTATE_EVENT, so I'm curious if perhaps it may be satisfactory to include a toggle to exclude artificial events from being dispatched to event listeners and only consumed by the BinlogClient itself, i.e.:

                if (isConnected()) {
                    eventLastSeen = System.currentTimeMillis();
                    updateGtidSet(event);
                    if (dispatchArtificialEvents || !isArtificialEvent(event)) {
                   		notifyEventListeners(event);
                    }                 
                    updateClientBinlogFilenameAndPosition(event);
                }

What's your take on this?

@sean-k1
Copy link
Author

sean-k1 commented Dec 1, 2023

Hello @Naros
I think your solution is pretty cool.
but I'm curious, why is dispatchArtificialEvents as a variable?

@Naros
Copy link
Collaborator

Naros commented Dec 1, 2023

It's there mostly to preserve existing behavior. I think it's something we can re-evaluate later on whether we should hard enforce no delivery without being able to toggle it on/off later based on feedback.

For Debezium, what we would do is set the toggle to false (true remains compatible with current behavior) and we could safely remove your temporary fix in Debezium and we would no longer see this event in the Debezium event callbacks.

@sean-k1
Copy link
Author

sean-k1 commented Dec 1, 2023

@Naros Oh I understood.
Thanks you for the explanation.

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 a pull request may close this issue.

2 participants