diff --git a/session/session.go b/session/session.go index bcc4f2694dc48..279b82f98ec2d 100644 --- a/session/session.go +++ b/session/session.go @@ -671,7 +671,13 @@ func (m temporaryTableKVFilter) IsUnnecessaryKeyValue(key, value []byte, flags t // of the errors defined in kv/error.go, these look to be clearly related to a client-inflicted issue, // and the server is only responsible for handling the error correctly. It does not need to log. func errIsNoisy(err error) bool { - return kv.ErrKeyExists.Equal(err) + if kv.ErrKeyExists.Equal(err) { + return true + } + if storeerr.ErrLockAcquireFailAndNoWaitSet.Equal(err) { + return true + } + return false } func (s *session) doCommitWithRetry(ctx context.Context) error { @@ -1569,7 +1575,7 @@ func (s *session) ExecuteStmt(ctx context.Context, stmtNode ast.StmtNode) (sqlex logStmt(stmt, s) recordSet, err := runStmt(ctx, s, stmt) if err != nil { - if !kv.ErrKeyExists.Equal(err) && !storeerr.ErrLockAcquireFailAndNoWaitSet.Equal(err) { + if !errIsNoisy(err) { logutil.Logger(ctx).Warn("run statement failed", zap.Int64("schemaVersion", s.GetInfoSchema().SchemaMetaVersion()), zap.Error(err),