Skip to content

Accept only time zone names that the built-in database has - #120288

Merged
alexey-milovidov merged 12 commits into
masterfrom
fix-time-zone-name-allowlist-120188
Sep 22, 2026
Merged

alexey-milovidov merged 12 commits into
masterfrom
fix-time-zone-name-allowlist-120188

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Closes: #120188
Related: #119634
Related: #118286

isSupportedTimeZoneName was a deny-list of two prefixes, libc: (#119634) and Fixed/
(#118286), so acceptance of every other name was delegated to whatever cctz's filesystem
fallback could open. That set is not the time zone database.

cctz resolves a name as a path under the time zone database directory, and with a file:
prefix as an arbitrary path, so one zone has unboundedly many names. On master:

SELECT toDateTime(0, 'Europe/./Amsterdam'), toDateTime(0, 'Europe//Amsterdam'),
       toDateTime(0, 'file:UTC'), toDateTime(0, 'file:/usr/share/zoneinfo/UTC');

1970-01-01 01:00:00   1970-01-01 01:00:00   1970-01-01 00:00:00   1970-01-01 00:00:00

None of those names is in system.time_zones (count() = 0), the number of spellings of one
zone is unbounded (./ repeats, extra /, file: + any path), and every distinct name that
gets loaded permanently costs ~4.6 MiB in the DateLUT cache, which never evicts anything
because callers keep bare references into it. So the cache that the two previous fixes were
bounding was still unbounded, reachable through toDateTime(x, '<name>'), the
session_timezone setting, binary type decoding, or the time zone of an Arrow or ORC timestamp
column. Peak RSS of one clickhouse-local process:

queries in one process before after
20 uses of Europe/Amsterdam 182 MB 229 MB
20 distinct ./-padded spellings of Europe/Amsterdam 303 MB rejected
100 distinct ./-padded spellings of Europe/Amsterdam 683 MB rejected
100 distinct file: spellings of UTC 679 MB rejected
100 queries that fail for an unrelated reason (reference) 360 MB 384 MB

The last row is the cost of the exceptions themselves: after the change, the 100 rejected
spellings cost 400 MB, which is that reference and not DateLUT growth.

file: was also a way to read a file outside the time zone database directory, which is exactly
what the CheckTimeZoneName guard vendored into contrib/cctz exists to prevent - it strips
the prefix and uses the rest as the path, so the guard's check on the beginning of the name
never sees the leading /. A TZif file copied anywhere on the filesystem loaded and answered as
that zone:

$ cp /usr/share/zoneinfo/Asia/Kathmandu tmp/mytz
$ clickhouse local -q "SELECT toDateTime(0, 'file:$PWD/tmp/mytz'), toDateTime(0, 'Asia/Kathmandu')"
1970-01-01 05:30:00   1970-01-01 05:30:00

The open happened while DateLUT::getImplementation held its global mutex, so a name pointing
at a FIFO or a hung network mount would have blocked every time zone lookup server-wide.

There is a third family, found by the AI review of this PR: getTimeZone, the lookup of the
built-in database, took a const char * and so stopped at the first \0. Names arrive from
length-prefixed carriers - a SQL literal, readStringBinary in binary type decoding - while
DateLUT::impls keys on the whole byte string, so UTC\0<anything> loaded the UTC blob under
a cache key of its own:

SELECT toDateTime(0, 'UTC\0x');
1970-01-01 00:00:00

100 queries using UTC cost 226 MB of peak RSS, 100 using distinct UTC\0<n> spellings cost
680 MB. The generated lookup now takes a std::string_view, so both the predicate and the
loader compare the whole name; the same 100 spellings now cost 392 MB, against the 385 MB
reference above.

The change

Make the check an allow-list: a name is accepted only if it is in the time zone database linked
into the binary - which is exactly what system.time_zones lists, and what the documentation of
the DateTime type and of session_timezone already tell users to use - or if it is one of the
114 Fixed/UTC±HH:MM:SS names for the offsets a time zone can really have (#118286). So the
cache holds at most 712 entries. This closes the padded spellings and the file: prefix in one
line, subsumes the libc: prefix, and makes the message the check reports true. The cctz
fallback in custom_factory is dropped as well, so no name can reach the host's filesystem even
if it gets past the predicate.

Names that only the host's time zone database has are no longer accepted. This is the
trade-off the issue names. ClickHouse ships its own tzdata (currently 2026c, 598 zones)
precisely so that results do not depend on the host; such a name is absent from
system.time_zones, so no user can discover or portably use it; and timezone() answering a
name that system.time_zones does not list is itself wrong. The one place where the host chooses
the name is the server's own local time zone, so DateLUT reports that case at startup, naming
the zone and how to override it, instead of leaving DateLUTImpl to report an unsupported name
with no hint that the host, and not a query, chose it.

This does not make the cache small - the 598 names of the time zone database plus the 114 fixed
offsets still reach ~3.2 GB if all of them are used - it makes it bounded. Shrinking a
DateLUTImpl, or evicting entries, is a separate matter (#107459).

Verified that all 598 names of system.time_zones and all 114 fixed offsets are still accepted.

Tests

New: 05218_time_zone_names_from_database, including the embedded-\0 spellings through
toDateTime, toDateTime64, CAST(... AS DateTime(...)) and session_timezone.

03926_arrow_fixed_offset_timezone: a misspelled time zone name is now reported as Time zone X is not supported. Use a name from `system.time_zones`, ... instead of Cannot load time zone X.

05059_formatDateTime_extralong_timezone checked the 32-byte limit that
formatDateTimeInJodaSyntax puts on a time zone name, using 'Etc' || repeat('/', 26) || 'UTC'
to reach exactly 32 bytes. That spelling is one of the ones this PR rejects, and the longest
real name, America/Argentina/ComodRivadavia, is exactly 32 bytes, so the test now uses it: the
name the per-row reservation has to fit is a real one, and nothing longer can be constructed.

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fix unbounded memory growth from time zone names that were not names of the time zone database:
dot segments or repeated separators inside a real name (Europe/./Amsterdam,
Europe//Amsterdam), the file: prefix, which took the rest of the name as a path and read a
file outside the time zone database directory, and a name carrying a zero byte, which was matched
against the database only up to that byte. None of these is listed in system.time_zones, one
zone had unboundedly many of them, and every distinct name permanently cost ~4.6 MiB that the
server never gave back. A time zone name now has to be one that system.time_zones lists, or a
fixed UTC offset spelled Fixed/UTC±HH:MM:SS; a name that only the host's time zone database has
is no longer accepted.


Workflow [PR]
Sync PR [sync-upstream/pr/120288]

Version info

  • Merged into: 26.10.1.434-master (included in 26.10 and later)

`isSupportedTimeZoneName` was a deny-list of two prefixes, `libc:` and `Fixed/`, so acceptance
of every other name was delegated to whatever `cctz`'s filesystem fallback could open. That set
is not the time zone database. `cctz` resolves a name as a path under the time zone database
directory, and with a `file:` prefix as an arbitrary path, so one zone has unboundedly many
names: `Europe/./Amsterdam`, `Europe//Amsterdam`, `file:UTC`, `file:/usr/share/zoneinfo/UTC`,
and any number of repetitions of `./` and `/`. None of them is in `system.time_zones`, and
every distinct name that gets loaded permanently costs ~4.6 MiB in the `DateLUT` cache, which
never evicts anything because callers keep bare references into it. So the cache that the two
previous fixes were bounding was still unbounded, reachable through `toDateTime(x, '<name>')`,
the `session_timezone` setting, binary type decoding, or the time zone of an Arrow or ORC
timestamp column. Peak RSS of `clickhouse-local`, before this change:

  20 uses of `Europe/Amsterdam`                             182 MB
  20 distinct `./`-padded spellings of `Europe/Amsterdam`    303 MB
  100 distinct `./`-padded spellings of `Europe/Amsterdam`   683 MB
  100 distinct `file:` spellings of `UTC`                    679 MB

`file:` was also a way to read a file outside the time zone database directory, which is
exactly what the `CheckTimeZoneName` guard vendored into `contrib/cctz` exists to prevent: a
TZif file copied anywhere on the filesystem loaded and answered as that zone. The open happened
while `DateLUT::getImplementation` held its global mutex, so a name pointing at a FIFO or a hung
network mount would have blocked every time zone lookup server-wide.

Make the check an allow-list: a name is accepted only if it is in the time zone database linked
into the binary - which is exactly what `system.time_zones` lists, and what the documentation of
the `DateTime` type and of `session_timezone` already tell users to use - or if it is one of the
114 `Fixed/UTC±HH:MM:SS` names for the offsets a time zone can really have. So the cache holds
at most 712 entries. This closes the padded spellings and the `file:` prefix in one line,
subsumes the `libc:` prefix, and makes the message the check reports true. The `cctz` fallback
in `custom_factory` is dropped as well, so no name can reach the host's filesystem even if it
gets past the predicate.

Names that only the host's time zone database has are no longer accepted. ClickHouse ships its
own tzdata precisely so that results do not depend on the host, such a name is absent from
`system.time_zones`, and `timezone()` answering a name that no user can spell is itself wrong.
The one place where the host chooses the name is the server's own local time zone, so `DateLUT`
reports that case at startup, naming the zone and how to override it.

This does not make the cache small - the 598 names of the time zone database plus the 114 fixed
offsets still reach ~3.2 GB if all of them are used - it makes it bounded. Shrinking a
`DateLUTImpl`, or evicting entries, is a separate matter (#107459).

A misspelled time zone name is now reported as "Time zone X is not supported. Use a name from
`system.time_zones`, ..." instead of "Cannot load time zone X", so
`03926_arrow_fixed_offset_timezone` is updated.

`05059_formatDateTime_extralong_timezone` checked the 32-byte limit that
`formatDateTimeInJodaSyntax` puts on a time zone name, using `'Etc' || repeat('/', 26) || 'UTC'`
to reach exactly 32 bytes. That spelling is one of the ones this rejects, and the longest real
name, `America/Argentina/ComodRivadavia`, is exactly 32 bytes, so the test uses it instead: the
name the per-row reservation has to fit is a real one, and nothing longer can be constructed.

Closes: #120188
Related: #119634
Related: #118286

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [db0df38]

Summary: ✅


AI Review

Summary

This PR tightens time zone acceptance to the embedded tz database plus canonical Fixed/UTC±HH:MM:SS offsets, removes the remaining cctz fallback paths that could alias or filesystem-resolve arbitrary names, and adds focused regression coverage for embedded-\0 names, file:/path spellings, non-canonical Fixed/UTC aliases, and host-local TZ aliases. After reconciling the current head against all prior review threads and replies, I do not see any remaining correctness, safety, or evidence gaps that warrant new review comments.

Final Verdict

Status: ✅ Approve

LLVM Coverage Report

Measured on commit db0df38.

Metric Baseline Current Δ
Lines 88.00% 88.00% +0.00%
Functions 91.70% 91.70% +0.00%
Branches 79.30% 79.30% +0.00%

Changed lines: Changed C/C++ lines covered: 53/60 (88.33%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Sep 15, 2026
Comment thread src/Common/DateLUTImpl.cpp Resolved
@alexey-milovidov alexey-milovidov added the blocker This issue / pr blocks a new release label Sep 15, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-datetime Date/DateTime/TimeZone datatypes and date-time semantics. label Sep 15, 2026
`getTimeZone`, the lookup of the time zone database linked into the binary, took a
`const char *`, so it stopped at the first `\0`. Names reach it from length-prefixed carriers - a
SQL literal, `readStringBinary` in binary type decoding - and `DateLUT::impls` keys on the whole
byte string, so `UTC\0<anything>` was accepted, loaded the `UTC` blob, and took a cache entry of
its own for every suffix:

  SELECT toDateTime(0, 'UTC\0x');
  1970-01-01 00:00:00

That is the allow-list of the previous commit defeated by one more unbounded family of
spellings. Peak RSS of one `clickhouse-local` process, before this change: 100 queries using
`UTC` cost 226 MB, and 100 using distinct `UTC\0<n>` spellings of it cost 680 MB.

So give the generated lookup a `std::string_view` parameter, which makes both the predicate and
the loader compare the whole name. The `Fixed/UTC±HH:MM:SS` branch was already matched by
length, since it checks the size of the offset part.

Found by the AI review of #120288

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Confirmed and fixed in b4c2e9f.

The finding is right, and it is reachable from plain SQL too — a string literal is a length-prefixed carrier as much as readStringBinary is:

SELECT toDateTime(0, 'UTC\0x');
1970-01-01 00:00:00

Peak RSS of one clickhouse-local process before the fix: 100 queries using UTC cost 226 MB, 100 using distinct UTC\0<n> spellings of it cost 680 MB. After the fix the same 100 spellings cost 392 MB, against a 385 MB reference for 100 queries that fail for an unrelated reason — so what is left is the cost of the exceptions, not DateLUT growth.

Took the first of the two suggestions: the generated lookup now takes a std::string_view (contrib/cctz-cmake/CMakeLists.txt), so isSupportedTimeZoneName and custom_factory both compare the whole name and no name can alias another by truncation. A \0 guard at the two call sites would have left the lookup itself able to alias; this removes that. isSupportedTimeZoneName goes back to taking a std::string_view now that the c_str() is gone. The Fixed/UTC±HH:MM:SS branch was already matched by length, since it checks the size of the offset part.

Note this predates the PR — the same getTimeZone(name.data()) is in custom_factory on master, and the old predicate accepted anything outside the two prefixes — but it defeats the bound this PR claims, so it belongs here.

Regression tests in 05218_time_zone_names_from_database: UTC\0, UTC\0suffix, Europe/Amsterdam\0suffix and Fixed/UTC+05:30:00\0suffix through toDateTime, toDateTime64 and CAST(… AS DateTime(…)), plus SET session_timezone = 'UTC\0suffix'.

Re-verified after the change that all 598 names of system.time_zones and all 114 Fixed/UTC±HH:MM:SS names are still accepted, and re-ran the 62 timezone/time_zone stateless tests plus 05098, 05194, 05059, 03926, 02668, 00396, 00189: all green.

@clickhouse-gh clickhouse-gh Bot added the submodule changed At least one submodule changed in this PR. label Sep 16, 2026
Comment thread src/Common/DateLUTImpl.cpp Resolved
@alexey-milovidov

Copy link
Copy Markdown
Member Author

CI on b4c2e9fe: 150 green, 4 red, and all four are infrastructure — no test failed.

Everything that exercises this change is green, including Fast test, all 20 builds, arm_tidy, Unit tests (7 configs, which construct a DateLUTImpl for all 598 embedded zones), every Stateless tests config, Stress test (11 configs), AST fuzzer (7 configs), BuzzHouse (4 configs), Upgrade check, Bugfix validation, and CH Inc sync.

Re-ran the four failed jobs.

Related: #120459
Related: #113408

@alexey-milovidov

Copy link
Copy Markdown
Member Author

Follow-up on the reds — both are now filed, and Build profile diff failed identically on the re-run, so neither is transient:

Neither job ran a single test, and both fail the same way on master, so nothing here reflects on this change.

Related: #120459
Related: #120462

Comment thread src/Common/DateLUTImpl.cpp Resolved
alexey-milovidov and others added 2 commits September 19, 2026 18:27
`isSupportedTimeZoneName` checked only the total offset of a `Fixed/UTC±HH:MM:SS` name, but
`cctz` normalizes the components, so `Fixed/UTC+00:75:00` and `Fixed/UTC+01:14:60` load the very
same `+01:15` zone as `Fixed/UTC+01:15:00` does. One offset therefore had several names, and with
them several permanent entries of the `DateLUT` cache - the aliasing this predicate exists to
prevent, and the same defect as the dot segments and the embedded `\0`, inside the `Fixed/`
branch.

Reject out-of-range components before the total-offset check, so a fixed offset has exactly one
spelling and the bound this change describes holds: the 598 names of the time zone database plus
114 fixed offsets.

Negative coverage in `05218_time_zone_names_from_database` through `toDateTime`, `toDateTime64`,
`CAST(... AS DateTime(...))` and `session_timezone`, next to the canonical spelling, which is
still accepted.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master into the branch (605 commits, clean — master did not touch any file this PR changes; the diff against master is unchanged at 10 files).

The only red on the previous head was Build profile diff, and it is the CI logs cluster again, not this change: job log. This time it is not the connection probe but a query that the endpoint refuses, so the job fails closed in compare_opt_functions:

RuntimeError: CI logs cluster query failed: SELECT file, quantileExactWeightedInterpolated(0.5)(pr_dur / base_dur, 1) AS skew, ...
    FROM build_time_trace ...

Zero comparison data is involved from this branch — Build profile diff reads build_time_trace rows for arm_release and compares them against the master base; nothing it reads is produced by the time zone change. Same underlying cluster as #120462, which is still open.

@groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120288&sha=835727aaf3262c20f8fc8706698d108c121e336d&name_0=PR&name_1=Build%20profile%20diff and provide a fix in a separate PR. If the fix is already in progress, link it here — note #120121, which would have turned exactly this class of read failure into a skipped comparison, was closed unmerged.

Related: #120462

Comment thread src/Common/DateLUT.cpp Resolved
@groeneai

Copy link
Copy Markdown
Collaborator

Investigated. It is not a query the endpoint refuses: every attempt timed out without ever getting an answer.

What the log says. LogCluster.select is retries=8, timeout=60, and all eight attempts on that one query raised requests.exceptions.ReadTimeout (03:45:51 through 03:55:12). No attempt got an HTTP status back, and there is no WARNING: LogCluster not ready line, so the 3 s SELECT 1 probe that runs in front of every attempt passed each time; the job had also already resolved both sides from the same endpoint (Comparing PR 120288 sha 835727aa against master 0b3b89d0 at 03:43:14). RuntimeError: CI logs cluster query failed: <query> is only what Db.query prints when select returns None: it echoes the query and never the reason, which is why the log reads like a rejection. The endpoint was up and serving trivial reads while the build_time_trace aggregations did not return within 60 s.

It is fleet wide and still going. In default.checks, Build profile diff last succeeded at 2026-09-20 01:24:29 and has failed on every run since: 242 consecutive failures up to 10:25 UTC, 13 to 31 minutes each, 73 runner-hours. I sampled three unrelated ones (#120614 at 01:25, #94148 at 06:31, #119585 at 07:56): identical shape, 8/8 ReadTimeout, zero HTTP statuses, zero No connection to LogCluster. Only the frame differs, because whichever heavy query runs first absorbs the outage: compare_symbols there, compare_opt_functions here. Heavy reads do still complete sometimes (#119585 survived 15 timed-out attempts over 23 minutes before compare_symbols exhausted its eight), and an earlier burst yesterday 19:00 to 20:00 recovered on its own. So #120462 is an open incident on the read-only endpoint right now, and no re-run can turn this green.

The fix in flight is yours, #121048. A ReadTimeout is a raising POST, so select ends at raise LogClusterUnavailable("every POST attempt failed with an exception") and report_cluster_unavailable completes the job green: this exact failure is covered. #118708 reaches the same outcome by the SKIPPED route (ReadTimeout is a requests.exceptions.Timeout, so select raises TransientReadFailure). Both rewrite the same select, so only one should land, and since yours is the owner's design with the OK-over-SKIPPED choice argued in its body, I am happy for it to be the one that does. For the record, azat asked for that skip inside #118708 on 2026-09-17 and it is implemented at 81e3d56. Tell me which of the two you want kept and I will close the other or rebase it down to whatever is left. No separate PR is needed for this failure.

One thing worth settling before #121048 merges. is_ready() returning false is classified unconditionally as LogClusterUnavailable, so a permanently unusable endpoint (a rotated password, a deleted SSM parameter, SELECT 1 not answering 1) also completes green with "the endpoint never became ready", and the check would then report nothing for the whole fleet for as long as that lasts. I have no occurrence of it in today's logs; it is only the question of whether the readiness leg belongs with the >= 500 leg or with the 4xx one.

#121048 is MERGEABLE but blocked: Performance Comparison (arm_release, master_head, 5/6) and (6/6) are failure at the job level with zero FAIL or ERROR test rows in default.checks (1309 and 1165 rows), which a change under ci/jobs/ cannot cause.

…ases

`determineDefaultTimeZone` returns the path of the host time zone file
relative to the time zone database directory, and that path keeps the
`posix/` or `right/` directory component when the host points its local
zone at one of those alternate copies - `/etc/localtime ->
/usr/share/zoneinfo/right/Europe/Berlin`, or `TZ=posix/Europe/Berlin`.
Neither prefixed name is in the database linked into the binary, so with
the allow-list this pull request introduces the server refused to start
on such a host. Confirmed with a control: `posix/Europe/Berlin` and
`right/Europe/Berlin` are both rejected by `isSupportedTimeZoneName`.

Strip the prefix in the two relative-path fast paths, which are the only
places that see the host-selected name verbatim - the content-scan
fallback below them already skips both directories, so a name it returns
is canonical already. `right/` zones count leap seconds, which ClickHouse
does not model, so `right/Europe/Berlin` is `Europe/Berlin` here; that is
also what the content scan resolves a copied `posix/` file to today.

`05233_local_time_zone_posix_right_alias` builds a private time zone
database with both directories and checks all five spellings resolve to
`Europe/Berlin`, covering both the name that comes from `TZ` and the name
that comes from the path of the file the local zone points to.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Pushed 03eead7bd3be, which adopts the AI Review blocker (posix/ / right/ host aliases becoming a startup failure). Details and the control that reproduces it are in the thread; short version: the two relative-path fast paths in determineDefaultTimeZone now strip the non-canonical directory component, and 05233_local_time_zone_posix_right_alias pins all five spellings.

On the reds from 206cf41d:

Related: #121163
Related: #120462
Related: #121048

Comment thread src/Common/DateLUTImpl.cpp Resolved
@groeneai

Copy link
Copy Markdown
Collaborator

Understood on both points.

is_ready(): the classification is posted on #121048 as the exact change, #121048 (comment). It is a LogClusterNotReady sibling of LogClusterError, which main() does not catch, so the job fails with no change in build_profile_diff_job.py. The leg you named is already the persistent case: that raise is only reached when all 8 attempts gave up before their POST, so the probe was false for the whole 180 s of backoff, and a blip that clears sets post_attempted and never lands there. The comment also names the one cause the rule pulls in with it, a transport timeout on the probe's own 3 s SELECT 1, and the five-line lever if you want only the three causes you named to be red.

#118708: stood down, no further pushes. I asked @ azat on the thread to confirm the close, #118708 (comment), since he has four review rounds in it and closed #120121 in its favour; I will close it on his word. If you would rather I not wait for that, say so and it is closed.

One correction to my note above, from measuring again just now: the endpoint is flapping rather than down, so a re-run can pass between bursts. Since 01:20Z today, 257 errored Build profile diff runs against 31 green: solid red 01:24 to 10:25, green 11:00 to 12:50, red again 12:50 to 13:18, green since 13:30, latest at 14:01Z. 77.7 runner-hours on the failed runs alone. The signature of the 13:18Z burst is identical to the one I reported (8 of 8 ReadTimeout, no HTTP status, no LogCluster not ready, only the frame differs: compare_symbols there), so nothing in this changes the diagnosis or #121048's shape.

@clickhouse-gh

clickhouse-gh Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing db0df38fe with master de0be4574 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 5af633e4c; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

13 translation units recompiled, 29 s compile time in total, 13 of them have a recent master baseline.

Job report

… docs

The predicate now accepts exactly the names of the time zone database that
is linked into the binary - what `system.time_zones` lists - plus the
canonical `Fixed/UTC±HH:MM:SS` offsets, but three source-level doc strings
still described the old contract:

- `registerDataTypeDateTime.cpp` pointed at the IANA database as the list of
  supported zones, without saying that it is the shipped copy and not the
  host's, and without the fixed-offset spelling.
- `ParserSetQuery.cpp` said `SET TIME ZONE` takes any valid IANA name.
- `Settings.cpp` listed only `system.time_zones` names for
  `session_timezone` and omitted the fixed offsets, which the new error
  message itself mentions.

All three now name the same set the code enforces, and say that a name only
the operating system's database has is rejected. The generated pages under
`docs/reference/` are regenerated from these strings, so they are left alone.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Pushed de5636817e72, which adopts the AI Review "Request changes" verdict — the only outstanding item. The three structured doc strings (DateTime, session_timezone, SET TIME ZONE) now describe the set the predicate enforces: system.time_zones names from the tz database shipped with the server, plus canonical Fixed/UTC±HH:MM:SS offsets, with host-only names explicitly out. Details in the thread. All three translation units compile.

On the reds from 03eead7b: the only real failure is still 05227_storage_settings_unknown_name on five stateless shards, and it is fleet-wide rather than this branch's — the CIDB rows for it are dominated by pull_request_number = 0 runs on master itself, and the fix, #121163, is still open and unmerged, so a fresh master merge would not clear it. Finish Workflow is the cascade of that one (Bugfix validation DROPPED because Stateless tests (amd_debug, parallel) failed), not an independent failure. Build profile diff came back green on this head.

Related: #121163

Comment thread src/Common/DateLUT.cpp Resolved
…one` server setting

The startup exception pointed at the `timezone` server setting as the way to
recover from a local zone ClickHouse does not know, but described it as taking
"a name from `system.time_zones`" only. `DateLUT::setDefaultTimezone` goes
through the same `DateLUTImpl::isSupportedTimeZoneName` allow-list as everything
else in this change, so a canonical `Fixed/UTC±HH:MM:SS` offset is accepted
there as well. Mention it, so the one recovery path the message names is
described in full.

The published `timezone` docs said "an IANA identifier", which both missed the
fixed-offset form and implied that any IANA name works, including one that only
the host's time zone database has. Restate them on the new contract. Only
`docs/reference/settings/server-settings/_server_settings_outside_source.mdx` is
edited: it is the source of truth that the server-settings generator reads, and
the copy in `docs/reference/settings/server-settings/settings/other.mdx` sits
inside the `AUTOGENERATED` markers.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@mintlify

mintlify Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
ClickHouse-docs 🟢 Ready View Preview Sep 22, 2026, 6:46 AM

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Both reds on cedcfe93b734 are unrelated to this change, and each already has a fix in flight.

No test of this change failed; the full stateless/integration report on this head is clean. 0 unresolved review threads, AI Review verdict is ✅ Approve on this exact head. Nothing to push — the branch stays at cedcfe93b734.

…allowlist-120188

Pulls in #121272, which fixes the
fleet-wide `Logical error: Incorrect table expression` (STID 3510-55f2) in
`StorageView::replaceWithSubquery` that was the only non-infra red on this
branch.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master (86a945d83f68) to pull in #121272, which merged at 2026-09-21 13:11 UTC and fixes the Logical error: Incorrect table expression (STID 3510-55f2) in StorageView::replaceWithSubquery — the only non-infra red on the previous head cedcfe93b734. The merge was clean and the diff against master is unchanged (the same 16 files); the five affected translation units (DateLUT.cpp, DateLUTImpl.cpp, Settings.cpp, registerDataTypeDateTime.cpp, ParserSetQuery.cpp) recompile with no warnings.

The other red, Build profile diff, is the flapping CI-logs-cluster read failure tracked in #120462 (fixes #121048 and #118708 are still open), so it is not cleared by this merge.

Comment thread src/Common/DateLUT.cpp Resolved
`determineDefaultTimeZone` kept the raw `TZ` spelling whenever the name was
relative, and the filesystem accepts many spellings of the same zone file that
a zone name does not have: `Europe/./Amsterdam`, `Europe//Amsterdam`, a leading
`./`, and any repetition of those. With the new allow-list such a name is no
longer accepted - `isSupportedTimeZoneName` deliberately rejects the extra
spellings, since each of them would otherwise be a separate `DateLUT` cache
entry for one and the same zone - so `DateLUT::DateLUT` threw and the server
refused to start on a host whose local time zone was configured that way.

The raw spelling is preferred only because resolving symlinks can rename a zone
(`/etc/localtime -> .../UTC -> UCT`), so keep it when the time zone database
knows it, and otherwise use the name that resolving the path produced. This is
the same regression class as the `posix/` and `right/` prefixes fixed earlier
in this pull request, and the prefix stripping still applies on top of the
resolved name.

`05233_local_time_zone_posix_right_alias` gained the five non-canonical `TZ`
spellings, with and without the POSIX `:` prefix, and two spellings that need
both the prefix and the `./` component removed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Pushed 5cd96c7f5ee3, which addresses the one Blocker of the ❌ Request changes verdict on src/Common/DateLUT.cpp:138.

determineDefaultTimeZone kept the raw TZ spelling for every relative name, and the filesystem accepts spellings of a zone file that a zone name does not have - Europe/./Berlin, Europe//Berlin, a leading ./, and any repetition of those. The allow-list rejects them deliberately, because each one would be a separate DateLUT cache entry for one and the same zone, so the fix belongs in the name determination and not in the predicate. Control on the previous binary: SELECT toDateTime(0, 'Europe/./Berlin') throws Time zone Europe/./Berlin is not supported, so a host configured that way really did turn into a startup failure.

New preferredTimeZoneName keeps the raw spelling only when the time zone database knows it - the reason it was preferred in the first place is that resolving symlinks can rename a zone, /etc/localtime -> .../UTC -> UCT - and otherwise uses relative_path.lexically_normal(). The posix/ / right/ stripping still applies on top, so a name needing both fixes gets both.

05233_local_time_zone_posix_right_alias now pins all five non-canonical spellings with and without the POSIX : prefix, plus posix/./Europe/Berlin and right//Europe/Berlin for the combined case. Full ninja clickhouse is green; 05233 (12/12) and 05218 both pass locally.

The Build profile diff note above is from the older head cedcfe93b734 (#120462, infra, flapping); it came back green on 86a945d83f68.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master (db0df38fe0e5, 272 commits, clean, no conflicts) to pull in #121477.

The only red on 5cd96c7f5ee3 was Integration tests (amd_asan_ubsan, db disk, 1/8): test_max_bytes_ratio_before_external_distinct[server] failed with MEMORY_LIMIT_EXCEEDED on the numbers(10000000, 7000000) query. That query is the shape #121096 gave the test; the branch itself did not carry that commit, the CI job ran the branch merged with master of the time. The failure is fleet-wide (62 failures across 60 PRs on 2026-09-21 and 2026-09-22, 4 on master itself) and #121477 reverted #121096 at 2026-09-22 02:58 UTC, so the merge clears it. Nothing in this PR touches memory accounting or external DISTINCT.

Related: #121454

master changed src/Common/DateLUTImpl.h (week-number arithmetic for toWeek / toYearWeek) and src/Core/Settings.cpp since the previous head, both disjoint from the allow-list; the diff against master is still the same 16 files. A full clickhouse link on the merge is clean with zero warnings, and 05218_time_zone_names_from_database plus 05233_local_time_zone_posix_right_alias pass against that binary.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 CI on db0df38fe0e5 is green across the whole public workflow (156 green, 17 skipped, 0 red; AI Review ✅ Approve, 0 unresolved threads). The only red is CH Inc sync, and it is not this change.

The private sync PR https://github.com/ClickHouse/clickhouse-private/pull/75243 merges and builds; one shard failed, Stateless tests (amd_asan_ubsan, distributed cache, meta in keeper, s3 storage, parallel, 2/2). The server aborted mid-run (Received signal 6 (internal), STID 5165-5d20) with std::terminate reached from TransactionManager::finalizeCommittedTransaction via ImplicitTransactionControlExecutor::commit under HTTPHandler. The follow-on 04650_adaptive_aggregator_pressure_spill Connection reset by peer and Server liveness check failed are just the fallout of that abort.

This is the known open crash #115501 ("Transaction log finalize failed during commit"; the issue records the trace as seen on master itself), tracked privately as clickhouse-private#45736. This PR changes only time zone name validation (DateLUT*, Settings.cpp doc strings, ParserSetQuery.cpp, registerDataTypeDateTime.cpp) and nothing in the transaction path. Re-ran only the failed private job (run 35696756567); no code change and no new master merge, since master has no fix for #115501 to pull in.

@alexey-milovidov alexey-milovidov self-assigned this Sep 22, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect!

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 22, 2026
Merged via the queue into master with commit d35cb18 Sep 22, 2026
176 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-time-zone-name-allowlist-120188 branch September 22, 2026 15:26
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 22, 2026
qoega pushed a commit to qoega/ClickHouse that referenced this pull request Nov 19, 2026
… logs cluster outage

When the read-only sub-service of the CI logs cluster stops answering,
every `SELECT 1` readiness probe of `LogCluster.select` raises
`requests.exceptions.ReadTimeout`. `is_ready` turned that into a bare
False without a `probe_error`, so `select` raised `LogClusterNotReady`,
which `build_profile_diff_job.main` does not catch, and the check went
red on unrelated PRs (8 of them on 2026-11-06 between 00:00Z and 02:52Z,
e.g. job 127646247697 of ClickHouse#129611). The same outage hitting a POST already
ends `LogClusterUnavailable` (ClickHouse#121048), and so does a probe the server
rejects with 241 (ClickHouse#128067).

A probe that raises `ReadTimeout` now records `LogClusterUnavailable` in
`probe_error`, and the tail added by ClickHouse#128067 reports the read green as
"the endpoint never became ready: the readiness probe timed out: ...".
The last probe decides, as there.

A `ReadTimeout` (requests 2.33.0, the CI pin) is raised only after the
name resolved and a server accepted the connection: a stalled TLS
handshake or a stalled answer. Connection refused, an unresolvable name,
no SYN-ACK and a certificate mismatch raise `ConnectionError`
(`ConnectTimeout` and `SSLError` are subclasses), and the server itself
rejects a rotated password with 516. All of those, a missing secret and
a gateway answer still end `LogClusterNotReady`, as ruled on ClickHouse#120288.

This is the `SELECT 1`-timeout leg left open on ClickHouse#121048. Validated with
a throwaway harness against master (real sockets, mocked transport and
`main()` end to end); only the probe-timeout cases change. No test is
committed for the CI scripts (ClickHouse#119766).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch was successfully deployed

1 active deployment
staging - docs — db0df38f Deployed Sep 22, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocker This issue / pr blocks a new release comp-datetime Date/DateTime/TimeZone datatypes and date-time semantics. pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo submodule changed At least one submodule changed in this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unbounded DateLUT growth remains: dot-padded and file: time zone names

3 participants