Repository navigation
fix(idxcron): scope task status updates to full catalog key - #29873
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? |
|
Commit review for The fix uses the existing The tests cover all three outcomes, the complete generated predicate, timestamp assignments, and quoted/backslash/empty index names. The embedded CN test exercises the real executor and verifies sibling error isolation. Matching local evidence passed: full idxcron UT and race, the embedded catalog test and race, No actionable review threads were open when checked. CI was still running at review time; this comment records the code review and local evidence, not a claim that CI is green. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
COMMENT-only review of b37a825fbb1afbc375f273b25876b4925894fed7, merge-base 03c34f837b1b399587e9d7e7e2f64a92010806e3. No blocking finding for #29869; approval recommendation only, not independent GitHub approval on a self-authored PR.
This completes the pending formal review action from the existing exact-head review. The head is unchanged. Reused the matched local normal/race/SCA and complete review evidence, and reconciled it with the now-green exact-head CI. Downloaded Linux UT job114397542530 actually selects the real TestIdxcronQuotedTableRename/catalogCommands path; arm64 SCA and both substantive multi-CN BVT jobs passed. No redundant full-suite rerun was needed.
Rechecked all three changed files. Task identity already is (account_id,table_id,index_name,action) in registration, catalog primary key, reader and unregister. Adding the missing index_name to both existing UPDATE templates restores that single source of identity. Error/skipped outcomes preserve last_update_at; success changes only the selected task's timestamp and status. Existing sqlquote.EscapeString handles the new literal, including quoted/backslash/empty names. No new state, query, transaction, scheduler branch or normal SQL execution work is added; work is limited to escaping the name and narrowing the existing background predicate. Existing result/error ownership remains unchanged.
Tests extend the owning SQL-shape test with all three outcomes, exact assignment/predicate checks and an empty-name control. The existing embedded catalog executor test now verifies two sibling tasks retain distinct task-specific errors, rather than testing a recreated updater. Its runtime behavior complements the generated-SQL success-timestamp oracle; it does not claim a native index rebuild was run. Implementation+3/-3; tests+55/-16; documentation0. No prior substantive finding remains open. Old overwritten timestamps are not reconstructed, and older executors retain the original bug until upgraded. No product edits or subagents.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Supplemental deep-review and QA evidence for b37a825fbb1afbc375f273b25876b4925894fed7: no blocking finding; recommend merge. COMMENT only, not independent approval of a self-authored PR.
The design remains appropriately scoped: registration, the catalog primary key, task loading and unregistration already use (account_id, table_id, index_name, action). Both existing status UPDATE statements now honor that identity. Error/skipped outcomes preserve last_update_at; success updates the selected task only. No additional storage, state machine, query, transaction, scheduling branch or ordinary SELECT/DML work is introduced. Existing result ownership, commit/rollback and cancellation cleanup remain with their existing owners. The added work is escaping the index name and applying one equality predicate in the existing background UPDATE; this review makes no benchmark speedup claim.
New independent local validation on Linux/x86 with Go 1.27.1 and native artifacts built from the PR head:
- Full
pkg/vectorindex/idxcronpackage: PASS (0.027s). - Temporary single-CN persistence probe: PASS (9.191s), 31 leaf cases. A build-tag-only bridge invokes the unchanged production
saveStatus; committed rows are read independently through the MySQL frontend. Seven name shapes cover quotes/backslashes, SQL-injection-shaped text, empty, Unicode, trailing backslash, literal*, and ordinary text. For success, skipped, error and error-with-updated=true, the probe checks the selected row and verifies status/timestamp preservation for sibling indexes, other accounts, other tables and other actions. Additional cases check a missing target, transaction rollback, and a context cancelled before starting the transaction. - Negative control: replacing only
executor.gowith its merge-base version makes the same success probe FAIL exactly on the sibling row: sentinel status becomesok, and its 2000-01-01 timestamp advances. Restoring the PR version removes this failure. This demonstrates that the probe detects the original defect, rather than merely repeating the implementation's assumptions.
The exact-head CI run is green: Linux UT, ARM64 SCA, coverage, PROXY BVT, multi-CN pessimistic BVT and CI Required. The downloaded UT log includes a passing TestIdxcronQuotedTableRename/catalogCommands, which exercises the actual task executor and sibling-specific error messages. Skipped CI jobs are not counted as executed coverage.
Implementation: +3/-3; tests: +55/-16 (net +39); documentation: no changes. The regression extends existing unit cases and the existing embedded fixture, without another cluster setup. SQL AST assertions and real executor results provide complementary checks; no extra abstraction or compatibility branch is warranted. No actionable unresolved review thread remains at this head.
Limits: the supplemental probe validates catalog persistence, not a native vector-index rebuild or cancellation during an in-flight lock wait. Previously overwritten historical status/timestamps are not reconstructed. All temporary diagnostic sources were archived outside the worktree and removed; tracked source is unchanged. No subagents were used.
…29861) ## What type of PR is this? - [x] BUG ## Which issue(s) this PR fixes: Fixes #29843 Fixes #29864 Fixes #29874 ## What this PR does / why we need it: Malformed UTF-8 identifiers could be admitted into the catalog. Catalog lookups formatted their names with Go `%q`, whose `\xNN` escapes are not decoded as hex by the MySQL scanner. A legacy `t_\xe3g` lookup therefore used `t_xe3g`; DROP DATABASE hit the missing-row cardinality panic. - Extend the existing DDL identifier validator to reject malformed UTF-8 before publication. Check original CTAS/view headings before normalization, cover CREATE SEQUENCE with encoding-only validation while preserving historically supported long sequence names, and keep generated/internal table exceptions restricted to identifier length. - Use the existing `sqlquote.String` helper at every consumer of the seven name-bearing catalog query formats. Lookup, storage fallback, enumeration and deletion retain exact legacy bytes, tenant predicates, table IDs and existing result ownership/cardinality checks. - Preserve raw-byte parsing for legacy object access and string/binary values. Validation targets names published by DDL; ordinary SELECT alias semantics are unchanged. No new validation runs on ordinary SELECT/DML. Additional scans run during DDL validation; quoting changes existing catalog SQL construction and preserve name-based pruning. No new persistent format, state or executor. - Reuse main’s #29866 and #29873 idxcron fixes: retain existing command/status escaping, scalar COUNT existence handling and the complete account/table/index/action status key. Consolidate new error-precedence, owned-result cleanup and exact write-error checks into the existing status test. Add command byte round trips and actual public vector-index lifecycle isolation coverage; remove unconditional raw SQL stderr writes. - Correct the shared `mo_indexes` deletion format and both DROP INDEX / ALTER TABLE DROP INDEX consumers together. Legal quoted index names now delete the intended metadata and maintenance task while preserving competing indexes and table data. No new builder, algorithm branch, schema or scheduler. ### Validation On Linux amd64, Go 1.27.1, with a freshly built/stamped CPU CGo generation: - Reproduced the original admission and DROP DATABASE panic through the actual MySQL protocol on base `4022729da24d71b082c22b52aaed3faba2b77ea5`. - Public protocol regression: malformed CREATE/CTAS/view rejected before metadata appears; legal Unicode, quoted/backslash names and binary prepared parameters preserved. Seeded historical invalid table/database names through the real typed engine interface, then verified DROP TABLE and DROP DATABASE without deleting competing `t_xe3g`/replacement-character tables. - Incremental UT **with `-race`**: existing and new identifier tests; full catalog and MySQL parser packages; actual storage query round trips; existing result ownership/read failure/cancel/cardinality, catalog replay/GC and temporary-schema tests; `TestApplyDeletesFromTombstoneObjects` directly affected consumer. - Incremental SCA on all affected packages: `go vet`, repository-configured golangci-lint v2.14.0 (**0 new issues**) and pinned molint. Molint's existing recover/unsafe diagnostics are confined to files byte-identical to base; no new findings. - Sequence compatibility correction: planner owning package normal (15.586s) and race (92.755s), public catalog regression normal/race, configured incremental lint **0 issues**, and molint without introduced findings. Original sequence case passed twice (**167/167** each); complete sequence directory passed **461/461** in normal comparison mode. Seven ASCII/Unicode/long-name lifecycle controls and short/long malformed-name rejection verified through SQL. Local BVT used one CN; corrected Compose/PROXY CI is pending. - New idxcron/index deletion closure: full idxcron and compile owning packages in normal and race modes; scanner and JSON round trips, error precedence/propagation and result release. Configured incremental SCA covers idxcron, compile and embed; no introduced findings (molint's recover diagnostics are in unchanged baseline files). - Actual MySQL-protocol regression with three databases and three vector rows per table: exact registration names, rejected rename without task changes, two quoted-name renames with stable table IDs/data/metadata, disable/re-enable configuration, backslash-name DROP DATABASE isolation, DROP INDEX and ALTER TABLE DROP INDEX preserving same-table competing indexes/tasks and data, and explicit zero catalog/task residue. Normal and two race executions using the same shared fixture passed. - Actual `gpt-6.1-sol / xhigh` design and complete 14-file final review; its missing final task-cleanup oracle was added and revalidated before delivery. ### Compatibility Historical malformed names remain readable/deletable; creating or renaming to a new malformed name is rejected. This does not sanitize existing catalogs. Admission protection requires upgrading every CN that can author DDL. This does not backfill already corrupted maintenance-task keys: re-registration replaces a row only when its account/table/index/action key matches. CI for the pushed revision is pending.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #29869
What this PR does / why we need it:
mo_index_updateidentifies a task by(account_id, table_id, index_name, action), but idxcron status updates omittedindex_name. A task could therefore overwrite the status of same-table/same-action sibling indexes. Successful reindexing also overwrote theirlast_update_at, which subsequent scheduling reads per index.Both existing UPDATE templates now select the complete task key. The new index-name literal uses the existing
sqlquote.EscapeStringhelper, retaining the escaping fix from #29866. Error/skipped outcomes still write only status; success writes status and the selected task'slast_update_at = now(). Empty index names match literally rather than broadening the predicate.No schema, API, scheduling algorithm, transaction, extra query, or normal SQL/DML execution-path change. The existing registration, reader, and unregistration already preserve the full key. Production changes replace three existing lines (net zero); tests extend two existing cases and reuse the existing single-CN fixture (net +39 lines); no tracked documentation is added.
Validation
Reproduced against main base
03c34f837b1b399587e9d7e7e2f64a92010806e3before the fix:index_namein error, skipped, and success cases.Passed locally using the repository CGo wrapper, Go 1.27.1, CPU native artifacts, and bounded timeouts:
./pkg/vectorindex/idxcronUT, normal and-race(-count=1). Covers complete-key predicates, quoted/backslash and empty names, exact assignment targets andnow(), JSON status, and SQL failure propagation.TestIdxcronQuotedTableRenamein./pkg/embed, normal and-race(-count=1). Real sibling-task persistence plus existing SQL-mode, rename, rollback, register/unregister and tenant cases. Normal 9.457s, race 13.014s; no race report.go vet, repository-pinned molint, configured.golangci.ymlgolangci-lint v2.14.0 with--new-from-rev=03c34f837b1b399587e9d7e7e2f64a92010806e3, over idxcron/embed including tests. All exited 0; lint reports 0 issues. gofmt andgit diff --checkclean.gpt-6.1-solwithxhighreasoning.Performance and scope
The only added work is escaping an index name and evaluating a narrower predicate in the existing background UPDATE. Query/transaction counts are unchanged; ordinary SQL adds no work. No throughput improvement is claimed. The success timestamp contract is checked through the actual generated SQL; this fix does not run or change native vector-index rebuilding.
Previously overwritten status/timestamps are not reconstructed. Older executors retain the defect until upgraded. CI is pending; local validation above is complete.