You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Compatibility]: ODKU ignores case-insensitive and trailing-space unique collations #28164
在 MatrixOne main 99ed717b769e261b842c2f17345bd65865fc1470,ODKU 没有按非二进制字符串唯一键的排序规则判定冲突:
CREATETABLEci (
id INTPRIMARY KEY,
k VARCHAR(32) COLLATE utf8mb4_general_ci UNIQUE,
v INT
);
INSERT INTO ci VALUES (1, 'Alpha', 10);
INSERT INTO ci VALUES (2, 'alpha', 20)
ON DUPLICATE KEY UPDATE v=VALUES(v);
INSERT INTO ci VALUES (3, 'Alpha ', 30)
ON DUPLICATE KEY UPDATE v=VALUES(v);
上一条 CI 修复评论中的 1a8c2b7d… 属于 rebase 前 head,已被 superseded。当前 PR #28520 已 rebase 到 upstream/main@7c643f469b9162dec19b7f880e4cf6b2c12507d9,远端 head 为 624edadde4acab3939ec83fe8af095da7d323a2b。
当前唯一有效 exact-head CI 为 34416285056,仍在运行;rebase 前的 CI 结果不用于最终验收。
Binary-assignment PR follow-up — 2026-10-22 16:08 UTC
PR #29057 now includes commit 48e544271aa5189febceeb5a95e572792f490102, which adds a changed-session DECIMAL generated-column regression and retargets the binary assignment while retaining the stored arithmetic expression. I inspected this incremental patch; it adds focused planner and public SQL coverage, and I found no definite defect in this change. The PR author reports the planner suite, three protocol-boundary tests and the binary-capacity SQL BVT passed on that incremental content; these are author-reported results, not a test run by me.
The current PR head is cf96663a108a53fd82d265b1077e70851db679e5, a subsequent main synchronization. Exact-head run 39811166703 still has UT, SCA, shared build and UT-coverage jobs in progress; only preflight/coverage eligibility/size checks are complete. The prior formal review/request-changes records predate the 48e5442 repair, and the version-floor inline thread remains unresolved. This local environment is at 460b96365a381e74916b044a99fc9423c33ad3fd with no Go toolchain, so I did not rerun the tests.
This PR explicitly covers only the binary-assignment/COPY stage of #28164; the general_ci UNIQUE ODKU collation defect remains unresolved. Issue stays open, with existing assignees ck89119 and VioletQwQ-0 unchanged; no tester transfer is warranted for the still-open core issue. Recheck current-head CI, reviewer disposition, and the outstanding ODKU reproduction separately.
Independent confirmation on main c6683bd2f5 (2026-10-29 build, local dual-CN launch): the defect is not limited to the ODKU path — a plain INSERT into a utf8mb4_general_ci UNIQUE column also misses the collision and succeeds silently:
CREATETABLEu1(id INTPRIMARY KEY, k VARCHAR(20)) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
INSERT INTO u1 VALUES (1,'abc');
INSERT INTO u1 VALUES (2,'ABC'); -- succeeds; MySQL 8.0 rejects with ERROR 1062INSERT INTO u1 VALUES (3,'abc '); -- succeeds; MySQL 8.0 rejects with ERROR 1062SELECT*FROM u1; -- 3 distinct rows
Since the binary-comparison lookup misses the row entirely, no error, no ODKU branch, no dedup — the constraint is effectively utf8mb4_bin for uniqueness regardless of the declared collation. Same root as the ODKU report (unique-key lookup ignoring the collation), confirmed still reproducing 9 days after the last verification on this thread; adding the plain-INSERT evidence since it shows every write path through the unique index is affected, not just upserts.
Additional v4.2.6 reproduction and white-box evidence (local embedded 3-CN; no concurrency):
CREATETABLEci (
id INTPRIMARY KEY,
k VARCHAR(32) COLLATE utf8mb4_general_ci NOT NULL,
v INTNOT NULL,
UNIQUE KEY uk_k(k)
);
INSERT INTO ci VALUES (1,'AbC',10);
INSERT INTO ci VALUES (2,'abc',20);
-- succeeds; COUNT(*) = 2INSERT INTO ci VALUES (3,'ABC',30)
ON DUPLICATE KEY UPDATE v=VALUES(v);
-- also succeeds as a third row; it does not update the existing key
On v4.2.6 commit 71498157cc21f833b8e717f45d50d1f926be3134, the hidden unique-index table held separate entries AbC and abc. The same duplicate was accepted by plain INSERT, so this is not limited to ODKU target arbitration. The utf8mb4_bin control also accepts case variants, as expected. On this branch, direct comparisons explicitly collated as utf8mb4_general_ci and utf8mb4_unicode_ci returned 0 for 'AbC' = 'abc', and the unicode_ci unique-index control accepted both rows too.
White-box observation: the plan Type/ColDef representation used here carries no collation identity, and unique-index table/key construction derives its key type from the column's basic type. The DML lookup then probes with the raw string key. The declared collation therefore cannot govern the unique-index key on this path. This is consistent with the broader collation work tracked by #25096/#29479; I did not create a duplicate issue.
After both spellings are stored, lookup of name='aBc' returns 0 with the normal plan, FORCE INDEX(uk_name), and IGNORE INDEX(uk_name).
ODKU on ('abc') also inserts a second row instead of updating the existing AbC row.
The utf8mb4_bin control accepts both case variants, as expected.
Thus the failure is still in current main and is broader than unique-index target selection: declared _ci comparison semantics are not honored by direct expressions, table scans, or index scans in this case. The local test was run from detached source commit ae40f12a64; no production files were changed.
White-box follow-up on the same exact current HEAD ae40f12a647880a63466de32a9f507c2c72dca0b: after the plain insert accepted both variants, I resolved the hidden table for uk_name and inspected it. It is defined with a raw VARCHAR(32)__mo_index_idx_col primary key and an integer primary column; the stored keys are the verbatim values AbC and abc in separate rows. No collation-derived canonical key is stored on this path. Together with the comparison results above (including table scan and forced index), this points to both comparison semantics and unique-index key construction failing to use the declared collation, rather than a DEDUP/ODKU-only error.
Activity
[Design] Define collation-aware unique key identity (#28164) (#28423)
VioletQwQ-0 commentedon Sep 9, 2026
补充阶段性实现记录(不关闭 issue):
2b8eade3d230597643b3cb9f3fd2686495835eaa81a6fc70e50d4ccc28d09b0d5e87f18a97a2ad9e本轮在共享 MOKY/MOKL/MOKS 契约和 sidecar 事务基础上新增
MOKP快照边界:快照携带 codec/registry/generation、关系 ID 和 revision,entry 严格按完整 key 排序,恢复前校验嵌套 key/locator、SHA-256 完整性以及大小和 entry 数上限。新增单测和 race 测试均通过;make cgo、make build、相关 planner/engine/fulltext/indexplugin 测试也通过。这仍是分阶段基础实现:v2 capability/activation 保持 fail-closed,普通 SQL 尚不能创建或写入 v2 关系。TN/catalog 持久化 sidecar、全局 SQL equality/hash/group、全部写入入口、
mo_ctl显式迁移、完整升级/恢复和 QA 尚未完成,不能据此宣称 #28164 已修复或确认客户 12 分钟根因。当前 exact-head CI run
34405953507仍在排队/运行,QA 尚未开始;issue 保持 OPEN,PR 保持 Draft。VioletQwQ-0 commentedon Sep 9, 2026
阶段性实现更新(不关闭 issue):
edca83a37e0d6eec581fa81323cad841ced38a2781a6fc70e50d4ccc28d09b0d5e87f18a97a2ad9emake cgo、make build和git diff --check均通过;mo-serviceSHA256:6eb2e4fe45b994788f33dd881ff1b44fa66c01b1451bf4f7f0583b0809c7ddde。边界保持不变:v2 capability/activation 仍 fail-closed,普通 SQL 尚不能创建或写入 v2。TN/catalog 持久化 sidecar、全局 SQL equality/hash/group、全部 bulk/LOAD/S3/partition 入口、mo_ctl 显式迁移、完整升级/恢复和 QA 尚未完成。该 PR 不能据此宣称客户 12 分钟根因已确认;#28164 保持 OPEN。
VioletQwQ-0 commentedon Sep 9, 2026
阶段性实现补充(#28520,仍为 Draft;不关闭 issue):
5206d263df3f48abbe1f78b58e7f5a377f897aeb;base:81a6fc70e50d4ccc28d09b0d5e87f18a97a2ad9e。MOKG迁移 gate checkpoint 编解码:固定大端字段、owner/permit/replay 映射排序、长度/总量上限、SHA-256 完整性校验,以及恢复前MigrationGate.Validate状态机校验。它防止恢复时丢失写入许可、owner fence、replay target 或已发布标记。pkg/common/collationkeyunit、race、vet、git diff --check和make cgo/make build均通过;该 head 的mo-serviceSHA256 为8469bd4f2476da22ff5aa45ec4c5adaed7368750261fa8dcaa256fcda2e4bb2d。34409583638当前仍在排队/运行,QA 尚未开始。边界不变:MOKG 目前是供后续 HAKeeper/catalog 适配器使用的内部持久化契约,尚未接入真实 TN/catalog sidecar、
mo_ctl迁移、全局 SQL 比较/哈希/group 或生产启用;v2 仍 fail-closed。该阶段不能宣称 #28164 已修复,也不能确认客户 12 分钟根因。请维护者按 exact-head CI、存储接入和 QA 继续验收。VioletQwQ-0 commentedon Sep 9, 2026
补充校验:迁移 gate 编解码的错误路径已收紧为目标缓冲区原子不变,并已推送到 #28520 当前 exact head
013860cb6f13fa58fe1c634ba82bea0bccbb3878(base81a6fc70e50d4ccc28d09b0d5e87f18a97a2ad9e)。pkg/common/collationkeyunit/race/vet、make cgo、make build和git diff --check重新通过;mo-serviceSHA256:78000b745d421f397b0c7e318e27ff71c061675114f88a45bcfff2a854705551。新 exact-head ALL CI 尚在排队/运行,QA 未开始。其余边界及“v2 未启用、不能宣称 issue 已修复”保持不变。VioletQwQ-0 commentedon Sep 9, 2026
持久化边界补充(#28520,仍为 Draft):
HAKeeperRSMState新增 typedUniqueKeyMigrationGate字段(field 44),CheckerState新增只读字段(field 20);RSM snapshot/recovery 和 StateQuery 均保留/深拷贝该 gate,旧 snapshot 在复用 state 时先清空,避免残留新状态。pkg/pb/logservice增加 commonMigrationGate↔ protobuf 的 fail-closed adapter,空/非法 gate 不会被当作新迁移;映射和 claim token 不共享调用方内存。c8b3adc870298ef0b1797825a9a77dfab5a55137,base:81a6fc70e50d4ccc28d09b0d5e87f18a97a2ad9e。相关 common、logservice、hakeeper、planner 窄测及构建通过。该字段目前只提供 RSM 持久化与观察,不提供迁移状态变更命令,也未接入 TN/catalog sidecar、
mo_ctl或生产 v2 启用;#28164 继续 OPEN,客户根因仍未确认。VioletQwQ-0 commentedon Sep 9, 2026
补充当前实现与验证记录(exact head):
fbfbe76d08dcfebc46649cb18ec36f0777670a0e,base 为81a6fc70e50d4ccc28d09b0d5e87f18a97a2ad9e,仍为 Draft;本次没有启用 v2,也没有改变普通 SQL 的唯一性行为。HAKeeperRSMState.UniqueKeyMigrationGates和CheckerState.UniqueKeyMigrationGates现在按物理 relation ID 保存 gate map,不再用单一 gate 覆盖不同关系;新增双 relation snapshot/restore 覆盖,并清理旧快照复用状态。go test ./pkg/common/collationkey ./pkg/pb/logservice ./pkg/hakeeperPASS;仓库mo-cgo-test ./pkg/sql/planPASS;make cgoPASS;make buildPASS。当前构建产物mo-serviceSHA256=f157ad0db80eda213b0607bf61bef5ee13cf2f423a86fb52b290e89a30470aef,cgo/libmo.dylibSHA256=760a841cb61c01c3ee44c011bad329a5707d86314bdf590b4ed4e20814400c87。mo_ctl迁移入口、升级/恢复和 QA 尚未完成。生产启用保持关闭,[Compatibility]: ODKU ignores case-insensitive and trailing-space unique collations #28164 不能据此关闭。VioletQwQ-0 commentedon Sep 9, 2026
补充:本轮 exact-head 验证证据已固化在开发工作树的 ignored artifact:
artifacts/issue-28164-implementation/20260909T224500Z/(含run.json、测试日志、preflight snapshot、审查清单和SHA256SUMS)。该目录只保存开发侧证据,不进入 Git。状态仍为:实现增量和本地定向验证通过;GitHub CI run 34412107334 尚在运行;升级验证、完整生产启用和 QA 未运行。请不要把这轮基础增量当作 #28164 已修复或客户根因确认。
VioletQwQ-0 commentedon Sep 9, 2026
CI 修复与基线同步补充(PR #28520,仍为 Draft):
34412107334的确定失败是TestV2PrimaryKeyRejectsMissingHiddenIdentity:v2 主键缺少隐藏身份时,planner 在 legacy nil-column 分支提前返回nil,未执行 fail-closed 拒绝。pkg/sql/planCGo 测试;legacy 主键路径行为保持不变。upstream/main@7c643f469b9162dec19b7f880e4cf6b2c12507d9,并以 lease 推送。当前 PR head:624edadde4acab3939ec83fe8af095da7d323a2b。34416285056,正在执行;旧 run34412107334、34414605024仅保留为 superseded 历史,不混入验收。artifacts/issue-28164-implementation/20260909T231820Z/,含新 head/base、diff/preflight 哈希、测试日志和 CI 快照。状态边界不变:这是共享编码、元数据/能力门禁、sidecar/checkpoint 与 planner 的阶段性基础增量;真实 TN/catalog sidecar 写入、全局 SQL 比较/hash/group、全部 bulk/LOAD/S3/partition 入口、管理迁移、升级/恢复和 QA 尚未完成,v2 未启用,#28164 继续开放,客户现场根因未确认。
VioletQwQ-0 commentedon Sep 9, 2026
版本纠正:
上一条 CI 修复评论中的
1a8c2b7d…属于 rebase 前 head,已被 superseded。当前 PR #28520 已 rebase 到upstream/main@7c643f469b9162dec19b7f880e4cf6b2c12507d9,远端 head 为624edadde4acab3939ec83fe8af095da7d323a2b。当前唯一有效 exact-head CI 为
34416285056,仍在运行;rebase 前的 CI 结果不用于最终验收。33 remaining items
test: cover canonical collation admission and legacy SQL behavior (#2…
feat(sql): enable native Unicode unique keys (#30113)
fix(plan): validate catalog collation metadata before pruning (#29056)
XuPeng-SH commentedon Oct 16, 2026
复验结果:原 issue 的 general_ci UNIQUE 问题仍可复现,请继续处理。
实测 main 提交:
97415db10bdb3d6ffdf53ff1810a7e80bd78ee11(实际 MySQL 协议)。第二次 INSERT 实际成功,未返回预期的重复键 1062。
#30113 交付的是 native Unicode UNIQUE 的限定子集;其功能测试通过并不表示原 issue 的 general_ci 语义已解决。测试入口:
TestAuditOriginalIssueSQL/issue_28164。当前仍由开发负责人 ck89119、VioletQwQ-0 负责,保留当前分配,保持 OPEN。
XuPeng-SH commentedon Oct 17, 2026
最近24小时合并项复核补充:在 main
aa4b6eddfdad54d11be6fd75a5675eb9801f6690上,再次通过实际 MySQL 协议复现本 issue。general_ci UNIQUE 仍允许先后插入 Apple、apple。
原始 SQL/对照与前一条复验评论一致。本轮没有证据表明它已修复,也不将其当作最近24小时新引入的问题。当前仍由开发负责人处理,保持 OPEN;关联 PR 已补充验证范围,未创建重复 issue。
XuPeng-SH commentedon Oct 17, 2026
继续验证记录(2026-10-17),main
a322466757b9b0165c59fbda565608653d923b2a(Go 1.27.1),Linux/amd64、匹配 CGo 产物、真实测试执行结果:general_ci UNIQUE 场景仍接受
Apple/apple,原始应拒绝插入的语句没有报错。此项仍未解决;保留现有开发指派,不转测。使用现有 issue 跟踪,没有为同一现象重复建 issue。
XuPeng-SH commentedon Oct 17, 2026
新会话初始化修复合并后的范围复核(2026-10-17,main
d9cf2dd4e2b92e2193bb390115be624b76099764,Linux/amd64、Go 1.27.1、匹配 CGo):本轮已通过真实 TCP 验证 #30398:45/192/224 的初始 session collation 均正确,mysql2 的 reset/change-user 四变量检查也通过。同轮通过真实 SQL 重跑本 issue 的独立场景,结果仍为:general_ci UNIQUE 仍接受
Apple后再插入apple,应出现的 1062 没有出现。因此不能用会话变量初始化已修复替代本 issue 的行为修复。该问题仍由现有开发负责人处理,保持 OPEN,不转测;此为已有问题的范围复核,未另建重复 issue。
XuPeng-SH commentedon Oct 18, 2026
补齐本轮 continue18 已完成实测的验收记录(2026-10-18;本评论没有冒充另一次新执行)。Linux/amd64、Go 1.27.1、各分支按源码独立新建 CPU/CGo、真实认证 MySQL TCP、CN0/CN1 分别运行;生产逻辑未修改。
main:
4226537e5094995155eab9c2a883db649ff7b95b4.2-dev:
35273bcd6a5cfa9468bcf7ca4031fe17560b5ab1结果仍失败:唯一列
k COLLATE utf8mb4_general_ci依次通过 ODKU 写入'Alpha'、'alpha'、'Alpha '后,main/4.2 两个 CN 均保留 3 行(预期 1 行),未按 collation 进入冲突 UPDATE。失败子场景为28164_unique。原始命名断言、SQL/错误与退出码保留于
/workspace/work/pr-audit-continue18/logs/main-sql-final.log、4.2-sql-final.log,相应混合命令均 exit 1,未称整批通过。独立诊断 overlay 为audit_sql_test.go,重放入口replay.sh main-sql/replay.sh 4.2-sql;完整证据包matrixone-pr-audit-20261018-continue18.zip。问题仍在,保持现有开发指派,不转测、不重复建 issue。XuPeng-SH commentedon Oct 19, 2026
本轮实测更新(2026-10-19,UTC)。目标分支 main,完整 SHA
8e63625c4e9baeb1d28c1095c07732f056c04895;Linux/amd64,Go 1.27.1,嵌入式两 CN、真实 MySQL TCP(仓库支持的MO_TEST_CLUSTER_TCP_ONLY=1)。当前源码由本轮测试命令构建;native CGo 产物通过 provenance 校验,基于090b14fbb4c288819728f628e009311a11812e1f构建后复用(其后 #30602 为 test-only、native 输入未变)。实测命令:
utf8mb4_general_ci UNIQUE上依次插入Alpha、ODKUalpha、ODKUAlpha后,CN0、CN1 均有 3 行(预期 1 行,最终值应由冲突更新得到 30)。问题仍可复现。该测试子集整体 exit 1,两个 CN 各 4 项失败。原始日志:
continue22/runs/followups-main/public-followups.log(完整 497,614 字节,SHA-2561fdfea1fa80b1f88f0cebe61be7a56252ca9e409834874eb3ff45ef753047765);临时测试源和 overlay 在同目录。保持现有开发指派。Binary-assignment PR follow-up — 2026-10-22 16:08 UTC
PR #29057 now includes commit
48e544271aa5189febceeb5a95e572792f490102, which adds a changed-session DECIMAL generated-column regression and retargets the binary assignment while retaining the stored arithmetic expression. I inspected this incremental patch; it adds focused planner and public SQL coverage, and I found no definite defect in this change. The PR author reports the planner suite, three protocol-boundary tests and the binary-capacity SQL BVT passed on that incremental content; these are author-reported results, not a test run by me.The current PR head is
cf96663a108a53fd82d265b1077e70851db679e5, a subsequent main synchronization. Exact-head run 39811166703 still has UT, SCA, shared build and UT-coverage jobs in progress; only preflight/coverage eligibility/size checks are complete. The prior formal review/request-changes records predate the48e5442repair, and the version-floor inline thread remains unresolved. This local environment is at460b96365a381e74916b044a99fc9423c33ad3fdwith no Go toolchain, so I did not rerun the tests.This PR explicitly covers only the binary-assignment/COPY stage of #28164; the general_ci UNIQUE ODKU collation defect remains unresolved. Issue stays open, with existing assignees
ck89119andVioletQwQ-0unchanged; no tester transfer is warranted for the still-open core issue. Recheck current-head CI, reviewer disposition, and the outstanding ODKU reproduction separately.daviszhen commentedon Oct 20, 2026
最新 main 验证(2026-10-20)
基线:
309f618995af4ee23e3b9149365f4af77264090d;相关 PR:#30113/#29890/#29834。结论:问题仍可复现。exact-main Docker 执行
utf8mb4_general_ci UNIQUE+Alpha、ON DUPLICATE KEY UPDATE alpha、ON DUPLICATE KEY UPDATE Alpha后仍得到 3 行;按大小写不敏感唯一键预期应复用同一行。该问题仍未解决,建议继续保留在开发中。Ariznawlll commentedon Oct 29, 2026
Independent confirmation on main
c6683bd2f5(2026-10-29 build, local dual-CN launch): the defect is not limited to the ODKU path — a plainINSERTinto autf8mb4_general_ciUNIQUE column also misses the collision and succeeds silently:Since the binary-comparison lookup misses the row entirely, no error, no ODKU branch, no dedup — the constraint is effectively
utf8mb4_binfor uniqueness regardless of the declared collation. Same root as the ODKU report (unique-key lookup ignoring the collation), confirmed still reproducing 9 days after the last verification on this thread; adding the plain-INSERT evidence since it shows every write path through the unique index is affected, not just upserts.XuPeng-SH commentedon Oct 31, 2026
Additional v4.2.6 reproduction and white-box evidence (local embedded 3-CN; no concurrency):
On v4.2.6 commit
71498157cc21f833b8e717f45d50d1f926be3134, the hidden unique-index table held separate entriesAbCandabc. The same duplicate was accepted by plain INSERT, so this is not limited to ODKU target arbitration. Theutf8mb4_bincontrol also accepts case variants, as expected. On this branch, direct comparisons explicitly collated asutf8mb4_general_ciandutf8mb4_unicode_cireturned 0 for'AbC' = 'abc', and the unicode_ci unique-index control accepted both rows too.White-box observation: the plan
Type/ColDefrepresentation used here carries no collation identity, and unique-index table/key construction derives its key type from the column's basic type. The DML lookup then probes with the raw string key. The declared collation therefore cannot govern the unique-index key on this path. This is consistent with the broader collation work tracked by #25096/#29479; I did not create a duplicate issue.XuPeng-SH commentedon Oct 31, 2026
Confirmed still reproducing on the exact local
origin/mainHEADae40f12a647880a63466de32a9f507c2c72dca0b(2026-10-31), using an embedded 3-CN test:utf8mb4_general_ci, inserting('AbC')then a plain UNIQUE value('abc')succeeds; row count becomes 2.'AbC' COLLATE utf8mb4_general_ci = 'abc' COLLATE utf8mb4_general_cireturns 0.name='aBc'returns 0 with the normal plan,FORCE INDEX(uk_name), andIGNORE INDEX(uk_name).('abc')also inserts a second row instead of updating the existingAbCrow.utf8mb4_bincontrol accepts both case variants, as expected.Thus the failure is still in current main and is broader than unique-index target selection: declared
_cicomparison semantics are not honored by direct expressions, table scans, or index scans in this case. The local test was run from detached source commitae40f12a64; no production files were changed.XuPeng-SH commentedon Oct 31, 2026
White-box follow-up on the same exact current HEAD
ae40f12a647880a63466de32a9f507c2c72dca0b: after the plain insert accepted both variants, I resolved the hidden table foruk_nameand inspected it. It is defined with a rawVARCHAR(32)__mo_index_idx_colprimary key and an integer primary column; the stored keys are the verbatim valuesAbCandabcin separate rows. No collation-derived canonical key is stored on this path. Together with the comparison results above (including table scan and forced index), this points to both comparison semantics and unique-index key construction failing to use the declared collation, rather than a DEDUP/ODKU-only error.fix(sql): isolate binary capacity and assignment semantics (#29057)