Repository navigation
test(plan): pin backslash comment replay and dump fingerprint regressions - #31143
Conversation
…ions Main already carries the production repair for matrixorigin#31068: the merged PR matrixorigin#31069 renders stored column/table comments with backslashes doubled for replay (verbatim under NO_BACKSLASH_ESCAPES) through ConstructCreateTableSQL, keeps the historical raw spelling for persisted DUMP fingerprints via ConstructCreateTableSQLForSchemaHash, and pins the display and legacy-archive regressions with its own UT and BVT. Rebase this branch onto that fix: the duplicate production changes and the signature churn of the private constructCreateTableSQL parameter are dropped in favor of the merged implementation, while the regression coverage this branch developed stays, adapted to the merged API: - pkg/sql/plan/show_create_comment_backslash_replay_test.go: catalog-stored comment bytes pinned across default and NO_BACKSLASH_ESCAPES modes including plain, empty, trailing-backslash and quote-adjacent columns; rendered fragment asserts plus their negation, replay idempotence, non-mutation of the input TableDef, and single-literal transport re-parsing. - pkg/frontend/table_dump_comment_fingerprint_test.go: the frozen pre-fix schema and logical-index fingerprints for backslash comments, old-manifest acceptance after the escaping fix, and corrupted-comment/altered-type mismatch controls on tableDumpRelationSchemaMatches. - comment_backslash_roundtrip BVT: replay SHOW output with both-column hex asserts, the NO_BACKSLASH_ESCAPES and plain-comment controls, merged with the upstream legacy dump-fixture and metadata-only DUMP/LOAD blocks. Related to matrixorigin#31068
16783fc to
07876cf
Compare
The BVT runner executes every case script on one shared session, and this script left sql_mode at '' after its NO_BACKSLASH_ESCAPES block, so all later scripts in the same generation lost ONLY_FULL_GROUP_BY. In the 'multi cn e2e bvt docker compose(PROXY)' run that made cte/local_outer_reference.sql rows 379/382 fail with 'correlated columns in aggregate function is not yet implemented': having_binder.go only rebinds aggregate/HAVING correlated columns under mysqlFullGroupByCompat, which requires ONLY_FULL_GROUP_BY in sql_mode. Save the incoming sql_mode before the block and restore it afterwards, the same pattern information_schema.sql and table_func_json_table.sql already use. Verified locally against a 07876cf head instance: running the ordered pair comment_backslash_roundtrip.sql -> local_outer_reference.sql with the CI compare semantics (resource map + nometa) reproduces the CI failure pre-fix (comment 42/42, cte 266/268, rows 379/382) and passes 311/311 post-fix (43/43 + 268/268); genrs output is byte-identical to the committed .result; the full comment group passes 117/117 (18+56+43) with metadata comparison on.
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: 57f93b5873d8b67ac3626b32eec39279e569cb28
Assessment: approve
Reviewed the complete four-file test-only delta and supplied discussions. The tests strengthen stored-byte, replay, nonmutation and legacy dump compatibility coverage through existing owners. Restoring the incoming SQL mode addresses the reported BVT session leak. No actionable defects or production runtime costs were identified.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
Validation:
-
Reused the frozen exact-head successful UT, UT Coverage, PROXY BVT and PESSIMISTIC BVT statuses; checked repository selectors against the affected packages and SQL suite.
-
Local static audit passed: exact head, unchanged source, complete test-only scope, git diff --check, patch correspondence, SQL-mode restoration order and golden hexadecimal values.
-
Reconciled exit-0 receipt checks/1792973359738985169-4.json with review-static-audit.log and review-static-audit.json under the assigned attempt directory. The earlier audit assertion failed only because the supplied patch omitted its terminal newline; original evidence and diagnosis are retained.
-
Detailed design, coverage and evidence assessment retained in review-notes.txt.
Limitations:
-
No local Go tests or BVT were repeated. CI evidence consists of the coordinator’s frozen status snapshot and checked-in selectors; raw CI logs were unavailable.
-
local_validation is empty. Author-local timings, test counts and historical hash-capture provenance were not independently verified.
Merge Queue Status
This pull request spent 49 minutes 46 seconds in the queue, with no time running CI. ReasonThe merge conditions cannot be satisfied due to failing checks
Failing checks: HintYou may have to fix your CI before adding the pull request to the queue again. Waiting for any of
All conditions
Tick the box to put this pull request back in the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
Related to #31068
What this PR does / why we need it:
The production repair for #31068 has already merged into
mainas #31069:stored column/table comments keep their already-doubled quotes and get their
backslashes doubled for replay while backslash escapes are active (verbatim
under
NO_BACKSLASH_ESCAPES), and the persistedDUMPschema fingerprints keephashing the historical raw comment spelling through
ConstructCreateTableSQLForSchemaHash.While that merged upstream, this branch had independently developed the same
regression theme. This PR rebases onto the merged fix, drops the duplicate
production implementation in favor of the merged one, and keeps the
complementary regression coverage this branch produced, adapted to the merged
API:
pkg/sql/plan/show_create_comment_backslash_replay_test.go(new): pins theexact catalog-stored comment bytes through render+replay in both SQL modes
for plain, empty, trailing-backslash and quote-adjacent columns, asserts the
rendered fragments plus their negation, requires replay idempotence
(re-rendering is byte-stable), non-mutation of the rendered
TableDef, andthat the displayed DDL survives single-literal transport encoding.
pkg/frontend/table_dump_comment_fingerprint_test.go(new): freezes thepre-fix schema and logical-index fingerprints for a backslash-comment
fixture, accepts an old manifest (legacy fingerprint) for an unchanged table
after the escaping fix, and rejects genuine mismatches: the corrupted
comment bytes the pre-fix bug produced and an altered column type.
test/distributed/cases/comment/comment_backslash_roundtrip.sql+.result:replay
SHOW CREATE TABLEoutput withinformation_schemahex checks on bothcolumns plus the table comment in both SQL modes, the plain-comment control
and the
NO_BACKSLASH_ESCAPEScontrols, merged with the upstreamimmutable legacy dump-fixture LOAD and metadata-only DUMP/LOAD
fingerprint-mismatch blocks. The case owns and drops its database and stages,
so it is re-runnable, and it saves the incoming
sql_modeinto a uservariable around its
NO_BACKSLASH_ESCAPEScontrol block and restores itafterwards (the pattern
information_schema.sqlandtable_func_json_table.sqlalready use), so the shared mo-tester session isleft in its incoming state for every later script of the same BVT
generation.
All production behavior now comes unchanged from
main; this PR is test-only.Validation
All verification ran on the rebased tree
07876cfdab=origin/main@b160a3895c(which already contains merged #31069) plus this commit; the produced binary contains CommitID07876cfdab(sha256968e0617...). CGo test runs use the repositorymo-cgo-testwrapper.go test -listselection proof:TestShowCreateTableCommentBackslashStoredByteRoundTrip,TestShowCreateTableCommentIsNotMutated,TestShowCreateTableCommentTransport(new inpkg/sql/plan), the merged upstreamTestShowCreateTableCommentBackslashRoundTrip, andTestDumpSchemaHashKeepsLegacyBackslashCommentSpelling,TestOldDumpManifestMatchesUnchangedTableAfterCommentEscapingFix(new inpkg/frontend) plus the upstreamTestTableSchemaHashStoredCommentCompatibility,TestTableSchemaHashStillRejectsCommentAndSchemaDifferencesall listed (non-empty selection).go test -run 'TestShowCreateTableComment' ./pkg/sql/plan- ok 2.527s, exit 0 (replay round trip in both sql modes, fragment/negation asserts, idempotent re-render, non-mutation, transport re-encode).go test -run 'TestDumpSchemaHashKeepsLegacyBackslashCommentSpelling|TestOldDumpManifestMatchesUnchangedTableAfterCommentEscapingFix|TestTableSchemaHashStoredCommentCompatibility|TestTableSchemaHashStillRejectsCommentAndSchemaDifferences' ./pkg/frontend- ok 7.847s, exit 0. The pre-fix fixture fingerprint staysd0f7fd53926c805dd05af3d5dcd2f4f148d8861d539db9a7490aa77e07b061bdunder the mergedConstructCreateTableSQLForSchemaHashpath (schema and logical-index hashes), an old manifest still matches an unchanged table, and corrupted-comment/altered-type mismatches are still rejected.go test ./pkg/sql/plan- ok 256.339s exit 0;go test ./pkg/frontend- ok 54.640s exit 0.genrsregeneratedcomment_backslash_roundtrip.resultbyte-identical to the committed file (zero-diff, every row reviewed against the union of the two upstream expectations); normal comparison run 42/42 exit 0; same-instance repeat run 42/42 exit 0; fulltest/distributed/cases/commentgroup 116/116 exit 0 (annotion18,comment56,comment_backslash_roundtrip42, mo-testererror.txtempty). The legacy$resourcesdump fixture loads with rows intact,FORCE INDEXis honored,LOADrejects the changed-schema target withtarget table schema does not match table dumpand the mismatched table stays empty. Post-run teardown verified:comment_bs_rtdatabase, both stages,/tmpmetadata files all absent; the instance was stopped with SIGTERM and confirmed exited with its listeners released.gofmt -lon all changed Go files - clean;go vetandgo vet -vettool=molinton./pkg/frontend ./pkg/sql/planwith the repository CGo environment - exit 0;golangci-lint run -c .golangci.yml --new-from-rev origin/mainon the two packages - 0 issues (see golangci-rebased log).Follow-up (2026-10-26): fix the compose-proxy BVT failure this branch introduced
CI run
40232128784
('multi cn e2e bvt test docker compose(PROXY)') failed exactly 2 of 49746
statements, both in
test/distributed/cases/cte/local_outer_reference.sql(rows 379/382) with
correlated columns in aggregate function is not yet implemented; every other script in the generation stayed green, includingcomment_backslash_roundtrip.sqlitself (42/42).Root cause: the case's
NO_BACKSLASH_ESCAPEScontrol block ended withset sql_mode = '', mo-tester reuses one session for every script of ageneration (CI log shows
con[id=0]throughout), so the CTE case andeverything later lost
ONLY_FULL_GROUP_BY.pkg/sql/plan/having_binder.goonly rebinds correlated columns in aggregate/HAVING predicates under
mysqlFullGroupByCompat, which requiresONLY_FULL_GROUP_BYinsql_mode;without it the binder returns the NYI error. Commit
57f93b5873thereforesaves the incoming
sql_modebefore the block and restores it afterwards.The same run's
UT Coveragefailure (TestCrossTargetUpgradeRecovery/manual-4.0.13,pkg/embed upgrade-recovery budget flake) is the known family flake tracked in
#31044 and is unrelated to this test-only diff.
New verification for
57f93b5873ran on a fresh isolated instance of the sameproduced binary (
07876cfdab;57f93b5873changes only the two comment BVTfiles, so production behavior is identical):
expected rows (1|1, 2|NULL, 3|0) under the platform default
sql_mode(
ONLY_FULL_GROUP_BY,...), fails with the exact NYI error undersql_mode='', and passes again after the save/restore pattern.$resourcesmapping +nometa), exactly as the CI group orders them: pre-fix reproduction =comment_backslash_roundtrip.sql42/42 andcte/local_outer_reference.sql266/268 with only rows 379/382 failing(mo-tester exit 1); post-fix = comment 43/43, cte 268/268, 311/311 and exit 0.
genrson the fixed case regeneratescomment_backslash_roundtrip.resultbyte-identical to the committed file (zero-diff).
test/distributed/cases/commentgroup with metadata comparison on:117/117 exit 0 (
annotion18,comment56,comment_backslash_roundtrip43).Residual risk
/tmp/mo-comment-backslash-roundtrip-31068/and removes it again in the same script (
remove files from stage ...), thesame path and cleanup the merged upstream case already carries.
the two new UT files and the reworked comment BVT case.