167 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 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
zooqueen fce0ee72e1 datastore: fix XML config tag mismatch (</clickhouse> closing tags)
Runtime regression from the final lowercase pass: it renamed <clickhouse> opening tags to
<datastore> but the / exclusion (protecting /clickhouse paths) left </clickhouse> closing tags,
so embedded + shipped configs became <datastore>...</clickhouse> -> SAXParseException 'Tag
mismatch' at runtime (compile was fine; XML is data). Renamed all <clickhouse/</clickhouse XML
tags -> datastore (101 closes across configs, embedded strings, keeper configs). Path strings
(/var/lib/clickhouse) have no angle bracket and are untouched. Build compiled; this fixes runtime
config parsing.
2026-06-22 00:25:01 -07:00
zooqueen ca73c44faa datastore rebrand: final lowercase pass — quote-adjacent display strings + install defaults
The prior sweep kept " in the exclusion set to guard the SQL keyword "clickhouse", which
over-protected ALL quoted display strings ("clickhouse " << app in --help, install-tool defaults
like DEFAULT_..._SERVER_USER="clickhouse"/getpwnam("clickhouse")/binary-name fallbacks). Redid the
pass dropping " from the exclusion while still skipping the 4 SQL dict-source keyword lines, URLs,
and /clickhouse + .clickhouse.hash paths (kept . / - in the boundary). Renamed the 2 fuzzer files
clickhouse_fuzzer.cpp / clickhouse-template.g (not built; completeness).

Remaining lowercase clickhouse (526) = URLs, SQL SOURCE(CLICKHOUSE) keyword, and ZK/fs path
conventions (/var/lib/clickhouse, /clickhouse/tables) + internal .clickhouse.hash ELF section —
all protocol/external/convention, intentionally kept.
2026-06-22 00:21:07 -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
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 MilovidovandGitHub 842b133f8d Merge pull request #100399 from ClickHouse/clang-tidy-init-variables
Enable clang-tidy check for uninitialized variables
2026-05-31 21:56:29 -07:00
Alexey Milovidov a4a69d3774 Merge remote-tracking branch 'origin/master' into clang-tidy-init-variables
# Conflicts:
#	src/Client/BuzzHouse/Generator/QueryOracle.h
#	src/Functions/hilbertEncode.cpp
#	src/Interpreters/ProfileEventsExt.h
#	src/Storages/Statistics/ConditionSelectivityEstimator.cpp
#	src/Storages/Statistics/Statistics.cpp
#	src/Storages/Statistics/tests/gtest_stats.cpp
2026-05-19 16:20:47 +00:00
Alexey Milovidov 7a2f9f408a Merge remote-tracking branch 'origin/master' into fix-compiler-warnings 2026-05-19 15:05:56 +00:00
Raúl MarínandClaude Opus 4.7 88cf709ca1 Share shellQuote and apply it to remaining shell sinks
Move the `shellQuote` helper out of `clickhouse install` into
`Common/shellQuote.h` so it can be reused. Apply it to two more
shell-command construction sites:

- `formatWithSudo` on FreeBSD wraps the inner command in `su -c '...'`.
  All current callers pass static literals, but an embedded single
  quote would break the wrapper. Quote the command via `shellQuote`
  so future callers can pass arbitrary strings safely.
- `clickhouse git-import` interpolates a commit hash parsed from
  `git log --pretty=%H` into `git show ... {hash}` and runs it via
  `/bin/sh -c`. `%H` is hex-only today, but a hand-crafted hash list
  or a future format change should not be able to inject shell
  syntax through the input.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-05-18 14:50:27 +00:00
Raúl MarínandClaude Opus 4.7 7bc5388dde Quote shell arguments in clickhouse install
`changeOwnership`, `createGroup`, `createUser`, and the `setcap`
invocation in `clickhouse install` interpolated CLI-controlled values
(`--user`, `--group`, `--log-path`, `--data-path`, `--pid-path`,
`--config-path`, `--binary-path`, `--prefix`) directly into shell
command strings passed to `/bin/sh -c`. The `shellQuote` helper
already used by the sudo invocation in the same file was not applied
elsewhere. Wrap every interpolated value in `shellQuote` so shell
metacharacters in CLI arguments cannot be interpreted by the shell.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-05-18 14:41:03 +00:00
Alexey Milovidov 9567f0d9ba Merge remote-tracking branch 'origin/master' into clang-tidy-init-variables
# Conflicts:
#	src/Processors/QueryPlan/Optimizations/Optimizations.h
#	src/Storages/MaterializedView/RefreshTask.cpp
2026-05-08 03:15:33 +00:00
Alexey Milovidov 7d54e33c7c Merge remote-tracking branch 'origin/master' into fix-compiler-warnings
# Conflicts:
#	programs/main.cpp
2026-05-06 03:18:15 +00:00
Alexey Milovidov f0347457c1 Address review: only apply --group when explicitly specified
`--group` for `clickhouse start` / `restart` had a default value of
`clickhouse` purely for documentation. The launcher applied it
unconditionally on the `sudo` path, so

    clickhouse start --user alice

was silently expanded to `sudo --preserve-env -u alice -g clickhouse ...`.
That fails when `alice` is not a member of the `clickhouse` group,
which is a behavior regression for users who only ever passed `--user`.

Clear `group` in `mainEntryClickHouseStart` and `mainEntryClickHouseRestart`
when `options["group"].defaulted()` is true, so the default is shown in
`--help` but not applied to the spawned server. The `no-sudo` path then
runs `clickhouse su user:`, where `setUserAndGroup` falls back to the
user's primary group.
2026-05-01 03:50:59 +00:00
Alexey MilovidovandClaude Opus 4.7 187bd4bb08 Address review: apply --group on sudo path of clickhouse start
The `--group` option for `clickhouse start` / `restart` was only honored on
the `--no-sudo` branch (`clickhouse su user:group ...`). On the default path
the command was built as `sudo --preserve-env -u <user> ...`, with no `-g`,
so the group was silently ignored.

Pass `-g <group>` to `sudo` (shell-quoted) when `group` is non-empty so the
advertised CLI option takes effect on both code paths.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-04-29 09:54:07 +00:00
Alexey MilovidovandClaude Opus 4.7 624c852ffe Shell-escape interpolated values in clickhouse start / restart
The previous attempt to harden the `--no-sudo` and `sudo` paths in
`clickhouse start` wrapped interpolated `user`, `group`, and binary
paths in single quotes only. This is insufficient: a value containing
a single quote (e.g. `bob';rm -rf /;'`) still breaks out because
single quotes do not nest.

Introduce a POSIX-compliant `shellQuote` helper in `Install.cpp` and
apply it to every user-controlled field interpolated into the `su` /
`sudo` command strings: `executable`, `config`, `pid_file`,
`binary`, `user`, and `group`. The helper replaces any `'` inside
the value with `'\''` before re-wrapping, which is the standard POSIX
idiom and safe against arbitrary byte content.

While CLI arguments to `clickhouse start` are not typically attacker
controlled (the caller already runs the binary), defense-in-depth is
worthwhile: these commands go through `/bin/sh -c` via
`ShellCommand::execute`, and unquoted interpolation has been flagged
as a hazard in code review.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-04-21 00:12:53 +00:00
Alexey MilovidovandClaude Opus 4.6 463881da74 Address review feedback: stderr for error help, shell quoting, keeper test
- `printHelp` now takes an `std::ostream &` parameter: explicit `help`
  writes to stdout, while `printHelpOnError` (mistyped commands) writes
  to stderr, preserving the error-output contract for scripts.
- Shell-quote binary path and user:group in the `--no-sudo` branch of
  `clickhouse start` to prevent command injection via crafted CLI args.
- Make the keeper availability check in the help return codes test more
  precise: match `clickhouse keeper [args]` exactly instead of bare
  `keeper` which could false-match `keeper-converter` etc.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2026-04-09 20:27:13 +00:00
Alexey MilovidovandClaude Opus 4.6 48426ad1a6 Fix issues that caused the revert of the original help improvements
The original PR #96025 was reverted (#98038) because:
1. The install completion message showed wrong relative paths like
   `var/run/clickhouse-server` instead of absolute `/var/run/clickhouse-server`.
   This happened because `options.contains()` returns true even for options
   with default values in boost::program_options. Fix: use `defaulted()`
   to only include options that the user explicitly specified.
2. The install completion message did not suggest `sudo` for the
   start/restart command. This happened because `getuid() != 0` is false
   when install runs as root via sudo, but the user returns to their
   unprivileged shell afterward. Fix: always suggest sudo (matching the
   original behavior).

Also address review feedback:
- Fix `clickhouse-client` help: remove misleading "initial table definition"
  (a `clickhouse-local` concept) from usage line
- Fix typo: "as command line tool" → "as a command line tool"
- Fix `clickhouse-local` help grammar: "After you can execute" → "After that,
  you can execute", "in first query" → "in the first query"
- Make keeper `--help` test robust for builds without `ENABLE_CLICKHOUSE_KEEPER`

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2026-04-09 08:06:11 +00:00
Alexey Milovidov 2e15ae037c Merge remote-tracking branch 'origin/master' into revert-98038-revert-96025-clickhouse-help 2026-03-30 07:43:50 +00:00
Alexey Milovidov fb4cee51f5 Merge remote-tracking branch 'origin/master' into clang-tidy-init-variables 2026-03-30 02:51:23 +00:00
Alexey Milovidov 01d5c6a84c Merge remote-tracking branch 'origin/master' into fix-compiler-warnings 2026-03-29 23:20:54 +00:00
Alexey MilovidovandGitHub 8b819651a9 Merge branch 'master' into revert-98038-revert-96025-clickhouse-help 2026-03-28 23:50:35 +01: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
Alexey MilovidovandClaude Opus 4.6 4d6c92f0d2 Address review comments: remove stale #embed comments and add missing deps
- Remove "CMake doesn't recognize changes in #embed-ed files" comments
  from all files, since this PR now tracks those dependencies.
- Add conditional `OBJECT_DEPENDS` for `FrequencyHolder.cpp` NLP blobs
  (guarded by `if (EXISTS ...)` for when the submodule is not checked out).
- Add `OBJECT_DEPENDS` for `attachInformationSchemaTables.cpp` which was
  also missing dependency tracking for its embedded SQL files.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2026-03-27 00:40:29 +01:00
Alexey MilovidovandGitHub 9fccf747f2 Merge master into cmake-embed-deps 2026-03-26 04:09:29 +01: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
Alexey MilovidovandClaude Opus 4.6 0681b7f0fa Track #embed file dependencies in CMake
The C++ `#embed` directive includes file contents at compile time,
but the build system does not automatically track these as
dependencies. When an embedded file (e.g., `play.html`) changes,
the .cpp file that embeds it is not recompiled.

Fix this by adding `OBJECT_DEPENDS` properties to all source files
that use `#embed`, covering: HTML pages, JavaScript files, XML
configs, and NLP data files.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2026-03-23 03:04:08 +01:00
Robert Schulze 898b0d8270 Add comments 2026-03-15 19:01:55 +00:00
Alexey MilovidovandGitHub 85164c93d4 Revert "Revert "Improve help output for ClickHouse applications"" 2026-02-27 00:49:00 +01:00
Alexey MilovidovandGitHub e8654c51eb Revert "Improve help output for ClickHouse applications" 2026-02-26 07:51:17 +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
Alexey MilovidovandClaude Opus 4.5 d010338fd8 Add --group option and pass install options to suggested start command
- Add --group option to start and restart commands
- Use clickhouse su instead of sudo when --no-sudo is set
- Pass --prefix, --pid-path, --config-path, --binary-path, --user, --group
  from install to the suggested start/restart command

Co-Authored-By: Claude Opus 4.5 <[email protected]>
2026-02-05 07:18:40 +01:00
Alexey MilovidovandClaude Opus 4.5 62ccfbd3aa Improve help output for ClickHouse applications
This commit improves the help output for all ClickHouse applications:

- Add `clickhouse help` command that lists all available subcommands
- Return exit code 0 for all help messages (previously some returned 1)
- Output help messages to stdout instead of stderr
- Use "clickhouse <cmd>" format instead of argv[0] in help messages
- Add dynamic `app_name` detection for `clickhouse client` and `clickhouse local`
  to show correct invocation name based on how the binary was called
- Add `--no-sudo` option for `clickhouse start` and `clickhouse restart`
  for environments without sudo (e.g., Docker containers)
- Add detailed help headers and footers for client and local with usage examples

Closes #58244

Co-Authored-By: Claude Opus 4.5 <[email protected]>
2026-02-05 07:12:44 +01:00
Raúl Marín 5a5673539d Missing files 2026-01-08 17:14:36 +01:00
Raúl Marín 2fb21c0e5f Fix builds 2025-12-18 19:28:02 +01:00
Raúl Marín a8d196b58d Remove StackTrace.h from Exception.h 2025-12-18 12:04:33 +01:00
Azat Khuzhin 2e630bb588 Improve --help for status/start/restart/stop 2025-09-15 08:53:47 +02:00
Azat Khuzhin b2b4040023 Bundle chdig into clickhouse binary
Previously it was only shipped as part of the client package, now it
will be bundled into the binary, and will be available as:
- clickhouse chdig
- clickhouse-chdig
- chdig

Note, that since now chdig will not be linked, we can remove all
quirks for this, that has been done in #79666
2025-06-23 17:06:25 +02:00
Azat Khuzhin 24d4607d21 clickhouse-stop: kill only processes that are passed via pid file 2025-06-07 17:21:20 +02:00
Azat Khuzhin 0fea21845d clickhouse-stop: ignore pid file does not exist only during polling 2025-06-07 17:21:20 +02:00
Azat Khuzhin 8e2a8a33ce clickhouse-stop: fix message for killing 2025-06-07 17:21:20 +02:00
Nikita Mikhaylov ee12273297 Improve the SSH protocol 2025-03-18 14:53:35 +01:00
Alexey MilovidovandGitHub b999483404 Merge pull request #73827 from ClickHouse/install-better-message
Better message during installation
2024-12-27 17:31:47 +00:00
Alexey Milovidov ff7f242ebf Ask before output binary data into terminal 2024-12-26 07:31:10 +01:00
Alexey Milovidov f1e59ccfbe Better message during installation 2024-12-25 08:04:55 +01:00
Sema Checherinda f1ab911910 cancel or finalize write buffer 2024-11-11 11:37:12 +01:00
Konstantin Bogdanov 67c1e89d90 Apply linter changes 2024-10-06 12:29:20 +02:00