Skip to content

Commit

Permalink
Fix panic cause miss stmt info and log (matrixorigin#19369)
Browse files Browse the repository at this point in the history
  • Loading branch information
xzxiong authored Oct 18, 2024
1 parent f9b8368 commit 5c9094b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/frontend/mysql_cmd_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -3057,6 +3057,8 @@ func ExecRequest(ses *Session, execCtx *ExecCtx, req *Request) (resp *Response,
} else {
resp = NewGeneralErrorResponse(COM_QUERY, ses.txnHandler.GetServerStatus(), moe)
}
// log the query's statement and error info.
logStatementStatus(execCtx.reqCtx, ses, execCtx.stmt, fail, err)
}
}()
ses.EnterFPrint(FPExecRequest)
Expand Down
5 changes: 3 additions & 2 deletions pkg/frontend/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,9 @@ func logStatementStringStatus(ctx context.Context, ses FeSession, stmtStr string

// pls make sure: NO ONE use the ses.tStmt after EndStatement
if !ses.IsBackgroundSession() {
stmt := ses.GetStmtInfo()
stmt.EndStatement(ctx, err, ses.SendRows(), outBytes, outPacket)
if stmt := ses.GetStmtInfo(); stmt != nil {
stmt.EndStatement(ctx, err, ses.SendRows(), outBytes, outPacket)
}
}
// need just below EndStatement
ses.SetTStmt(nil)
Expand Down

0 comments on commit 5c9094b

Please sign in to comment.