29 Commits
Author SHA1 Message Date
zeekay 9a90943b8f merge: ClickHouse 26.7.1.1315-stable into datastore — preserve debrand
13,838 upstream commits, forward from the 26.6.1.1 fork point. 129 conflicts:
37 resolved mechanically (take upstream's file, re-apply the brand sweep) and
92 by hand where our fork and upstream had both changed the same code.

The rule throughout: upstream owns the engine, we own the naming and a small set
of deliberate deviations. Never resolve by discarding an upstream change — a
dropped rename or a missed new parameter becomes a compile error a thousand
files away.

Deviations verified intact after the merge:
  ENABLE_XRAY still defaults OFF        (CMakeLists.txt:105)
  X-Datastore-User read by the server   (authenticateUserByHTTP.cpp)
  X-ClickHouse-* in src/                0
  hanzo/research                        present
  system.*_log retention bound          present
  ArrowFlight rip                       held against upstream re-adding it

Two things worth naming, because neither shows up as a conflict:

  src/CMakeLists.txt gained an UNGUARDED
  `add_object_library(datastore_storages_arrowflight Storages/ArrowFlight)` from
  upstream, for a directory our gRPC rip deleted. It sat outside every conflict
  hunk, so a resolver reading only the markers would sail straight past it into
  a CMake configure error. Removed; the Server/ArrowFlight sibling at line 474
  stays because it is inside `if (TARGET ch_contrib::arrow_flight)`.

  The brand sweep had rewritten github.com/ClickHouse/ClickHouse issue links to
  github.com/Datastore/Datastore — a dead host. Those point at upstream's own
  tracker and are restored, alongside the contributors list, sql.clickhouse.com
  and the ClickHouse Inc copyright: attribution is theirs, not ours to rename.

base/glibc-compatibility/memcpy/memcpy.h is deleted, not kept: upstream dropped
it for LLVM-libc's, and our only change to it was a comment rebrand.
2026-07-26 14:47:43 -07:00
Michael Kolupaev e2d3573682 Reorganize flag packing in KeeperNodeStats 2026-07-06 14:55:54 -07:00
Michael KolupaevandClaude Opus 4.8 b41d913fe2 Coordination tests: convert CoordinationTest to value-parametrized test
Step 1 of decoupling the Coordination gtests from KeeperMemoryStorage
internals: replace the typed-test fixture (TestParam<TStorage, compress>)
with a value-parametrized one. TestParam is now a plain struct with a
non-constexpr enable_compression field, CoordinationTest derives from
testing::TestWithParam<TestParam>, all TYPED_TEST become TEST_P, and a
single INSTANTIATE_TEST_SUITE_P lives in gtest_coordination_common.cpp.

A makeKeeperContext helper centralizes KeeperContext creation so a future
TestParam field selecting the KeeperStorage implementation can be applied
in one place.

Storage usages temporarily point at KeeperMemoryStorage; subsequent
commits replace them with KeeperStorage::create and virtual-method access.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-25 23:28:06 -07:00
Michael Kolupaev 23e1df421c Split KeeperStorage into 3 parts 2026-06-25 23:28:06 -07:00
Michael KolupaevandClaude Opus 4.8 b5917d8756 Remove ignore_system_path_on_startup
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-25 23:28:06 -07:00
Michael KolupaevandClaude Opus 4.8 5a82478ee2 Pull KeeperStorageStats instead of pushing
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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 KolupaevandClaude Opus 4.8 f79d60220f KeeperNodeStats
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-25 23:28:06 -07:00
Michael Kolupaev 94fbad6622 Merge remote-tracking branch 'origin/master' into unrocks 2026-06-25 10:40:32 -07:00
zooqueen 0f1e1b5143 merge: ClickHouse 26.6.1.1 into datastore — preserve debrand + ZAP + gRPC/gcloud removal
Merge upstream/changelog-26.6 (9593 commits) into our debranded fork.
- 190 conflicts resolved: 24 delete-side kept-removed (grpc/arrowflight/gcloud), submodules+version→26.6,
  contrib/CMakeLists keeps zap + new libpng, drops capnproto (zap provides kj), Server.cpp/CMakeLists
  re-apply the ZAP wiring + gRPC/arrowflight/gcloud removal.
- Full-tree debrand re-swept over the new 26.6 code (uniform Datastore naming; Azure fork Clickhouse*
  symbols preserved). 0 clickhouse in product src/programs/CMakeLists.
- Version now 26.6.1.1. gRPC/google-cloud/chdig stay removed; ZAP remains the transport.
2026-06-23 12:23:48 -07:00
zooqueen 0357c7e3ff datastore rebrand: lowercase clickhouse -> datastore in commands/prose/help
Completes the user-facing branding: lowercase `clickhouse` command/symlink names
(clickhouse-server/-client/-local/...), `clickhouse <subcommand>` usage strings, and bare-word
prose in messages/comments -> datastore (~238 occurrences across 227 files).

Intentionally KEPT (not branding):
- SQL dict-source keyword "clickhouse" (SOURCE(CLICKHOUSE(...)) compat) - 4 sites
- external URLs (clickhouse.com / github.com/ClickHouse)
- filesystem / ZooKeeper path conventions (/var/lib/clickhouse fallback default, /clickhouse/tables/
  ReplicatedMergeTree ZK path) - deployment convention, overridden by our datastore-* config

String/comment-literal changes only; no identifiers touched (verified no bare lowercase clickhouse
C++ symbol exists). Build was already green; verifying this is still green.
2026-06-21 23:46:30 -07:00
zooqueen 06f45b6529 datastore rebrand: compound symbols + CMake targets/macros (clickhouse -> datastore)
The deep internal rebrand (user: "rename all compound symbols", "datastore_ good", "DB:: fine"):
- CamelCase symbols ClickHouse* -> Datastore* (358 distinct): mainEntryDatastoreServer,
  DatastoreDictionarySource, DatastoreRevision, DatastoreVersion, etc. URL/repo lines skipped.
- snake targets + macros clickhouse_* -> datastore_* (850 occ): datastore_common_io,
  datastore_add_executable, datastore_program_install, datastore_functions, etc. — uniform
  across src + cmake + all CMakeLists, and the contrib wrappers that link/use them
  (croaring, nuraft, corrosion, chdig, delta-kernel-rs, mongo-cxx).
- CLICKHOUSE_* macros -> DATASTORE_* (DATASTORE_OFFICIAL_BUILD, ENABLE_DATASTORE_*, etc.).
- project(ClickHouse) -> project(Datastore) so ${Datastore_SOURCE_DIR}/${Datastore_BINARY_DIR}
  (45 refs) resolve.

Replace (not drop) -> collision-free. DB:: namespace kept (per direction). lowercase SQL
`clickhouse` dictionary-source keyword + clickhouse.com / github.com/ClickHouse URLs kept.
NEEDS BUILD VERIFICATION on spark/CI — uniform + inspected-consistent but uncompiled here.
2026-06-21 20:38:05 -07:00
zooqueen 332335ddb4 datastore rebrand: standalone "ClickHouse" word -> "Datastore" (prose, strings, comments)
The correct, safe broad rebrand: renames "ClickHouse" only as a whole word (boundary on
BOTH sides), so it rewrites display strings/messages/comments but leaves every compound
C++ symbol intact — `ClickHouseDictionarySource`, `getInfoIfClickHouseDictionarySource`,
`mainEntryClickHouseServer`, `ClickHouseRevision`, `ClickHouse_SOURCE_DIR` are untouched
(an earlier one-sided heuristic mangled suffix symbols like `manageClickHouse`; reverted).
1677 occurrences across 482 files. Compile-safe (string/comment content; symbols preserved).

Still NOT renamed (would be a build-coupled symbol rename, needs build-host iteration): the
199 compound identifiers containing ClickHouse, the `DB::` namespace, the `clickhouse_*`
CMake targets/macros, the lowercase `clickhouse` SQL dictionary-source keyword. Needs build
verification.
2026-06-21 20:10:25 -07:00
Michael Kolupaev b565ad4a64 Remove keeper rocksdb storage 2026-06-19 12:43:30 -07:00
Antonio AndelicandClaude Fable 5 2d1459eb92 Coordination: address review findings on the snapshot-locking branch
Review-fix pass over the keeper-snapshot-locking branch (post master merge).

- G-F1: startup-retained duplicate same-index snapshot files were only logged, never
  tracked, so detachOutdatedSnapshotsIfNeeded could never reclaim them — they leaked on
  disk until the next restart. Track them in retained_duplicate_snapshots (kept
  retained-window duplicates and re-point orphans) and retire them together with their
  index. Aged out without a restart; new test RetainedDuplicateAgesOutWithoutRestart.
- detachSnapshotForRemoval now returns the detached pins (registered entry + tracked
  duplicates) instead of unlinking in place, so the create path's unlink happens in
  Phase 4 outside snapshots_lock (no disk I/O under the lock).
- C-F1: snapshots_queue.push can throw bad_alloc (emplaceImpl allocates before the
  noexcept move); wrap it and route both the false-return and throw outcomes to the same
  inline cleanup so when_done(false) fires exactly once.
- G-F2: keeper-utils snapshot-analyzer deserialized by parsed index, so with same-index
  duplicates it could analyze a different file than the one named; deserialize the exact
  named path instead.
- C-F4: corrected the create skip-branch log wording (condition is >=, not "bigger").
- retained_duplicate_snapshots is an unordered_map (point lookups only).

C-T1: the SameIndexCreateFailsClosedOnMissingRegisteredFile test was deliberately removed
(it asserted a fail-closed existsFile probe the birth-unique-names design no longer has — a
registered same-index entry is pinned by protected_pending_snapshot_log_idx so retention
cannot unlink it before apply); the adopt site documents this in a comment.

Known untested corners (pre-accepted, not regressions): the cross-disk re-point orphan path
and the create-path Phase-4 deferred unlink (gtest covers the synchronous removeSnapshot
path), the keeper-utils analyzer (no gtest harness), the push bad_alloc leg, and the
deferred receive-path I/O under snapshots_lock (multi-disk only).

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-06-15 14:59:55 +00:00
Antonio AndelicandClaude Fable 5 411b966bee Coordination: rewrite Keeper snapshot locking around birth-unique snapshot file names
Snapshot files are now created with birth-unique names
(`snapshot_<idx>_<uuid>.bin[.zstd]`), which removes same-path write races entirely:
local snapshot creation writes outside `snapshots_lock` and publishes metadata under
it (adopting a concurrently published snapshot instead of overwriting it), so
`read_logical_snp_obj` no longer waits behind a full snapshot write.
`apply_snapshot` no longer blocks on in-flight create tasks
(`KeeperStateMachine::storage` is a `shared_ptr` captured by the task), so no
claim/deferral machinery is needed. Startup keeps duplicate files for retained
indexes as redundant recovery points and deletes duplicates outside the retention
window. S3 keys stay legacy-shaped via a canonical name mapping.

Also fix failed snapshot-queue-push cleanup so `when_done(false)` is invoked exactly
once, and make the `KeeperStorageSnapshot` constructor exception-safe.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-06-12 11:39:00 +00:00
robot-clickhouse d894e6b011 Backport #101757 to 26.5: KeeperDispatcher overhaul 2026-05-25 07:54:57 +00:00
Alexey Milovidov 724a4d6428 Merge remote-tracking branch 'origin/master' into fix-compiler-warnings
# Conflicts:
#	src/Functions/seriesPeriodDetectFFT.cpp
#	src/Functions/stl.hpp
#	src/Functions/tests/gtest_string_similarity.cpp
2026-05-23 07:21:41 +00:00
Michael KolupaevandClaude Opus 4.6 1dc0dc0829 Extract KeeperRequestDispatcher from KeeperDispatcher
Split request processing (batching, session management, request/response
threads) into a separate `KeeperRequestDispatcher` class, leaving
`KeeperDispatcher` as a thin shell for snapshots, session ID assignment,
session cleanup, and cluster configuration management.

Key interface changes:
- `KeeperStateMachine` now takes a `KeeperResponseCallback` instead of
  a `ResponsesQueue &`, decoupling the state machine from the queue type.
- `KeeperServer` constructor takes `KeeperResponseCallback` instead of
  `ResponsesQueue &`.
- `KeeperServer::KeeperRaftServer` moved from .cpp anonymous definition
  to the header for visibility.
- `ZooKeeperResponseCallback` moved to `KeeperCommon.h`, returns `bool`
  for future flow control.
- `shutdown` now takes a `closed_all_connections` parameter.
- Consolidated `finishSession` calls into a single `SCOPE_EXIT` in
  `KeeperTCPHandler`.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2026-04-07 15:45:25 -07:00
Alexey MilovidovandClaude Opus 4.6 8b47d200d5 Enable -Wmissing-prototypes compiler warning
Add `static` to file-local functions and forward declarations
for cross-TU functions to satisfy `-Wmissing-prototypes`.

This ensures all functions have visible prototypes before their
definitions, improving code quality and catching accidental
linkage issues.

Reference: https://github.com/ClickHouse/ClickHouse/issues/76944

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2026-03-27 20:11:07 +00:00
Michael Stetsyuk db7c98e866 make seq_num int64 2026-03-09 19:50:30 +00:00
Antonio Andelic 863549b089 Fix system.zookeeper_info 2026-01-12 12:27:55 +01:00
Mikhail Artemenko e3b76919b3 support check stat keeper extension 2025-09-18 12:51:54 +00:00
Antonio Andelic b2a2e8bb40 Replace StringRef with std::string_view in Keeper code 2025-09-08 11:54:19 +02:00
Azat Khuzhin eb74cb7fa9 keeper-utils: configurable limit for dumping top subtress 2025-08-07 15:16:39 +02:00
Antonio Andelic f92310d8df Print biggest subtree in snapshot analyzer 2025-07-04 17:50:33 +02:00
Antonio Andelic 880ee44ef8 Fix segfault 2025-06-16 13:28:45 +02:00
Antonio Andelic 22261481bb More features 2025-06-12 16:25:44 +02:00
Antonio Andelic 4289db0e4a Add keeper-utils which contains utility tools for Keeper 2025-06-11 20:29:48 +02:00