fix divByZero#24355
Conversation
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
…xone into 0512-fix-divzero
XuPeng-SH
left a comment
There was a problem hiding this comment.
Review
Fix is correct — the two bugs (cache leakage across statements, PREPARE/EXECUTE using wrong stmt type) are properly addressed. The approach of decoupling divByZero-specific stmtType/queryType/ignore from the session-level fields is clean. Test coverage is comprehensive.
Minor nits (non-blocking)
-
Redundant
elseafterreturnincheckDivisionByZeroBehavior— theif ignore { return false } else { return true }pattern is non-idiomatic Go. Drop theelse. -
getStatementType(statement)called twice inrefreshProcessDivByZeroProfileForPreparedStmt— cache the intermediate result. -
clearDivByZeroRuntimeProfileinsideSetStmtProfile— this creates an implicit contract that callers must callSetDivByZeroRuntimeProfileafterSetStmtProfile. Consider a comment documenting this, since a future caller ofSetStmtProfilemight not know they need to follow up.
LGTM.
Merge Queue Status
This pull request spent 1 hour 2 minutes 11 seconds in the queue, with no time running CI. Waiting for any of
All conditions
ReasonThe merge conditions cannot be satisfied due to failing checks HintYou may have to fix your CI before adding the pull request to the queue again. |
|
@mergify refresh |
✅ Pull request refreshed |
|
@mergify refresh |
✅ Pull request refreshed |
Merge Queue Status
This pull request spent 24 seconds in the queue, including 3 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #23438
What this PR does / why we need it:
#23438 在最新的main未复现.
此pr修改:
1, 多语句情景下, 问题: 前一个语句的DivByZeroErrorMode 会继承成给下一个条语句.
2, prepare/execute 场景下 insert/insert ignore的行为. execute与 实际执行的语句 是不同的. 为divByZero单独增加了stmtType, queryType和Ignore. 与主语句的相关变量区分开.