Skip to content

Commit

Permalink
[parser] plugin: add flush tidb plugins [plugin-name,..] support (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
lysu authored Feb 18, 2019
1 parent a2cf09e commit 2d541c1
Show file tree
Hide file tree
Showing 4 changed files with 2,890 additions and 2,831 deletions.
12 changes: 12 additions & 0 deletions parser/ast/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ const (
FlushTables
FlushPrivileges
FlushStatus
FlushTiDBPlugin
)

// FlushStmt is a statement to flush tables/privileges/optimizer costs and so on.
Expand All @@ -525,6 +526,7 @@ type FlushStmt struct {
NoWriteToBinLog bool
Tables []*TableName // For FlushTableStmt, if Tables is empty, it means flush all tables.
ReadLock bool
Plugins []string
}

// Restore implements Node interface.
Expand Down Expand Up @@ -553,6 +555,16 @@ func (n *FlushStmt) Restore(ctx *RestoreCtx) error {
ctx.WriteKeyWord("PRIVILEGES")
case FlushStatus:
ctx.WriteKeyWord("STATUS")
case FlushTiDBPlugin:
ctx.WriteKeyWord("TIDB PLUGINS")
for i, v := range n.Plugins {
if i == 0 {
ctx.WritePlain(" ")
} else {
ctx.WritePlain(", ")
}
ctx.WritePlain(v)
}
default:
return errors.New("Unsupported type of FlushTables")
}
Expand Down
Loading

0 comments on commit 2d541c1

Please sign in to comment.