Skip to content

[4.2-dev] Preserve ENUM definitions across schema rebuilds and honor explicit redefinition - #32887

Merged
XuPeng-SH merged 4 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:codex/32886-42-enum-writer
Nov 18, 2026
Merged

XuPeng-SH merged 4 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:codex/32886-42-enum-writer

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Nov 18, 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 #32886 and #30771. Binary collation assignment is tracked in #32814.

What this PR does / why we need it:

Preserve the catalog's ENUM member order and encoding through LIKE, CLONE, ALTER COPY, TRUNCATE, partition rebuilds, and Data Branch output. A v4.2.8 table originally declared as ENUM('a,b','c') can store c as ordinal 3. Reconstructive DDL keeps that ordinal by taking the effective definition from the typed catalog.

On 4.2-dev, an explicit declaration uses the existing 4.2 writer. Ordinary ENUM('a','b') still writes a,b in legacy encoding. Framing is used where exact legacy representation is impossible, including comma-bearing members and the singleton empty member. Explicitly redefining a released ENUM('') with DEFAULT '' therefore writes a framed definition, and inserts using the default store ordinal 1. Copying that legacy column without redefining it keeps the original pair. The ordinary writer continues to use the existing lookup and comparison paths.

Data Branch ENUM output preserves the caller's identifier casing for CREATE, INSERT, and failure cleanup. A same-name temporary table is rejected before CREATE. Partition fan-out reuses the same inherited definitions across children.

Validation

The local SQL checks cover a real v4.2.8 fixture, legacy empty ENUM redefinition and default insertion before and after restart, legacy partition rebuild and expansion, new comma-bearing members, and mixed-case branch output with temporary-table collision handling. A standalone v4.2.8 round trip created and wrote an ordinary ENUM on the candidate, then reopened the same data on v4.2.8 and verified labels, ordinals, and default insertion. The focused tests check copied versus explicitly redefined types, legacy default replay, and failure cleanup after cancellation.

Both targeted ENUM SQL suites passed all 170 checks. Owning-package race and incremental vet and lint checks passed. The repository molint diagnostics in the affected scope match the baseline.

Rollback to v4.2.8

This procedure covers the ENUM format introduced on 4.2-dev. Use the exact v4.2.8 binaries and compatible configuration for the whole cluster. Check other changes in the deployed build independently.

1. Determine whether the current data can be reused

On the upgraded cluster, run this read-only check as an administrator for each tenant with visibility into its complete current column catalog. Run it again after writes and DDL are paused.

SELECT att_database, att_relname, attname,
       SUBSTRING(HEX(atttyp), 13, 4) AS enum_encoding
FROM mo_catalog.mo_columns
WHERE SUBSTRING(HEX(atttyp), 1, 4) = '0042'
  AND (LENGTH(atttyp) <> 20 OR SUBSTRING(HEX(atttyp), 13, 4) <> '0000')
ORDER BY att_database, att_relname, attname;

The query checks the ENUM type identifier and encoding bytes in this version's current catalog. Any result blocks direct rollback. An empty result must be backed by deployment history showing that no encoding-1 definition or dependent expression was committed anywhere in the deployment. Include retained snapshots and historical metadata in that assessment. The query alone cannot detect a framed column that was later dropped or changed.

Ordinary ENUM('a','b') uses encoding 0. A comma-bearing member such as ENUM('a,b','c'), a new ENUM(''), or an explicit redefinition of a legacy singleton empty ENUM can commit encoding 1. An empty table can already cross that boundary.

2. Direct rollback when the compatibility check passes

  1. Pause application writes, schema changes, and background jobs that can write to the cluster. Let in-flight work finish or roll back. Record the last committed business write and capture representative results from the upgraded cluster, including row counts, primary keys, HEX(CAST(enum_col AS CHAR)), enum_col + 0, and NULL values. Record rows written since the upgrade. Repeat the catalog check while traffic is paused.
  2. Stop every cluster service. Preserve a complete, consistent copy of the stopped upgraded storage, including catalog, object storage, and log data. Keep the upgraded binaries and configuration available. Retain the pre-upgrade backup if one exists.
  3. Start the exact v4.2.8 binaries against a separate writable copy of that stopped state. Isolate the rehearsal from production writers and storage. Compare schemas and the recorded rows, including upgrade-period writes. Check a default insert and any business-critical ENUM assignment on this rehearsal copy. An instance that starts can still misread labels. Any startup error, mismatch or unexpected SQL error ends the direct rollback attempt.
  4. Once the rehearsal passes, start the v4.2.8 deployment from the verified stopped state using the v4.2.8 configuration. Recheck the last committed business write, representative ENUM results, and application health before reopening traffic. If verification fails before reopening writes, return to the preserved upgraded deployment and storage.

