Skip to content

Add file IO and integrate new keeper storage - #112378

Closed
alexey-milovidov wants to merge 39 commits into
masterfrom
kpreint
Closed

alexey-milovidov wants to merge 39 commits into
masterfrom
kpreint

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Jul 29, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • New Feature

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

Keeper stores nodes in an LSM tree now. It has about the same performance as the previous storage and lower memory usage. It is enabled by default (use_new_storage), and by default it keeps all data in memory without writing node files to disk (storage_memory_only); set use_new_storage to 0 to go back to the previous storage. Continuation of #110065, which was created as a stacked PR.


#107261 added new storage with memory-only mode. This PR

  • Adds ability to store data in files. The storage is not actually persistent, the directory is wiped on startup and re-created from snapshot, just like with previous rocksdb storage. So the files don't have things like headers and version numbers yet, we can add that later if we want faster startup.
  • Integrates the new storage into keeper.

@clickhouse-gh

clickhouse-gh Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [9e2a535]


AI Review

Summary

This PR wires the new Keeper LSMT storage into the server, adds optional file-backed runs, and flips the new backend on by default. Current head fixed many earlier lifecycle bugs, but I still see one fresh availability blocker in the default write path plus two previously-discussed concerns that remain real in the current code.

PR Metadata
  • Changelog category: New Feature matches the code change.
  • Changelog entry: present, but the "about the same performance" / "lower memory usage" claim is not supported by this PR and is contradicted by the current Keeper stress failure on the shipped default backend.
  • Suggested replacement: Keeper can use the new LSM-tree node storage. It is enabled by default via \use_new_storage`; set `use_new_storage` to `0` to return to the previous storage.`
Findings

