73 Commits
Author SHA1 Message Date
Michael KolupaevandClaude Opus 4.8 3daf5230a8 Remove default arguments from virtual methods because someone at google judged them to be too error-prone for everyone everywhere.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-26 12:45:14 -07:00
Michael Kolupaev 23e1df421c Split KeeperStorage into 3 parts 2026-06-25 23:28:06 -07:00
Michael KolupaevandClaude Opus 4.8 63f4bd4d23 Refactor snapshot deserialization
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-25 23:28:06 -07:00
Michael Kolupaev b565ad4a64 Remove keeper rocksdb storage 2026-06-19 12:43:30 -07:00
Michael Kolupaev 879d219071 Review comments 2026-06-01 21:46:23 -07:00
Michael Kolupaev a4fae9f8dd Merge remote-tracking branch 'origin/master' into keeper-storage-bench 2026-06-01 20:49:58 -07:00
Michael Kolupaev 86caade8e9 Merge remote-tracking branch 'origin/master' into keeper-storage-bench 2026-05-05 16:54:05 -07:00
Alexey Milovidov eb4a2eb181 Merge remote-tracking branch 'origin/master' into clang-tidy-init-variables
# Conflicts:
#	src/Processors/Formats/Impl/ParquetBlockInputFormat.cpp
#	src/Processors/Formats/Impl/ParquetBlockInputFormat.h
2026-04-28 14:05:11 +00:00
Alexey Milovidov fc06ff7bc9 Merge remote-tracking branch 'origin/master' into clang-tidy-init-variables
# Conflicts:
#	src/Interpreters/FileCache/FileCache.cpp
#	src/Interpreters/TransactionVersionMetadata.cpp
#	src/Storages/ObjectStorage/DataLakes/Iceberg/ExecuteOptionsParser.cpp
#	src/Storages/ObjectStorageQueue/ObjectStorageQueueOrderedFileMetadata.cpp
#	src/Storages/StorageMerge.h
2026-04-19 21:27:42 +00:00
Michael KolupaevandClaude Opus 4.7 392b35c425 keeper-bench: add KeeperStorage-only benchmark mode
New `--storage` flag switches keeper-bench into an in-process mode that exercises
`KeeperStorage` directly, without the rest of the keeper server (no network, no
raft, no state machine).

Threading model mirrors a simplified Keeper commit path:
  * N generator threads (`--concurrency`, default 4) produce requests using the
    existing `Generator` (so `setup` + `generator` config is reused).
  * One "preprocess" thread calls `preprocessRequest` for every write (stands in
    for the path that, in real keeper, runs under `raft_server::lock_`).
  * One "commit" thread calls `processRequest` for writes. After each committed
    write, with probability `1/writes_per_read_batch` it drains the pending read
    queue and processes it in one `processLocalRequests` batch.

Inter-thread queues are `NonblockingBoundedQueue` (copied from commit
6a91c30115) with 100µs polling — no condition
variables. The preprocess->commit queue has a small configurable bound
(`storage.preprocess_commit_queue_size`, default 32).

Periodic reports include (for the period): committed writes/s and reads/s,
preprocess / commit-write / commit-read thread utilization, znode count, RSS,
snapshot-mode flag, and per-op-num average preprocess/process ns and ns-per-
list-name.

Every `storage.snapshot_toggle_periods` periods the runner toggles
`enableSnapshotMode`/`disableSnapshotMode` + `clearGarbageAfterSnapshot`, so the
snapshot overhead shows up in the timings.

Refactoring: `Generator`/`PathGetter` previously took a `Coordination::ZooKeeper
&` to resolve `children_of` paths. They now take a `ListChildrenFn` callback;
the existing Runner passes a lambda wrapping the ZooKeeper client, the new
StorageRunner passes a lambda that calls `KeeperStorage::processLocalRequests`.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-04-18 15:36:53 -07:00
Michael KolupaevandClaude Opus 4.7 5113596b65 keeper-bench: fall back to manual recursive remove when server lacks REMOVE_RECURSIVE
PR #101801 switched `keeper-bench` setup/cleanup to the native
`RemoveRecursive` Keeper request. That request is only available on
ClickHouse Keeper versions that advertise the `REMOVE_RECURSIVE`
feature flag, so using `keeper-bench` against plain ZooKeeper or an
older Keeper fails with `RemoveRecursive request type cannot be used`.

