Skip to content

Commit

Permalink
planner: only users with SUPER or CONNECTION_ADMIN privilege can kill…
Browse files Browse the repository at this point in the history
… auto analyze (pingcap#33057)

close pingcap#33058
  • Loading branch information
xuyifangreeneyes authored Mar 15, 2022
1 parent b83af27 commit 4c94056
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions planner/core/planbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -3081,6 +3081,10 @@ func (b *PlanBuilder) buildSimple(ctx context.Context, node ast.StmtNode) (Plan,
b.visitInfo = appendDynamicVisitInfo(b.visitInfo, "CONNECTION_ADMIN", false, err)
b.visitInfo = appendVisitInfoIsRestrictedUser(b.visitInfo, b.ctx, &auth.UserIdentity{Username: pi.User, Hostname: pi.Host}, "RESTRICTED_CONNECTION_ADMIN")
}
} else if raw.ConnectionID == util2.GetAutoAnalyzeProcID() {
// Only the users with SUPER or CONNECTION_ADMIN privilege can kill auto analyze.
err := ErrSpecificAccessDenied.GenWithStackByArgs("SUPER or CONNECTION_ADMIN")
b.visitInfo = appendDynamicVisitInfo(b.visitInfo, "CONNECTION_ADMIN", false, err)
}
}
case *ast.UseStmt:
Expand Down

0 comments on commit 4c94056

Please sign in to comment.