Skip to content

[Bug]: Session timestamp override loses a microsecond for some fractions #31047

Done

Description

@XuPeng-SH

Summary

A fractional value accepted by SET SESSION timestamp can be returned one microsecond early by NOW(6) and CURRENT_TIMESTAMP(6). The configured session value reads back at the requested six-decimal precision.

Reproduction

On a fresh UTC session for each case:

SET SESSION time_zone = '+00:00';
SET SESSION timestamp = 1704067200.125000;
SELECT CAST(@@session.timestamp AS DECIMAL(20,6)),
       CAST(NOW(6) AS CHAR),
       CAST(CURRENT_TIMESTAMP(6) AS CHAR);
-- 1704067200.125000 | 2024-01-01 00:00:00.124999 | 2024-01-01 00:00:00.124999

The same one-microsecond loss reproduced for .250000, .625000, and .999999:

Configured fraction NOW(6) / CURRENT_TIMESTAMP(6)
.123456 .123456
.125000 .124999
.250000 .249999
.375000 .375000
.500000 .500000
.625000 .624999
.750000 .750000
.875000 .875000
.999999 .999998

Each value was tested on its own fresh session. SYSDATE() remained tied to wall time, as expected. The exact .123456 and .500000 values covered by the existing session-override regression still pass.

Evidence and scope

This was reproduced over the real MySQL protocol on an isolated local MatrixOne service built from 6f773c556d4f3177f5373eb193cd576e080b662f (binary SHA256 51489b59a60310e79eddcf1182c582685b2c60f800f35a0a625eb5359469349b). The complete SQL fixture and result matrix are available in the QA run artifacts; no customer data was used.

The pinned source main 0abc1d317aea608f3a228297d68e1ae4e619a3a2 has unchanged relevant frontend/session and temporal planner source files from the tested service revision, but a service binary built from 0abc1d3 was not run. This report therefore records the exact tested binary and does not claim a newer binary run.

Related reports

This is a residual fractional-value case related to closed #28599, fixed by merged PR #28932. It is narrower than #22701's general temporal precision report. MySQL documents timestamp as a DOUBLE because it includes microseconds and says it affects NOW() but not SYSDATE(): https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_timestamp.

Activity

  1. added a commit that references this issue on Oct 25, 2026
    80ea60a
  2. Ariznawlll commented on Dec 1, 2026

    @Ariznawlll
    Collaborator

    已在当前官方 main c22be4264ea21f6a705437096b962a5b2337295f 完成原场景复测,验收开末官方 SHA 一致,双 CN git_version() 均一致。

    原生 Go 编译两次均仅因 no space left on device 失败,未计为原生 PASS,也未据此关闭;本关闭依据是上述真实双 CN 原场景验收。证据:screenshot-20261130/three-correctness-main-c22be/。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions