Repository navigation
Conversation
aptend
left a comment
There was a problem hiding this comment.
Re-reviewed exact head 7e9da2f against base 8e8e199, including all reviews/comments/thread state, the two-commit delta from c279ef8, and the complete diff. The original false-success bug is fixed in source: the target/options are retained, only utf8mb4/utf8mb4_bin is accepted, database lookup errors are preserved, and database privileges are assigned. Parser regeneration is clean; focused selection and all four owning packages passed locally. One previously requested public access-control closure remains missing: the BVT still runs only as admin and never proves denial for an existing but inaccessible database.
# Conflicts: # pkg/sql/parsers/dialect/mysql/mysql_sql.go
iamlinjunhong
left a comment
There was a problem hiding this comment.
发现 1 个 P1 阻塞问题:
[P1] 不应把 utf8mb4_bin 无条件当作 ALTER DATABASE 的安全 no-op
位置:pkg/frontend/mysql_cmd_executor.go:3738(handler 位于 3737-3749)。
触发场景:默认配置下执行 ALTER DATABASE db CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;,随后执行未显式指定 COLLATE 的 CREATE TABLE t(v VARCHAR(10)); 并检查表定义或文本比较/排序行为。
当前 handler 只接受这个 pair,查到数据库后直接返回成功;它没有更新数据库或 session 的默认排序规则。同步后的基线在 pkg/frontend/variables.go:1402 将 collation_server 默认设为 utf8mb4_general_ci,而 pkg/sql/plan/build_util.go:606-623 规定未指定表排序规则的 CREATE TABLE 继承 collation_server。因此该 ALTER 返回成功后,后续表仍按 general_ci 解析,requested bin 并不是已经生效的等价 no-op,属于对公开兼容语义的错误成功响应。
请改为实际持久化/应用数据库默认值,或仅在运行时确认 requested collation 已等价生效时接受 no-op,并补充覆盖未指定 COLLATE 的 CREATE TABLE 及 SHOW CREATE/比较行为的回归测试。
|
@iamlinjunhong Thanks for the review. We will keep this PR within the scope of #28998 and will not expand it into database-level charset/collation persistence. This change is intentionally a compatibility no-op for the exact Gitea bootstrap spelling ( The PR now retains and validates the target/options, checks database existence and privileges, rejects other charset/collation pairs, and preserves non-existence/infrastructure errors. Implementing persisted database defaults and propagating them into |
iamlinjunhong
left a comment
There was a problem hiding this comment.
P1 — compatibility no-op reports success for semantics that are not effective
File: pkg/frontend/mysql_cmd_executor.go:3737-3749 (the unconditional return nil at line 3749).
Trigger: on the default configuration, execute:
ALTER DATABASE db CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE TABLE t(v VARCHAR(10));The handler validates only the literal pair and database existence, then returns success without changing database metadata or collation_server. The current default is utf8mb4_general_ci (pkg/frontend/variables.go:1402), and unqualified table creation inherits collation_server (pkg/sql/plan/build_util.go:606-623), so the subsequent table still has general-ci semantics although the successful ALTER requested utf8mb4_bin. This is a false-success public contract, not a compatibility-safe no-op.
The author’s conversation reply limits this PR to the Gitea spelling but does not change that behavior. Please either apply/persist the requested default or only accept the no-op after proving the requested collation is already effective, and add a regression covering an unqualified CREATE TABLE/SHOW CREATE or comparison behavior.
There was a problem hiding this comment.
Re-reviewed exact head beca3b0 against base 780ef93. I read all historical reviews, inline threads, author replies, the incremental change from my prior reviewed head 7e9da2f, and the complete current 18-file diff. The prior access-control blocker is now closed: the public BVT proves denial for an existing inaccessible database and success after ownership is granted. Parser regeneration, diff-check, and formatting are clean, and exact-head required CI is green.
One public-contract blocker remains. The accepted utf8mb4/utf8mb4_bin statement still returns success without making that requested default effective. On this exact base, collation_server defaults to utf8mb4_general_ci and unqualified CREATE TABLE inherits it, so the successful ALTER is contradicted by subsequent table metadata and comparison/ordering behavior. The BVT creates only an INT column and therefore cannot detect this. The limited Gitea scope does not make a false success compatibility-safe; either apply/persist the requested default or accept a no-op only after proving it is already effective.
|
Thanks for clarifying the concern. MatrixOne currently does not support database/table collation semantics, including persisted database collation defaults or collation inheritance compatible with MySQL. Therefore this PR cannot make The scope of #28998 is narrower: Gitea emits this statement as part of ORM bootstrap, and the parser error blocks the rest of initialization. This PR recognizes that specific compatibility statement and returns a no-op success solely so the ORM can continue. In this compatibility context, success means that the unsupported bootstrap statement was tolerated; it does not mean MatrixOne changed or established any collation behavior. Implementing real collation behavior would require a separate feature covering metadata persistence, defaults, DDL inheritance, comparison/ordering semantics, and introspection. We do not plan to expand this compatibility PR into that feature. |
There was a problem hiding this comment.
P1 — 成功响应与实际 collation 语义不一致
文件:pkg/frontend/mysql_cmd_executor.go:3749(handleCompatibilityNoOpStmt 的无条件 return nil)。
触发场景:
ALTER DATABASE db CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE TABLE t(v VARCHAR(10));在默认配置下,handler 只校验字面量 pair 和数据库存在性,随后直接成功返回;它没有持久化数据库默认值,也没有更新 collation_server。当前基线在 pkg/frontend/variables.go:1402 将 collation_server 默认设为 utf8mb4_general_ci,而 pkg/sql/plan/build_util.go:606-623 规定未指定 COLLATE 的 CREATE TABLE 继承该值。因此 ALTER 报告成功后,后续表仍按 general_ci 生成(可由 SHOW CREATE 或比较/排序行为观察),请求的 utf8mb4_bin 实际并未生效,这是公开兼容语义上的错误成功响应。
作者在 conversation 中明确说明本 PR 会忽略该 directive、不改变后续 collation 语义;这确认了触发路径仍存在,不能关闭该 P1。请改为实际应用/持久化数据库默认值,或仅在运行时确认请求的 collation 已等价生效时接受 no-op,并补充 VARCHAR + SHOW CREATE/比较行为的回归测试。
aptend
left a comment
There was a problem hiding this comment.
Re-reviewed exact head beca3b0ad194c9b80738247f9c5abd4b6ae13f94 against base 780ef933f2479aa1679faf13d08850ce6c8f7c2f after the fresh review request. I read the complete current diff and all historical reviews, inline comments, author replies, and resolved/unresolved thread state. There is no commit delta from my preceding review. Focused parser, planner, and frontend tests pass locally with the required CGO dependencies, and exact-head required CI is green.
The author reply confirms rather than closes the remaining P1 at pkg/frontend/mysql_cmd_executor.go:3749: the accepted statement deliberately returns OK while ignoring the requested utf8mb4_bin semantics. Reproducer: ALTER DATABASE db CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; CREATE TABLE t(v VARCHAR(10)); on the default configuration. collation_server remains utf8mb4_general_ci, so the unqualified table inherits general-ci semantics (observable via SHOW CREATE or comparison/ordering) although ALTER succeeded. An OK SQL response is the public contract; limiting the trigger to Gitea does not make silent non-application safe. Please apply/persist the requested default, or accept a no-op only after proving the requested semantics are already effective; otherwise reject it. The current INT-only BVT still cannot detect this mismatch.
aunjgr
left a comment
There was a problem hiding this comment.
Reviewed beca3b0. The compatibility no-op is restricted to utf8mb4/utf8mb4_bin, preserves database-existence and privilege failures, remains within an active transaction, and follows the frontend path for prepared execution. The parser, privilege, transaction, prepare/execute, rejection, and public SQL regressions cover the changed contracts. I found no blocking issue.
|
@aptend @iamlinjunhong Thanks for the detailed reviews. We understand and agree with the factual observation that this no-op does not make That behavior is intentional and is now documented explicitly in the PR's Compatibility contract and Non-goals sections. MatrixOne currently does not implement database/table collation semantics. This PR only tolerates the fixed Gitea ORM bootstrap directive so initialization is not blocked by a parser error. An OK response on this compatibility path means “accepted and ignored”; it does not mean that collation metadata, defaults, inheritance, comparison, ordering, or introspection behavior changed. Persisting and applying collation defaults would require a separate cross-layer feature. We are not expanding #28998 into that feature. The implementation concerns within this bounded contract have been addressed: the target/options are retained, only the fixed pair is accepted, database existence and access are checked, infrastructure errors are preserved, and the public BVT covers missing/inaccessible targets and success after ownership is granted. Because the remaining objection is about the intended product scope rather than an implementation defect within the stated compatibility contract, we would like a maintainer to confirm whether this compatibility policy is acceptable and decide whether the requested changes should remain blocking. |
aptend
left a comment
There was a problem hiding this comment.
Re-reviewed exact head 177f46d0b3db2086f68d8a83c94e8d2d8bc12748 against base 480b91764a94cf9ab49d3f2b43a60cb63ce677c6. I read every historical review, inline reply, and resolved-thread state, compared the increment from my prior reviewed head beca3b0ad194c9b80738247f9c5abd4b6ae13f94, and rechecked the complete 18-file diff. The increment is only the merge of the new base; none of the PR implementation or test files changed. The prior target/existence/access-control findings remain closed. git diff --check and exact-head focused collation tests pass.
[P1] pkg/frontend/mysql_cmd_executor.go:3749 still returns OK while the requested utf8mb4_bin default is not effective. This is now directly contradicted by current production semantics, not merely by hypothetical future collation support: collation_server defaults to utf8mb4_general_ci; unqualified CREATE TABLE inherits that value; text types retain distinct general-ci and utf8mb4-bin identities; COLLATION() reports the identity; and MIN/MAX select different comparators. The exact-head tests confirm general-ci over a,b,c,E,C,D yields MIN=a, MAX=E, while utf8mb4-bin yields MIN=C, MAX=c.
Reproducer: ALTER DATABASE d CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; USE d; CREATE TABLE t(v VARCHAR(10)); INSERT INTO t VALUES ("a"),("b"),("c"),("E"),("C"),("D"); SELECT COLLATION(v) FROM t LIMIT 1; SELECT MIN(v), MAX(v) FROM t;. This handler leaves the new column as utf8mb4_general_ci, so the observable result is general-ci / a,E despite the successful ALTER requesting bin / C,c. The INT-only BVT cannot detect the mismatch. This can change case-sensitive ordering, aggregate, index, and uniqueness assumptions made by the migrated application.
Issue #28998 permits a compatibility no-op only when the requested collation is already effective. Documenting OK as accepted-and-ignored in the PR body does not change that public SQL contract. Please persist/apply the database default, or reject/gate the no-op unless utf8mb4_bin is already effective, and add a VARCHAR plus COLLATION()/comparison or aggregate oracle.
iamlinjunhong
left a comment
There was a problem hiding this comment.
针对当前 head 177f46d(base 480b917)复核了完整 18 文件 diff、parser 到鉴权和执行的调用链,以及相关测试。29 个 check 均已结束且无失败。当前仍确认以下 P1。
P1 — pkg/frontend/mysql_cmd_executor.go:3749:compatibility no-op 在请求的排序规则未生效时仍返回成功
触发场景:
CREATE DATABASE d;
ALTER DATABASE d CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
USE d;
CREATE TABLE t(v VARCHAR(10));
SELECT COLLATION(v) FROM t LIMIT 1;
handleCompatibilityNoOpStmt 只校验字面量 utf8mb4/utf8mb4_bin 和数据库存在性,随后在 3749 行无条件返回 nil;它没有持久化数据库默认排序规则,也没有更新 collation_server。当前基线 pkg/frontend/variables.go:1402 的 collation_server 默认值是 utf8mb4_general_ci,而 pkg/sql/plan/build_util.go:606-623 会用该变量解析未显式指定的表字符列;build_util.go:503-514 还将 general_ci 与 bin 映射为不同的内部字符集身份。因此上述 ALTER 报告成功后,t.v 仍是 general_ci,可通过 SHOW CREATE TABLE 或 COLLATION(v) 观察到,比较和排序结果也会不同。这违背了 issue #28998 所要求的兼容安全 no-op 条件(只有请求的 collation 已经是有效值时才可无影响地忽略)。
作者已在 thread 和 PR conversation 中明确表示这是故意的 accepted-and-ignored 行为;但该意图不能消除这里对调用方造成的 false success。请让请求的默认值真正生效,或仅在请求值已经生效时返回兼容成功,并补充 VARCHAR 元数据或比较结果的回归断言。
What type of PR is this?
Which issue(s) this PR fixes:
issue #28998
What this PR does / why we need it:
Gitea sends the following statement during ORM bootstrap:
MatrixOne currently rejects this statement at the parser boundary, preventing the rest of the ORM initialization from running. This PR recognizes that exact charset/collation pair and handles it as a compatibility no-op.
The implementation retains and validates the target and options, verifies database existence and access rights, preserves infrastructure errors, rejects unsupported charset/collation pairs, supports transactions and prepared statements, and returns zero affected rows.
Compatibility contract
MatrixOne currently does not implement MySQL database/table collation semantics. On this compatibility path, an OK response means that the fixed, unsupported Gitea bootstrap directive was accepted and ignored so ORM initialization can continue. It does not mean that
utf8mb4_binbecame effective or that any collation behavior changed.Non-goals
This PR intentionally does not:
collation_serveror session defaults;CREATE TABLEstatements;SHOW CREATEor other collation introspection behavior;ALTER DATABASE ... CHARACTER SET ... COLLATE ...semantics.Implementing those semantics is a separate cross-layer feature requiring metadata, planner, execution, comparison/ordering, DDL inheritance, and introspection design. It is outside the scope of the Gitea compatibility bug fixed by #28998.
Validation
main.