❌ Blockers

  • [src/Coordination/Storage/StorageState.cpp:552] appendUncommittedNode still turns MEMORY_LIMIT_EXCEEDED into abortOnFailedAssertion. With use_new_storage = 1 and storage_memory_only = 1 now the shipped defaults, the current PR Keeper stress job already reaches this path under write-multi-no-fault[default], so write-heavy clusters can self-terminate instead of backpressuring or failing a request cleanly.
    Suggested fix: keep the legacy storage as the default until memory pressure is handled non-fatally here, or add a dedicated MEMORY_LIMIT_EXCEEDED path that rejects/backpressures without aborting Keeper.
  • [src/Coordination/CoordinationSettings.cpp:74-75] [dismissed by author -- https://github.com/ClickHouse/ClickHouse/pull/112378#discussion_r3690203408] Shipping both use_new_storage and storage_memory_only as true makes every upgrade land on the memory-only LSMT even though the current PR stress signal already shows the default backend exceeding Keeper's memory limit. I still consider this real because the default now depends on the aborting path above and the rollout evidence is not there yet.
    Suggested fix: keep the old storage default until the new default survives stress within the configured memory envelope, or gate the new default behind an explicit experimental/compatibility switch.
  • [src/Coordination/KeeperContext.cpp:230-255] [dismissed by author -- https://github.com/ClickHouse/ClickHouse/pull/112378#discussion_r3690203400] The disk-sharing guard still only proves "same storage root" for equal disk names or canonical local paths. Two differently named remote/plain-object-storage disks can still point at the same bucket/prefix, and initializeDataDisk still wipes the whole node-storage root on startup. I still consider this real because a misconfigured remote deployment can still delete Keeper's own snapshot/log/state objects on restart.
    Suggested fix: put Keeper node files under their own forced sub-prefix on named remote disks, or reject remote named-disk mode unless the implementation can prove the roots differ.
Tests
  • ⚠️ The changelog/body claim that the new storage has "about the same performance" and "lower memory usage" still lacks before/after measurements in the PR, and the current Keeper stress evidence goes the other direction for the shipped default backend. A focused comparison against legacy storage for memory peak and throughput would close this.
Final Verdict

Request changes. The on-disk LSMT plumbing is much cleaner now, but the current default rollout still has an observed memory-limit abort path and an unresolved remote-disk data-loss gap.

@clickhouse-gh clickhouse-gh Bot added the pr-feature Pull request with new product feature label Jul 30, 2026
alexey-milovidov added a commit that referenced this pull request Jul 31, 2026
Findings from the `Build (arm_tidy)` CI check:
- `KeeperLSMTNodesStorage::getCommittedNode` and `StorageState::writeInfoFile` can be made const
- `NodeStreamForSnapshot` single-argument constructor must be explicit
- `op` in `rollbackUncommittedDelta` can be `const auto &`
- subscript instead of `.data()` in `NodePath::makeChildPath`

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=112378&sha=a20a74aad4f6dd80dea609ab15c1c6c9cc1f6e3b&name_0=PR&name_1=Build%20%28arm_tidy%29
#112378

Co-Authored-By: Claude Fable 5 <[email protected]>
alexey-milovidov added a commit that referenced this pull request Jul 31, 2026
`prepareImpl` stored in `LSMTDelta` a `FullNode` whose `data_ptr` still
pointed at the caller's buffer (the request data), which often doesn't
survive until `commitDelta`. The commit then serialized bytes from freed
memory into the committed memtable, so subsequent reads of the node
returned garbage of the correct length. In the `Fast test` CI check this
broke 210 tests with errors like:

    Cannot parse input: expected 'columns format version: 1\n' before:
    '<garbage>'. (CANNOT_PARSE_INPUT_ASSERTION_FAILED)

Fix it in `BlockData::appendNodeNoResize`: after copying the data into
the block, re-point `node.data_ptr` at the immutable serialized copy,
which lives as long as the block is pinned by the returned `NodeRef`
(`LSMTDelta` keeps such a ref precisely for this). This matches the
documented intent of `LSMTDelta::new_node` ("deserialized node
corresponding to `new_node_ref`").

Add a unit test asserting that `appendNode` re-points the data into the
block and the node stays valid after the original buffer is destroyed.

Reproduced locally with a standalone `clickhouse keeper`: `create`
followed by `get` returned binary garbage instead of the stored value;
after the fix, `create`/`set`/`get` and `ReplicatedMergeTree`
metadata round-trips work correctly.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=112378&sha=a20a74aad4f6dd80dea609ab15c1c6c9cc1f6e3b&name_0=PR&name_1=Fast%20test
#112378

Co-Authored-By: Claude Fable 5 <[email protected]>
Comment thread src/Coordination/KeeperContext.cpp Outdated
return create_local_disk(config.getString("keeper_server.data_storage_path"));

if (config.has("keeper_server.data_storage_disk"))
return config.getString("keeper_server.data_storage_disk");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

data_storage_disk currently points at the named disk root, but initializeDisks later iterates that root and removeRecursiveWithLimits every entry before startup. If an operator reuses the same disk for snapshot_storage_disk, log_storage_disk, or any shared object-storage disk, Keeper startup deletes unrelated files and can wipe its own persisted logs/snapshots before recovery. The LSMT files need their own subdirectory/prefix on named disks (like coordination/data) or this option needs to reject shared disks.

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.

🕵 Fixed in f76abee. initializeDisks now refuses to start when keeper_server.data_storage_disk names the same disk as the log, snapshot or state storage (including the old_* disks), instead of wiping it. The dedicated-path forms (data_storage_path, storage_path, the implicit coordination/data) always get a directory of their own, so only the named-disk case needed the guard.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This still reproduces for the explicit-path forms. getDataPathFromConfig returns a DiskLocal rooted at keeper_server.data_storage_path verbatim in src/Coordination/KeeperContext.cpp:463-474, and initializeDisks still iterateDirectory("")/removeRecursiveWithLimits every entry in that root in src/Coordination/KeeperContext.cpp:224-226. So data_storage_path == snapshot_storage_path (or log_storage_path) still wipes those files on startup even though the named-disk case now throws.

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.

🕵 Fixed in 8ae0dbc. The guard is no longer limited to the named-disk case: initializeDisks now also resolves both the node storage and each log/snapshot/state storage to a local path and throws BAD_ARGUMENTS when the node storage directory is or contains one of them, so data_storage_path == snapshot_storage_path (or log_storage_path, or a parent of either) refuses to start instead of wiping. The opposite nesting is still allowed on purpose - it is the default layout, where the node storage is a subdirectory of the state directory and wiping it touches nothing outside.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

localDiskPath is nullopt for remote disks, so this guard still only rejects named disks when the names are literally equal. That leaves shared plain-object-storage roots uncovered: data_storage_disk = s3_plain_a and snapshot_storage_disk = s3_plain_b can point at the same bucket/prefix, but src/Coordination/KeeperContext.cpp:233-251 only compares disk names or canonical local paths. Startup still wipes the whole node-storage root in src/Coordination/KeeperContext.cpp:265-267, so the snapshot/log objects can still be deleted. This still needs either a dedicated subdirectory/prefix for named remote disks or a stronger same-root check for remote/plain disks.

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.

🕵 Re-applied in ce9efd3 (the guard from f76abee/8ae0dbcf104 was lost when the branch was rebuilt): initializeDataDisk now refuses to start with BAD_ARGUMENTS when the node storage names the same disk as the log, snapshot or state storage, or when a locally-resolved node-storage directory is or contains one of theirs. Opposite nesting stays allowed (default layout). Known limitation: two differently named remote disks pointing at the same bucket/prefix are not detected - disk configs can express the same remote location in too many ways to compare reliably, so that case remains the operator's responsibility.

DECLARE(UInt64, raft_limits_reconnect_limit, 50, "If connection to a peer is silent longer than this limit * (multiplied by heartbeat interval), we re-establish the connection.", 0) \
DECLARE(UInt64, raft_limits_response_limit, 20, "Total wait time for a response is calculated by multiplying response_limit with heart_beat_interval_ms", 0) \
DECLARE(Bool, async_replication, true, "Enable async replication. All write and read guarantees are preserved while better performance is achieved.", 0) \
DECLARE(Bool, use_new_storage, true, "Use LSM tree storage for nodes. Has about the same performance but lower memory usage.", 0) \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Making use_new_storage default to true means every Keeper upgrade switches to the new LSM backend automatically, even though this PR is introducing its own flush/merge/recovery pipeline and the accompanying stress docs still describe it as a future opt-in replacement. That removes the safety gate entirely: any regression in the new backend becomes the default behavior for existing clusters. This should stay opt-in/experimental until the rollout evidence and migration docs exist.

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.

🕵 The changelog entry was misleading and is fixed - it now says the backend is on by default and how to opt out. Leaving the default itself as is: use_new_storage = true together with storage_memory_only = true is a deliberate rollout choice by the author, and note that with storage_memory_only the new backend does not write any node files to disk by default, so the on-disk pipeline is not what upgrades get. Flipping the default is a call for @alexey-milovidov / @al13n321.

@alexey-milovidov
alexey-milovidov requested a review from a team as a code owner August 3, 2026 11:55
alexey-milovidov added a commit that referenced this pull request Aug 3, 2026
…indings

* The gtest `KeeperStorage.NodeCacheEraseReleasesBlockRef` held `storage_mutex` exclusively across
  `StorageState::shutdown`. The flush and merge threads take that mutex in shared mode at the top of
  their loops, so `shutdown` deadlocked in `join` and the job timed out after 45 minutes (Unit tests
  tsan/msan/asan_ubsan).
* `KeeperNodeStats::getEphemeralOwner` reports `CONTAINER_EPHEMERAL_OWNER` (`INT64_MIN`) for
  container nodes, and `LSMTDelta` passed it through, so committing a container node registered it
  in `committed_ephemerals` under a nonexistent session. After a restart nothing registered it, and
  removing the container threw `Session -9223372036854775808 is expected to have ephemeral paths but
  no path is registered` (`test_keeper_container_nodes/test.py::test_container_preserved_after_restart`).
* `std::current_exception` is null while unwinding towards a handler that has not been entered yet,
  so the `SCOPE_EXIT` in `preprocessRequest` could never print the in-flight exception and aborted
  with a bare `Finalize not called before returning`, destroying the only clue (Keeper Stress
  `write-multi-no-fault`). Don't abort while unwinding: let the exception reach
  `KeeperStateMachine::preprocess`, whose handler logs the message and the stack trace.
* Address review: the startup wipe guard now also rejects a node storage directory that contains the
  log, snapshot or state directory, not only a shared named disk.
* Address review: keep exporting `KeeperKeyArenaSize` in `system.asynchronous_metrics` (always 0),
  instead of silently dropping a documented metric.
* Address review: the `lsmt` stress backend now turns `storage_memory_only` off, so it exercises the
  on-disk flush/merge/recovery path as the README describes.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=112378&sha=f76abeec947de40eafffc826b289c001a9e2ee91&name_0=PR
#112378
@mintlify

mintlify Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

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

Project Status Preview Updated (UTC)
ClickHouse-docs 🟢 Ready View Preview Aug 3, 2026, 12:21 PM

Comment thread src/Coordination/KeeperContext.cpp Resolved
al13n321 and others added 10 commits August 3, 2026 17:37
New events, all with the `KeeperLSMT` prefix, also registered in
`KeeperConstants.cpp` for the standalone keeper build:
 * flushes and merges finished successfully; exceptions in flushes, merges,
   and file deletions;
 * compressed and uncompressed bytes written by flushes;
 * in merge's `publish_results`: published output files and their compressed
   and uncompressed bytes, consumed input files and their uncompressed bytes
   (i.e. read and write throughput measured in files and in bytes);
 * entries appended by `appendUncommittedNode` (count and serialized bytes,
   broken down by `NodeAction`), and serialized bytes appended by
   `appendCommittedNode`;
 * throttled writes; committed and uncommitted memtables created;
 * `getUncommittedNode` hits and misses in uncommitted memtables;
 * the three return cases of `getCommittedNode`, and node cache entries
   re-pointed at a freshly loaded block;
 * for list operations: names obtained from memtables and from files, blocks
   and entries scanned by `SortedFile::listChildrenNames`, and
   `parent_paths_filter` usage (skipped / false positive / true positive);
 * the three cases of `SortedFile::getOrLoadBlock` (from the block info weak
   pointer, from the block cache, loaded a group from disk); blocks and
   uncompressed bytes loaded by `loadBlockGroup`.

Also add the `KeeperLSMTParentPathsFilterSize` asynchronous metric: total size
of `parent_paths_filter` bloom filters across all files.

Co-Authored-By: Claude Fable 5 <[email protected]>
alexey-milovidov and others added 2 commits August 6, 2026 08:21
…_runs`

`flushThread` cleared `delete_when_destroyed` on the new run's files right
after writing them, before the run was published. If the run then waited in
the `flushed_files` reorder buffer (an earlier memtable still flushing), a
shutdown or `KeeperStateMachine::apply_snapshot` destroying `BackgroundWork`
in that window dropped the `SortedFile`s without deleting their files,
leaking them on the node-storage disk across in-process snapshot installs.

Now the flag is flipped only at the moment the run is moved into
`storage->sorted_runs`, under the same locks. Files destroyed while still
unpublished enqueue their own deletion in `~SortedFile`, and
`StorageState::shutdown` drains that queue after `background.reset()`.

#112378 (comment)

Co-Authored-By: Claude Fable 5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 @groeneai, investigate the three stress-test failures on commit 5a674f8 and provide fixes in separate PRs (if a fix is already in progress, link it here). All three are in query-execution code this Keeper PR does not touch:

@groeneai

groeneai commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Investigated all three. Confirmed unrelated to this PR: its 46 changed files are all Keeper, Coordination, keeper-bench and disk/IO; none of the three stacks enters that code.

Resolved STIDs from the artifacts: 3252-4616, 2508-2e0c, 5007-4590. I recovered both unowned triggers from the server logs, which changes two of your three readings.

1. Invalid binary search result in MergeTreeSetIndex (Set.cpp:831): a fix task owns it, not the 107951 class.

Trigger, from query id 164f0b27-6c00-49a0-80c2-e56d93026612:

SELECT count() FROM t_04493_plain FINAL WHERE flag AND (value != 7)
SETTINGS move_all_conditions_to_prewhere = 0;

That is 04493_lazy_final_prewhere_derived_filter_column.sql, byte-identical to the sighting you raised on 108096 in July, so this is the lazy-FINAL __lazy_final_set set-build path already tracked there, not the fuzzer-internal-path class: the stack has no fuzzer frame, it is the ordinary read path (markRangesFromPKRange -> genericExclusionSearch -> checkInHyperrectangle). 3252-4616 differs from 3252-3a4a only by taking the sparse checkInRange overload via forAnySparseHyperrectangle, so I treat it as the same defect rather than a new sub-cause.

Set.cpp:827 names the cause itself: the applyMonotonicFunctionsChainToRange call above applies nonmonotonic functions and yields left > right. Its TODO waits on issue 90461, which is closed, so that precondition is stale. My open 112231 does not cover it. It threads a chain-application flag through both checkInRange overloads but never touches the begin > end block.

One correction that unblocks this: the artifacts are not 403. I asked you for them on 108096 in July after getting 403, and the cause was the path form, not permissions. Stress_test__amd_debug_/... gives 403; the normalized stress_test_amd_debug/clickhouse-server.err.log.zst gives 200. No action needed from you.

2. IColumn::assertTypeEquality (IColumn.h:941): fixing PR 113534 (yours, open).

A link, not new work. The frame is buildAdditionalFilter (HashJoinMethodsImpl.h:807, insertFrom filling a declared-type column from a stored one) under SpillingHashJoin::joinBlock, and 113534's own description names STID 2508-2e0c for that shape. This is site 1 of 107951 by assertion text only; the reachable defect here is the mixed-ON-condition type divergence 113534 fixes, and it needs no fuzzer.

3. Digest does not match in commitAlterTable: a fix task is created.

Trigger, from query id d9b4b60b-414b-4b9a-ae04-32fb449822c8:

/* ddl_entry=query-0000000143 */ ALTER TABLE test_1.t_04545_po
    (ADD COLUMN IF NOT EXISTS `c` Array(LowCardinality(UInt64)))

The log names which of the two branches fired, and it narrows the search. Digest of local metadata (7177318334792950359) is not equal to in-memory digest (14835910239923816706) (DatabaseReplicated.cpp:1371), one occurrence, and zero of the local-vs-Keeper branch. So Keeper is not implicated; the suspect arithmetic is commitAlterTable's own incremental update at :2655-2658. The ALTER is IF NOT EXISTS, so a no-op ALTER that still runs the subtract/add pair is the first shape I will test.

On 113009 being only the commitCreateTable diagnostic: it covers this site too. All ten assertion call sites, including commitAlterTable at :2663 and commitCreateTable at :2637, funnel through assertDigestWithProbability -> checkDigestValid, and the guard mismatch it fixes is exactly what silenced this dump. The assertion is guarded by DEBUG_OR_SANITIZER_BUILD (:1295) while the dump is #ifndef NDEBUG (:1373, :1393), and this artifact contains zero dump output. So the root cause stays unnamed here for the reason you gave, and 113009 removes that obstacle for the next sighting; the root-cause fix is separate and is the task I created.

Breadth, 30 days, master rows first: 3252-4616 0 master / 4 PR-side across 4 unrelated PRs; 5007-4590 0 master / 2 across 2 unrelated PRs, onset 2026-08-05; 2508-2e0c 2 master / 46 across 44 PRs. None is PR-caused.

I will post each fixing-PR link here as it opens. Separate PRs, one per bullet, as you asked.

alexey-milovidov and others added 2 commits August 7, 2026 02:41
Both `KeeperLSMTNodesStorage::visitUncommittedRecursive` and
`KeeperMemNodesStorage::visitUncommittedRecursive` treated the root node
as free: `RemoveRecursive` with `remove_nodes_limit = 0` still removed a
single existing znode, diverging from `TestKeeper` and from the original
`ToDeleteTreeCollector` (which initialized `nodes_observed = 1` for the
root). Now the root counts toward the limit in both backends, and the
zero-limit case is pinned by new cases in `TestRemoveRecursiveRequest`
running on both backends.

Co-Authored-By: Claude Fable 5 <[email protected]>
@groeneai

groeneai commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Fixing PR for bullet 3 (5007-4590, Digest does not match at commitAlterTable) is open: #113794

Root cause is a test-isolation defect, not product code: the assertion correctly detected a real disk-vs-memory divergence. In shared-database mode the stress lane points some clients at one long-lived database that is never recreated per test. 03762_create_as_url_cluster.sql re-created it as Replicated and never restored it, and no-replicated-database cannot react because the guard reads a static CLI flag. 04545_attach_projection_part_offset_setting_disabled.sh then ran there, its DETACH was refused with Code: 80, its helper ignored that status, and sed -i rewrote the metadata of a live attached table. The next successful ALTER compared that file against the stale in-memory digest and aborted; on restart the replica was declared lost and one table was moved to <db>_broken_tables.

Tests only, four files, no src/ change. The three earlier no-op ADD COLUMN ALTERs on the same table completed with DUPLICATE_COLUMN without aborting, which is what shows the ALTER is the detector rather than the cause.

The other two bullets are still with me and I will post their links here as they open.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 CI on 964eb63 had three reds; analysis:

  1. Keeper Stress Tests (PR), write-multi-no-fault[default] — related to this PR. With this branch the default backend actually runs the new storage in memory-only mode (use_new_storage = 1 and storage_memory_only = 1 are the new defaults), and keeper1 aborted after MEMORY_LIMIT_EXCEEDED in KeeperStateMachine::preprocess: (total) memory limit exceeded: would use 11.38 GiB ... maximum: 10.80 GiB, followed by the intended Aborting to avoid inconsistent state. The same scenario passes on other PRs (old storage) and is marginal on this branch: 4 of the last 7 runs failed, alternating between [default] and [lsmt]. This also resolves the previously unexplained write-multi-no-fault[lsmt] abort at StorageState::appendUncommittedNode on 2910973: the stress Keeper does enforce a total memory limit, so that catch-all abort was most likely the same MEMORY_LIMIT_EXCEEDED. Mechanically, in memory-only mode every flushed block stays pinned uncompressed in RAM (SortedFile::pinned_blocks), so peak memory under a write-heavy load is memtables plus multi-version sorted runs until merges reclaim them — the write-multi workload sits right at the 10.8 GiB limit. This is direct measurement input for the open use_new_storage = true rollout question. Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=112378&sha=964eb633270011125a723e20855585b40410d749&name_0=PR&name_1=Keeper%20Stress%20Tests%20%28PR%29

  2. Stress test (amd_tsan), data race — unrelated: two threads analyze the shared row-policy AST in place (ReadFromMerge::RowPolicyData racing with buildRowPolicyFilterIfNeeded over ASTLiteral::unique_column_name). The fix is already open: Do not analyze the shared row policy AST in place in Merge #113563.

  3. Stress test (arm_msan), Logical error: 'Unexpected return type from globalIn. Expected Nullable(UInt8). Got UInt8' in ActionsDAG::updateHeader during planning — unrelated (query-planning code this PR does not touch); the same failure (STID 3262-3243) fired on Native Google Cloud Storage integration (google-cloud-cpp) #109455 on 2026-08-05. No open issue or in-progress fix found. @groeneai, investigate this failure and provide a fix in a separate PR; if one is already in progress, link it here. Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=112378&sha=964eb633270011125a723e20855585b40410d749&name_0=PR&name_1=Stress%20test%20%28arm_msan%29

Merged current master (was 300 commits behind) and pushed 9e2a535; all 315 Coordination/Keeper gtests pass locally after the merge.

@groeneai

groeneai commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Bullet 3: the fix is already open, #113750. It was created at 2026-08-07T00:33:15Z, about 19 hours before your comment, so it did exist when you looked; it is not linked from this thread, which is probably why the search missed it.

I recovered the failing query from the arm_msan artifact for 964eb63 (stress_test_arm_msan/clickhouse-server.err.log.zst, query id 18445c49-d337-4750-9281-46c7e3a864ac, the log's only crash):

SELECT 1 GLOBAL IN (_data_17232541238428130802_3723440931786826121 AS __table1) AS s,
       1 GLOBAL IN (_data_17232541238428130802_3723440931786826121 AS __table2) AS s
FROM clusterAllReplicas('test_cluster_five_shards_localhost', 'system', 'one') AS __table3
GROUP BY GROUPING SETS ((1 GLOBAL IN (_data_17232541238428130802_3723440931786826121 AS __table4) AS s))

The crash report's Changed settings line for that query carries group_by_use_nulls = true, its only occurrence in the log, and frame 20 is executeASTFuzzerQueries, so this is an in-server fuzzer mutation and not SQL from your branch. GLOBAL IN over a table identifier inside GROUP BY GROUPING SETS with group_by_use_nulls = 1 is exactly the shape 113750's changelog entry names and its first test arm reproduces, so this occurrence is covered by it.

Root cause: group_by_use_nulls promotes the grouping key's declared type to Nullable(UInt8) (src/Analyzer/FunctionNode.h:193), while FunctionIn declares plain UInt8 (src/Functions/in.cpp:58) and discarded the result_type it was handed. Its constant-folding wrapper is off (:66), and with GLOBAL IN over a table the set is still unfilled while the header is computed, so the dry-run path returns a bare ColumnUInt8 where Nullable(UInt8) was declared and columnMatchesType fails at src/Interpreters/ActionsDAG.cpp:1341. The PR reconciles the produced column against result_type once, at a chokepoint above all seven returns.

Confirming your unrelated call from the diff rather than from the stack: of this PR's 46 changed files, 35 are src/Coordination, 4 are src/Disks, 2 are tests/stress, and there is one each in src/IO, src/Common, programs/keeper-bench, ci/jobs and tests/casa_del_dolor. None is in src/Analyzer, src/Planner, src/Interpreters/ActionsDAG.cpp or src/Functions.

One correction to my own bookkeeping on your 2026-08-06 comment: I wrote yesterday that two of its bullets were still with me, but bullet 2 already carries a link (113534, yours), so only bullet 1 remains, the MergeTreeSetIndex assertion. It still has no fix PR: my open 112231 threads a chain-application flag through both checkInRange overloads and never touches the begin > end block. I will post the link here when one opens.

std::abort();
/// Put the exception message into the fatal report: the text log may not survive the
/// process death, and the crash report is often the only thing test harnesses collect.
DB::abortOnFailedAssertion(fmt::format(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

appendUncommittedNode still converts MEMORY_LIMIT_EXCEEDED into a fatal assertion failure, and the comment above already acknowledges that this exception is expected here. With use_new_storage = 1 and storage_memory_only = 1 now the shipped defaults, that is an availability regression rather than an internal TODO: the current PR Keeper stress lane already hits this under write-multi-no-fault[default], so a write-heavy upgrade can turn memory pressure into Keeper self-termination.

Either the old storage needs to remain the default until this path can surface a controlled failure/backpressure, or MEMORY_LIMIT_EXCEEDED needs a dedicated non-fatal handling path here.

@al13n321

al13n321 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

#113903

This branch was successfully deployed

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

Labels

pr-feature Pull request with new product feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants