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

have flush binary logs be noop #2170

Merged
merged 5 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions enginetest/queries/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -8559,6 +8559,14 @@ from typestable`,
{nil},
},
},
{
Query: "flush binary logs",
Expected: []sql.Row{},
},
{
Query: "flush engine logs",
Expected: []sql.Row{},
},
}

var KeylessQueries = []QueryTest{
Expand Down
15 changes: 14 additions & 1 deletion sql/planbuilder/priv.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,23 @@ func (b *Builder) buildFlush(inScope *scope, f *ast.Flush) (outScope *scope) {
b.handleErr(err)
}

switch strings.ToLower(f.Option.Name) {
// MySQL docs: https://dev.mysql.com/doc/refman/8.0/en/flush.html
// Some opts should be no-ops, but we should support others, so have those be errors
opt := strings.ToLower(f.Option.Name)
if strings.HasPrefix(opt, "relay logs for channel") {
err := fmt.Errorf("%s not supported", f.Option.Name)
b.handleErr(err)
}
switch opt {
case "privileges":
node, _ := plan.NewFlushPrivileges(writesToBinlog).WithDatabase(b.resolveDb("mysql"))
outScope.node = node
case "binary logs", "engine logs":
node := plan.Nothing{}
outScope.node = node
case "error logs", "relay logs", "general logs", "slow logs", "status":
err := fmt.Errorf("%s not supported", f.Option.Name)
b.handleErr(err)
default:
err := fmt.Errorf("%s not supported", f.Option.Name)
b.handleErr(err)
Expand Down