Skip to content

Commit

Permalink
Merge branch 'master' into issue_30135
Browse files Browse the repository at this point in the history
  • Loading branch information
fengou1 committed Dec 18, 2021
2 parents 4555d5c + 778e188 commit 0794b83
Show file tree
Hide file tree
Showing 13 changed files with 9,258 additions and 8,928 deletions.
2 changes: 1 addition & 1 deletion br/pkg/storage/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

const (
localDirPerm os.FileMode = 0o755
localDirPerm os.FileMode = 0o777
localFilePerm os.FileMode = 0o644
// LocalURIPrefix represents the local storage prefix.
LocalURIPrefix = "file://"
Expand Down
27 changes: 23 additions & 4 deletions parser/ast/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1856,6 +1856,7 @@ const (
AdminShowTelemetry
AdminResetTelemetryID
AdminReloadStatistics
AdminFlushPlanCache
)

// HandleRange represents a range where handle value >= Begin and < End.
Expand All @@ -1864,6 +1865,15 @@ type HandleRange struct {
End int64
}

type StatementScope int

const (
StatementScopeNone StatementScope = iota
StatementScopeSession
StatementScopeInstance
StatementScopeGlobal
)

// ShowSlowType defines the type for SlowSlow statement.
type ShowSlowType int

Expand Down Expand Up @@ -1929,10 +1939,11 @@ type AdminStmt struct {
JobIDs []int64
JobNumber int64

HandleRanges []HandleRange
ShowSlow *ShowSlow
Plugins []string
Where ExprNode
HandleRanges []HandleRange
ShowSlow *ShowSlow
Plugins []string
Where ExprNode
StatementScope StatementScope
}

// Restore implements Node interface.
Expand Down Expand Up @@ -2070,6 +2081,14 @@ func (n *AdminStmt) Restore(ctx *format.RestoreCtx) error {
ctx.WriteKeyWord("RESET TELEMETRY_ID")
case AdminReloadStatistics:
ctx.WriteKeyWord("RELOAD STATS_EXTENDED")
case AdminFlushPlanCache:
if n.StatementScope == StatementScopeSession {
ctx.WriteKeyWord("FLUSH SESSION PLAN_CACHE")
} else if n.StatementScope == StatementScopeInstance {
ctx.WriteKeyWord("FLUSH INSTANCE PLAN_CACHE")
} else if n.StatementScope == StatementScopeGlobal {
ctx.WriteKeyWord("FLUSH GLOBAL PLAN_CACHE")
}
default:
return errors.New("Unsupported AdminStmt type")
}
Expand Down
1 change: 1 addition & 0 deletions parser/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ var tokenMap = map[string]int{
"PESSIMISTIC": pessimistic,
"PLACEMENT": placement,
"PLAN": plan,
"PLAN_CACHE": planCache,
"PLUGINS": plugins,
"POLICY": policy,
"POSITION": position,
Expand Down
Loading

0 comments on commit 0794b83

Please sign in to comment.