Skip to content

The retry mutation binds its DateTime64 from integer epoch milliseconds, not timestamp() * 1000 - #153

Merged
zlareb1 merged 6 commits into
mainfrom
pufit/main-green-updated-ms
Nov 1, 2026
Merged

zlareb1 merged 6 commits into
mainfrom
pufit/main-green-updated-ms

Conversation

@pufit

@pufit pufit commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Related: #152

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Why

main is red at tests/unit/test_rmt_version_unit.py::test_no_writer_builds_a_millisecond_version since fae8ccf8 (the memory.extraction_status_mine / extraction_retry_mine merge, whose own CI run on main was cancelled, so it went unseen until the next pull request ran the suite: https://github.com/ClickHouse/loom/actions/runs/40183629842/job/121139733973).

The gate refuses timestamp() * 1000 anywhere under server/, because a ReplacingMergeTree version built in milliseconds never wins against the nanosecond ones. The flagged line in _submit_retry is not a version: it is the bound millisecond value the retry mutation turns into updated_at with fromUnixTimestamp64Milli (a replicated table refuses now64() in a mutation). The spelling is what the gate objects to, so the fix is the expression, not the gate.

Scope and risk

  • _submit_retry binds (_now() - UNIX_EPOCH) // timedelta(milliseconds=1): whole milliseconds by integer arithmetic, no float rounding. Same parameter, same SQL, same clock seam (_now), so tests that pin the module's time still do.
  • server.core.datetimes.UNIX_EPOCH is the one tz-aware epoch; the private copies in extraction_queue, usage_fold, status_store and tasks.app.common read it. The naive datetime(1970, 1, 1) copies stay as they are.
  • Nothing else changes: no schema, no op, no version column.

Compatibility, rollout and rollback

  • Wire: none.
  • Operator steps: none.
  • Rollback: reverting restores the red test; nothing is left behind.

Tests

  • test_retry_changes_only_the_principals_failed_rows_in_scope pins the clock and reads back the stored updated_at, truncated to the millisecond (clickhouse-local).
  • test_rmt_version_unit.py, test_extraction_retry_mine.py, test_extraction_retry_erasure.py pass locally; ruff, mypy-gate and function-length-gate pass.

Generated by Nerve

…) * 1000

memory.extraction_retry_mine updates the failed rows' updated_at through a
bound millisecond value (a replicated table refuses now64() in a mutation).
It built that value as int(_now().timestamp() * 1000) — the exact spelling
the version-unit gate (test_rmt_version_unit) refuses in server code, since a
ReplacingMergeTree version built in milliseconds never wins against the
nanosecond ones; main has been red on that test since the op landed.

The value is a timestamp, not a version, so the fix is the expression:
server.core.datetimes.epoch_ms turns an aware or naive-UTC datetime into
whole milliseconds since the epoch with integer arithmetic, and the mutation
binds that.

Signed-off-by: pufit <[email protected]>
@pufit pufit mentioned this pull request Oct 25, 2026
zlareb1 and others added 5 commits October 27, 2026 11:02
…th the module's

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lareb Zafar <[email protected]>
…d_ms

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lareb Zafar <[email protected]>
…the stored updated_at

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lareb Zafar <[email protected]>
One caller does not need a helper; the read-back test pins the stored value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lareb Zafar <[email protected]>
@zlareb1 zlareb1 changed the title The retry mutation binds its DateTime64 from epoch_ms, not timestamp() * 1000 The retry mutation binds its DateTime64 from integer epoch milliseconds, not timestamp() * 1000 Oct 27, 2026
@zlareb1
zlareb1 merged commit 8dca482 into main Nov 1, 2026
22 checks passed
@pufit pufit mentioned this pull request Nov 2, 2026
9 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants