Repository navigation
fix(plan): preserve replayable defaults and dump fingerprints - #31067
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? |
|
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: fe4684700bef44d24786b4fd9b6ff562bc9abd7a
Assessment: request_changes
Reviewed the complete four-file delta and affected callers. Removing duplicate escaping is sound, but changing this shared formatter breaks compatibility with existing DUMP TABLE archives.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
- P1
pkg/sql/plan/build_show_util.go:1689: Create a DUMP TABLE archive before this change for a table containing DEFAULT 'it''s' or a backtick-containing string default, then upgrade and LOAD it into an identically defined empty table.
Impact: LOAD rejects the existing archive with "target table schema does not match table dump" despite unchanged schema. Preserve legacy fingerprint compatibility alongside the SHOW fix and add a pre-fix archive/current-version LOAD regression.
Evidence: tableSchemaHashWithOptions hashes ConstructCreateTableSQL output (pkg/frontend/table_dump.go:357–367); DUMP persists that hash, and LOAD requires exact equality at lines 1722–1723 without a compatibility fallback. This change replaces DEFAULT 'it''''s' with DEFAULT 'it''s' in the hash input. The source-extracted base/head probe confirms fingerprint drift for apostrophe and backtick defaults, with seven unaffected controls.
Validation:
-
Isolation preflight passed; receipt checks/1792911564992648349-2.json matches preflight.log.
-
Source-extracted Go probe passed nine named cases using the supplied test-exec; receipt checks/1792911625154745710-2.json matches default_hash_probe.log and the retained source/probe fingerprint ledger.
-
Independently audited commands, exit codes, logs, fingerprints and clean source status. Evidence and review notes are retained under /home/xupeng/.local/state/mo-bot/jobs/c892eb982311a480903fad9c/attempt-1.
-
Frozen exact-head evidence records successful UT, SCA, coverage and proxy/pessimistic BVT checks; local_validation contains no retained worker gates.
Limitations:
-
The local probe executes extracted formatting helpers with a fixture envelope, not the production DUMP/LOAD entrypoint. The rejection is established by tracing the unchanged production hash comparison.
-
Native package tests and a cross-version server restore were not run; raw CI logs were not supplied.
-
Removing escaping scans should reduce formatting work; no performance benchmark was run. Ordinary SELECT/DML execution does not call this helper.
fe46847 to
150681f
Compare
Resolve table_dump.go conflict with matrixorigin#31069: a single ConstructCreateTableSQLForSchemaHash now keeps both legacy comment bytes and legacy string-default bytes for DUMP fingerprints.
|
@XuPeng-SH thanks for the P1. It's addressed on the current head:
Local:
|
|
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: 34c28052c0439eefe8e52020c333e3ccda10556f
Assessment: approve
Reviewed the complete 19-file delta and affected callers. The shared renderer correctly separates replayable DDL from historical DUMP fingerprint bytes, uses the actual consumer’s parser mode, and preserves shared metadata ownership. The previous archive-compatibility finding is resolved. No actionable defects remain.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
Validation:
-
Isolation preflight and native provenance verification passed; 192 native inputs matched this revision.
-
Fourteen focused planner/frontend tests passed, covering four SQL modes, malformed defaults, metadata immutability, historical default/comment hashes and fallback paths. Receipt checks/1792983129419388710-4.json matches focused-tests.log.
-
TestQuotedDefaultDumpRoundTrip and all 11 subtests passed through the real SQL frontend: historical archive LOAD, current DUMP hashes, incompatible-schema/hash rejection, repeated SHOW replay, CREATE LIKE and ALTER COPY/charset conversion. Package duration: 8.204s. Receipt checks/1792983178153537132-3.json matches public-sql.log.
-
Frozen exact-head evidence records successful UT, SCA, coverage and proxy/pessimistic BVT checks. Broad CI coverage was reused.
-
Final audit reconciled commands, source fingerprints, exit receipts and retained logs; source remained clean. Evidence is retained in /home/xupeng/.local/state/mo-bot/jobs/3494f94ddca8a528a7493152/attempt-1/review-audit.json. Fixture checksums passed; the separate whitespace diagnostic flagged only intentional trailing empty BVT result fields.
Limitations:
-
Raw CI logs and retained author gates were not supplied; local checks independently verified the changed behavioral paths. The linked issue body was absent from the frozen evidence.
-
Historical compatibility validation covers the captured pre-fix archive and frozen hash cases, not every historical release or a live mixed-version upgrade.
-
No throughput benchmark was run. Ordinary SELECT/DML execution gains no new work; additional scalar parsing is confined to rendering backslash-containing defaults for NO_BACKSLASH_ESCAPES.
Merge Queue Status
This pull request spent 49 minutes in the queue, with no time running CI. ReasonPull request #31067 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Waiting for any of
All conditions
Tick the box to put this pull request back in the merge queue (same as
|
…ity (matrixorigin#31066) The once-escaped SHOW CREATE TABLE string-default fix for matrixorigin#31066 landed on main in matrixorigin#31067 (4769417), which renders executable DDL defaults from the stored OriginString and keeps the historical DUMP fingerprint rendering. That supersedes this branch's previous competing re-quote rendering, which the review showed corrupted assignment-padded binary defaults, so the branch now rebases onto the merged implementation and carries test-only deltas on top of it. Added on top of main: - planner: TestShowCreateReplayKeepsAssignmentPaddedBinaryDefault pins the review P2 for matrixorigin#31066. `binary(8) DEFAULT 'a'` binds a NUL-padded Sval while the stored default text stays 'a'; SHOW CREATE must print the stored text, replaying the printed DDL re-binds the same OriginString/Sval, the second SHOW cycle is idempotent, and the schema-hash input of the replayed table stays equal to the source's, so an archive keeps loading into a target rebuilt from SHOW output. The same test fails on the superseded re-quote head (e73f3a3), which printed and re-bound the padded spelling. - frontend: TestTableDumpPaddedBinaryDefaultReplayHashMatchesManifest and TestTableDumpPaddedBinaryDefaultRejectsPaddedSpelling pin the manifest/hash gate the P2 broke: a replayed target hashes equal to the manifest and is accepted, while the padding-spelling default text the superseded rendering produced is a genuinely different schema and is rejected. - BVT: keeps show_create_table_default_quote (dml/show), whose information_schema column_default/hex parity between source and replayed tables complements the merged cases/ddl pair.
…ts (#32449) ## What type of PR is this? - [x] BUG - [x] Test and CI ## Which issue(s) this PR fixes Backport of #31067 for #31066 on `4.2-dev`. ## Why 128 nightly [run 42641191428](https://github.com/matrixorigin/mo-nightly-regression/actions/runs/42641191428/job/129245352973), MO `ba2a0caee86dd0f660776560a2a68943abb11df2`, passed the actual TPCH 10G dump/import row and schema checks, but failed the independent post-restore default-value oracle: apostrophes and backticks were doubled after replaying SHOW CREATE TABLE. ## Branch-specific backport Originally based on `4.2-dev@bf15b1c`, subsequently synchronized by Mergify to `9dd4d33e2bf3353ac66f62105f9093c8032e6ed2`; adapted from main commit `4769417cdce5531c9771644eca49f1e71d8f654c` rather than importing unrelated main-only charset/DDL infrastructure. - Executable DDL preserves the canonical stored default SQL; NO_BACKSLASH_ESCAPES rendering and the returned AST use the same target mode. - ALTER COPY renders for its ordinary-mode internal executor, not the caller's session mode. - DUMP TABLE hashing keeps **the exact existing 4.2 escaping policy** through a separate hash-only renderer. Main's newer logical/physical hash fixtures are not substituted for 4.2's schema hash. - Backport the SHOW CREATE BVT and focused planner tests; add 4.2-specific frozen SQL/hash assertions, metadata immutability and genuine-schema-change controls. Cover repeated replay, empty/quoted/backslash/NULL/BINARY defaults and four SQL modes. ## Validation - Go formatting and `git diff --check` for Go/SQL passed. The copied upstream BVT `.result` deliberately preserves trailing spaces for its empty-string output column. - On exact PR SHA `30295d25dfc032e6b4966648b907a5fe321d3075`, the following focused tests passed with `-count=3` on macOS arm64 / Go 1.26.5: - `TestShowCreateTableStringDefaultRoundTrip` - `TestDefaultWithoutBackslashEscapesRejectsInvalidScalar` - `TestAlterCopyDefaultUsesInternalParserMode` - `TestTableDumpDefaultHashesPreserve42` - `TestTableSchemaHashIgnoresIdentity`, `TestTableSchemaHashExpandsCreateLike`, `TestTableSchemaHashFallback` - The final frontend test link initially exhausted local disk; its successful retry used `-ldflags=-w` only to omit local test-binary debug symbols. No product build flags, assertions or timeouts were weakened. Native dependencies came from the existing local MatrixOne build. The BVT file has been backported but not independently executed yet. - Dispatched [targeted acceptance run 42750895237](https://github.com/matrixorigin/mo-nightly-regression/actions/runs/42750895237) using exact PR SHA `30295d25dfc032e6b4966648b907a5fe321d3075` from `Ariznawlll/matrixone`, regression workflow `main@d00e9351280da05a4d7f88e059a60e6c77a9e8f0`, `Run_Mode=modump-only`. It covers default-value SQL dump/restore plus TPCH 10G nation/customer/orders export, ordinary-tenant import, full row/schema checksums and owner-scoped cleanup. Status: in progress, not yet accepted. - No full regression, TPCC/Sysbench/SSB/Vector/CDC test is requested. No timeout increase or weakened assertion. Remote verification results will be linked when available. Remote acceptance is pending; this is not a claim that the PR or mo-dump run is fully green. Approved-by: XuPeng-SH <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #31066.
What this PR does / why we need it:
Preserve string defaults when replaying SHOW CREATE TABLE, while keeping existing DUMP TABLE schema fingerprints compatible. Executable DDL uses canonical default SQL; historical fingerprint rendering retains its exact previous escaping and whitespace rules. Legacy charset normalization copies changed column shells instead of mutating shared catalog metadata.
Also fix the ALTER COPY regression exposed by CI: under NO_BACKSLASH_ESCAPES, adding
DEFAULT 'a\b'generated session-mode SQL that the ordinary-mode internal executor decoded as a backspace. Both COLUMN_DEFAULT and actual inserted values were wrong. The shared renderer now takes its target parser mode explicitly: COPY uses ordinary mode; SHOW and existing AST consumers keep their matching reader/parser modes. No executor, protocol, stored format, cache or retry changes.Rebased onto main
6c53cf0ce2. The identical public SQL passed on exact-main source, failed on the unfixed rebased PR (HEX6108), and passed after correction (HEX615C62for both metadata and inserted values).Local validation (macOS arm64, Go 1.27.1):
No work is added to ordinary SELECT/DML. The mode flag is computed once per rendering; COPY avoids the unnecessary per-default mode conversion. No throughput benchmark is claimed. Historical fixtures certify their captured archive format, not every historical release. New-head CI remains pending.