The tested case is a local standalone round trip. The candidate created an ordinary ENUM table and committed rows. v4.2.8 read those same labels and ordinals and accepted another insert using the default.

3. Recovery when encoding 1 exists or history is uncertain

  • With a pre-upgrade backup. Restore it to a separate v4.2.8 deployment, verify the recovery point and ENUM values, then reconcile subsequent writes using a trusted change log or upstream source. Replay only v4.2.8-representable changes before cutover. Keep the newer deployment intact until verification completes.
  • Without a pre-upgrade backup. Keep the upgraded binaries and take a verified backup of the current state. If v4.2.8 has already opened that state, stop it, preserve the data, and reconcile any writes made while it was active. Recover to a separate v4.2.8 instance through logical export and import only when the definitions are representable or the application accepts a schema change. Verify member order, label bytes, ordinals, NULL, ordinal 0, defaults, and dependent schema before cutover. A backup taken now preserves the upgraded state. It cannot recreate the pre-upgrade state.

v4.2.8 can interpret a framed payload as literal member text, causing silent wrong labels, invalid-ordinal errors, or accepted writes with unintended meaning. If faithful migration cannot be verified, continue running the upgraded deployment.

Review findings · Data Branch review

@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 →

@mergify

mergify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · superseded

Commit: 83c1e7389aa29eae98ffddf39015061867073da6

Review linked issue or PR description changed before publication; a fresh contextual review is queued.

@XuPeng-SH

XuPeng-SH commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 83c1e7389aa29eae98ffddf39015061867073da6

Review completed. Read the assessment.

@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.

mo-bot review · mo-bot-local · review

Commit: 83c1e7389aa29eae98ffddf39015061867073da6

Assessment: request_changes

The ENUM writer reuses the tagged codec and preserves released ordinal mappings through the typed catalog. The updated recovery guidance correctly distinguishes logical migration from direct rollback. Data Branch output still needs consistent identifier casing across CREATE, INSERT, and cleanup.

Model: gpt-6.2-sol / xhigh

Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0

  • P2 pkg/frontend/data_branch_output.go:914: Run DATA BRANCH DIFF OUTPUT AS with an ENUM column, a mixed-case destination, and lower_case_table_names=0.
    Impact: CREATE uses the lowercased name while INSERT and cleanup use the requested name. An empty diff can report success under a name the user cannot resolve. A failed INSERT can leave the lowercased table behind.
    Evidence: The exact-head probe observed the CREATE helper pass diffout to ExecStmt for the requested name DiffOut. The lowercase control passed. CREATE hardcodes parser mode 1, while INSERT at line 720 uses parserLowerCaseTableNames(ses). Use that same identifier-casing setting for CREATE.

Validation:

  • Verified the frozen head, merge base, patch, linked issues, and all four discussion entries. Compared the released v4.2.8 writer and reader with the candidate. See checks/1794984192542682072-2.json.

  • Reconciled the earlier exact-head preflight, receipts, and logs under recovered-same-head/. Six owning package suites passed: types, partition service, parser tree, planner, SQL function, and executor.

  • The retained Data Branch probe reproduced the mixed-case mismatch. The lowercase control, stored-ENUM INSERT test, and focused ALTER COPY and TRUNCATE tests passed. See recovered-same-head/diff-output-case.jsonl and its receipt 1794983934019570128-2.json.

Limitations:

  • The Data Branch probe observed the AST handed to the executor. INSERT and cleanup effects were traced in source.

  • The full frontend suite timed out, and the full compiler suite recorded three Parquet fanout failures.

  • Release restart, physical restore, distributed SQL, race, and performance results were author-reported.

@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.

Request changes on a4591fd7e3 against 4.2-dev merge base 1920dc5c25.

  1. P2. An ALTER can commit a default that makes future inserts fail. Create CREATE TABLE t(id INT PRIMARY KEY, e ENUM('')) on v4.2.8, insert one row with a NULL ENUM, shut down, and open the data on the candidate. Run ALTER TABLE t MODIFY e ENUM('') DEFAULT '' and then INSERT INTO t(id) VALUES (2). Both binaries accept the ALTER. The base accepts the INSERT and returns ('', 1). The candidate rejects the INSERT with 20101, item is not in enum []. The ALTER uses ordered-member equality to preserve the legacy encoding, while the legacy empty payload has no members in the runtime coercion path. Keep the legacy domain for copies of an existing column. For an explicit redefinition, preserve the old encoding only if its assignment semantics also match the new definition. Add a regression using a released-format fixture that checks the committed default and the subsequent INSERT. ALTER decision · Runtime empty-domain rule

  2. Design blocker. A routine CREATE activates a new persistent format on the 4.2 maintenance branch. The base already uses framed encoding where the older writer cannot represent the members exactly. This PR also converts ordinary ENUM('a','b') to that encoding. The downgrade rehearsal demonstrates a user-visible consequence: v4.2.8 starts, ordinal 1 displays 2#1:a1:b, and ordinal 2 raises 20101. The release compatibility guidance requires new on-disk formats to be opt-in. Keep the existing representation for definitions that already round-trip on 4.2.8, unless the release owner explicitly accepts that routine DDL activates the newer format. The rebuild fixes can stand on their own. The recovery procedure documents the consequence after the format is used. Writer

Previous feedback. The mo-bot casing finding is resolved. The current head's SQL probe preserves EmptyDiff and FullDiff, including a quoted ENUM label and ordinal. A temporary destination collision returns 1050 and leaves the existing row readable. The injected failure test checks the exact DROP destination after caller cancellation and preserves both errors. Prior finding

Cost and scope. The delta adds 199 production lines and removes 51, adds 175 test/result lines and removes 47, and adds 7 design lines and removes 3. Carrying the existing catalog type through reconstructive DDL has a clear purpose. The tests exercise distinct release-schema, identifier, and failure behavior. Some of the added plumbing follows from sending ordinary columns through the new format. The design amendment should define where the legacy reader's metadata equality differs from assignment equivalence. The integration coverage needs the ALTER and default case in finding 1.

The batched conversion benchmark isolates runtime value conversion. The new default also affects schema comparison. On this head, a focused Go benchmark comparing identical domain payloads measured 17 ns and zero allocations for 128 legacy members, versus 948 ns and 2,304 bytes allocated for the same members in framing. At 4,096 members it measured 489 ns versus 30.8 µs and 64 KiB allocated. These are helper measurements, with end-to-end planning impact unmeasured. If ordinary definitions move to framing, measure planning and type comparisons at realistically large domain sizes. Preserve malformed-frame rejection when removing redundant decode or allocation work. Equality path

Reviewed the complete diff, the linked release contract and comments. Used a pinned v4.2.8 fixture and tested the new ALTER/default counterexample on the base and candidate. Also checked legacy partition expansion and a fresh ENUM unique-index lookup as controls. CI failures were excluded from the decision.

@XuPeng-SH

XuPeng-SH commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · superseded

Commit: a4591fd7e3c22bc4cf561a18df9eb25425778b52

PR closed or head changed

@XuPeng-SH XuPeng-SH changed the title [4.2-dev] Use one writer for new ENUM definitions and preserve released ordinals [4.2-dev] Preserve ENUM definitions across schema rebuilds and honor explicit redefinition Nov 18, 2026
@XuPeng-SH

XuPeng-SH commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · superseded

Commit: 9e6f8eae11eac6c60c5c9a3a5058042bf2b4cf68

Review discussion changed before publication; a fresh contextual review is queued.

@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.