Restore the pre-#101801 behavior as a fallback: detect the feature
flag on the connected server and, if it is not enabled, use the
previous manual `list`+batched-`multi(remove)` traversal. Also add a
`use_remove_recursive` top-level config flag (default `true`) so it
can be disabled explicitly even when the server does support it.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-04-17 14:41:10 -07:00
Michael Stetsyuk b288998536 init spans in KeeperOverDispatcher 2026-04-14 09:11:12 +00:00
Michael Stetsyuk 70d2370537 fix keeper-bench build 2026-04-13 18:59:40 +00:00
Alexey Milovidov 739e7c79ba Merge remote-tracking branch 'origin/master' into clang-tidy-init-variables
# Conflicts:
#	src/Common/WKB.cpp
#	src/Coordination/KeeperDispatcher.cpp
#	src/IO/examples/dragonbox_test.cpp
#	src/Storages/MergeTree/MergeTreeIOSettings.h
#	src/Storages/VirtualColumnsDescription.h
2026-04-12 13:16:03 +00:00
Michael Kolupaev 0b19b92011 Merge remote-tracking branch 'origin/master' into parallel-reads 2026-04-10 19:13:58 -07:00
Michael Kolupaev 732b64eac0 Generator init fix, review comments 2026-04-10 13:05:57 -07:00
Michael Kolupaev 44f01a4ede Tags 2026-04-08 14:20:34 -07:00
Michael Kolupaev 4f70b270fb Much faster startup 2026-04-08 01:06:41 -07:00
Michael Kolupaev 341ea70496 Fix watches inside multi 2026-04-08 00:51:01 -07:00
Michael Kolupaev eb325bb0f5 Make the periodically printed stats show throughput from the last period rather than the whole run. Remove per-operation latencies (they should all be the same because of batching anyway). 2026-04-07 23:26:11 -07:00
Alexey MilovidovandClaude Opus 4.6 8f24b78a17 Merge origin/master into clang-tidy-init-variables
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2026-04-07 03:01:25 +02:00
Alexey MilovidovandGitHub cfcd19cb7a Merge branch 'master' into parallel-reads 2026-04-06 17:49:15 -07:00
Michael Kolupaev 19a5e151f6 keeper-bench: watches 2026-04-04 20:03:23 -07:00
Michael Kolupaev 5ce440dab3 Merge remote-tracking branch 'origin/master' into parallel-reads 2026-03-28 01:43:15 -07:00
Michael Kolupaev c338e0f7c8 Fix use after free when request fails 2026-03-25 19:05:17 -07:00
Michael Kolupaev 0e75ba56e2 Count requests slightly more carefully 2026-03-25 13:19:15 -07:00
Michael Kolupaev da772d82a4 Ok it compiles now, and even doesn't fail tsan 2026-03-25 12:51:17 -07:00
Michael Kolupaev 0ede0f9c11 keeper-bench: go faster 2026-03-24 19:07:33 -07:00
Alexey Milovidov 9f6854b4b4 Merge branch 'master' into clang-tidy-init-variables
# Conflicts:
#	src/Coordination/KeeperSnapshotManager.cpp
#	src/Storages/ObjectStorage/DataLakes/Iceberg/FileNamesGenerator.h
#	src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergDataObjectInfo.h
#	src/Storages/ObjectStorage/DataLakes/Iceberg/Mutations.cpp
#	src/Storages/ObjectStorage/DataLakes/Iceberg/Snapshot.h
2026-03-24 19:34:14 +00:00
Alexey MilovidovandClaude Opus 4.6 d249cd3f9d Fix clang-tidy cppcoreguidelines-init-variables and hicpp-member-init after merge with master
New code from master introduced uninitialized variables and struct
members that trigger the newly enabled clang-tidy checks. Fix all 368
errors by adding default initializers (`{}`, `= 0`, `= nullptr`) to
local variables and struct/class member declarations.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100399&sha=78a76ff56fc5747009e8c34795b8a3cb2432eeae&name_0=PR

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2026-03-24 11:25:35 +00:00
Michael Kolupaev 68c37517ce KeeperStorage::processLocalRequests 2026-03-23 19:43:14 -07:00
Michael Stetsyuk d8a6c0c5e9 resolve conf 2026-03-19 13:15:29 +00:00
Michael Stetsyuk f2a96c231a better 2026-03-19 12:55:52 +00:00
Antonio AndelicandClaude Opus 4.6 c8aa474ebd Fix keeper-bench: exclude setup time from metrics and batch recursive removal
- Reset elapsed/total timers after warmup/setup so setup time is not
  counted toward throughput or time limit
- Rewrite `removeRecursive` to collect deletes in a single post-order
  batch (flushed every 1000 ops) instead of removing children then parent
  in separate rounds, reducing the number of multi requests
- Add proper error handling for list and multi responses

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-03-13 13:49:17 +01:00
Antonio AndelicandClaude Opus 4.6 a3cea2d34a Fix keeper-bench throughput and latency measurement
Two fixes:

1. Measure request latency in the response callback instead of when
   `collect_request` drains the in-flight deque. Previously the
   `Stopwatch` ran from submission until collection, which at high
   `pipeline_depth` included time the request sat completed in the
   deque waiting to be collected. Now a shared `Stopwatch` is captured
   by the callback and read when the response actually arrives.

2. Compute RPS using wall-clock elapsed time (`Stopwatch`) instead of
   deriving it from `sum(individual_latencies) / concurrency`. The old
   formula did not account for pipelining: with `pipeline_depth=64` it
   reported ~2k RPS while actual wall-clock throughput was ~140k RPS.
   `getThroughput` now takes elapsed seconds directly, and the
   `concurrency` parameter is removed from `report` and `writeJSON`.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-03-10 11:20:56 +01:00
Antonio AndelicandClaude Opus 4.6 793589c920 Fix style check and seed collision in MultiRequestGenerator
Add `// Ok` comments to `catch (...)` blocks in `Runner.cpp` that handle
exceptions via `handle_request_exception` (which logs and counts errors)
but were flagged by the `catch_all` style check.

Fix seed collision in `MultiRequestGenerator::setSeedImpl`: the inner
`RequestGetter::setSeed` distributed sub-seeds as `seed + i + 1`, which
collided with siblings assigned by the outer `RequestGetter` using the
same scheme. Use a large prime offset (500009) to separate the inner
seed namespace.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98906&sha=latest&name_0=PR

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-03-08 22:27:24 +01:00
Antonio AndelicandClaude Opus 4.6 31601a2e87 Batch removeRecursive deletions and lock mutex in report/writeJSON
Restore batched child removal in `removeRecursive` using `multi` requests
in chunks of 1000, reducing network round trips from O(N) to O(N/1000).

Add `std::lock_guard` in `Stats::report` and `Stats::writeJSON` so that
collector fields are consistently protected by `Stats::mutex` regardless
of caller context.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-03-08 21:43:50 +01:00
Antonio Andelic 36daeb474d Merge branch 'master' into keeperbench-improv
# Conflicts:
#	programs/keeper-bench/Runner.cpp
#	programs/keeper-bench/Stats.cpp
#	programs/keeper-bench/Stats.h
2026-03-06 20:36:24 +01:00
zlareb1 ff0317563d move back to last_request 2026-03-06 20:09:49 +05:30
zlareb1andClaude Sonnet 4.6 c58be47e0e keeper-bench: fix assertion failure and data race in log replay mode
Fix two issues reported by Cursor Bugbot in `Stats::report` and
`requestFromLogExecutor`:

1. `Stats::report` called `getThroughput` unconditionally on both
   collectors after only checking if both are zero. A log with only read
   requests would hit `assert(requests != 0)` inside
   `write_collector.getThroughput`. Now each collector's throughput is
   computed only when its request count is non-zero.

2. `requestFromLogExecutor` only waited for the last request's promise.
   When an executor processes requests across multiple ZooKeeper
   connections (one per session_id), callbacks on earlier connections
   could still be running on I/O threads after `last_request->wait()`
   returned, causing a data race with `report`/`writeJSON` which read
   `Stats` fields without `Stats::mutex`. Fixed by collecting all
   per-request futures and waiting for all of them before returning.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-03-06 20:09:49 +05:30
zlareb1 317e7f247f accommodate claude bot suggestions 2026-03-06 20:09:49 +05:30
zlareb1 6132997cee add read, write metrics to stats 2026-03-06 20:09:49 +05:30
zlareb1 29df85aee0 don't handle which benchmark to run in runBenchmark 2026-03-06 20:09:49 +05:30
Mohammad Lareb ZafarandAntonio Andelic 391832a815 Apply suggestion from @antonio2368
Co-authored-by: Antonio Andelic <[email protected]>
2026-03-06 20:09:48 +05:30
zlareb1 03ae870353 Enable JSON metrics for log mode and report errors in metrics reported file 2026-03-06 20:09:48 +05:30
Antonio AndelicandClaude Opus 4.6 5b6d4b77e7 Fix warmup_complete race condition in keeper-bench
The producer thread was setting `warmup_complete = true` before acquiring
the mutex and calling `info->clear()`. This created a window where a
worker could observe `warmup_complete == true`, acquire the mutex first,
record post-warmup stats, and then have those stats silently discarded
when the producer subsequently called `clear()`.

Move the atomic store after `clear()` inside the locked section so that
workers can only begin recording once the stats have been reset.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-03-06 13:01:56 +01:00
Antonio AndelicandClaude Opus 4.6 e34d304af9 Fix failure callbacks lost when executeGenericRequest throws
The `on_failure_callbacks` (which clean up `paths_pending` in
`CreateRequestGenerator`) were moved into the response callback lambda.
If `executeGenericRequest` threw (e.g. expired connection), the lambda
was destroyed without being invoked, so the failure callbacks never ran.
This permanently leaked entries in `paths_pending`, eventually exhausting
`max_name_generation_retries`.

Fix by storing callbacks in `shared_ptr` so they remain accessible in
the catch block, and invoking failure callbacks there.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-03-06 10:52:55 +01:00
Antonio AndelicandClaude Opus 4.6 17344a6d17 Improve keeper-bench with pipelining, warmup, per-op stats, and reproducible seeds
- Add `pipeline_depth` and `queue_depth` settings to allow asynchronous
  in-flight requests per consumer thread, hiding round-trip latency
- Add `warmup_seconds` to discard early stats while caches warm up
- Add `generator.seed` for reproducible workloads
- Track per-operation-type stats (Create, Remove, Get, Set, List, Multi)
  in both stderr reports and JSON output
- Add `on_failure_callbacks` to clean up pending paths on failed creates
- Replace `paths_created` set with O(1) swap-and-pop vector+index structure
  for random path removal
- Fix `static` → `thread_local` for RNG instances to avoid data races
- Fix `continue_on_errors` → `continue_on_error` (match actual config key)
- Validate `remove_factor` range, zero weights, and empty path getters
- Add retry limit for unique path name generation
- Simplify `removeRecursive` and deduplicate default ACL construction
- Document all new settings in README

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-03-06 10:32:03 +01:00
Raúl MarínandClaude Opus 4.6 9aa8e4ed27 Move ErrnoException from Exception.h to its own header
Extract `ErrnoException` into `Common/ErrnoException.h` to reduce the
include footprint of `Exception.h`. This removes `<base/errnoToString.h>`
and `<cerrno>` from `Exception.h`, which is included by ~95% of all
translation units.

All files referencing `ErrnoException` now include the new header
directly. Files that used `errnoToString` without `ErrnoException`
got an explicit `<base/errnoToString.h>` include.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-20 13:47:23 +01:00
Antonio Andelic f9f786eb11 Fix remove_factor in keeper-bench 2026-02-17 15:53:46 +01:00