Commit Graph
1923 Commits
Author SHA1 Message Date
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 e19decaa0b datastore: remove gRPC entirely — no contrib, no server, no USE_GRPC paths
Disable/remove all gRPC machinery so datastore cannot encode/translate to gRPC:
- contrib/grpc submodule + contrib/grpc-cmake + .gitmodules entry + add_contrib(grpc-cmake) gone
- USE_GRPC cmakedefine + configure_config gate + StorageSystemBuildOptions row removed
- Server.cpp: gRPC include, grpc_port createServer, and the gRPC-based ArrowFlight block removed
- ProtocolServerAdapter: GRPCServerAdapterImpl + IGRPCServer ctor removed (TCP + ZAP remain)
- ServerType::GRPC enum + parse/dispatch cases removed
- arrow-cmake: gate include(flight.cmake) on ENABLE_ARROW_FLIGHT (Flight is gRPC-based; needs the
  removed grpc_cpp_plugin) — otherwise the native build references $<TARGET_FILE:grpc_cpp_plugin>
- google-cloud-cpp already self-guards via if(NOT ENABLE_GRPC)
The transport slot is ZAP only. protobuf (the data FORMAT) is untouched — it is not gRPC.
2026-06-22 21:51:50 -07:00
zooqueen 12ee47043b datastore: eliminate ALL clickhouse references from the product (no clickhouse, period)
Comprehensive removal across the compiled-product surface (src/programs/base/cmake/configs,
excl contrib third-party + unit tests): URLs clickhouse.com/.tech/.cloud -> hanzo.ai and
github.com/ClickHouse/ClickHouse -> github.com/hanzoai/datastore; fs/zk paths /var/lib/clickhouse
-> /var/lib/datastore, /clickhouse/tables -> /datastore/tables; SQL dict-source keyword
"clickhouse" -> "datastore" (SOURCE(DATASTORE(...)), forwards-only); .clickhouse.hash ELF section
-> .datastore.hash (main.cpp + CMake); hasClickhouse/Clickhouse symbols -> Datastore; all remaining
lowercase clickhouse -> datastore. 175 files. contrib/ (upstream deps) untouched. Build-verify since
this changes the SQL keyword, default paths and the binary-hash section.
2026-06-22 16:33:18 -07:00
Alexey MilovidovandGitHub 969978989c Merge pull request #101143 from ClickHouse/local-server-system-listen
Support SYSTEM START/STOP LISTEN in clickhouse-local
2026-06-22 20:30:22 +02:00
zooqueen afb3fbe91b datastore: native ZAP transport scaffold (gRPC replacement) — wiring + USE_ZAP
Wires the native ZAP query transport into the server, end to end, on the green unify foundation:
- src/Server/ZapServer.{h,cpp}: the transport owner (port + lifecycle thread). Minimal compiling
  skeleton; the KJ event loop + zap-rpc TwoPartyServer (promise pipelining) serving the .zap query
  interface is the next increment (kept out of the header behind an opaque Runtime).
- ProtocolServerAdapter: IServer/ZapServer ctor + ZapServerAdapterImpl (#if USE_ZAP), mirroring the
  old gRPC adapter.
- ServerType::ZAP (+ default-start list); Server.cpp createServer for `zap_port` (#if USE_ZAP);
  config.xml <zap_port> (commented, opt-in like grpc_port was).
- USE_ZAP cmakedefine (set when ch_contrib::zap exists); dbms links ch_contrib::zap.

This verifies the whole transport wiring + USE_ZAP build config compiles with zap linked. Next:
implement ZapServer::run() (KJ setupAsyncIo -> listen -> TwoPartyServer) + the .zap query schema +
executeQuery dispatch + result streaming.
2026-06-22 10:29:36 -07:00
murphy-4oandGitHub c46081e195 Merge pull request #105401 from murphy-4o/uk-pr-3-bitmap-store
UNIQUE KEY: Bitmap sidecar store, part APIs, and cache wiring (3/N)
2026-06-22 12:54:33 +00:00
Sergei TrifonovandGitHub 994d948d93 Merge pull request #102928 from seva-potapov/concurrencycontrol-lazy-allocation
Fix SELECT slowdown caused by simple INSERTs holding unused CPU slots
2026-06-22 10:28:21 +00: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
murphy-4o ec8bf665b2 Merge branch 'master' into uk-pr-3-bitmap-store
# Conflicts:
#	src/Storages/MergeTree/UniqueKey/DeleteBitmap.cpp
2026-06-22 12:59:31 +08: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
zooqueen 17bdb3e474 datastore: rip out gRPC (and Arrow Flight, which is gRPC-based)
No more gRPC. Datastore's native RPC transport will be zap (Cap'n Proto / KJ, ~/work/zap);
the HTTP (8123) and native TCP (9000) protocols remain.

- ENABLE_GRPC forced OFF (contrib/grpc-cmake) -> USE_GRPC=0, and since Arrow Flight gates on
  ch_contrib::arrow_flight (which needs grpc), USE_ARROWFLIGHT=0 too. All #if USE_GRPC /
  #if USE_ARROWFLIGHT code compiles out; the grpc + grpc_protos + arrow_flight CMake is
  `if (TARGET ch_contrib::grpc)`-guarded, so nothing builds.
- deleted src/Server/{GRPCServer.cpp,GRPCServer.h,IGRPCServer.h,grpc_protos/,ArrowFlight/}.
- removed the one unconditional ArrowFlight include in Server.cpp; removed the <grpc> config.

Needs build verification. Dead #if USE_GRPC stubs remain in ProtocolServerAdapter + Server.cpp
(guarded, compiled-out) — cleanup follow-up.
2026-06-21 20:09:02 -07:00
zooqueen b4c5e88334 datastore rebrand: runtime env vars CLICKHOUSE_* -> DATASTORE_*
The server/daemon and container-init env vars are now DATASTORE_*, matching the
white-label scripts (entrypoint, init, service) and compose which already use DATASTORE_*:
  WATCHDOG_ENABLE/NO_FORWARD/RESTART, GENERIC_PROGRAM, PROGRAM_ENV, CONFIG, INIT_TIMEOUT,
  SERVER_USER/GROUP, BRIDGE_USER/GROUP, USER, PASSWORD, PASSWORD_FILE, DB, UID, GID,
  DATA_DIR, RUN_AS_ROOT, DO_NOT_CHOWN, SKIP_USER_SETUP, ALWAYS_RUN_INITDB_SCRIPTS,
  DEFAULT_ACCESS_MANAGEMENT, WATCH.
Files: programs/{docker-init,install,server}, src/Daemon/BaseDaemon.cpp. String-literal
getenv/setenv only — no macros (e.g. CLICKHOUSE_OFFICIAL_BUILD) touched, no symbols renamed.
Feature flags CLICKHOUSE_CLOUD / CLICKHOUSE_COMPLETION_LOADED (client/cloud detection,
not branding) intentionally left.
2026-06-21 19:33:12 -07:00
Alexey MilovidovandClaude Opus 4.8 289039e086 Fix build after merge: restore NETWORK_ERROR error code in Server.cpp
The merge with master brought in the multistage distributed queries
feature, whose `ExchangeServer` startup code in `Server.cpp` throws
`Exception(ErrorCodes::NETWORK_ERROR, ...)`. This branch had removed the
`extern const int NETWORK_ERROR;` declaration from `Server.cpp` because
its only previous use (in `Server::createServer`) was extracted into
`src/Server/createServer.cpp`. Restore the declaration so the new use
compiles.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-17 15:03:03 +00:00
Alexey Milovidov a88469d95d Merge remote-tracking branch 'origin/master' into local-server-system-listen 2026-06-17 15:03:02 +00:00
Miсhael StetsyukandGitHub e78aeb970e Merge pull request #107291 from ClickHouse/static-thread-pool-shutdownall
Fix stuck shutdown in server and local and join all global pool threads in all binaries
2026-06-17 13:44:41 +00:00
Antonio AndelicandGitHub 47f6c3116b Merge pull request #106822 from linjiayu1025-collab/keeper_server_secure
Fix keeper_server.http_control.secure_port serves plaintext HTTP instead of HTTPS
2026-06-17 12:14:22 +00:00
Den Kalantaevskii 2fb02911ff private sync 2026-06-16 15:51:30 +00:00
linjiayuandhaozelong 5f759fbcbe Fix keeper_server.http_control.secure_port serves plaintext HTTP instead of HTTPS 2026-06-16 13:50:33 +08:00
Alexander GololobovandGitHub 239073ef8e Merge pull request #107146 from ClickHouse/revert-107122-revert-106020-multistage-distributed
Revert "Revert "Multistage distributed queries" (#106020) — fixes ASan heap corruption on master"
2026-06-15 14:54:48 +00:00
murphy-4oandClaude Opus 4.7 77183ded71 UNIQUE KEY: bitmap sidecar store, part APIs, cache wiring (3/N)
Third slice of the UNIQUE KEY stack. Lands the per-part delete-bitmap
storage layer on top of PR-2's DeleteBitmap + DeleteBitmapFileOps
primitives, aligned with the CSN-based transaction model documented
in design/txn/transaction_consistency.md.

Why a separate bitmap store. UNIQUE KEY needs to mark logically-deleted
rows without rewriting the part. Each commit publishes one cumulative
bitmap per touched part, tagged by a monotonic per-partition version.
Readers pin a snapshot version and consult the bitmap with
`max version ≤ snapshot` for each part — that's the snapshot-isolation
primitive for UK reads, INSERT-time probe, and merge-time row
resolution. This PR delivers the storage and read/write API for that
bitmap; the transaction-control plane (version allocation, partition
mutex, query snapshot, manifest, recovery) lands in later PRs.

What's in this PR:
- MergeTreeBitmapStore — one per table. Atomic install at a version
  (strictly monotonic; throws LOGICAL_ERROR otherwise), snapshot-pinned
  read returning (shared_ptr<const DeleteBitmap>, chosen_version),
  (V_b, V_next)-rule GC, and dropPart for parts leaving the active
  set. Keeps an in-memory version index per part (rebuilt from disk on
  first access) so the hot read path is map lookup + binary search,
  not a syscall.
- DeleteBitmapCache — process-wide cache for deserialized bitmaps,
  keyed by stable part identity + version. Configurable via
  unique_key_bitmap_cache_* settings, wired through Context startup/
  reload, observable via DeleteBitmapCache* metrics and
  UniqueKeyBitmap* events.
- IMergeTreeDataPart — cache-identity accessor for callers building
  cache keys; delete_bitmap_<csn>.rbm enumeration in
  getFileNamesWithoutChecksums so BACKUP and replication-fetch carry
  bitmap sidecars.

Why the API is shaped this way:
- Bitmaps are immutable by version. readBitmap returns
  shared_ptr<const DeleteBitmap> so a writer building a new version
  must copy, never mutate the cached older snapshot.
- The store is concrete (no IUniqueKeyBitmapStore interface). Future
  SharedMergeTree variant runs a fundamentally different protocol
  (Keeper-coordinated S3 with (bn, uuid) refs); a shared base wouldn't
  fit at this layer.
- Integration with active reads/writes lands in later slices (PR 4
  read filter, PR 5 DELETE, PR 13 INSERT/UPSERT commit, PR 14a merge
  reconcile).

Tests: 39 / 39 PASS in DeleteBitmap*:*BitmapFileOps*:*MergeTreeBitmapStore*
filter:
- 20 DeleteBitmapTest (primitive)
- 1 DeleteBitmapCacheTest (cache wrapper)
- 11 DeleteBitmapFileOpsTest (file I/O)
- 7 MergeTreeBitmapStoreTest: read empty / max-≤-snapshot pick / cache
  reuse / GC removal / GC committed-filter / dropPart / corrupt-file
  surface.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-06-15 21:32:04 +08:00
Miсhael StetsyukandGitHub 551dbd1db2 Merge pull request #107187 from ClickHouse/revert-106727-fix-startup-scripts-reload
Do not run startup scripts on config reload
2026-06-15 10:02:06 +00:00
Alexander Gololobov f06576dbff Merge remote-tracking branch 'origin/master' into revert-107122-revert-106020-multistage-distributed
# Conflicts:
#	src/Processors/Transforms/ScatterByPartitionTransform.cpp
2026-06-14 23:01:11 +02:00
Alexey Milovidov f14ef43632 Merge remote-tracking branch 'origin/master' into local-server-system-listen 2026-06-14 16:50:49 +00:00
Alexey MilovidovandGitHub 40359661e7 Merge pull request #101447 from tuanpach/fix-workload-storage-lifetime-race
Fix use-after-free of workload storage mutex during server shutdown
2026-06-13 20:40:44 +00:00
Alexey Milovidov 1b780f54bc Merge remote-tracking branch 'origin/master' into local-server-system-listen 2026-06-13 02:30:26 +00:00
Alexey MilovidovandGitHub 436c6f159d Merge pull request #104964 from ClickHouse/memory-worker-dynamic-limit
Dynamically adjust memory limit based on system free/cached memory
2026-06-12 19:39:27 +00:00
Alexander GololobovandClaude Fable 5 cbf4b26470 Shrink idle thread pools of the distributed query infrastructure
Co-Authored-By: Claude Fable 5 <[email protected]>
2026-06-12 10:48:35 +02:00
Alexey Milovidov f3d3f575d1 Merge remote-tracking branch 'origin/master' into local-server-system-listen 2026-06-12 00:41:26 +00:00
Michael Stetsyuk 3a9c7df8d2 Join threads from global thread pool before exiting from main 2026-06-11 21:45:31 +00:00
Alexey MilovidovandClaude Fable 5 272db20fa0 Add memory_worker_dynamic_hard_limit setting to opt out of the runtime limit adjustment
Address review: a positive max_server_memory_usage_to_ram_ratio used to
opt the server into runtime hard-limit shrinking with no way to keep the
previous static cap, while setting the ratio to 0 removed the cap
entirely. The new memory_worker_dynamic_hard_limit server setting
(enabled by default) gates only the runtime adjustment: when disabled,
max_server_memory_usage_to_ram_ratio caps the hard memory limit
statically at startup and on configuration reload, exactly as in
previous versions.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-06-11 16:17:04 +00:00
Azat KhuzhinandGitHub 32cedf25cc Merge pull request #101942 from fastio/feature-oom-canary
Add OOM canary: a sacrificial child process to protect the server from the OOM killer
2026-06-11 12:17:44 +00:00
Raúl MarínandGitHub 4190813eef Merge pull request #107033 from Algunenano/darwin-thread-stack-size
Use an 8 MiB thread stack on Darwin to avoid stack overflow in JIT codegen
2026-06-11 10:21:16 +00:00
Miсhael StetsyukandGitHub 5b08f689b0 Revert "Fix logical error in startup scripts in SYSTEM RELOAD CONFIG" 2026-06-11 11:01:42 +01:00
Alexander GololobovandGitHub 41edd03279 Revert "Revert "Multistage distributed queries" (#106020) — fixes ASan heap corruption on master" 2026-06-11 06:09:43 +02:00
Alexey Milovidov c8328abbd9 Revert "Merge pull request #106020 from ClickHouse/multistage_distributed_queries"
This reverts commit c3131f3265, reversing
changes made to 4f3fe68b90.
2026-06-11 01:27:26 +00:00
Alexey Milovidov 1fa92f9aec Revert "Merge pull request #106978 from ClickHouse/distributed-plan-shrink-idle-thread-pools"
This reverts commit 4f2c87963e, reversing
changes made to 56d78b5c22.
2026-06-11 01:27:11 +00:00
Alexander GololobovandGitHub e9e12b9017 Merge pull request #106978 from ClickHouse/distributed-plan-shrink-idle-thread-pools
Shrink idle thread pools of the distributed query infrastructure
2026-06-10 19:04:48 +00:00
Raúl Marín 103d070e24 Use an 8 MiB thread stack on Darwin to avoid stack overflow in JIT codegen 2026-06-10 18:29:42 +02:00
Alexander GololobovandClaude Fable 5 f2a5248652 Reject stateless_worker_server.max_threads=0
Co-Authored-By: Claude Fable 5 <[email protected]>
2026-06-10 15:55:09 +02:00
Alexander GololobovandClaude Fable 5 fccf8073bb Shrink idle thread pools of the distributed query infrastructure
Co-Authored-By: Claude Fable 5 <[email protected]>
2026-06-10 15:35:21 +02:00
Miсhael StetsyukandGitHub 4e2a34fe26 Merge pull request #106727 from ClickHouse/fix-startup-scripts-reload
Fix logical error in startup scripts in SYSTEM RELOAD CONFIG
2026-06-10 12:39:10 +00:00
Michael Stetsyuk 80bf58fa66 do not rename os thread in loadStartupScripts 2026-06-09 18:25:56 +00:00
Michael Stetsyuk 607c541231 Fix logical error in startup scripts in SYSTEM RELOAD CONFIG 2026-06-08 14:58:01 +00:00
Alexey Milovidov 31678faee7 Merge remote-tracking branch 'origin/master' into local-server-system-listen 2026-06-07 08:34:08 +00:00
Alexey Milovidov 2d67c3c0c5 Merge remote-tracking branch 'origin/master' into memory-worker-dynamic-limit 2026-06-07 04:44:12 +00:00
Alexey MilovidovandClaude Opus 4.8 6e5d95a75c Fix shutdown-concurrent lifetime race in lazy resource-manager init
The previous fix protected `PipelineExecutor::allocateCPU` and the
query-execution callers, but the lazy initialization of the resource
manager still observed the same shutdown race.

`Context::getWorkloadClassifier` initializes the resource manager lazily
through `getResourceManager`, which calls `createResourceManager`. That
passed `getWorkloadEntityStorage()` (a raw reference whose owning
`shared_ptr` temporary is destroyed at the end of the full expression),
so no owner was held across `WorkloadResourceManager`'s constructor while
it runs `getAllEntitiesAndSubscribe`. If this first lazy init overlaps
shutdown's reset of `workload_entity_storage`, the storage can be
destroyed while the constructor is still using it — the same
`recursive_mutex` use-after-free this PR set out to fix.

Make `WorkloadResourceManager` take and retain a
`shared_ptr<IWorkloadEntityStorage>`, and have `createResourceManager`
pass `getWorkloadEntityStoragePtr`. The storage is only touched in the
constructor, so holding the owner for the manager's lifetime is more than
sufficient.

Also remove the now-unused reference accessor
`Context::getWorkloadEntityStorage` (the last caller in `Server.cpp`'s
startup `loadEntities` is migrated to `getWorkloadEntityStoragePtr`), so
the shutdown-unsafe accessor can no longer be reintroduced.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-06 11:53:22 +00:00
Alexander Gololobov 1740db5ef3 Merge branch 'master' of github.com:ClickHouse/ClickHouse into multistage_distributed_queries 2026-06-06 09:35:45 +02:00
Miсhael StetsyukandGitHub eb3f7f5fe8 Merge pull request #105617 from ClickHouse/system-keeper-changelogs
Add system.keeper_changelogs table
2026-06-05 11:10:40 +00:00
Alexey Milovidov eaf13ba145 Merge remote-tracking branch 'origin/master' into local-server-system-listen 2026-06-05 06:29:04 +00:00