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: check hostname length #1013

Merged
merged 2 commits into from
Mar 12, 2025
Merged

Conversation

dveeden
Copy link
Collaborator

@dveeden dveeden commented Mar 11, 2025

Closes #388

@dveeden dveeden requested review from atercattus and lance6716 March 11, 2025 08:03
@@ -573,13 +573,17 @@ func (b *BinlogSyncer) writeBinlogDumpMariadbGTIDCommand(gset mysql.GTIDSet) err
return b.writeBinlogDumpCommand(mysql.Position{Name: "", Pos: 0})
}

// localHostname returns the hostname that register slave would register as.
// localHostname returns the hostname that register replica would register as.
// this gets truncated to 255 bytes.
Copy link
Collaborator

Choose a reason for hiding this comment

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

because in the old version the length limit is 60, it's better to truncate based on MySQL version

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think that's correct.

To me it looks like MySQL 9.2.0 sends a up to 255 bytes hostname to the source when registering (see register_slave_on_master() in mysql-server) even when the source it is replicating from is (much) older.

So the limitation was mostly that older version would not send a longer hostname, not that the protocol or server couldn't handle it.

@lance6716 lance6716 merged commit 8458ff6 into go-mysql-org:master Mar 12, 2025
15 checks passed
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.

FATAL ERROR 1105 (HY000): Failed to register slave: too long 'report-host'
2 participants