Repository navigation
Finish the LONG_IS_A_DISTINCT_TYPE conversion, and fix it for wasm64 - #112866
Conversation
`base/defines.h` names the two conditions under which `long` and `size_t` are types of their own, distinct from every fixed-width integer type, and `base/itoa.h` and `Common/iota.h` already use them. Two places still spell the same thing `OS_DARWIN`: the `Field::safeGet<unsigned long>` instantiation and the `ColumnVector<T>::indexImpl<size_t>` ones. No behaviour change on any platform - both macros are defined exactly when `OS_DARWIN` is - but the named conditions say why the instantiation is there, and cover the other platforms where it is needed. `base/defines.h` is now included outright in both files rather than relied on transitively, since the `#if` would silently evaluate false if it ever stopped arriving. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Workflow [PR], commit [5d1e55d] Summary: ✅
AI ReviewSummaryThis PR finishes the Final Verdict
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 0/0 (nothing coverable) · Uncovered code |
…each other `LONG_IS_A_DISTINCT_TYPE` tests `!defined(__LP64__)`, which is wrong for `wasm64`: that target is LP64, so `long` is 64 bits wide, but its `uint64_t` is `unsigned long long`, so `long` is still not one of the fixed-width types. The macro therefore said "not distinct" while `SIZE_T_IS_A_DISTINCT_TYPE` said "distinct" - and since `size_t` is `unsigned long` there, the two contradicted each other. The symptom is that `itoa(size_t)` becomes ambiguous, far from anything that mentions either macro. Name WebAssembly explicitly, and state the implication between the two macros as an `#error`, since one is documented as strictly narrower than the other. `base/itoa.h` also gains the self-check that `Common/iota.h` already has, so the condition cannot silently drift from the types it is describing. No change on any platform that builds today: `__LP64__` is defined and `__wasm__` is not, so `LONG_IS_A_DISTINCT_TYPE` is unset exactly as before, and the two static_asserts and the `#error` all hold. Checked with Emscripten 6.0.5: `-sMEMORY64=1` confirms `__LP64__` is defined, `size_t` is `unsigned long` and `uint64_t` is `unsigned long long`, and `itoa(size_t)` resolves after this change and does not before. On the host both static_asserts hold and the `#error` fires when the macros are forced out of agreement. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The `#else` branch of the new self-check spells `long` in a `std::is_same_v` comparison, and clang-tidy asks to replace it with `int64` - which is exactly the thing the assertion is there to rule out, so the suggestion cannot be followed. Wrap the whole conditional in `NOLINTBEGIN`/`NOLINTEND` for `google-runtime-int`; the `#if` branch instantiates `long` and `unsigned long` for the same reason and would hit it on Darwin and `wasm64`. Failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=112866&sha=ada63397799cda5d8ce97f24627363d536e01b2b&name_0=PR&name_1=Build%20%28arm_tidy%29 #112866
…nct-type # Conflicts: # base/base/defines.h
|
🕵 The only CI red was Merged |
The test needs INSERT analysis to serve a stale schema while the sink force-reads the latest one. It built that by warming the server-global Iceberg metadata files cache and relying on the entry surviving to the INSERT. That cache is SLRU-bounded at 1000 entries and shared with every other test on the server, so a cache left at its bound by earlier tests evicts the entry: the INSERT reads fresh, both views agree, and the rejection correctly does not fire. A second defect made that silent. Both oracles were `grep -oF "INCORRECT_DATA"`, which prints nothing for a successful INSERT and nothing for a different error code, so the reference diff could not distinguish a wrong error code from no error at all, and in the opposite cache state the test passed vacuously. Clear the cache immediately before each warm-up SELECT so the test owns the state it depends on, and report the actual outcome for every outcome (the error code name, or NO_ERROR). The reference file is unchanged, so the rejection must still fire in both scenarios; a run that stops exercising it now fails and names what happened instead of passing. no-parallel is kept, and its comment now states the real reason: the test issues a server-global cache clear, so it must be alone on the server. That is the same pairing 03272_prewarm_mark_cache_add_column.sql uses for the mark cache. Validation: with the cache bound lowered to 40 and pre-filled to 40/40 occupancy (measured via IcebergMetadataFilesCacheFiles), the old form fails with a stdout diff byte-identical to the CI failure and the new form passes on that same injected state. 50/50 randomized runs pass. The only other tests using iceberg_metadata_staleness_ms, 04214 and 04337, are not exposed to residual occupancy and are unchanged. Failed 7 times on Stateless tests (arm_asan_ubsan, targeted) across two unrelated PRs, ClickHouse#113010 and ClickHouse#112866.
|
🕵 Merged |
…nct-type # Conflicts: # base/base/defines.h
base/defines.hnames the two conditions under whichlongandsize_tare types of their own, distinct from every fixed-width integer type, andbase/itoa.handCommon/iota.halready use them. Two places still spelled the same thingOS_DARWIN: theField::safeGet<unsigned long>instantiation and theColumnVector<T>::indexImpl<size_t>ones.base/defines.his now included outright in both files rather than relied on transitively, since the#ifwould silently evaluate false if it ever stopped arriving — and on Linux that is also the correct answer, so nothing would notice until a Darwin build failed to link.While converting them, one of the two macros turned out to be wrong.
LONG_IS_A_DISTINCT_TYPEtests!defined(__LP64__), which does not hold forwasm64: that target is LP64, solongis 64 bits wide, but itsuint64_tisunsigned long long, solongis still not one of the fixed-width types. The macro therefore said "not distinct" whileSIZE_T_IS_A_DISTINCT_TYPEsaid "distinct" — and sincesize_tisunsigned longthere, the two contradicted each other, despite one being documented as strictly narrower than the other. The symptom is thatitoa(size_t)becomes ambiguous, a long way from anything that mentions either macro.So: name WebAssembly explicitly, state the implication between the two macros as an
#error, and givebase/itoa.hthe self-check thatCommon/iota.halready has, so the condition cannot drift from the types it describes again.No change on any platform that builds today —
__LP64__is defined and__wasm__is not, soLONG_IS_A_DISTINCT_TYPEis unset exactly as before, and the two new static_asserts and the#errorall hold.Checked with Emscripten 6.0.5:
-sMEMORY64=1confirms__LP64__is defined,size_tisunsigned longanduint64_tisunsigned long long;itoa(size_t)resolves after this change and does not before. On the host both static_asserts hold, and the#errorfires when the macros are forced out of agreement.Related: #112911
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes