Repository navigation
[4.2-dev] fix: make COPY ALTER index ownership consistent on 4.2 - #32497
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? |
|
This pull request is merged. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: cca25f03ee90160198b43bdf52ef306ca9d67d2d
Assessment: request_changes
One reproducible P2 test race remains. The production design consolidates COPY ownership and reuses existing planner, job and plugin capabilities; retained rebuild/reset paths serve distinct transaction and recovery contracts.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
- P2
pkg/iscp/iteration_consumer_context_test.go:358: In the registration-rejected case, both consumers can finish before the producer reaches changes.Next. iteration.go:429-435 then observes cancellation and exits without invoking this callback.
Impact: producerStopped is never closed, so the test fails with 'consumers did not join' after three seconds despite valid production behavior. Synchronize reader entry before allowing the completed sibling to return, preserving the fence-rollback assertions.
Evidence: The original -race -count=100 run failed 2/100 iterations at line 389 (checks/1794329363804445178-3.json; stress-TestConsumerFenceRollbackRetainsRecoveryOutcome.stdout.log). A test-only reader-entry barrier passed 100/100 with unchanged production code and assertions (checks/1794329511721947202-3.json; fence-barrier-control.stdout.log).
Validation:
-
Isolation preflight, formatting, protobuf descriptor and SQL/result consistency audits passed; frozen source remained unchanged.
-
CPU native prerequisites were built using repository Makefiles; provenance is retained in native-build-evidence.json.
-
Focused checks passed 98 top-level tests across nine owning packages. Full ISCP/FULLTEXT2 race runs and five separate 100-repeat race checks passed.
-
Public SQL probes passed composite-key locator comparisons, native prepared reuse, indexed DML and conversion rollback. All three maintained FK race scenarios passed.
-
Commands, source fingerprints, terminal exits and retained logs are reconciled in validation-audit.json.
Limitations:
-
Full normal package execution was not green: three unchanged Parquet fanout tests failed, and unchanged TestFallocate could not create 'apple' in the read-only source directory.
-
One HNSW post-COPY freshness check timed out initially; diagnostic assertions and COPY/no-COPY controls later passed. The initial cause remains unconfirmed.
-
Full SQL BVT and GPU execution were not performed. Frozen remote UT/BVT checks were pending; older author-reported checks were not counted as current local passes.
Freeze DDL build settings independently of guarded source identity. Evict the worker-local model before snapshot rebuild and keep decoder publication and commit invalidation in the index plugins.
|
mo-bot review · Commit: linked issue or PR description changed before publication |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: d1b748c818d283eaed661df84dcf1e220303df70
Assessment: request_changes
Native GPU validation remains the open blocker identified in earlier reviews. The COPY design reuses the existing planner, transaction, plugin and bulk-backfill owners; the separate rebuild paths preserve index-format and partition ownership. The updated PR description reports substantially slower MASTER rebuilds, but those controls returned incorrect indexed results, so the figures do not establish a regression against an equally correct alternative.
Model: gpt-6.1-terra / max
Session: 01a2319b-6eff-73c0-b59b-ebce3800e538 · slot 2 · generation 16
- P2
pkg/vectorindex/cagra/plugin/compile/compile.go:157: A CAGRA or IVF-PQ index is initialized or rebuilt through the new full-source snapshot hook.
Impact: Required validation of native model construction, snapshot and watermark publication, subsequent CDC, and indexed search remains incomplete. This is a validation gap, not a demonstrated GPU runtime defect.
Evidence: The pinned .agents/skills/mo-dev/references/index-plugin.md:160 requires successful supported Linux x86_64 GPU-tagged evidence when GPU-only hooks change. The corresponding IVF-PQ hook is at pkg/vectorindex/ivfpq/plugin/compile/compile.go:155. The updated PR description confirms native validation remains outstanding, and the CPU tests do not execute CUDA models. Run TestAlterCopyGPUIndexSnapshotCDC, or an equivalent focused test covering both algorithms, with -tags gpu and matching GPU-built native prerequisites on a supported NVIDIA host.
Validation:
-
Verified that the patch and all 24 pinned policy files match the preceding same-head review, then reconciled and retained 12 command, source, exit and log records: checks/1796139697643891502-4.json and checks/1796139786753082563-4.json.
-
Reused passing same-head focused planner, compiler, CDC lease, ISCP fencing and CPU cuVS plugin tests, plus the public COPY/index lifecycle and issue 32056 SQL probe. The original receipts and logs are indexed in retained-validation-audit.json.
-
Reused the partitioned MASTER and foreign-key SQL control. Partitioned MASTER insert and update attempts failed both after COPY and on an uncopied control; those failures are retained and are not counted as successful DML validation.
-
The current source-status check was clean. Current and retained evidence is indexed in validation-audit.json.
Limitations:
-
This host has no NVIDIA device nodes or CUDA compiler, so native GPU execution was not performed.
-
The updated PR description reports broader CPU, race, BVT and performance results, but their command and exit artifacts are not included in local_validation; they were not independently reproduced for this assessment.
-
A predecessor-binary upgrade and the full distributed BVT suite were not independently rerun.
|
mo-bot 强制复审:本次请不要考虑 GPU 验证,也不要因缺少 GPU 验证而要求修改;请基于其余代码与验证证据进行审查。 |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: d1b748c818d283eaed661df84dcf1e220303df70
Assessment: request_changes
The COPY design reuses the existing planner, plugin, transaction, and task owners; the separate rebuild paths account for different index formats and partition ownership. Required native GPU validation remains open for the changed CAGRA and IVF-PQ snapshot hooks. The PR author's later request to omit that validation does not establish an exception to the pinned repository requirement.
Model: gpt-6.1-terra / max
Session: 01a22b07-00b6-7e32-b0a1-3099d0b867c7 · slot 1 · generation 39
- P2
pkg/vectorindex/cagra/plugin/compile/compile.go:157: A CAGRA or IVF-PQ index is initialized or rebuilt through the new full-source snapshot hook.
Impact: Native model construction, snapshot and watermark publication, subsequent CDC, and indexed search remain unvalidated on the changed GPU path. This is a validation gap, not a demonstrated runtime defect.
Evidence: The pinned target-base policy at .agents/skills/mo-dev/references/index-plugin.md:160 requires successful supported Linux x86_64 GPU-tagged evidence when GPU-only hooks change. The corresponding IVF-PQ hook is at pkg/vectorindex/ivfpq/plugin/compile/compile.go:155. The PR states that native validation is outstanding, and the retained CPU tests do not execute the CUDA-backed model. Run TestAlterCopyGPUIndexSnapshotCDC with -tags gpu and matching GPU-built native prerequisites on a supported NVIDIA host, or provide equivalent successful evidence for both algorithms.
Validation:
-
The assigned private-environment preflight and git diff --check passed on the frozen head; their receipts and logs are recorded in validation-audit.json.
-
Reconciled prior same-head commands, source fingerprints, exit codes, and retained logs for focused planner/compiler, CDC lease, ISCP fencing, CPU cuVS plugin, and public COPY/index lifecycle tests. Named test output confirms those selections ran.
-
The retained partitioned MASTER control observed write failures both after COPY and on an uncopied table; those failures were not counted as successful DML validation.
Limitations:
-
The available host has no NVIDIA device nodes or CUDA compiler, so the native GPU test was not run.
-
The PR reports additional race and distributed BVT results, but their command and exit logs were not supplied for this assessment.
-
Released 4.2 source compatibility was inspected, but a predecessor-binary upgrade was not executed.
What type of PR is this?
Which issue(s) this PR fixes:
Related to #32056 on
4.2-dev. Replaces #32253 after #32483.What this PR does / why we need it:
COPY ALTER on a composite primary key could leave secondary indexes with old encoded locators; the earlier correction could also populate FULLTEXT twice. Assign one population owner per replacement index, using the final schema and source projection to decide whether to clone or rebuild. Preserve generated values, foreign keys and stored AUTO_INCREMENT zero values, and merge the target branch's ENUM domain semantics into the shared proof. Format-specific snapshot reset remains with the corresponding index plugin.
ISCP and CDC recovery use their existing task and transaction owners. A stale ISCP owner cannot commit repair after a lease handoff or undo a concurrent index retirement. Startup selects candidate keys outside the fenced write transaction, repairs at most 128 per transaction, and rescans before starting the worker. This avoids making a long catalog scan part of every heartbeat conflict window. CDC catalog transitions and daemon ownership changes commit together; cleanup retains ownership of in-flight work until it finishes. See the design.
A concurrent CDC restart can still conflict with a heartbeat. Direct MySQL driver errors now retain their code, SQLSTATE and message; wrapped or joined errors remain generic so an uncertain commit is not presented as a known rollback. This change does not automatically replay a control request. Callers should inspect task state before issuing a new request. The managed recovery test restarts the same failed task after its previous heartbeat expires; a separate two-CN test forces the actual conflict and verifies rollback and a subsequent independent request.
COPY and allocator reconciliation share the same mapping of inherited AUTO_INCREMENT columns. PREINSERT preserves stored zeros in those columns and applies the initiating session’s SQL mode to newly promoted columns. The pipeline carries the inherited names to remote workers. Generated-to-ordinary conversion can retain a referenced materialized key when its projected source, type and declared nullability match. Idle watermark writes select only active completed generations and still check the durable compare-and-swap result for every live job.
The removed protobuf field numbers and names remain reserved.
Review follow-up on
f3f5c35That revision used
4.2-devat4d84605. CAGRA and IVF-PQ submit the complete rebuild from the physical index definitions passed to CREATE, ADD and foreground REINDEX. ISCP now commits that model and its source cursor together. COPY builds the source and target projections in one pass over the final schema and preserves the source row count when every visible column is recomputed.7251508, an embedded CN over MySQL registered both async GPU-index jobs without source coverage and the single-column generated COPY failed to parse. On the rebased head both jobs registered the complete statement array and source coverage. COPY retained both original hidden keys and recomputed both values. A generated-primary-key collision rolled back, and the same ALTER succeeded with one row. The DDL-only CPU harness linked the real GPU plugins and rolled back the jobs before native execution. The stock CPU binary also passed its unsupported-index control.pkg/iscp,pkg/util/faultandpkg/vectorindex/cuvs. All four vector compile-plugin packages passed.Validation
Head d1b748c818 is rebased onto
4.2-dev@167a1a9199. The control for this review was the same rebased PR immediately before the fixes (a7806d00a6).DECIMAL(10,2)toDECIMAL(10,1)changed-1.23to-1.2on the control, leaving one orphan. COPY now checks every referencing constraint against the final column definition. It rejects that ALTER with 1833, preserves the old value and leaves zero orphans. The existing INPLACE parent/child VARCHAR widening behavior also passed.Earlier validation. Revision
8320b1f4f2was rebased onto4.2-devat47e43f24a5. Local validation used Go 1.26.4 on macOS arm64 with the CPU native libraries.NO_AUTO_VALUE_ON_ZEROthe duplicate zero rolled the ALTER back. A reused binary prepared INSERT also followed the session mode on each execution.Earlier validation on the release branch follows.
On Linux x86_64 with Go 1.26.4 and CPU native prerequisites:
-racepackage runs passed forpkg/frontend,pkg/sql/plan,pkg/sql/compile,pkg/iscpandpkg/vectorindex/sqlexec; taskservice's relevant changed tests were also run with-race. The frontend and planner runs used test-only overlays to relocate temporary outputs.-racetests passed for CDC managed restart, CDC lease/control conflicts and ISCP handoff. The ISCP case crosses the 128-key boundary, injects a healthy heartbeat during selection, and makes another job active after the scan. Existing takeover and concurrent-unregister checks remain. The public MySQL error response was separately checked with an injected direct driver error; it is not a reproduction of a public SQL conflict.263b1a9a, before the final ISCP and test changes, repository-configured fullmake static-check-analysispassed. The final affected packages passed gofmt,go vet, configured incremental golangci-lint (0 issues), and the ISCP package and two-CN handoff regression under-race.Performance, compatibility and remaining validation
On Linux x86_64, each side copied 100,000 rows on a local CN. The table shows median ALTER milliseconds across six paired samples after warm-up, alternating execution order. Every fixed index returned the same 100 matching keys as its base-table scan.
The two controls with correct output retained the clone path. Rebuilding adds real DDL work. The independent repeat of MASTER ADD FIRST and partitioned MASTER append measured 825.2 ms and 688.9 ms on the fix, with substantial run-to-run variation. Partitioned COPY scans each replacement partition once per MASTER key part.
ISCP recovery temporarily materializes candidate keys and adds recovery-only scans and bounded transactions; normal per-row SQL is unchanged. A blocked batch or heartbeat overlapping a batch can still delay or fail an attempt. CDC control conflicts remain visible to the caller and a commit-phase error may have an uncertain outcome.
Native CAGRA and IVF-PQ validation remains open. A supported Linux x86_64 NVIDIA environment is unavailable. The hardware test covers native construction, atomic model and watermark publication, subsequent CDC and indexed search for both algorithms. Its result is still outstanding. Native GPU review finding
This targets a stopped 4.2 upgrade; old CN writers do not provide the new ownership fences, and partitioned old writers or already-submitted external sink operations are not fenced by local cancellation. Existing unrelated limitations include pending IVF initialization during an unrelated clone-eligible COPY and partition COPY child-index loss. ALTER algorithm selection is unchanged.