Skip to content

[Bug]: information_schema.TABLES invents UPDATE_TIME and CHECK_TIME at table creation #31163

Closed

Description

@Ariznawlll

Description

Immediately after creating an empty base table, MatrixOne reports information_schema.TABLES.UPDATE_TIME and CHECK_TIME as the table's CREATE_TIME. No update or table check has occurred. MySQL leaves both fields NULL at this point.

Environment

  • Branch: official main
  • Commit: 5fe08a3307e246e1ab9951ab690b50557af0f509
  • Deployment: fresh isolated LOG/TN/CN cluster, SQL port 36601, 2026-10-26
  • Reference: isolated MySQL 8.3.0, local socket only

Steps to reproduce

CREATE DATABASE qa_tabletime_repro;
CREATE TABLE qa_tabletime_repro.t(id INT PRIMARY KEY, v INT);
SELECT table_name, create_time, update_time, check_time
FROM information_schema.tables
WHERE table_schema='qa_tabletime_repro' AND table_name='t';

Actual behavior

MatrixOne returns UPDATE_TIME=CREATE_TIME and CHECK_TIME=CREATE_TIME on the new empty table. This occurred in three independent fresh databases (3/3).

Expected behavior

The metadata should not claim an update or check at creation time. MySQL 8.3.0 returns NULL for both fields on the same fresh InnoDB table.

Stability and controls

  • Reproducer: 3/3 fresh databases qa_tabletime_1, _2, _3.
  • Normal control: a view in each database has UPDATE_TIME=NULL and CHECK_TIME=NULL in both engines.
  • Continuation/data check: inserting one row into each table succeeded and the row count remained exactly one; this is a metadata-only fault.

Evidence

Each of the three rounds, before any INSERT:

                   CREATE_TIME non-NULL  UPDATE_TIME NULL  CHECK_TIME NULL
MatrixOne table    yes                   no                no
MySQL 8.3 table    yes                   yes               yes
MatrixOne/MySQL view: UPDATE_TIME and CHECK_TIME both NULL

Code analysis

pkg/util/sysview/predefined.go InformationSchemaTablesV41DDL (used by the current subscription-aware TABLES view) projects created_time directly as both UPDATE_TIME and CHECK_TIME for base tables. This is distinct from #30910, which tracks hardcoded zero row-count/size statistics.

Regression coverage

Assert CREATE/UPDATE/CHECK metadata for an untouched table, a view, and a table after DML/check operations; never fabricate an event timestamp from creation time.

Activity

  1. added this to the MO-202610 milestone on Oct 26, 2026
  2. added
    kind/bug
    on Oct 26, 2026
  3. added theissue type on Oct 26, 2026
  4. added a commit that references this issue on Oct 27, 2026
    ea4c68a
  5. assigned and unassigned on Oct 28, 2026
  6. Ariznawlll commented on Oct 28, 2026

    @Ariznawlll
    CollaboratorAuthor

    这次旧租户升级窗口同时涉及 #31160 和本 issue 的 UPDATE_TIME/CHECK_TIME。我已在 #31160 的测试说明 中 @aptend:服务可连接但后台维护尚未完成时,同一次升级中的 3 个已有租户新建表短暂返回非 NULL;维护完成后恢复正确,另一次升级后的重启检查也保持正确。

    等待研发确认该窗口是否符合预期,以及维护完成信号与验收标准;当前不把该现象预先判定为新缺陷。

  7. Ariznawlll commented on Nov 2, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    • 官方 main:87fe4e0c3ac3f9a98b308f8931fd3f8be345b076;Issue 修复代码已在该 main 中。
    • 隔离 SQL 服务:127.0.0.1:6001,MatrixOne 8.0.30-MatrixOne-v1.3.0。
    • 测试日期:2026-11-02。

    原问题验证

    新建 qa_tabletime_repro.t(id INT PRIMARY KEY, v INT) 后查询 information_schema.TABLES,CREATE_TIME 非 NULL,UPDATE_TIME 和 CHECK_TIME 均为 NULL;插入一行后两个字段仍为 NULL。3 个独立数据库结果一致。

    Happy Path 覆盖

    1. 新建基础表并查询创建时间、更新时间、检查时间。
    2. 新建视图并查询相同元数据。
    3. 插入数据后再次查询基础表元数据。
    4. MOTR 用例连续三轮运行,27/27 statements 通过。

    Unhappy Path 覆盖

    1. 查询不存在的表返回 0 行。
    2. 重复创建同名表返回 ERROR 1050 (42S01)。
    3. 失败后原表仍存在,UPDATE_TIME/CHECK_TIME 保持 NULL,未产生部分元数据。

    白盒验证

    已核对 pkg/util/sysview/predefined.go:新建基础表的 UPDATE_TIME 和 CHECK_TIME 显式投影为 NULL,视图和分区元数据保持既有语义。

    回归测试

    已加入 matrixorigin/motr#304:suites/14_issue_regression/issue_31163_table_time_metadata。

    测试证据

    MOTR 单次及 --repeat 3 均成功,累计 27/27 statements 通过;执行日志保存在本地 MOTR worktree 的 var/log/ 下。

    测试结论

    测试通过。

  8. Ariznawlll commented on Nov 2, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试结论更正

    之前的测试通过结论和关闭操作过早,已重新打开 Issue。已运行的基础 SQL 和 MOTR 定向测试结果仍有效,但本地运行二进制的构建 SHA 尚未确认,不能将工作树的 SHA 当作运行版本;此前的 Happy/Unhappy 覆盖和完整 suite/CI 验证也不足以作为最终验收。需要在确认版本的官方 main 上补齐测试后再决定状态。

  9. Ariznawlll commented on Nov 3, 2026

    @Ariznawlll
    CollaboratorAuthor

    结论

    测试通过。新建表不会再把创建时间冒充为更新时间或检查时间。

    关键证据

    • 2026-11-03 在独立本地 LOG/TN/CN 环境测试,运行中的 git_version() 确认为官方 main@d61a7206c16b30baa4efc525eb6067c4364035aa。
    • Happy case:新建空表的 CREATE_TIME 非 NULL,而 UPDATE_TIME、CHECK_TIME 均为 NULL;视图作为对照。原始复现和独立公开 SQL 断言均覆盖,定向 MOTR 用例各重复 3 次通过。
    • Unhappy case:验证不存在表的查询不产生虚假行;CHECK TABLE 返回预期的不支持错误;执行 INSERT、UPDATE、DELETE、ALTER 后查询仍正常,不伪造这两个时间。白盒 pkg/util/sysview 的新建表时间与历史视图适配定向测试 -count=3 通过。
    • 回归已加入 MOTR PR #305,用例 issue_31163_table_time_metadata 与公开 SQL 断言均在 PR 中;PR head f110fd965d4e3c29a374704a286434a913c663c1 的 4 项离线 CI 检查通过。此次本地为定向验证,不代表完整 MOTR 全量 suite 已运行。

    待解决点

    无。

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