Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Yisaer committed Dec 30, 2022
1 parent 11dd068 commit a846cc5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -2377,7 +2377,9 @@ func runStmt(ctx context.Context, se *session, s sqlexec.Statement) (rs sqlexec.
stmtNode := s.GetStmtNode()
startTS := se.GetSessionVars().StmtCtx.StmtSnapshotTS
if se.GetSessionVars().EnablePlanReplayedContinuesCapture {
checkPlanReplayerContinuesCapture(se, stmtNode, startTS)
if checkPlanReplayerContinuesCaptureValidStmt(stmtNode) {
checkPlanReplayerContinuesCapture(se, stmtNode, startTS)
}
} else {
checkPlanReplayerCaptureTask(se, stmtNode, startTS)
}
Expand All @@ -2396,6 +2398,16 @@ func runStmt(ctx context.Context, se *session, s sqlexec.Statement) (rs sqlexec.
return nil, err
}

// only allow select/delete/update/insert/execute stmt captured by continues capture
func checkPlanReplayerContinuesCaptureValidStmt(stmtNode ast.StmtNode) bool {
switch stmtNode.(type) {
case *ast.SelectStmt, *ast.DeleteStmt, *ast.UpdateStmt, *ast.InsertStmt, *ast.ExecuteStmt:
return true
default:
return false
}
}

func checkPlanReplayerCaptureTask(sctx sessionctx.Context, stmtNode ast.StmtNode, startTS uint64) {
dom := domain.GetDomain(sctx)
if dom == nil {
Expand Down

0 comments on commit a846cc5

Please sign in to comment.