Skip to content

refactor: define canonical compute-group execution and harden ingress-owned scheduling - #26109

Merged
XuPeng-SH merged 11 commits into
matrixorigin:mainfrom
XuPeng-SH:scheduler_phase9_workload_pool_routing
Sep 8, 2026
Merged

XuPeng-SH merged 11 commits into
matrixorigin:mainfrom
XuPeng-SH:scheduler_phase9_workload_pool_routing

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes

Related to #25451. This does not close the canonical compute-group implementation gate.

Outcome and scope

Rebased on main at 0b195e4f5a23c06a40552a8db3e7fdf182979a3a.
Latest repair: 6a96463a66.

This PR separates a draft canonical compute-group RFC/acceptance matrix from
independently useful legacy ingress-scheduling and LOCAL-upload correctness
fixes. It does not implement compute-group identity, authorization, admission,
or the future distributed drain protocol. The rejected workload-policy
DDL/catalog/RPC/cache and raw-label product model remain removed. RFC owner
approval and Milestone-B implementation/validation remain separate gates.

Implementation

  • Writable AP workspaces retain ingress participation. LOCAL input is
    ingress-only and is allocated only after successful compile/placement.
  • General vector-index scan IR from current main retains the ingress/ordinal
    invariant; no resurrection of the removed IVF-only function-scan IR.
  • Exact service ID wins over aliases; local routes use the real ingress
    address. Authoritative empty/excluded/draining pools fail closed rather than
    manufacturing local membership.
  • Interrupted LOCAL upload now terminates at the network protocol boundary:
    cancel interrupts both pipe and network I/O; cleanup joins the watcher and
    producer before freeing buffers or reusing session/ExecCtx state.
  • Removed unbounded discard-to-EOF and consecutive-error retries. Packet
    retries cannot reconstruct a partially consumed frame, and successful packets
    previously reset the error budget indefinitely.
  • UDF file import shares the same repaired lifecycle. Storage write errors and
    panics cancel the producer before joining; its duplicate watcher is removed.
  • Compatibility tradeoff: a failed/canceled upload before protocol EOF closes
    its client connection; clients must reconnect. Successful EOF retains normal
    connection reuse. No successful-upload size cap or per-row cache is added.

RFC correction

DrainRequested publication is not a distributed claim barrier. The authority
must collect generation/incarnation-fenced receiver seals, serialized against
local/remote claim admission, before publishing effective Draining. A stale
Ready cache and valid lease cannot bypass an acknowledged seal. Missing acks
produce bounded pending/failure responses and retain DrainRequested, not false
success. Lease expiry alone cannot stand in for an acknowledgement; permanently
lost participants require a separately reviewed execution-fencing protocol.
This explicitly trades drain availability for a clock-independent safety rule.

Test plan

Automated regression and static checks

  • Full ./pkg/frontend normal: 25.795s; full race: 41.427s.
  • Focused protocol tests: pre-cancel, invalid config, blocked request write,
    idle read, partial header/body, blocked pipe, pipe failure, disconnect, EOF,
    next-command reuse after late cancel, and allocator balance.
  • Runner error/panic and UDF storage error/panic prove cleanup does not wait
    for client EOF, with exactly-once disconnect/free assertions.
  • Each lifecycle test received its own -race -count=100 run; final focused
    race also includes the added allocator-balance assertions. No repeated full
    package stress.
  • go vet via controlled CGo wrapper -vet=all -run '^$'; ordinary package
    execution evidence is recorded separately above. gofmt, git diff --check,
    and Python AST parsing pass.
  • Reuse unchanged rebase evidence: schedule full suite, compile focused
    TestScheduleQueryWorkers, and placement A/B benchmarks against the same main.
  • Full compile suite is not green in this environment: five Parquet
    fanout tests fail identically on clean main 0b195e4f5a with matched native
    inputs. They are not attributed to this PR and are not hidden/skipped.

Real service: 10.222.1.55, two CNs

  • Final normal binary SHA-256:
    b076571701a5ae6b38733d22f5e23e4527fcdf90b5bdb6a312441c3a8750d6b4.
  • On both ingress ports: two committed rows plus one uncommitted row;
    read-your-writes, peer isolation and rollback; normal LOCAL result and
    subsequent command on the same connection.
  • KILL QUERY with no upload EOF: idle client, incomplete header,
    incomplete body and continuing packet sender; server closes connection and
    aborted LOAD leaves no rows. UDF import cancellation publishes no function.
  • Final normal witness passes twice on the same instance; each run verifies
    database teardown. Service was stopped afterward; no local mo-service started.
  • Separate white-box build enables existing SetForceScanOnMultiCN(true)
    only after SQL/ISCP readiness; the LOAD/transaction witness passes twice with
    the same tiny data. This is injection evidence, not normal performance.
    Temporary injection code is removed and is not in the commit.
  • An initial always-on injection interfered with bootstrap discovery and
    failed required-ingress placement. That run is excluded, its data quarantined,
    and the successful gated injection used a fresh data directory.

QA reproduction is committed under
optools/testdata/load_local_lifecycle/README.md and validate.py.
Use only a disposable test-owned two-CN instance, never shared/production data.
Retained run logs: /mnt/nvme/xupeng/pr26109-validation.TZpKhg on 55.

Performance and limitations

Placement allocation profile is unchanged from clean main: all-workers
10192 B/op, 7 allocs/op; max-workers 11600 B/op, 9 allocs/op. Three short
samples showed no obvious latency regression, but do not establish a <=2%
p50/p95 or end-to-end SQL performance gate. LOCAL repair removes failure-path
work and a redundant UDF watcher, without changing normal per-packet payload
allocation. Future compute-group benchmarks/acceptance remain unclaimed.

CI is not awaited as part of this delivery. The separate generate_series offset
defect remains tracked by #27069.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKING REVIEW — GitHub does not allow the PR author to submit REQUEST_CHANGES on their own PR. One correctness blocker remains. The new workload-policy path assumes at most one catalog row per (account_id, variable_name), but that invariant is not enforced: mo_mysql_compatibility_mode is keyed only by configuration_id, while doSetGlobalSystemVariable performs a transactional read-then-insert. Two sessions concurrently doing the first SET GLOBAL query_workload_policy can both observe no row and insert distinct auto-increment IDs. The initial cache load then picks one row by result order, and the periodic revalidation rejects the duplicate forever; later SETs update both rows and cannot heal it. This can make every query for the account fail after the refresh interval. Please make creation unique/atomic (or otherwise define and enforce one authoritative row), apply the same cardinality rule during initial load, and add a concurrent first-SET plus restart/refresh regression test.

Comment thread pkg/frontend/variables.go Resolved

@LeftHandCold LeftHandCold left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for one production-reachable regression in the new LOAD routing path. When an account's load policy selects a non-ingress CN, LOAD DATA LOCAL INFILE is also materialized as a remote external-scan scope, but the uploaded byte stream exists only in the ingress process's in-memory pipe and is not part of remote ProcessInfo. The remote reader therefore cannot consume the client data and the ingress upload goroutine can block. Please preserve or fail explicitly at this ingress-only boundary and add a focused regression for a remote load policy plus LOAD DATA LOCAL.

Comment thread pkg/sql/compile/compile.go Resolved

@aptend aptend left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head f4aebae95e42a917173e734332a692516263def6. Two production-reachable correctness blockers remain.

P1 — Keep workload-routed scans local when the transaction workspace has writes

compileQuery derives AP/TP execution from GetExecType(..., c.getHaveDDL(), ...), so a transaction with prior DML but no DDL can still be classified as AP. evaluateQueryPlacement then permits a workload rule such as current_cn: excluded to select only remote workers; the only semantic current-CN override is for the IVF entries scan.

This breaks read-your-writes. For example: BEGIN; INSERT ...; followed by a sufficiently large SELECT can execute its table scan entirely on another CN. CNTxnSnapshot carries transaction metadata, locks, options, and flags, but not the ingress CN workspace. The remote pipeline creates a fresh workspace, and its RemoteDataSource strips the empty-block marker representing in-memory workspace data. The SELECT can therefore omit rows inserted earlier in the same transaction.

Please require the ingress/current CN whenever TxnOperator.GetWorkspace() is non-nil and not read-only (or reject a policy that excludes it), and add a regression covering prior in-memory INSERT + AP policy with current_cn: excluded + SELECT read-your-writes.

P1 — Preserve the ingress-only boundary for LOAD DATA LOCAL INFILE

The workload path routes every external source through constructWorkloadScopeForExternal, including LOAD DATA LOCAL INFILE, and marks it remote when the selected LOAD worker is not the ingress CN. However, the client-uploaded bytes exist only in the ingress process’s in-memory io.PipeReader; that reader is not serialized in remote ProcessInfo. The remote external reader therefore cannot consume the client stream, while the ingress upload writer can block waiting for a reader.

Please pin LOCAL INFILE execution to the ingress CN (or reject incompatible remote LOAD placement before starting the upload) and add a focused remote-load-policy regression.

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

已完成 latest-main rebase、全量 comment 复盘和提交前 deep self-review;PR 已 squash 到 exact head 4279bae,base 为 main@1c292cf20e113b296a3db2cb6a65e00af2ea2327。

历史 review closure:

  • rolling upgrade:重新分配 WorkloadPolicyUpdate wire ID 为 CmdMethod 40 / Request 42 / Response 43,使用 MORPC v18;catalog upgrade 追加到 v4.0.6,activation gate 精确等待 offset 14,生成代码已重跑并保持确定性。
  • control plane:配置、revision 在单事务内原子提交;Working、Unknown、Draining CN 均在提交前做真实 handler probe;提交后的 publish 仅作为 3s 有界 convergence accelerator,失败记录 account/revision/cause 但不再把已提交 DCL 伪报为失败。
  • identity / ownership:foreground、BackgroundExec、internal executor、ResetSession 均按 execution account 独立 acquire/release;cross-account restore/clone 不借用 creator state,internal bit、routing account label 与 authorization TenantInfo 分离;cold load、refresh、remove、idle generation 均有确定 owner 和 fence。
  • placement / prepared / topology:严格 target labels 不会回退到 ingress labels;local/single/multi routing、target CPU、preferred/required current、remote scope grouping、prepared policy/class 与 CN placement generation 均重新审计;CommitID 现在也参与 candidate compatibility 和 prepared placement invalidation。

最新两个 P1 的根因修复:

  1. dirty transaction workspace 是 ingress-owned state。策略生效时,非只读 workspace 会成为独立 correctness constraint:current CN 必须包含在 worker set;current_cn=excluded 或 strict pool 不包含 ingress 时在 discovery/执行前 fail closed。没有把整个 AP 查询强制单 CN,已提交数据分区仍可远端并行,因此不扩大正常性能影响。
  2. LOAD DATA LOCAL 的 io.PipeReader 不在 ProcessInfo wire contract 中,而且下游 local-register topology 也不能把 source 单独搬走。LOCAL upload 因此整体 pin 到 ingress;strict target pool 不包含 ingress 时在 upload producer 启动前明确失败。没有新增 pipe bridge、协议字段、转发 goroutine或额外等待关系。非 LOCAL、S3、stage load 保持原 workload routing。

额外正确性 closure:remote DML 的 last_insert_id 通过已有 terminal JSON envelope 可选回传;旧 client 会忽略新字段,新 client 接收旧 server 的缺省零值,error path 不覆盖既有 session ID。LOCAL worker materialization 使用 canonical ingress route,避免同一 CN 的地址别名误变 RemoteRun。

性能 / unhappy-path:

  • 无策略 statement path 不做 catalog I/O、RPC、锁或额外 map clone;snapshot 读约 1.8ns,statement fast path 约 29.7ns,session fast path 约 39.7ns,均 0 B/op / 0 allocs/op。
  • account snapshot 为 immutable atomic read;每账号最多一个 5s refresh,重试指数退避上限 30s;idle LRU 上限 1024;trace/worker/scans/stages/failures 均有硬上界。
  • cluster callback 无 I/O、无 goroutine;generation 在 snapshot publication 前后 odd/even bracket,避免 prepared compile 跨 metadata transition 复用。

