-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
MDEV-33782 Implement WRITE_TO_BINLOG_ENABLE option for events #3174
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
base: main
Are you sure you want to change the base?
Conversation
1b36c60 to
63c54e4
Compare
HugoWenTD
left a comment
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.
In my opinion, DISABLE ON SLAVE and ENABLE ON SLAVE seem to suggest that they are specific options for the replica (formerly known as the slave) only. However, the existing DISABLE ON SLAVE command actually disables the feature on both the source (formerly known as the master) and the replica. MySQL actually has a bug report for it. https://bugs.mysql.com/bug.php?id=31643
On the other hand, if based on current behavior, new ENABLE ON SLAVE seems to do the right thing as the opposite to DISABLE ON SLAVE.
By the way, better to add some descriptions in the commit message for example why the change is needed.
LinuxJedi
left a comment
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.
Nice work!
It appears this is failing a test when embedded server is built, funcs_1.is_columns_mysql_embedded, could you please fix this too?
63c54e4 to
a2b0553
Compare
I'm working on it. Edit: It's fixed now |
a2b0553 to
3e65c97
Compare
LinuxJedi
left a comment
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.
Many thanks for fixing that. I'll try to get someone from the replication team to give it the next stage of review.
|
@andremralves salute! Thanks for this work for far! Andrei |
sql/sql_yacc.yy
Outdated
| Lex->event_parse_data->status_changed= true; | ||
| $$= 1; | ||
| } | ||
| | ENABLE_SYM ON SLAVE |
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.
Please read a discussion on Jira about how to express in SQL way the desired effect.
This patch does address the FR, but it complicates earlier dubious design decision still. As the FR requires to achieve on slave Event::status as ENABLE a straightforward way to help it is to encode such intent as a new option which would be merely for logging on master and unlogging on slave (that is slave should be able to deduce which of the binary status the replicated Event should be created with). That is it need not to expand Event::status, rather contrary.
We could even leave the current name of SLAVESIDE_ENABLED but not regard it the way it's done in the current patch.
Also consider WRITE_TO_BINLOG_ENABLE (somewhat this naming would follow an existing NO_WRITE_TO_BINLOG) instead.
When it's specified ...
sql/sql_yacc.yy
Outdated
| } | ||
| | ENABLE_SYM ON SLAVE | ||
| { | ||
| Lex->event_parse_data->status= Event_parse_data::SLAVESIDE_ENABLED; |
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.
... status would be set on slave straight to ENABLE unless the event is CREATE-ed with DISABLE status.
Logics inside Event_parse_data::check_originator_id() would need some adjustment, which is to disable the event on slave
status= Event_parse_data::DISABLED
without the new logging option.
The status of event on any server then would flip between just two ENABLE and DISABLE.
I think the slave should preserve the new option in its binlog when one is configured on the slave.
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.
Hi @andrelkin, you also mentioned create event .. log_as [DISABLE|ENABLE] in Jira, which I believe have the same purpose of WRITE_TO_BINLOG_ENABLE, but the latter one is just a more polished idea, right?
So basically, if WRITE_TO_BINLOG_ENABLE is set we replicate as ENABLED otherwise DISABLED. I made a table to make it easier to visualize:
| Options | Master Status | Slave Status |
|---|---|---|
| status: ENABLED | Enabled | Disabled |
| status: DISABLED | Disabled | Disabled |
| status: ENABLED + WRITE_TO_BINLOG_ENABLE | Enabled | Enabled |
| status: DISABLED + WRITE_TO_BINLOG_ENABLE | Disabled | Enabled |
Now I see that Event:status would be reduced to only ENABLED/DISABLED, but what should we do to SLAVESIDE_DISABLED? Remove it? Change it's 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.
the latter one is just a more polished idea, right?
Indeed, and more precisely the new option to the command's syntax does not force a new state.
SLAVESIDE_DISABLED? Remove it?
Correct.
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.
Howdy @andremralves !
To make it clear your option's syntax - just a single word WRITE_TO_BINLOG_ENABLE looks fine to me.
The patch therefore only lacks SLAVESIDE_DISABLED removal.
andrelkin
left a comment
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.
Hello Andre!
Thanks for a good effort to satisfy to the feature request.
I am explaining why we could and should do it better though.
Specifically I think we should treat the new syntax as a sub-clause to control logging/unlogging.
Inevitably we would eradicate the old Event_parse_data::SLAVESIDE_DISABLED from Event::status.
I hope the measures will make sense for you as well.
Cheers,
Andrei
|
Hi Andrei, Thanks for your feedback. I will read more carefully the discussion on jira and then respond here and there. |
|
Salve @andremralves! I wonder about your plan and timetable to complete this PR? Happy NY on few calendars :-)! Andrei |
|
Salve @andrelkin ! I got caught up with other things and honestly forgot about this issue—sorry for the delay! I’ll try to finish it over the weekend, and if I can’t, I’ll update you all on how I plan to proceed. Thanks for checking in, and happy NY on those calendars too! Cheers, |
3e65c97 to
c74e22e
Compare
af5a058 to
072bb89
Compare
072bb89 to
b1a0100
Compare
|
@andremralves, hi! It looks like @andrelkin made one final suggestion (link) to your patch before it is ready to go. Are you still planning on working on this? |
Description
Implement a new option for events,
WRITE_TO_BINLOG_ENABLE. If this option is set, events will be replicated withEvent:status = ENABLE, otherwise, the event status will beDISABLED. Thanks @andrelkin for the idea.Here is a table showing some examples:
Previously, events were replicated with the
SLAVESIDE_DISABLEDstatus. With this patch they will be set either toDISABLEDorENABLED--ifWRITE_TO_BINLOG_ENABLEis defined.Release Notes
Implement a new option for events,
WRITE_TO_BINLOG_ENABLE. If this option is set, events will be replicated withEvent:status = ENABLE, otherwise, the event status will beDISABLED. Replicated events will not be set toSLAVESIDE_DISABLEDanymore.How can this PR be tested?
It can also be tested with manual tests setting up a replication.
Basing the PR against the correct MariaDB version
PR quality check