Repository navigation
fix(sql): honor cancellation inside LoopJoin and LIKE evaluation - #30862
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
LeftHandCold
left a comment
There was a problem hiding this comment.
结论:需要修改(REQUEST_CHANGES 建议),基于 8bd800cf9fa4c07c16986d7dd7d543f913545cce。
按 mo-self-review / mo-dev / unhappy-path-audit 完整核对了六个文件、LoopJoin 条件窗口所有权、错误向 pipeline/Scope 的传播、Reset/Free、PairCondition 挂起恢复及 LIKE 的 NULL/selection/fast-path。原问题的取消修复方向合理,原始 normal/race/SQL 取消与 benchmark 日志也支持它,但还存在一个已被真实 CI 证实的正常业务回归,见 inline comment。
当前账户与 PR 作者相同,GitHub 不允许作者对自己的 PR 提交正式 REQUEST_CHANGES;因此以 COMMENT 明确记录阻断结论。对应 4.2 PR #30863 刚新增 aa160a4 修复了此边界,Main 也需要独立适配并验证,不能仅凭另一分支已修复放行。
1628328 to
d436f4f
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed the complete 12-file change at d436f4fd5dbd6c6df4ff7dd4731151d87acc5b2d against merge-base 4ffaa4ceaef74f7c7272d454b7ed4412ce9a1e62. No remaining blocking findings.
Design/ownership: cancellation stays with the existing request/pipeline context and vm.CancelCheck; LoopJoin retains its existing continuation/result/window owners. The private ownedWindow pointer correctly survives explicit nil error returns. Error/cancel paths clear resume state, and Reset/Free release the execution generation. PairCondition results remain owned by the dependent frame. The frontend correction borrows only proc.Ctx across synchronous construction/evaluation/result consumption/free, restoring it afterward; query/top contexts, cancel handles and compiler counters remain owned by the existing compiler lifecycle. All five direct frontend evaluation sites were checked. No new state machine, wire/storage format, background worker or duplicate execution path is introduced.
The historical P1 SHOW regression is substantively resolved, not merely marked resolved. The current-request scope and real same-connection SHOW VARIABLES/ILIKE/SHOW COLLATION cases close it. Removing the earlier blanket resets also preserves prepared external-file execution and metadata-only view creation. meta_scan's nonfoldable argument is covered. Main approval does not close the separate 4.2 incident (#30836 / #30863).
QA/evidence: verified all 12 source hashes against the final validation receipt and parsed the original terminal logs: all four owning packages pass race (4,969 root tests), scoped-context race x100 and public protocol race x28 pass; final frontend normal and public/coverage-mode checks also terminate successfully. Independently added and ran an expression-error challenge with a real owned null-bitmap window, then reused the live execution and verified zero retained allocation after cleanup. It and the five cancellation roots pass locally with -race. Exact-head CI run 39874511010 is successful, including UT, SCA (0 issues), PROXY and pessimistic BVT.
Production, test and documentation increments were considered separately. Tests use bounded inputs, deterministic cancellation and the canonical one-CN fixture, with meaningful state/output/resource oracles. Fast LIKE polling is amortized every 256 rows; regexp checks are between matches. A running individual Go regexp match remains non-preemptible as documented; no new end-to-end throughput or release-branch qualification is claimed.
Merge Queue Status
This pull request spent 57 minutes 41 seconds in the queue, including 57 minutes 12 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
Related to #30836. The incident affects 4.2 and the same executor gap exists on main. The separately validated affected-branch fix is #30863; a main merge alone must not close the 4.2 incident.
What this PR does / why we need it:
A no-output LoopJoin can scan many inputs inside one Call, and text LIKE can evaluate many matches without observing cancellation. Check the existing context at LoopJoin work boundaries and between LIKE regexp matches; constant-pattern loops poll every 256 rows. Preserve temporary condition-window ownership on error, PairCondition continuation, text/binary dispatch, Unicode/escape, NULL/selection and cache semantics. An individual running Go regexp match remains non-preemptible.
Frontend expressions can run before a new pipeline installs its context, so the session Process may still carry an ended previous execution. Borrow the current request context only for synchronous frontend runtime evaluation, then restore the exact prior field after consuming and freeing the result. Apply this at SHOW VARIABLES/COLLATION filters, prepared SET, simple/stored-procedure expressions and meta_scan privilege argument evaluation. Bind/plan before entering the scope. EngineKey for simple expressions belongs to the local current context.
Remove the earlier three frontend-wide ResetQueryContext calls. They interfered with compiler-owned state: the executed candidate/base comparisons reproduced prepared external filepath LIKE allocation failures and unintended side effects while describing a WHERE view. The scoped correction preserves query/top contexts, cancellation handles, counters and cached-compile ownership; it changes no allocator, planner, storage, wire or state machine. The innermost allocation-account violation is not independently localized, so this PR does not claim a general allocator cure or rely on a canceled context as a metadata-safety policy.
Reuse pkg/embed's canonical single-CN fixture for the protocol regression. The old two-CN helper passed alone but failed after existing package tests retained a one-CN fixture. Keep the original eight SQL scenarios and add compiler-ownership controls (prepared 2/0/2, per-node fault state after view DDL) plus the reproduced nonfoldable meta_scan argument case. Restore session settings, original fault states, statements and databases on exit.
Rebased without conflicts onto main
4ffaa4ceaef74f7c7272d454b7ed4412ce9a1e62; final revisiond436f4fd5dbd6c6df4ff7dd4731151d87acc5b2d.Validation:
-covermode=set,-coverpkg=./pkg/embed,matrixone_test), including the previously failing fixture-admission path. This is targeted coverage-mode validation, not a full CI coverage-percentage claim.The scope adds context assignments/deferred restoration per direct expression evaluation, with no per-row work or frontend-wide reset/counter mutex. The meta_scan scope runs only for that argument branch. Original matching/operator benchmark evidence is historical and the relevant kernel sources are unchanged; no new end-to-end TP throughput claim.
Required gpt-6.1-sol / xhigh design and final review: Revised scoped design GO before implementation, session
01a16403-3c63-7b31-a05d-db212a832857; complete review, P2 correction and final terminal-receipt reconciliation Overall PASS, session01a1640f-503f-75a1-9774-9cf603474012. Actual model/effort verified from CLI turn_context; no unresolved material finding.Old CI failures were classified separately: UT and coverage failed fixture admission; pessimistic BVT exposed the two repaired compiler regressions; proxy BVT failed DockerHub image metadata retrieval with HTTP 500 before SQL ran. Fresh remote CI is pending. New targeted public protocol regressions use a single CN; full remote proxy/pessimistic acceptance is not claimed passed.