Approve 9e6f8eae11 against 4.2-dev merge base 1920dc5c25. No remaining merge blockers in the reviewed scope.

  • The Data Branch finding is resolved. Empty and populated ENUM output use the requested mixed-case destination. The failure test checks exact-name DROP after cancellation and propagation of both errors. The SQL collision test returned 1050, left the temporary row readable, and created no permanent table.
  • Both subsequent findings are resolved. Explicitly redefining a released ENUM('') fixes assignment of the empty label. Omitted-column inserts stored ordinal 1 both before and after restart. Ordinary declarations retain the legacy encoding, and the standalone v4.2.8 round trip read both rows created on the candidate and used the declared default.
  • Additional public SQL checks covered repartitioning and adding a partition with a comma-bearing member, a quoted label, and an adjacent SET column. Existing and new rows retained their labels and ordinals. An ALTER that removed an in-use padded member failed as expected, preserved the original row bytes and ordinals, left no copy table in the catalog, and allowed subsequent writes to the original table. Legacy ordinal 3 also survived partition redefinition and new inserts.

The typed catalog remains the source of truth. Reconstructive DDL passes a statement-local map of existing types to the CREATE planner and validates it there. The partition path shares that map across children and restores the borrowed partition option before freeing the parsed parent statement. The runtime codec and ordinary type-comparison paths match the base. The extra work is in DDL and Data Branch output, including validation of inherited members and a single temporary-name lookup per typed output CREATE. The previous helper benchmark for making every ordinary definition framed no longer describes the ordinary path. End-to-end performance was not rebenchmarked in this review.

The full delta is +191/-32 production lines, +174/-21 test lines, and +7/-3 design documentation lines. The production changes cover distinct reconstruction paths and share the same catalog contract. Tests cover legacy default replay, explicit redefinition, and independent output failure cases. The rollback guidance distinguishes normal legacy-encoded declarations from columns that require framing. Retain that boundary as a release constraint. CI status was excluded from the decision.

@XuPeng-SH

XuPeng-SH commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 9e6f8eae11eac6c60c5c9a3a5058042bf2b4cf68

Review completed. Read the assessment.

@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.

mo-bot review · mo-bot-local · review

Commit: 9e6f8eae11eac6c60c5c9a3a5058042bf2b4cf68

Assessment: approve

Schema rebuilds reuse the catalog’s ENUM definitions and preserve released ordinal mappings. Ordinary declarations retain legacy encoding, while explicitly redefining a singleton empty ENUM uses framing so its default can store ordinal 1. Data Branch now uses consistent identifier casing for CREATE, INSERT, and cleanup.

Model: gpt-6.2-sol / xhigh

Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0

Validation:

  • The frozen source matched the supplied patch and passed git diff --check. Isolation preflight and the native prerequisite build passed. See source-audit.log, preflight.log, and native-build.log with receipts checks/1794990689509420958-3.json, checks/1794990659401926099-3.json, and checks/1794990729694823197-3.json.

  • The types, partition service, parser tree, planner, and executor package suites passed, including released default replay and explicit singleton-empty redefinition. See owning-packages.jsonl and checks/1794991121779741814-3.json.

  • Focused frontend and compiler tests passed, including Data Branch identifier casing, temporary-table collision handling, and cleanup after cancellation. See frontend-compile-focused.jsonl and checks/1794991129666614376-3.json.

  • Compared the released v4.2.8 ENUM writer and reader with the candidate and accounted for all ten discussion entries in discussion-assessment.json.

Limitations:

  • The release restart, partition SQL, and standalone rollback observations come from the supplied same-head review. Local execution covered Go tests.

  • CI was still in progress in the supplied snapshot. Binary-collation assignment and HEX semantics remain separately tracked.

@XuPeng-SH
XuPeng-SH merged commit 971bbf2 into matrixorigin:4.2-dev Nov 18, 2026
@XuPeng-SH
XuPeng-SH deleted the codex/32886-42-enum-writer branch November 18, 2026 08:47
XuPeng-SH added a commit that referenced this pull request Dec 1, 2026
…32824)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [x] Code Refactoring

## Which issue(s) this PR fixes:

Addresses #32814 on `4.2-dev` within the scope in #32886. The
schema-rebuild fix shipped separately in v4.2.9 (#32887).

## What this PR does / why we need it:

- Resolve ENUM assignment using the destination column's ordered domain
and effective collation. Copying binary `ENUM('A','a')` into
`ENUM('a','A')` stores `A` at ordinal 2 and `a` at ordinal 1. Numeric
conversion after GROUP BY recovers ordinals with the source domain's
collation.
- Normalize newly declared, explicitly collated ENUM labels before
encoding. CREATE, ADD, MODIFY and CHANGE trim only trailing ASCII spaces
and reject duplicate labels using the assignment collation. Partition
children use the normalized parent type. Typed reconstruction and bare
ENUM authoring preserve their existing rules.
- Carry explicit assignments through planning, typed catalog
reconstruction, bulk input, and ALTER COPY. SHOW FULL COLUMNS and
INFORMATION_SCHEMA.COLUMNS expose the effective explicit collation. The
4.0.6 offset-6 upgrade refreshes persisted COLUMNS views for existing
tenants. On retry, the migration checks the catalog’s lowercase view
name and retains an already-current definition.
- Keep legacy ENUM lookup and DUMP/LOAD TABLE v1 hashes. DUMP and LOAD
reject typed ENUM columns at schema admission because v1 hashes do not
encode their assignment identity. An old archive's `create_sql` records
the original statement, which can contain a collation the original
version ignored.
- Reconstruct checkpoint DDL from the persisted type. DDL-only export
retains the collation. Single-table and batch LOAD DATA scripts reject
typed ENUM before exporting CSV because a numeric-looking member can be
confused with an ordinal.

- Reject source tables with explicitly collated ENUM columns when
initializing a MatrixOne or MySQL CDC SQL sink. The existing serializer
quotes an ordinal, so a target ENUM can interpret it as a
numeric-looking member label. Admission records a permanent diagnostic
on the source table before target schema or data changes.

## Verification on the rebased 4.2-dev head

Head `d9d8fcbd71` is based on `6afdb0cbb9`. The original assignment case
still stores `A / 2` and `a / 1` across reordered binary domains.

- The previous PR head stored `h / 8` via INSERT and `j / 10` via LOAD
DATA for the same string `'010 '`. The new MySQL-wire regression also
failed on the rebased control `6e95873f54`. Both writes now store `h /
8` for binary and general_ci columns. Numeric-looking labels take
precedence, strict imports reject invalid ordinals atomically, and
legacy CSV still reads `'010'` as decimal 10 and accepts zero. [Review
finding](#32824 (review))
- The same 134,577,988-byte file was imported with parallel mode enabled
and disabled. Both stored 10,923 rows of `h / 8`, 10,923 of `j / 10`,
and 10,922 of the declared label `0x2 / 1`. In five paired parser
microbenchmarks, a hexadecimal fallback (`'0x8 '`) went from two heap
allocations per cell to zero. Ordinary labels and decimal input stayed
at zero.
- The rebase keeps #32497's shared ALTER COPY key check and CDC
cancellation context. COPY index lifecycle and the ENUM restart test
passed over MySQL TCP. A live MatrixOne CDC sink recorded a permanent
error for an explicitly collated ENUM before creating its destination
database. A bare ENUM replicated as `b / 2`.
- The candidate opened a v4.2.8 cold backup and the stopped data
directory from the official v4.2.9 writer. The catalog moved from
4.0.6/5 to 4.0.6/6. Reopening preserved legacy bytes and ordinals,
including a valid empty label and the error ordinal. After the v4.2.9
upgrade, new binary columns retained the reordered assignment before and
after restart.
- All 11 owning Go packages passed their short suites. `types`,
`external`, `plan` and `cdc` ran in full under `-race -short`. The ENUM
wire and restart suite also passed under `-race` and independently with
scoped coverage instrumentation. `go vet` and incremental golangci-lint
passed across all 21 changed Go packages, with zero incremental lint
issues. The repository-pinned molint reported the same nine existing
`recover()` diagnostics on the clean base and the candidate.
Regenerating the plan protobuf from the merged schema reproduced the
committed file byte for byte.
- Nine BVT fixtures passed 888 statements with values compared and two
configured skips. With strict JDBC metadata enabled, 883 passed and the
five failing system-variable column headers matched the clean
`6afdb0cbb9` baseline exactly. All row values matched.

<details>
<summary>Earlier assignment, upgrade and benchmark results</summary>

This round verified `75bc4698f8` on base `167a1a9199`. The
conflict-update control is `0e18d0e28d`, the original PR rebased onto
that base. The execution-plan comparison uses its subsequent revision
`fbd0529ae2`.

- INSERT, UPDATE and duplicate-key updates now use the same assignment
builder. When the ordered domain and collation agree, the planner copies
the ordinal. For differing domains it binds one typed conversion using
the source ordinal, source members and destination lookup. Over MySQL
TCP, `EXPLAIN VERBOSE` went from two references to the same source
column inside a CASE to one reference in that conversion. Copying 65,536
alternating binary labels produced exactly 32,768 rows each at `41 / 2`
and `61 / 1` (hex bytes / ordinal).
- SQL regressions check NULL, the error ordinal zero, a valid empty
member, statement rollback and IGNORE when the destination cannot accept
a source label. The original two-, three- and four-argument lookup
expressions also execute over MySQL TCP.

- Reproduced two conflict-update failures over MySQL TCP on the control.
A literal `e='A'` failed with error 20203. Assigning
`e=VALUES(incoming)` copied ordinals across differently ordered binary
domains, silently interchanging the labels. The final head binds the
ordinary and duplicate-key assignment paths to the destination ENUM
definition. Literal, prepared, incoming-column, ordered existing-column
and DEFAULT assignments passed, including full-statement rollback on a
bad label. This also covers the ENUM portion of #33281.
- The types package owns scalar and indexed label resolution. DDL
duplicate checks and the planner's projected-order reversibility check
use the same member keys. Constant vector domains and collation tags are
validated once per batch. Tests cover Unicode weights, malformed UTF-8,
numeric-looking labels, legacy narrowing and invalid collation tags
under IGNORE.
- The official Linux/arm64 v4.2.9 binary (`6c05e42`) wrote `61 / 1` for
both differently cased source labels. A stopped upgrade using its data
directory moved an existing tenant from catalog 4.0.6/5 to 4.0.6/6.
Previously stored `6120 / 1` and `61 / 2` rows survived upgrade, ALTER
COPY and restart. Copying the released source to a newly declared binary
destination stored `41 / 2` and `61 / 1` before and after restart. A
separate restored v4.2.8 cold backup retained ordinals 2, 0 and 3,
including both empty-display cases, and retained the legacy lookup on a
subsequent write.
- All 11 owning Go package suites passed with `-short
-tags=matrixone_test`. Targeted `-race` tests covered assignment, the
MySQL TCP restart test, the composite index regression and CDC sink
admission. The restart test also passed with scoped coverage
instrumentation. The four changed BVT fixtures ran with the Compose CI
runner options and passed 530 assertions with two configured skips. Five
further BVT fixtures covering ENUM domain round trips, ENUM and SET
index maintenance, SET and geometry passed 358 assertions. Incremental
static analysis reported zero issues across the 22 changed Go packages.
Plan protobuf regeneration was verified on `fbd0529ae2`; its schema and
generated code are identical on this head.

The following medians compare five alternating runs of the text lookup
at `0e18d0e28d` and `fbd0529ae2` on the same Darwin/arm64 host with Go
1.26.4 and one CPU. The workload assigns unaccented uppercase inputs to
accented general_ci members. The large batch includes index
construction.

| Rows / labels | Control time per batch | Shared lookup time per batch
| Heap allocations per batch |
| --- | ---: | ---: | ---: |
| 1 / 8 | 283 ns | 163 ns | 9 → 0 |
| 16 / 8 | 2.76 µs | 1.60 µs | 88 → 0 |
| 1,024 / 64 | 45.2 µs | 35.6 µs | 1,094 → 68 |

### Additional validation on earlier revisions

- Released v4.2.8 and v4.2.9 reproduced the original assignment error.
Earlier stopped upgrades from both releases preserved existing ENUM rows
and lookup behavior.
- The stopped-upgrade validation used an actual v4.2.9 offset-5 catalog
with an existing tenant. The stopped upgrade refreshed COLUMNS at offset
6, preserved legacy bytes and ordinals, and reports both explicit
collations. The actual v4.2.9 full v1 archive restored into a legacy
table; the explicit-collation target was rejected and remained empty.
- The rebuilt checkpoint CLI read on-disk data. SHOW CREATE and DDL-only
preserved the member list and collation. CSV exported the original
ordinals, and both single-table and database restore scripts refused the
ambiguous load before output creation.
- Local race tests passed for the affected packages, including planner,
partitionservice, bootstrap and the MySQL-wire regression. The latter
covers partitioned assignment, padded ADD and MODIFY, failed duplicate
reauthoring, grouped numeric conversion, metadata, DUMP/LOAD admission
and catalog reopen. The pre-CDC head passed repository SCA.
- The four BVT fixtures affected by the updated COLUMNS metadata passed
locally (530 assertions, two configured skips). This covers the width
and view definition mismatches in the prior [Compose Pessimistic
job](https://github.com/matrixorigin/matrixone/actions/runs/45945393691/job/140331714011)
and [Compose Proxy
job](https://github.com/matrixorigin/matrixone/actions/runs/45945393691/job/140331713990).
Hosted CI on the new head runs separately.

- Live MatrixOne CDC reproduced the source label/ordinal `a / 2`
arriving as `2 / 3` on the preceding head. On the new head, the typed
tasks reported permanent table errors. An existing destination row kept
its original label/ordinal and a fresh destination database was not
created. The bare ENUM control still replicated. The CDC and frontend
owning suites passed with `-race -short -tags matrixone_test`.
Incremental SCA reported zero issues across the complete rebased diff.

- The embedded ENUM recovery test gives each cluster start its own
bounded SQL context. The previous [coverage
failure](https://github.com/matrixorigin/matrixone/actions/runs/45963415497/job/140392146674)
expired the original SQL context while the cluster recycled. The test
still performs a full restart and checks persisted labels, ordinals, and
write lookup.
- At `0cfd6e26e8`, the entire MySQL-wire ENUM test passed locally under
`-race` and independently under `-covermode=set` with scoped
instrumentation. Incremental SCA was clean against `4.2-dev` at
`0e568746d2`. The rebase includes the separate publication-test fix in
#33400. Hosted checks run on the new head.

<details>
<summary>Released-catalog upgrade and retry evidence</summary>

Stopped v4.2.9 Linux x86-64 binary `6c05e42` and started candidate
`388aac15c1` with the same launch configuration and data directory. The
release executable SHA-256 was
`d76fcc947ee73bc8a6ada94c437910c40a12d52af1a67d55ad0d2708f51d79e4`.

The existing tenant saved `ENUM('a ','a') COLLATE utf8mb4_bin` with
declared members as understood by the release. Seeded ordinals through
both numeric and text inserts. `SELECT id, HEX(CAST(e AS CHAR)), e+0
FROM legacy ORDER BY id` returned the same rows before upgrade, after
upgrade, and after restart and manual retry.

| id | HEX | ordinal |
| --- | --- | --- |
| 1 | 6120 | 1 |
| 2 | 61 | 2 |
| 3 | 6120 | 1 |
| 4 | 61 | 2 |

`CREATE TABLE inherited LIKE legacy`, INSERT SELECT, unrelated ALTER
COPY and additional text inserts preserved these same member mappings. A
new general_ci column exposed `utf8mb4_general_ci` and stored `'A '` as
byte `61` at ordinal 1.

| State | Ready catalog | System COLUMNS rel_id | Tenant COLUMNS rel_id
|
| --- | --- | --- | --- |
| Released | 4.0.6 offset 5 | 272495 | 272613 |
| Candidate after stopped upgrade | 4.0.6 offset 6 | 282925 | 282926 |
| After restart and manual retry | 4.0.6 offset 6 | 282925 | 282926 |

After candidate restart, `UPGRADE ACCOUNT 'enum_pad_tenant' WITH RETRY
2` and `UPGRADE ACCOUNT 'sys' WITH RETRY 2` each reached the COLUMNS
upgrade entry. The executor log contained no DROP or CREATE for COLUMNS
during retry. The before and after retry SQL transcripts, including SHOW
CREATE and relation IDs, compared byte-for-byte.

</details>

</details>

## Release boundary

Validate the stopped 4.2-to-main bridge and remaining recovery/transfer
paths, before releasing builds that author the new identity. Durable
database/table defaults, mixed-version use and metadata downgrade, typed
ENUM data restore and CDC support, and comparison/index-key changes
remain separate.

---------

Co-authored-by: Codex <[email protected]>

This branch was previously deployed

1 inactive deployment
ci — 9e6f8eae Deployed Nov 18, 2026 by XuPeng-SH
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/enhancement kind/refactor Code refactor kind/test-ci size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants