From 1257d59903ca24bf0e7b6c283db0cad8e153eeff Mon Sep 17 00:00:00 2001 From: lance6716 Date: Fri, 3 Mar 2023 21:21:11 +0800 Subject: [PATCH 1/2] This is an automated cherry-pick of #41832 Signed-off-by: ti-chi-bot --- session/session.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/session/session.go b/session/session.go index f0484876a3c90..dba744de8a5e9 100644 --- a/session/session.go +++ b/session/session.go @@ -1945,7 +1945,18 @@ func (s *session) ExecuteStmt(ctx context.Context, stmtNode ast.StmtNode) (sqlex // Only print log message when this SQL is from the user. // Mute the warning for internal SQLs. if !s.sessionVars.InRestrictedSQL { +<<<<<<< HEAD logutil.Logger(ctx).Warn("compile SQL failed", zap.Error(err), zap.String("SQL", stmtNode.Text())) +======= + if !variable.ErrUnknownSystemVar.Equal(err) { + sql := stmtNode.Text() + if s.sessionVars.EnableRedactLog { + sql = parser.Normalize(sql) + } + logutil.Logger(ctx).Warn("compile SQL failed", zap.Error(err), + zap.String("SQL", sql)) + } +>>>>>>> 5ba709f9554 (session: check redact when log compile error (#41832)) } return nil, err } From 478da3719cc13249ac990d7cd797a80f42798263 Mon Sep 17 00:00:00 2001 From: Yang Keao Date: Thu, 29 Jun 2023 16:31:41 +0800 Subject: [PATCH 2/2] merge conflict Signed-off-by: Yang Keao --- session/session.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/session/session.go b/session/session.go index dba744de8a5e9..d8ef14cd5377e 100644 --- a/session/session.go +++ b/session/session.go @@ -1945,9 +1945,6 @@ func (s *session) ExecuteStmt(ctx context.Context, stmtNode ast.StmtNode) (sqlex // Only print log message when this SQL is from the user. // Mute the warning for internal SQLs. if !s.sessionVars.InRestrictedSQL { -<<<<<<< HEAD - logutil.Logger(ctx).Warn("compile SQL failed", zap.Error(err), zap.String("SQL", stmtNode.Text())) -======= if !variable.ErrUnknownSystemVar.Equal(err) { sql := stmtNode.Text() if s.sessionVars.EnableRedactLog { @@ -1956,7 +1953,6 @@ func (s *session) ExecuteStmt(ctx context.Context, stmtNode ast.StmtNode) (sqlex logutil.Logger(ctx).Warn("compile SQL failed", zap.Error(err), zap.String("SQL", sql)) } ->>>>>>> 5ba709f9554 (session: check redact when log compile error (#41832)) } return nil, err }