最终验证:

  • 完整 schedule、compile、frontend、parser、query client、v4.0.6 upgrade、clusterservice、cnservice、disttae package matrix 通过。
  • frontend / compile / schedule / clusterservice 完整 race 通过;session/revision/invalidation focused race 50 轮,CN publication ordering 100 轮通过。
  • dirty workspace、LOCAL INFILE、sparse shared scope、remote terminal 新旧 wire focused regressions 通过。
  • build、go vet、molint、golangci-lint 0 issues、err-check、license header、git diff check 通过。
  • parser/protobuf 生成器重跑前后 checksum 一致。

请基于 4279bae 重新 review。当前唯一未 resolve 的 inline LOAD LOCAL thread 已由上述 ingress ownership boundary 和回归测试在代码层闭合。

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Blocking product review — exact head 4279bae

This is an author-side blocking review. GitHub does not allow the PR author (the authenticated account here) to submit a formal REQUEST_CHANGES review on their own PR, so this comment is the authoritative “do not merge” decision and I am converting the PR back to Draft.

I re-reviewed #25451 from the product contract backward, rather than treating the existing Phase 9 design as a requirement. The implementation has closed many real correctness issues, but the public model is still wrong. More patches to the current JSON will not fix that boundary.

P0 — pool is not a real resource identity

In pkg/sql/schedule/workload_policy.go, a rule contains both PoolIdentity and Labels. The JSON requires both pool and labels, but ResolveWorkloadPolicy uses the labels to obtain workers while PoolIdentity is primarily intent/diagnostic identity.

Consequences:

  • pool and labels can disagree without a single authoritative owner;
  • there is no create/use/alter/drop lifecycle for the named pool;
  • no ACL says which account/role may use it;
  • rename, deletion, membership generation, capacity, and drain semantics are undefined;
  • the Operator/Proxy already own named cnGroups, but this PR creates a parallel SQL “pool” name that is not tied to that identity.

A stable product cannot promise execution on pool ap while actually selecting whatever CNs happen to match an independent label map.

P0 — TP/AP is an unstable policy key

queryWorkloadClass in pkg/sql/compile/scheduler.go maps the planner's ExecTypeTP and ExecTypeAP variants directly to public tp/ap policy buckets. GetExecType in pkg/sql/plan/stats.go derives those modes from statistics, block count, cost thresholds, prepared-versus-direct execution, index/plan shape, DDL state, and force-one-CN constraints.

Therefore the same SQL can change target pools after ANALYZE, an index change, parameter/prepare differences, optimizer work, or an upgrade. TP/AP describes a current execution strategy; it is not durable business workload identity. Freezing it into an account policy makes placement and availability behavior unpredictable.

P1 — the public JSON exposes unrelated internal responsibilities

The proposed account JSON combines:

  • raw CN labels and protected account identity;
  • workload classification;
  • current_cn transaction/ingress constraints;
  • strict/compatibility fallback and empty-worker behavior;
  • CN fan-out through max_workers.

These are not one product object. In particular:

  • current-CN participation must be derived from local-input, workspace, transaction, lock, and session ownership. It must not be a customer safety knob.
  • max_workers caps worker fan-out/DOP. It is not CPU, memory, query concurrency, admission, or a resource budget.
  • fallback cannot silently change the compute-isolation boundary. Any temporary compatibility fallback requires a separate explicit migration contract and observability.
  • internal, unclassified, and maintenance expose implementation buckets without a complete or stable workload lifecycle.

The result is a low-level scheduler serialization format presented as a long-lived account API.

P1 — too much compatibility machinery is being committed before the product object is defined

This PR adds a catalog table, account cache lifecycle, publication/reconciliation RPC, bootstrap upgrade gate, parser/DDL surface, metrics, and broad frontend integration across 75 files. Those mechanisms are expensive to change after release. The repeated correctness fixes were valuable, but they also show that we are hardening an API before agreeing what resource it controls and what users may rely on.

What is valuable and should be kept or extracted

The following work is directionally sound and can survive a product re-scope:

  • immutable statement snapshots and monotonic revision/generation fencing;
  • separation of candidate discovery, eligibility, placement, and topology materialization;
  • authenticated account identity that cannot be widened by user input;
  • prepared/retry invalidation and placement-generation checks;
  • RemoteRun grouping/topology validation;
  • bounded trace/EXPLAIN data;
  • correctness coverage for LOAD DATA LOCAL, dirty workspace, draining, mixed version, cancellation, and route failures.

These should be extracted only where they have an independent consumer or stable internal contract; do not retain catalog/RPC/cache machinery merely to preserve sunk work.

Required re-scope before this can return to review

  1. Define one canonical compute-group identity that bridges the existing Operator cnGroups, Proxy routing, CN metadata, and SQL execution. Users choose a group; labels remain implementation attributes.
  2. Define ownership, ACL, membership generation, rename/delete, drain, unavailable/overloaded, and transaction-pinning behavior in a product RFC and acceptance matrix.
  3. Start with an explicit authorized account/session/statement binding and strict failure outside the group. Preserve current behavior when disabled.
  4. Keep TP/AP_ONECN/AP_MULTICN as internal execution capabilities. Add stable workload assignments later from trusted identity/source/tag inputs with documented precedence.
  5. Enforce ingress, local-input, dirty-workspace, DDL/lock, and transaction constraints internally.
  6. Do not claim resource governance until an admission owner provides bounded concurrency/queue/reservation semantics.
  7. Split independently useful infrastructure from the public DDL/catalog/publication design; do not merge ALTER ACCOUNT CONFIG ... query_workload_policy in its current form.
  8. Re-enter review only with real multi-CN acceptance for explicit selection, cross-account denial, first DML, read-your-writes, prepared execution, retry, cancellation, draining, membership/address change, and rolling upgrade, plus a no-policy fast-path benchmark.

The product-first rationale and outcome-gated roadmap are recorded in #25451:
#25451 (comment)

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Product-first rescope pushed in 51aeb95d45 (safely replacing exact prior head 4279baeb59 with --force-with-lease).

The previous workload-policy implementation is removed rather than patched around its unstable identity model. This PR is now the draft Milestone-A contract: canonical immutable compute-group identity, account/role authorization generations, authenticated Proxy handoff, ingress-vs-execution boundaries, transaction/local ownership, receiver-side RemoteRun fencing, lifecycle/rolling-upgrade semantics, and a normative acceptance matrix.

CI root cause closure: the former Ubuntu UT failure in TestIssue25782BroadcastHashBuildFailsClosedUnderHardBudget was an early invalid-scheduling-intent from the rejected workload-policy path during internal table_stats; the exact test passes on this reset baseline and reaches the intended hash-build memory-budget failure.

The independently confirmed generate_series multi-CN offset bug is split to #27069. This PR intentionally stays draft: #25451 and all unchecked Milestone-B rows remain open until named owners provide multi-CN and disabled-path benchmark evidence.

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Code fix pushed at 942d96b206 after a fresh first-principles review.

Implemented only the independently closed execution-safety slice:

  • dirty AP workspaces now require real ingress participation while retaining remote persisted-partition parallelism;
  • LOAD DATA LOCAL is ingress-only; strict pools excluding ingress fail before execution, while the default path performs no candidate lookup;
  • same-service-ID/stale-address candidates are canonicalized to the actual local route and duplicate aliases are removed;
  • TP/AP_ONECN keep the existing no-workspace-inspection hot path.

I removed the partial self-reported compute-group metadata/resolver/RemoteRun scaffold instead of pushing an unauthenticated or incomplete protocol. The Draft RFC remains the authority for that later Milestone-B work.

Validation passed: full schedule/compile and frontend packages, the exact issue-25782 regression, focused race x20, formatting/diff checks, and an independent blocker-only review (APPROVE).

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Force-pushed the latest-main rebase at 369c3f14b6 and rewrote the title/body to match the actual scope.

The re-review pass fixed the remaining ingress-owned execution gaps: exact-ID candidate priority independent of discovery order, rejection of same-address/different-ID aliases, canonical local address materialization, cancellation before the LOCAL fast return, no LOCAL pipe before compile acceptance, and joined cleanup on both success and runner failure. The outdated LOAD DATA LOCAL review thread is now closed by code and regression coverage.

Local validation passed for full schedule, compile, and frontend tests and race suites; the LOCAL ownership case also passed -race -count=100, plus build/vet, the former Ubuntu blocker, and placement benchmarks. Fresh GitHub CI is running on this head.

The PR intentionally remains Draft because it defines—but does not claim to implement—the Milestone-B compute-group authorization/generation/RemoteRun contract.

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Deep-review update pushed at f5485e3866.

This pass closes three additional code blockers: runner-panic upload ownership is now joined before statement cleanup, authoritative Draining ingress state can no longer be re-added by local fallback, and IVF ingress proof now uses the same ID-first hard constraint/canonical route as writable workspaces. Each new regression fails under the unfixed semantics and passes after the change.

The RFC/matrix also now close authority-liveness renewal versus membership-generation churn, ticket claimant/restart ownership, unclaimed-route drain behavior, receiver incarnation/replay handling, prepared reauthorization, and multi-hop A -> B -> C grant propagation.

Local full tests/race for frontend, schedule, and compile; focused race x100; build; vet; Issue #25782; and allocation benchmarks pass. Title and body have been rewritten to state the exact scope. The PR remains Draft because this is the Milestone-A contract plus legacy correctness fixes, not a claim that Milestone B is implemented.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@gouhongshen gouhongshen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex automated review

Prior blockers remain fixed, including dirty-workspace routing, LOAD DATA LOCAL ownership, canonical local routing, draining handling, and cleanup paths. One new blocker remains: required ingress can be re-added by empty-worker fallback when only a draining same-address alias with a different service ID is resolved.

P1 - Do not re-add required ingress after resolved aliases are ineligible (pkg/sql/schedule/placement.go:350)

With RequireCurrentCN, a resolved candidate {ID: "stale", Addr: current.Addr, State: Draining} does not match ingress {ID: "current", Addr: current.Addr} because ID-first matching rejects non-empty ID aliases. Eligibility then drops the draining alias. Since resolvedCurrentStateChecked is already true, this branch skips another rejection and ensureCurrentWorker re-adds the ingress, returning satisfied placement. The query therefore runs on an ingress identity absent from the resolved pool and bypasses the draining state. Required-ingress placement must fail closed when an authoritative resolved snapshot cannot prove ingress membership; add a mismatched-ID draining/drained regression.

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Addressed the latest P1 in 5b4fbbc43c.

The fix makes the ingress-ownership invariant independent of post-filter worker count: whenever RequireCurrentCN has an authoritative pool resolution, placement now requires canonical ingress membership proof. This closes both:

  • a non-empty resolved pool whose mismatched-ID same-address aliases are all filtered as Draining/Drained; and
  • an explicitly empty authoritative resolution.

The ordering remains fail-closed and diagnostic: an exact ingress candidate that is Draining/Drained is still rejected with its current-CN state reason before membership proof, while a genuinely unresolved legacy request still retains local fallback.

Added regressions for mismatched-ID same-address Draining and Drained aliases, authoritative empty resolution, and the unresolved fallback control.

Local verification:

  • full pkg/sql/schedule tests
  • focused counterexample matrix at -count=100
  • pkg/sql/schedule under -race
  • build/vet for pkg/sql/schedule and pkg/sql/compile
  • full pkg/sql/compile tests through the repository CGo test wrapper

Please re-review the new head.

@gouhongshen gouhongshen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex automated review

