Skip to content

[Bug]: writable external tables reject valid INSERT IGNORE VALUES and SELECT with 20313 #32512

Closed

Description

@slyunnn

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Searched open/closed issues for external IGNORE titles and external 20313. No matching admission failure was found.

Branch Name

main

Commit ID

45917e803f2915f6f0838b2b2fe9f591fc5b6018

Other Environment Information

Fresh CPU build, macOS arm64, Go 1.27.1. Co-hosted 2 CN / 1 TN / 1 Log service / Proxy. All cases reproduced through Proxy 6001, CN1 16001, and CN2 16002 using PyMySQL text protocol.

Actual Behavior

An external table configured with a valid writable file-stage pattern accepts ordinary INSERT, but rejects INSERT IGNORE with error 20313, unsupported DML: external table. Both VALUES and SELECT inputs fail with entirely valid, non-NULL data. NULL input has the same admission error.

Expected Behavior

A writable external target should admit its supported INSERT IGNORE input forms and apply the external writer's checked assignment contract. At minimum, valid data should reach the writable external path consistently with ordinary INSERT and the supported LOAD ... IGNORE control.

Steps to Reproduce

Create an empty client/server-visible directory /tmp/qa-external-ignore on the disposable test host. Execute on one connection.

CREATE DATABASE qa_external_ignore;
USE qa_external_ignore;
CREATE STAGE qa_external_stage URL='file:///tmp/qa-external-ignore/';
CREATE EXTERNAL TABLE e(id INT,a INT NOT NULL)
INFILE{'filepath'='stage://qa_external_stage/p-*.csv',
       'format'='csv',
       'write_file_pattern'='stage://qa_external_stage/p-%U.csv'}
FIELDS TERMINATED BY ',';
INSERT IGNORE INTO e VALUES(1,1);
INSERT IGNORE INTO e SELECT 2,2;
INSERT IGNORE INTO e VALUES(3,NULL);
INSERT INTO e VALUES(4,4);
SELECT * FROM e;
SELECT 1;
DROP STAGE qa_external_stage;
DROP DATABASE qa_external_ignore;

Each INSERT IGNORE returns 20313. The ordinary insert succeeds and the final row is (4,4). Connection recovery succeeds.

Additional information

Found while verifying #30906 / #32299. This rejection precedes NOT NULL filling and also occurs without NULLs. The internal-table regression passed 399/399 SQL statements per endpoint. A separate real file-stage LOAD ... IGNORE of 17,000 rows also passed through every endpoint, with exactly 4 warnings 1048, complete stored-value comparison and nullable siblings preserved. This report tracks the external INSERT IGNORE entry-point limitation separately from those working assignment paths.

@gouhongshen please confirm the intended public admission contract for writable external INSERT IGNORE.

Activity

  1. added
    kind/bug
    on Nov 11, 2026
  2. added theissue type on Nov 11, 2026
  3. added this to the MO-202611 milestone on Nov 11, 2026
  4. added a commit that references this issue on Nov 14, 2026
    8868e6c
  5. XuPeng-SH commented on Nov 14, 2026

    @XuPeng-SH
    Contributor

    QA 交接:main 已合入,待独立验收

    关联修复:#32750,merge SHA 8868e6c39230691d3595e7c7f934757352b604c7;最终 PR head 0ccfff3489bdab57cee5fbca1b5bf97035679ea6。

    修复范围是 writable、non-Iceberg external table 的 INSERT IGNORE 准入:VALUES、SELECT 及 prepared 形式在精确 external-table sentinel 下进入原有 legacy writer。没有新增写入执行路径,也没有改变赋值、warning、FileService 或权限语义。只读 external、Iceberg、ODKU、RETURNING 和 non-Iceberg OVERWRITE 的拒绝边界保留。已重读 issue 全文、全部评论及 PR 完整讨论,未发现针对此已合并修复的适用反例或未完成开发 follow-up;这不是 CI flaky issue。

    验证证据与限制:

    • 作者报告最终源上的 RED/GREEN;owning pkg/sql/plan 24,593 个 named passes、2 个 skips,固定版本全树 SCA 通过。真实 SQL foreground 与 helper 均 exit 0:98 条语句、14 个精确类型负例、20 行结果及 18 个 CSV 文件的 multiset 对比、NULL/default、native prepared handle 复用、writer ENOTDIR 错误及同连接恢复、非管理员 file-policy 拒绝和资源清理。早期失败私有夹具不计为通过。
    • 最终 head 的 评审 approve,报告冻结 CI 的 build/UT/SCA/coverage/active multi-CN BVT 通过;14 skipped 和 2 neutral 不计通过。评审本地 focused test 因缺匹配 libmo.so 前置而在编译前停止,未取得新的产品测试或 SQL 通过;作者原始日志及 CI 原始执行日志未取得。
    • 合并队列 确认 CI Required success;up-to-date 故队列没有再次运行 CI。本轮只做远端资料核对,未运行本地测试,作者/评审报告不冒称本轮实测。

    请 QA 在合并后的 main 独立复核原始 Proxy、CN1、CN2 入口,覆盖合法 VALUES/SELECT、NULL 与 warning、prepared 复用/错误恢复、实际 CSV 内容及权限/只读/Iceberg 等拒绝控制。作者单次 SQL 证据不等同原多 CN 场景、生产或全量回归验收;release 4.2 不在本交接保证内,不因此新增 backport 要求。转测不表示验收通过,issue 保持 open。

  6. Ariznawlll commented on Nov 15, 2026

    @Ariznawlll
    Collaborator

    结论

    测试通过。最新 main 的双 CN 隔离环境中,可写 external table 已接受原报告的 INSERT IGNORE VALUES/SELECT;正常写入、NULL 警告及失败边界与数据检查均符合预期。

    关键证据

    • 版本:官方 main@d1893e5ae729b387dd4289ee7ae2ebd06b84a1c0,双 CN、单 TN、单 LogService;两 CN 的 git_version() 均核对为该完整 SHA。
    • 双 CN 运行:每个 CN 各重复 3 次,VALUES、SELECT、prepared、普通 INSERT 和 NULL 转换/1048 warning 均正确;完整查询结果、实际 CSV 多重集和另一 CN 的读取一致。只读 external 写入返回 20301;不可写路径触发 writer 错误后,原文件与表数据不变、原连接可继续使用。
    • 权限及白盒控制:两个 CN 各 3 轮,普通非管理员角色的普通与 IGNORE 外部写入均被拒绝,内部表 DML 正常。TestExternalInsertIgnoreAdmission 在 main 重复 3 次通过、无跳过,检查 writable/readonly、Iceberg、RETURNING、ODKU、OVERWRITE 及 prepared 的 planner 允许/拒绝边界;Iceberg 部分是 mock planner 白盒,并非真实 Iceberg 集群。
    • 新增 MOTR #343,main 专用,双 CN 各重复 3 次、6/6 通过且无跳过;同一用例在旧版 main@71390fb3c16f986b5cbe77e44ea0e5b7f5dbcff6 以原始 20313 错误失败。MOTR 离线 CI 通过,PR 尚待合入;未向 MatrixOne 主库另提测试 PR。

    待解决点

    • 此前完整 issue-regression suite 为 928 项中 797 通过、12 失败、119 跳过,不能称全套通过;真实 Iceberg catalog 和生产环境本轮未测试。修复交接范围为 main,不据此宣称 4.2-dev 通过。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugneeds-triage

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions