Repository navigation
fix(enum): trim trailing spaces from ENUM labels like MySQL - #32885
Conversation
MySQL removes trailing spaces from ENUM members at CREATE TABLE and rejects members that are then duplicates. MO stored labels verbatim, so a padded label such as 'a ' only matched the exact input 'a ' -- 'a' and 'a ' were rejected or truncated. - DDL: NormalizeEnumValues trims trailing spaces and rejects members equal case-insensitively after trimming, mirroring the existing SET rules. - Lookup: ParseEnum and the batch enumValueIndex compare with trailing spaces trimmed on both sides, so tables created before this change with padded labels also match. For legacy definitions whose labels are equal after trimming, the first such label wins. Ref matrixorigin#30538 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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? |
|
Queue requested — the merge queue status continues in this comment ↓. |
dtype/enum declares labels with trailing spaces, which are now trimmed at
CREATE (display, length, reverse, concat, rpad and find_in_set follow);
issue_29840 now uses ENUM('red','') and asserts the ' '/'' duplicate DDL is
rejected.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…into fix-enum-trailing-space-labels
|
Addressed the three findings from the review in b9efb06 (plus a comment-only follow-up dadd264). P2
P2
On
P2 Local runs: |
🛑 The queue request has been cancelled: new commits were pushedDetails@fengttt pushed to this pull request after |
TestArenaPoolCountCap crashed in CI with "reset of synctest timer from outside bubble": TestArenaBurstReleasedWhileStillActive frees arenas inside a testing/synctest bubble, which armed the global SimpleCAllocator mmap cache timer in that bubble, and a later free outside it called timer.Reset on put. expire already re-arms the timer from lastPut, so put only needs to record lastPut. The idle deadline is unchanged, the free path no longer touches the timer, and only the arming goroutine or the timer's own callback operates on it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
mo-bot review · Commit: "interrupted" |
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes #32951 Fixes #32946 Fixes #32893 Fixes #32953 Fixes #32956 Related to #32952, #32954, #32955, #32745 and #32885. The first three issues stay open for Linux confirmation of tenant cleanup, a duration-neutral batch deadline fix, and diagnosis of the remaining embedded and multi-CN failures. ## What this PR does / why we need it: - Seed the virtual-clock arena test with small buffers tracked by the arena memory pool. This keeps it on the real arena list and reaper path without installing a timer in the process-wide mmap cache. - Preserve the caller's cancellation cause throughout WAL record reads, including client checkout and retry backoff. Keep transient retries and the closed-pool error. - Choose a session offset distinct from the process offset in the frontend temporal test without writing the global timezone. - Consolidate tenant cleanup into one DROP ACCOUNT, which also removes the tenant source database. Retain the two-minute account cleanup timeout already on main from #32885. Four CI runs showed five tenant cases timing out at the 20-second account cleanup after their progress assertions. Both tenant scenarios retain their COPY, lock, and data assertions. - Preserve physical offsets when writing the snapshot of an old appendable data object. Rows without an eligible append node remain invisible placeholders so a reader that holds an existing RowID still reaches the same value after the in-memory object is replaced by its persisted snapshot. Ordinary logtail range collection stays dense. - Record the remaining Go test budget when a race batch starts. Keep the shared 40-minute budget, existing process pool and 120-minute outer UT watchdog. - Stop dependent LOAD statements after a pinned session fails and retain the existing shared SQL deadline. Run role-policy tenant cleanup through the admin pool, and check account absence only after a successful drop, within the existing SQL timeouts. Failed shared generations still retire through their current owner. - Enable the breaker in the morpc regression and assert the open-circuit error and nil backend. Remove the 20 ms wall-clock assertion. Validated on Go 1.27.1 with the full frontend, objectio and WAL driver packages under race, the complete scalar refresh regression under race, the affected timezone regression with a non-UTC process timezone, and incremental formatting, vet and lint checks. The linked Linux CI runs establish the original failures. The additional changes passed the full morpc, TAE tables and append-MVCC packages under race, the focused TAE flush and TestDelete4 cases, the role-policy and LOAD fixtures under race, and the UT scheduler harness. The sparse snapshot regression fails with the old code and passes after the fix. A separate local run replayed WAL after restart and reproduced the old panic before checking the fix. The unit test also covers modern and legacy layouts. Targeted local coverage exercised all 16 changed Go production blocks counted by the CI parser. A cold Linux runner can still reach the independent outer UT deadline. --------- Signed-off-by: XuPeng-SH <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
Ref #30538 (follow-up: #30683 fixed the value side; this fixes the label side)
What this PR does / why we need it:
MySQL removes trailing spaces from ENUM members at
CREATE TABLEand rejects members that are duplicates after that. MO stored labels verbatim, soENUM('a ','b')kept"a ", and only the exact input'a 'matched it:'a'and'a 'were rejected (strict) or truncated to 0.'a ','b''a''a ','b''a ''a','b''a 'Changes
build_util.go): newtypes.NormalizeEnumValuestrims trailing ASCII spaces from labels and rejects members equal case-insensitively after trimming (duplicate enum member), mirroring the existingNormalizeSetValues. Leading spaces, NBSP and tabs stay significant.types.ParseEnumand the batchenumValueIndexinfunc_mo.go): one pass comparing with trailing spaces trimmed on both sides, so tables created before this change with padded labels also match. Both paths keep identical semantics.Behavior change for legacy definitions: a table created earlier with labels equal after trimming (e.g.
ENUM(' ','red','')from the #29840 test, which MySQL rejects) now resolves both' 'and''to the first such label. Already-stored rows are unchanged. Tests that pinned the old raw-first matching were updated accordingly.Tests
New:
TestNormalizeEnumValues,TestEnumDDLRejectsMembersEqualAfterTrim, ENUM cases inTestEmptyDomainTypeReplay(DDL → format → replay round trip).Updated:
TestEnumAssignmentParsing,TestEnumValueIndexAssignmentBoundaries(covers both linear and indexed paths),TestMySQLSpecialOrderProvenanceRejectsNonReversibleEnum, twoexternalLOAD tests.BVT
load_data/issue_29840_load_empty_enum_set.sql: its table usedENUM(' ','red',''), now invalid DDL; switched toENUM('red','')and added a statement asserting the duplicate DDL is rejected.Unit tests pass locally for
pkg/container/types,pkg/sql/plan,pkg/sql/plan/function,pkg/sql/colexec/external,pkg/sql/compile,pkg/frontend.BVT: regenerated
.resultforload_data/issue_29840_load_empty_enum_set(member indexes shift; duplicate DDL rejected) anddtype/enum(padded labels now trimmed, so their display,length,reverse,concat,rpadandfind_in_setresults follow). Ran all 71 BVT case files that useenum(against a dev cluster built from this branch: 0 failures.🤖 Generated with Claude Code