Skip to content
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

replication,cmd: improve flavor handling #946

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dveeden
Copy link
Collaborator

@dveeden dveeden commented Nov 8, 2024

Issue: close #944

For go-mysqlbinlog and go-canal: return an error for invalid flavors.

For go-mysqlbinlog: log a non-critical error if the server version has "MariaDB" in it but the flavor isn't set to "mariadb".

For `go-mysqlbinlog` and `go-canal`: return an error for invalid
flavors.

For `go-mysqlbinlog`: log a non-critical error if the server version has "MariaDB"
in it but the flavor isn't set to "mariadb".
@dveeden
Copy link
Collaborator Author

dveeden commented Nov 8, 2024

If there is an good way to make it auto detect the flavor this would be even better

Copy link
Collaborator

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

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

rest lgtm

func (b *BinlogSyncer) checkFlavor() {
serverVersion := b.c.GetServerVersion()
if b.cfg.Flavor != MariaDBFlavor &&
strings.Contains(b.c.GetServerVersion(), "MariaDB") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The server returns MariaDB but our flavor requires lowercased, this is a bit uncomfortable. I orefer we let ValidateFlavor ToLower the string before compare.

serverVersion := b.c.GetServerVersion()
if b.cfg.Flavor != MariaDBFlavor &&
strings.Contains(b.c.GetServerVersion(), "MariaDB") {
b.cfg.Logger.Errorf("misconfigured flavor (%s) for server %s",
Copy link
Collaborator

Choose a reason for hiding this comment

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

And I think we can add comment to explain why this is only a log not a failure to caller, like "MariaDB still sends binlog events in a compatible way although some functionalities are lost, so we just log the problem"

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 this pull request may close these issues.

go-mysqlbinlog: wrong positions for events and Gtid events get decoded as QueryEvent
2 participants