上一轮唯一阻塞项(权威解析仅剩不同 ID 的 draining/drained 地址别名时,required ingress 被 fallback 重新加入)已在 5b4fbbc 修复,并有回归覆盖;未解析的 legacy fallback 属于明确兼容契约。此前 dirty-workspace、LOAD DATA LOCAL、canonical route、drain/cleanup/IVF 问题已修复;旧 workload-policy 控制面问题已随 rescope 移除。当前无 blocking 或 non-blocking finding。

@aptend aptend left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head 5b4fbbc43c00b1fb9aa0dbdebbaf1efeab8c9bab after the RFC rescope and all ingress-owned execution fixes. My prior writable-workspace and LOAD DATA LOCAL blockers are closed: AP multi-CN writable workspaces require authoritative ingress membership and retain the local all-data partition; LOCAL is ingress-only, rejects incompatible strict placement before pipe creation, and the accepted path owns/closes/joins/clears the reader and upload producer across success, runner error, cancellation, and panic. IVF entries use the same service-ID-first proof and canonical in-process route.

The latest fix also closes the remaining fallback edge: any authoritative resolved pool—including empty or fully filtered results—must positively contain the exact ingress identity; a same-address/different-ID draining or drained alias can no longer be converted into local execution. Conflicting exact ingress states fail closed independent of order, while the explicitly unresolved legacy fallback remains distinct. The RFC and normative matrix clearly mark Milestone B implementation gates as unimplemented and specify immutable identity, authorization, generation/drain/replay fences, and Q1-Q3 bounds. Focused schedule regressions pass under -race -count=10; exact-head UT, SCA, coverage, and both BVT jobs are green. No blocker found.

@iamlinjunhong iamlinjunhong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head 5b4fbbc43c00b1fb9aa0dbdebbaf1efeab8c9bab against refreshed origin/main@263567cf1a56da904788bc6d1d613ff19cb44783 (merge-base e0a66b63ec87762167eec73fbc8590a269e05de3). The new main commit touches only planner charset compatibility and does not overlap this PR.

My prior two P1 integration findings are closed: the author explicitly replied, then the product rescope removed the workload-policy proto/bootstrap/catalog control plane entirely. I re-read the complete 9-file diff, the scheduling/materialization callers, workspace Readonly contract, IVF local-partition path, and the LOAD DATA LOCAL pipe lifecycle. Authoritative empty/aliased/ineligible pools now fail closed for ingress-owned execution; accepted LOCAL execution creates the pipe only after compile and closes, joins, and clears it on success, runner error, panic, and cancellation. I found no remaining P0/P1/P2/P3 issue.

Fresh local evidence: all 13 added schedule regressions passed; pkg/sql/schedule build/vet passed; four representative identity/state counterexamples passed -race -count=100; the full schedule package passed once under race. Focused compile/frontend execution was unavailable locally because the isolated worktree has no cgo/libmo.dylib; exact-head GitHub checks are all completed with no failing conclusion (UT, SCA, coverage, and BVT included).

@aunjgr aunjgr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head . Ingress-owned execution now fails closed against authoritative empty, aliased, or ineligible pools; writable workspaces retain the local partition, IVF routing canonicalizes the exact service identity, and creates its pipe only after accepted placement and joins/clears the producer on success, error, cancellation, and panic. The RFC keeps the unimplemented compute-group milestone explicitly separated from these scheduler fixes. The full schedule package plus focused compile/frontend lifecycle regressions pass locally, and all required checks are green. No blocker found.

@aunjgr aunjgr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected review summary for exact head 5b4fbbc43c00b1fb9aa0dbdebbaf1efeab8c9bab: ingress-owned execution fails closed against authoritative empty, aliased, or ineligible pools; writable workspaces retain the local partition; IVF routing canonicalizes exact service identity; and LOAD DATA LOCAL creates its pipe only after accepted placement and joins and clears the producer on every exit. The RFC keeps the unimplemented compute-group milestone separate from these fixes. The full schedule package plus focused compile and frontend lifecycle regressions pass locally, and all required checks are green. No blocker found.

@mergify

mergify Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working kind/documentation Improvements or additions to documentation kind/enhancement kind/feature kind/refactor Code refactor kind/test-ci size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants