mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Merge branch 'master' into vdimir/join_select_inner_table
This commit is contained in:
commit
62789dab31
@ -16,6 +16,9 @@ Checks: [
|
||||
|
||||
'-android-*',
|
||||
|
||||
'-boost-use-ranges',
|
||||
'-modernize-use-ranges',
|
||||
|
||||
'-bugprone-assignment-in-if-condition',
|
||||
'-bugprone-branch-clone',
|
||||
'-bugprone-easily-swappable-parameters',
|
||||
@ -28,7 +31,6 @@ Checks: [
|
||||
'-bugprone-reserved-identifier', # useful but too slow, TODO retry when https://reviews.llvm.org/rG1c282052624f9d0bd273bde0b47b30c96699c6c7 is merged
|
||||
'-bugprone-unchecked-optional-access',
|
||||
'-bugprone-crtp-constructor-accessibility',
|
||||
'-bugprone-suspicious-stringview-data-usage',
|
||||
|
||||
'-cert-dcl16-c',
|
||||
'-cert-dcl37-c',
|
||||
@ -42,6 +44,8 @@ Checks: [
|
||||
|
||||
'-clang-analyzer-optin.performance.Padding',
|
||||
|
||||
'-clang-analyzer-cplusplus.PlacementNew',
|
||||
|
||||
'-clang-analyzer-unix.Malloc',
|
||||
|
||||
'-cppcoreguidelines-*', # impractical in a codebase as large as ClickHouse, also slow
|
||||
@ -90,6 +94,7 @@ Checks: [
|
||||
'-misc-non-private-member-variables-in-classes',
|
||||
'-misc-confusable-identifiers', # useful but slooo
|
||||
'-misc-use-anonymous-namespace',
|
||||
'-misc-use-internal-linkage',
|
||||
|
||||
'-modernize-avoid-c-arrays',
|
||||
'-modernize-concat-nested-namespaces',
|
||||
@ -137,6 +142,7 @@ Checks: [
|
||||
'-readability-suspicious-call-argument',
|
||||
'-readability-uppercase-literal-suffix',
|
||||
'-readability-use-anyofallof',
|
||||
'-readability-math-missing-parentheses',
|
||||
|
||||
'-zircon-*'
|
||||
]
|
||||
|
@ -30,8 +30,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
|
||||
double preciseExp10(double x)
|
||||
{
|
||||
|
@ -4,8 +4,9 @@ FROM ubuntu:22.04
|
||||
# ARG for quick switch to a given ubuntu mirror
|
||||
ARG apt_archive="http://archive.ubuntu.com"
|
||||
RUN sed -i "s|http://archive.ubuntu.com|$apt_archive|g" /etc/apt/sources.list
|
||||
ARG LLVM_APT_VERSION="1:19.1.4~*"
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=18
|
||||
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=19
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install \
|
||||
@ -26,7 +27,7 @@ RUN apt-get update \
|
||||
&& echo "deb https://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${LLVM_VERSION} main" >> \
|
||||
/etc/apt/sources.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install --yes --no-install-recommends --verbose-versions llvm-${LLVM_VERSION} \
|
||||
&& apt-get install --yes --no-install-recommends --verbose-versions llvm-${LLVM_VERSION}>=${LLVM_APT_VERSION} \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /var/cache/debconf /tmp/*
|
||||
|
||||
@ -72,10 +73,6 @@ RUN ln -s /usr/bin/lld-${LLVM_VERSION} /usr/bin/ld.lld
|
||||
# https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/commit/992e52c0b156a5ba9c6a8a54f8c4857ddd3d371d
|
||||
RUN sed -i '/_IMPORT_CHECK_FILES_FOR_\(mlir-\|llvm-bolt\|merge-fdata\|MLIR\)/ {s|^|#|}' /usr/lib/llvm-${LLVM_VERSION}/lib/cmake/llvm/LLVMExports-*.cmake
|
||||
|
||||
# LLVM changes paths for compiler-rt libraries. For some reason clang-18.1.8 cannot catch up libraries from default install path.
|
||||
# It's very dirty workaround, better to build compiler and LLVM ourself and use it. Details: https://github.com/llvm/llvm-project/issues/95792
|
||||
RUN test ! -d /usr/lib/llvm-18/lib/clang/18/lib/x86_64-pc-linux-gnu || ln -s /usr/lib/llvm-18/lib/clang/18/lib/x86_64-pc-linux-gnu /usr/lib/llvm-18/lib/clang/18/lib/x86_64-unknown-linux-gnu
|
||||
|
||||
ARG TARGETARCH
|
||||
ARG SCCACHE_VERSION=v0.7.7
|
||||
ENV SCCACHE_IGNORE_SERVER_IO_ERROR=1
|
||||
@ -105,5 +102,14 @@ RUN groupadd --system --gid 1000 clickhouse \
|
||||
&& useradd --system --gid 1000 --uid 1000 -m clickhouse \
|
||||
&& mkdir -p /.cache/sccache && chmod 777 /.cache/sccache
|
||||
|
||||
|
||||
# TODO move nfpm to docker that will do packaging
|
||||
ARG TARGETARCH
|
||||
ARG NFPM_VERSION=2.20.0
|
||||
RUN arch=${TARGETARCH:-amd64} \
|
||||
&& curl -Lo /tmp/nfpm.deb "https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/nfpm_${arch}.deb" \
|
||||
&& dpkg -i /tmp/nfpm.deb \
|
||||
&& rm /tmp/nfpm.deb
|
||||
|
||||
ENV PYTHONPATH="/wd"
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
@ -58,6 +58,7 @@ RUN apt-get update -y \
|
||||
curl \
|
||||
wget \
|
||||
xz-utils \
|
||||
ripgrep \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /var/cache/debconf /tmp/*
|
||||
|
||||
@ -114,4 +115,5 @@ RUN curl -L --no-verbose -O 'https://archive.apache.org/dist/hadoop/common/hadoo
|
||||
RUN npm install -g azurite@3.30.0 \
|
||||
&& npm install -g tslib && npm install -g node
|
||||
|
||||
ENV PYTHONPATH=".:./ci"
|
||||
USER clickhouse
|
||||
|
@ -4,3 +4,4 @@ requests==2.32.3
|
||||
pandas==1.5.3
|
||||
scipy==1.12.0
|
||||
pyarrow==18.0.0
|
||||
grpcio==1.47.0
|
||||
|
@ -4,11 +4,15 @@ from praktika.result import Result
|
||||
from praktika.settings import Settings
|
||||
from praktika.utils import MetaClasses, Shell, Utils
|
||||
|
||||
from ci.jobs.scripts.clickhouse_version import CHVersion
|
||||
|
||||
|
||||
class JobStages(metaclass=MetaClasses.WithIter):
|
||||
CHECKOUT_SUBMODULES = "checkout"
|
||||
CMAKE = "cmake"
|
||||
UNSHALLOW = "unshallow"
|
||||
BUILD = "build"
|
||||
PACKAGE = "package"
|
||||
|
||||
|
||||
def parse_args():
|
||||
@ -33,8 +37,7 @@ CMAKE_CMD = """cmake --debug-trycompile -DCMAKE_VERBOSE_MAKEFILE=1 -LA \
|
||||
-DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON \
|
||||
{AUX_DEFS} \
|
||||
-DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 \
|
||||
-DCOMPILER_CACHE={CACHE_TYPE} \
|
||||
-DENABLE_BUILD_PROFILING=1 {DIR}"""
|
||||
-DCOMPILER_CACHE={CACHE_TYPE} -DENABLE_BUILD_PROFILING=1 {DIR}"""
|
||||
|
||||
|
||||
def main():
|
||||
@ -91,6 +94,27 @@ def main():
|
||||
|
||||
res = True
|
||||
results = []
|
||||
version = ""
|
||||
|
||||
if res and JobStages.UNSHALLOW in stages:
|
||||
results.append(
|
||||
Result.create_from_command_execution(
|
||||
name="Repo Unshallow",
|
||||
command="git rev-parse --is-shallow-repository | grep -q true && git fetch --depth 10000 --no-tags --filter=tree:0 origin $(git rev-parse --abbrev-ref HEAD)",
|
||||
with_log=True,
|
||||
)
|
||||
)
|
||||
res = results[-1].is_ok()
|
||||
if res:
|
||||
try:
|
||||
version = CHVersion.get_version()
|
||||
assert version
|
||||
print(f"Got version from repo [{version}]")
|
||||
except Exception as e:
|
||||
results[-1].set_failed().set_info(
|
||||
f"Failed to get version from repo, ex [{e}]"
|
||||
)
|
||||
res = False
|
||||
|
||||
if res and JobStages.CHECKOUT_SUBMODULES in stages:
|
||||
Shell.check(f"rm -rf {build_dir} && mkdir -p {build_dir}")
|
||||
@ -127,6 +151,38 @@ def main():
|
||||
Shell.check(f"ls -l {build_dir}/programs/")
|
||||
res = results[-1].is_ok()
|
||||
|
||||
if res and JobStages.PACKAGE in stages:
|
||||
if "debug" in build_type:
|
||||
package_type = "debug"
|
||||
elif "release" in build_type:
|
||||
package_type = "release"
|
||||
elif "asan" in build_type:
|
||||
package_type = "asan"
|
||||
else:
|
||||
assert False, "TODO"
|
||||
|
||||
if "amd" in build_type:
|
||||
deb_arch = "amd64"
|
||||
else:
|
||||
deb_arch = "arm64"
|
||||
|
||||
output_dir = "/tmp/praktika/output/"
|
||||
assert Shell.check(f"rm -f {output_dir}/*.deb")
|
||||
|
||||
results.append(
|
||||
Result.create_from_command_execution(
|
||||
name="Build Packages",
|
||||
command=[
|
||||
f"DESTDIR={build_dir}/root ninja programs/install",
|
||||
f"ln -sf {build_dir}/root {Utils.cwd()}/packages/root",
|
||||
f"cd {Utils.cwd()}/packages/ && OUTPUT_DIR={output_dir} BUILD_TYPE={package_type} VERSION_STRING={version} DEB_ARCH={deb_arch} ./build --deb",
|
||||
],
|
||||
workdir=build_dir,
|
||||
with_log=True,
|
||||
)
|
||||
)
|
||||
res = results[-1].is_ok()
|
||||
|
||||
Result.create_from(results=results, stopwatch=stop_watch).complete_job()
|
||||
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
import argparse
|
||||
import os
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
@ -131,6 +130,10 @@ def main():
|
||||
)
|
||||
res = res and CH.start()
|
||||
res = res and CH.wait_ready()
|
||||
# TODO: Use --database-replicated optionally
|
||||
res = res and Shell.check(
|
||||
f"./ci/jobs/scripts/functional_tests/setup_ch_cluster.sh"
|
||||
)
|
||||
if res:
|
||||
print("ch started")
|
||||
logs_to_attach += [
|
||||
|
@ -101,6 +101,7 @@ def main():
|
||||
f"ln -sf {ch_path}/clickhouse {ch_path}/clickhouse-client",
|
||||
f"ln -sf {ch_path}/clickhouse {ch_path}/clickhouse-compressor",
|
||||
f"ln -sf {ch_path}/clickhouse {ch_path}/clickhouse-local",
|
||||
f"ln -sf {ch_path}/clickhouse {ch_path}/clickhouse-disks",
|
||||
f"rm -rf {Settings.TEMP_DIR}/etc/ && mkdir -p {Settings.TEMP_DIR}/etc/clickhouse-client {Settings.TEMP_DIR}/etc/clickhouse-server",
|
||||
f"cp programs/server/config.xml programs/server/users.xml {Settings.TEMP_DIR}/etc/clickhouse-server/",
|
||||
# TODO: find a way to work with Azure secret so it's ok for local tests as well, for now keep azure disabled
|
||||
@ -114,6 +115,7 @@ def main():
|
||||
f"for file in /tmp/praktika/etc/clickhouse-server/*.xml; do [ -f $file ] && echo Change config $file && sed -i 's|>/var/log|>{Settings.TEMP_DIR}/var/log|g; s|>/etc/|>{Settings.TEMP_DIR}/etc/|g' $(readlink -f $file); done",
|
||||
f"for file in /tmp/praktika/etc/clickhouse-server/config.d/*.xml; do [ -f $file ] && echo Change config $file && sed -i 's|<path>local_disk|<path>{Settings.TEMP_DIR}/local_disk|g' $(readlink -f $file); done",
|
||||
f"clickhouse-server --version",
|
||||
f"chmod +x /tmp/praktika/input/clickhouse-odbc-bridge",
|
||||
]
|
||||
results.append(
|
||||
Result.create_from_command_execution(
|
||||
@ -138,6 +140,7 @@ def main():
|
||||
res = res and Shell.check(
|
||||
"aws s3 ls s3://test --endpoint-url http://localhost:11111/", verbose=True
|
||||
)
|
||||
res = res and CH.log_cluster_config()
|
||||
res = res and CH.start()
|
||||
res = res and CH.wait_ready()
|
||||
if res:
|
||||
@ -170,6 +173,7 @@ def main():
|
||||
batch_total=total_batches,
|
||||
test=args.test,
|
||||
)
|
||||
CH.log_cluster_stop_replication()
|
||||
results.append(FTResultsProcessor(wd=Settings.OUTPUT_DIR).run())
|
||||
results[-1].set_timing(stopwatch=stop_watch_)
|
||||
res = results[-1].is_ok()
|
||||
|
@ -66,6 +66,24 @@ class ClickHouseProc:
|
||||
print(f"Started setup_minio.sh asynchronously with PID {process.pid}")
|
||||
return True
|
||||
|
||||
def log_cluster_config(self):
|
||||
return Shell.check(
|
||||
f"./ci/jobs/scripts/functional_tests/setup_log_cluster.sh --config-logs-export-cluster /tmp/praktika/etc/clickhouse-server/config.d/system_logs_export.yaml",
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
def log_cluster_setup_replication(self):
|
||||
return Shell.check(
|
||||
f"./ci/jobs/scripts/functional_tests/setup_log_cluster.sh --setup-logs-replication",
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
def log_cluster_stop_replication(self):
|
||||
return Shell.check(
|
||||
f"./ci/jobs/scripts/functional_tests/setup_log_cluster.sh --stop-log-replication",
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
def start(self):
|
||||
print("Starting ClickHouse server")
|
||||
Shell.check(f"rm {self.pid_file}")
|
||||
|
38
ci/jobs/scripts/clickhouse_version.py
Normal file
38
ci/jobs/scripts/clickhouse_version.py
Normal file
@ -0,0 +1,38 @@
|
||||
from pathlib import Path
|
||||
|
||||
from praktika.utils import Shell
|
||||
|
||||
|
||||
class CHVersion:
|
||||
FILE_WITH_VERSION_PATH = "./cmake/autogenerated_versions.txt"
|
||||
|
||||
@classmethod
|
||||
def _get_tweak(cls):
|
||||
tag = Shell.get_output("git describe --tags --abbrev=0")
|
||||
assert tag.startswith("v24")
|
||||
num = Shell.get_output(f"git rev-list --count {tag}..HEAD")
|
||||
return int(num)
|
||||
|
||||
@classmethod
|
||||
def get_version(cls):
|
||||
versions = {}
|
||||
for line in (
|
||||
Path(cls.FILE_WITH_VERSION_PATH).read_text(encoding="utf-8").splitlines()
|
||||
):
|
||||
line = line.strip()
|
||||
if not line.startswith("SET("):
|
||||
continue
|
||||
|
||||
name, value = line[4:-1].split(maxsplit=1)
|
||||
name = name.removeprefix("VERSION_").lower()
|
||||
try:
|
||||
value = int(value)
|
||||
except ValueError:
|
||||
pass
|
||||
versions[name] = value
|
||||
|
||||
version_sha = versions["githash"]
|
||||
tweak = int(
|
||||
Shell.get_output(f"git rev-list --count {version_sha}..HEAD", verbose=True)
|
||||
)
|
||||
return f"{versions['major']}.{versions['minor']}.{versions['patch']}.{tweak}"
|
118
ci/jobs/scripts/functional_tests/setup_ch_cluster.sh
Executable file
118
ci/jobs/scripts/functional_tests/setup_ch_cluster.sh
Executable file
@ -0,0 +1,118 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -x
|
||||
|
||||
clickhouse-client --query "SHOW DATABASES"
|
||||
clickhouse-client --query "CREATE DATABASE datasets"
|
||||
clickhouse-client < ./tests/docker_scripts/create.sql
|
||||
clickhouse-client --query "SHOW TABLES FROM datasets"
|
||||
|
||||
USE_DATABASE_REPLICATED=0
|
||||
|
||||
while [[ "$#" -gt 0 ]]; do
|
||||
case $1 in
|
||||
--database-replicated)
|
||||
echo "Setup cluster for testing with Database Replicated"
|
||||
USE_DATABASE_REPLICATED=1
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [[ "$USE_DATABASE_REPLICATED" -eq 1 ]]; then
|
||||
clickhouse-client --query "CREATE DATABASE test ON CLUSTER 'test_cluster_database_replicated'
|
||||
ENGINE=Replicated('/test/clickhouse/db/test', '{shard}', '{replica}')"
|
||||
|
||||
clickhouse-client --query "CREATE TABLE test.hits AS datasets.hits_v1"
|
||||
clickhouse-client --query "CREATE TABLE test.visits AS datasets.visits_v1"
|
||||
|
||||
clickhouse-client --max_memory_usage 10G --query "INSERT INTO test.hits SELECT * FROM datasets.hits_v1"
|
||||
clickhouse-client --max_memory_usage 10G --query "INSERT INTO test.visits SELECT * FROM datasets.visits_v1"
|
||||
|
||||
clickhouse-client --query "DROP TABLE datasets.hits_v1"
|
||||
clickhouse-client --query "DROP TABLE datasets.visits_v1"
|
||||
else
|
||||
clickhouse-client --query "CREATE DATABASE test"
|
||||
clickhouse-client --query "SHOW TABLES FROM test"
|
||||
if [[ -n "$USE_S3_STORAGE_FOR_MERGE_TREE" ]] && [[ "$USE_S3_STORAGE_FOR_MERGE_TREE" -eq 1 ]]; then
|
||||
clickhouse-client --query "CREATE TABLE test.hits (WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16,
|
||||
EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32,
|
||||
UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String,
|
||||
RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16),
|
||||
URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8,
|
||||
FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16,
|
||||
UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8,
|
||||
MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16,
|
||||
SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16,
|
||||
ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32,
|
||||
SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8,
|
||||
FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8,
|
||||
HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8,
|
||||
GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32,
|
||||
HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String,
|
||||
HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32,
|
||||
FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32,
|
||||
LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32,
|
||||
RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String,
|
||||
ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String,
|
||||
OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String,
|
||||
UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64,
|
||||
URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String,
|
||||
ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64),
|
||||
IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate)
|
||||
ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192, storage_policy='s3_cache'"
|
||||
clickhouse-client --query "CREATE TABLE test.visits (CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8,
|
||||
VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32,
|
||||
Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String,
|
||||
EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String,
|
||||
AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32),
|
||||
RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32,
|
||||
SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32,
|
||||
ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32,
|
||||
SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16,
|
||||
UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16,
|
||||
FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8,
|
||||
FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8,
|
||||
Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8,
|
||||
BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16),
|
||||
Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32),
|
||||
WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64,
|
||||
ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32,
|
||||
ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32,
|
||||
ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32,
|
||||
ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16,
|
||||
ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32,
|
||||
OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String,
|
||||
UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime,
|
||||
PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8,
|
||||
PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16),
|
||||
CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64,
|
||||
StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64,
|
||||
OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64,
|
||||
UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32,
|
||||
ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64),
|
||||
Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32,
|
||||
DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16))
|
||||
ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID)
|
||||
SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192, storage_policy='s3_cache'"
|
||||
|
||||
clickhouse-client --max_memory_usage 10G --query "INSERT INTO test.hits SELECT * FROM datasets.hits_v1 SETTINGS enable_filesystem_cache_on_write_operations=0, max_insert_threads=16"
|
||||
clickhouse-client --max_memory_usage 10G --query "INSERT INTO test.visits SELECT * FROM datasets.visits_v1 SETTINGS enable_filesystem_cache_on_write_operations=0, max_insert_threads=16"
|
||||
clickhouse-client --query "DROP TABLE datasets.visits_v1 SYNC"
|
||||
clickhouse-client --query "DROP TABLE datasets.hits_v1 SYNC"
|
||||
else
|
||||
clickhouse-client --query "RENAME TABLE datasets.hits_v1 TO test.hits"
|
||||
clickhouse-client --query "RENAME TABLE datasets.visits_v1 TO test.visits"
|
||||
fi
|
||||
clickhouse-client --query "CREATE TABLE test.hits_s3 (WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192, storage_policy='s3_cache'"
|
||||
# AWS S3 is very inefficient, so increase memory even further:
|
||||
clickhouse-client --max_memory_usage 30G --max_memory_usage_for_user 30G --query "INSERT INTO test.hits_s3 SELECT * FROM test.hits SETTINGS enable_filesystem_cache_on_write_operations=0, max_insert_threads=16"
|
||||
fi
|
||||
|
||||
clickhouse-client --query "SHOW TABLES FROM test"
|
||||
clickhouse-client --query "SELECT count() FROM test.hits"
|
||||
clickhouse-client --query "SELECT count() FROM test.visits"
|
261
ci/jobs/scripts/functional_tests/setup_log_cluster.sh
Executable file
261
ci/jobs/scripts/functional_tests/setup_log_cluster.sh
Executable file
@ -0,0 +1,261 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
# This script sets up export of system log tables to a remote server.
|
||||
# Remote tables are created if not exist, and augmented with extra columns,
|
||||
# and their names will contain a hash of the table structure,
|
||||
# which allows exporting tables from servers of different versions.
|
||||
|
||||
# Config file contains KEY=VALUE pairs with any necessary parameters like:
|
||||
# CLICKHOUSE_CI_LOGS_HOST - remote host
|
||||
# CLICKHOUSE_CI_LOGS_USER - password for user
|
||||
# CLICKHOUSE_CI_LOGS_PASSWORD - password for user
|
||||
CLICKHOUSE_CI_LOGS_CREDENTIALS=${CLICKHOUSE_CI_LOGS_CREDENTIALS:-/tmp/export-logs-config.sh}
|
||||
CLICKHOUSE_CI_LOGS_USER=${CLICKHOUSE_CI_LOGS_USER:-ci}
|
||||
|
||||
# Pre-configured destination cluster, where to export the data
|
||||
CLICKHOUSE_CI_LOGS_CLUSTER=${CLICKHOUSE_CI_LOGS_CLUSTER:-system_logs_export}
|
||||
|
||||
EXTRA_COLUMNS=${EXTRA_COLUMNS:-"pull_request_number UInt32, commit_sha String, check_start_time DateTime('UTC'), check_name LowCardinality(String), instance_type LowCardinality(String), instance_id String, INDEX ix_pr (pull_request_number) TYPE set(100), INDEX ix_commit (commit_sha) TYPE set(100), INDEX ix_check_time (check_start_time) TYPE minmax, "}
|
||||
EXTRA_COLUMNS_EXPRESSION=${EXTRA_COLUMNS_EXPRESSION:-"CAST(0 AS UInt32) AS pull_request_number, '' AS commit_sha, now() AS check_start_time, toLowCardinality('') AS check_name, toLowCardinality('') AS instance_type, '' AS instance_id"}
|
||||
EXTRA_ORDER_BY_COLUMNS=${EXTRA_ORDER_BY_COLUMNS:-"check_name"}
|
||||
|
||||
# trace_log needs more columns for symbolization
|
||||
EXTRA_COLUMNS_TRACE_LOG="${EXTRA_COLUMNS} symbols Array(LowCardinality(String)), lines Array(LowCardinality(String)), "
|
||||
EXTRA_COLUMNS_EXPRESSION_TRACE_LOG="${EXTRA_COLUMNS_EXPRESSION}, arrayMap(x -> demangle(addressToSymbol(x)), trace)::Array(LowCardinality(String)) AS symbols, arrayMap(x -> addressToLine(x), trace)::Array(LowCardinality(String)) AS lines"
|
||||
|
||||
# coverage_log needs more columns for symbolization, but only symbol names (the line numbers are too heavy to calculate)
|
||||
EXTRA_COLUMNS_COVERAGE_LOG="${EXTRA_COLUMNS} symbols Array(LowCardinality(String)), "
|
||||
EXTRA_COLUMNS_EXPRESSION_COVERAGE_LOG="${EXTRA_COLUMNS_EXPRESSION}, arrayDistinct(arrayMap(x -> demangle(addressToSymbol(x)), coverage))::Array(LowCardinality(String)) AS symbols"
|
||||
|
||||
|
||||
function __set_connection_args
|
||||
{
|
||||
# It's impossible to use a generic $CONNECTION_ARGS string, it's unsafe from word splitting perspective.
|
||||
# That's why we must stick to the generated option
|
||||
CONNECTION_ARGS=(
|
||||
--receive_timeout=45 --send_timeout=45 --secure
|
||||
--user "${CLICKHOUSE_CI_LOGS_USER}" --host "${CLICKHOUSE_CI_LOGS_HOST}"
|
||||
--password "${CLICKHOUSE_CI_LOGS_PASSWORD}"
|
||||
)
|
||||
}
|
||||
|
||||
function __shadow_credentials
|
||||
{
|
||||
# The function completely screws the output, it shouldn't be used in normal functions, only in ()
|
||||
# The only way to substitute the env as a plain text is using perl 's/\Qsomething\E/another/
|
||||
exec &> >(perl -pe '
|
||||
s(\Q$ENV{CLICKHOUSE_CI_LOGS_HOST}\E)[CLICKHOUSE_CI_LOGS_HOST]g;
|
||||
s(\Q$ENV{CLICKHOUSE_CI_LOGS_USER}\E)[CLICKHOUSE_CI_LOGS_USER]g;
|
||||
s(\Q$ENV{CLICKHOUSE_CI_LOGS_PASSWORD}\E)[CLICKHOUSE_CI_LOGS_PASSWORD]g;
|
||||
')
|
||||
}
|
||||
|
||||
function check_logs_credentials
|
||||
(
|
||||
# The function connects with given credentials, and if it's unable to execute the simplest query, returns exit code
|
||||
|
||||
# First check, if all necessary parameters are set
|
||||
set +x
|
||||
for parameter in CLICKHOUSE_CI_LOGS_HOST CLICKHOUSE_CI_LOGS_USER CLICKHOUSE_CI_LOGS_PASSWORD; do
|
||||
export -p | grep -q "$parameter" || {
|
||||
echo "Credentials parameter $parameter is unset"
|
||||
return 1
|
||||
}
|
||||
done
|
||||
|
||||
__shadow_credentials
|
||||
__set_connection_args
|
||||
local code
|
||||
# Catch both success and error to not fail on `set -e`
|
||||
clickhouse-client "${CONNECTION_ARGS[@]}" -q 'SELECT 1 FORMAT Null' && return 0 || code=$?
|
||||
if [ "$code" != 0 ]; then
|
||||
echo 'Failed to connect to CI Logs cluster'
|
||||
return $code
|
||||
fi
|
||||
)
|
||||
|
||||
function config_logs_export_cluster
|
||||
(
|
||||
# The function is launched in a separate shell instance to not expose the
|
||||
# exported values from CLICKHOUSE_CI_LOGS_CREDENTIALS
|
||||
set +x
|
||||
if ! [ -r "${CLICKHOUSE_CI_LOGS_CREDENTIALS}" ]; then
|
||||
echo "File $CLICKHOUSE_CI_LOGS_CREDENTIALS does not exist, do not setup"
|
||||
return
|
||||
fi
|
||||
set -a
|
||||
# shellcheck disable=SC1090
|
||||
source "${CLICKHOUSE_CI_LOGS_CREDENTIALS}"
|
||||
set +a
|
||||
__shadow_credentials
|
||||
echo "Checking if the credentials work"
|
||||
check_logs_credentials || return 0
|
||||
cluster_config="${1:-/etc/clickhouse-server/config.d/system_logs_export.yaml}"
|
||||
mkdir -p "$(dirname "$cluster_config")"
|
||||
echo "remote_servers:
|
||||
${CLICKHOUSE_CI_LOGS_CLUSTER}:
|
||||
shard:
|
||||
replica:
|
||||
secure: 1
|
||||
user: '${CLICKHOUSE_CI_LOGS_USER}'
|
||||
host: '${CLICKHOUSE_CI_LOGS_HOST}'
|
||||
port: 9440
|
||||
password: '${CLICKHOUSE_CI_LOGS_PASSWORD}'
|
||||
" > "$cluster_config"
|
||||
echo "Cluster ${CLICKHOUSE_CI_LOGS_CLUSTER} is confugured in ${cluster_config}"
|
||||
)
|
||||
|
||||
function setup_logs_replication
|
||||
(
|
||||
# The function is launched in a separate shell instance to not expose the
|
||||
# exported values from CLICKHOUSE_CI_LOGS_CREDENTIALS
|
||||
set +x
|
||||
# disable output
|
||||
if ! [ -r "${CLICKHOUSE_CI_LOGS_CREDENTIALS}" ]; then
|
||||
echo "File $CLICKHOUSE_CI_LOGS_CREDENTIALS does not exist, do not setup"
|
||||
return 0
|
||||
fi
|
||||
set -a
|
||||
# shellcheck disable=SC1090
|
||||
source "${CLICKHOUSE_CI_LOGS_CREDENTIALS}"
|
||||
set +a
|
||||
__shadow_credentials
|
||||
echo "Checking if the credentials work"
|
||||
check_logs_credentials || return 0
|
||||
__set_connection_args
|
||||
|
||||
echo "My hostname is ${HOSTNAME}"
|
||||
|
||||
echo 'Create all configured system logs'
|
||||
clickhouse-client --query "SYSTEM FLUSH LOGS"
|
||||
|
||||
debug_or_sanitizer_build=$(clickhouse-client -q "WITH ((SELECT value FROM system.build_options WHERE name='BUILD_TYPE') AS build, (SELECT value FROM system.build_options WHERE name='CXX_FLAGS') as flags) SELECT build='Debug' OR flags LIKE '%fsanitize%'")
|
||||
echo "Build is debug or sanitizer: $debug_or_sanitizer_build"
|
||||
|
||||
# We will pre-create a table system.coverage_log.
|
||||
# It is normally created by clickhouse-test rather than the server,
|
||||
# so we will create it in advance to make it be picked up by the next commands:
|
||||
|
||||
clickhouse-client --query "
|
||||
CREATE TABLE IF NOT EXISTS system.coverage_log
|
||||
(
|
||||
time DateTime COMMENT 'The time of test run',
|
||||
test_name String COMMENT 'The name of the test',
|
||||
coverage Array(UInt64) COMMENT 'An array of addresses of the code (a subset of addresses instrumented for coverage) that were encountered during the test run'
|
||||
) ENGINE = MergeTree ORDER BY test_name COMMENT 'Contains information about per-test coverage from the CI, but used only for exporting to the CI cluster'
|
||||
"
|
||||
|
||||
# For each system log table:
|
||||
echo 'Create %_log tables'
|
||||
clickhouse-client --query "SHOW TABLES FROM system LIKE '%\\_log'" | while read -r table
|
||||
do
|
||||
if [[ "$table" = "trace_log" ]]
|
||||
then
|
||||
EXTRA_COLUMNS_FOR_TABLE="${EXTRA_COLUMNS_TRACE_LOG}"
|
||||
# Do not try to resolve stack traces in case of debug/sanitizers
|
||||
# build, since it is too slow (flushing of trace_log can take ~1min
|
||||
# with such MV attached)
|
||||
if [[ "$debug_or_sanitizer_build" = 1 ]]
|
||||
then
|
||||
EXTRA_COLUMNS_EXPRESSION_FOR_TABLE="${EXTRA_COLUMNS_EXPRESSION}"
|
||||
else
|
||||
EXTRA_COLUMNS_EXPRESSION_FOR_TABLE="${EXTRA_COLUMNS_EXPRESSION_TRACE_LOG}"
|
||||
fi
|
||||
elif [[ "$table" = "coverage_log" ]]
|
||||
then
|
||||
EXTRA_COLUMNS_FOR_TABLE="${EXTRA_COLUMNS_COVERAGE_LOG}"
|
||||
EXTRA_COLUMNS_EXPRESSION_FOR_TABLE="${EXTRA_COLUMNS_EXPRESSION_COVERAGE_LOG}"
|
||||
else
|
||||
EXTRA_COLUMNS_FOR_TABLE="${EXTRA_COLUMNS}"
|
||||
EXTRA_COLUMNS_EXPRESSION_FOR_TABLE="${EXTRA_COLUMNS_EXPRESSION}"
|
||||
fi
|
||||
|
||||
# Calculate hash of its structure. Note: 4 is the version of extra columns - increment it if extra columns are changed:
|
||||
hash=$(clickhouse-client --query "
|
||||
SELECT sipHash64(9, groupArray((name, type)))
|
||||
FROM (SELECT name, type FROM system.columns
|
||||
WHERE database = 'system' AND table = '$table'
|
||||
ORDER BY position)
|
||||
")
|
||||
|
||||
# Create the destination table with adapted name and structure:
|
||||
statement=$(clickhouse-client --format TSVRaw --query "SHOW CREATE TABLE system.${table}" | sed -r -e '
|
||||
s/^\($/('"$EXTRA_COLUMNS_FOR_TABLE"'/;
|
||||
s/^ORDER BY (([^\(].+?)|\((.+?)\))$/ORDER BY ('"$EXTRA_ORDER_BY_COLUMNS"', \2\3)/;
|
||||
s/^CREATE TABLE system\.\w+_log$/CREATE TABLE IF NOT EXISTS '"$table"'_'"$hash"'/;
|
||||
/^TTL /d
|
||||
')
|
||||
|
||||
echo -e "Creating remote destination table ${table}_${hash} with statement:" >&2
|
||||
|
||||
echo "::group::${table}"
|
||||
# there's the only way big "$statement" can be printed without causing EAGAIN error
|
||||
# cat: write error: Resource temporarily unavailable
|
||||
statement_print="${statement}"
|
||||
if [ "${#statement_print}" -gt 4000 ]; then
|
||||
statement_print="${statement::1999}\n…\n${statement:${#statement}-1999}"
|
||||
fi
|
||||
echo -e "$statement_print"
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "$statement" | clickhouse-client --database_replicated_initial_query_timeout_sec=10 \
|
||||
--distributed_ddl_task_timeout=30 --distributed_ddl_output_mode=throw_only_active \
|
||||
"${CONNECTION_ARGS[@]}" || continue
|
||||
|
||||
echo "Creating table system.${table}_sender" >&2
|
||||
|
||||
# Create Distributed table and materialized view to watch on the original table:
|
||||
clickhouse-client --query "
|
||||
CREATE TABLE system.${table}_sender
|
||||
ENGINE = Distributed(${CLICKHOUSE_CI_LOGS_CLUSTER}, default, ${table}_${hash})
|
||||
SETTINGS flush_on_detach=0
|
||||
EMPTY AS
|
||||
SELECT ${EXTRA_COLUMNS_EXPRESSION_FOR_TABLE}, *
|
||||
FROM system.${table}
|
||||
" || continue
|
||||
|
||||
echo "Creating materialized view system.${table}_watcher" >&2
|
||||
|
||||
clickhouse-client --query "
|
||||
CREATE MATERIALIZED VIEW system.${table}_watcher TO system.${table}_sender AS
|
||||
SELECT ${EXTRA_COLUMNS_EXPRESSION_FOR_TABLE}, *
|
||||
FROM system.${table}
|
||||
" || continue
|
||||
done
|
||||
)
|
||||
|
||||
function stop_logs_replication
|
||||
{
|
||||
echo "Detach all logs replication"
|
||||
clickhouse-client --query "select database||'.'||table from system.tables where database = 'system' and (table like '%_sender' or table like '%_watcher')" | {
|
||||
tee /dev/stderr
|
||||
} | {
|
||||
timeout --preserve-status --signal TERM --kill-after 5m 15m xargs -n1 -r -i clickhouse-client --query "drop table {}"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while [[ "$#" -gt 0 ]]; do
|
||||
case $1 in
|
||||
--stop-log-replication)
|
||||
echo "Stopping log replication..."
|
||||
stop_logs_replication
|
||||
;;
|
||||
--setup-logs-replication)
|
||||
echo "Setting up log replication..."
|
||||
setup_logs_replication
|
||||
;;
|
||||
--config-logs-export-cluster)
|
||||
echo "Configuring logs export for the cluster..."
|
||||
config_logs_export_cluster "$2"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
echo "Usage: $0 [--stop-log-replication | --setup-logs-replication | --config-logs-export-cluster ]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
@ -179,7 +179,7 @@ class _Environment(MetaClasses.Serializable):
|
||||
if bucket in path:
|
||||
path = path.replace(bucket, endpoint)
|
||||
break
|
||||
REPORT_URL = f"https://{path}/{Path(settings.HTML_PAGE_FILE).name}?PR={self.PR_NUMBER}&sha={'latest' if latest else self.SHA}&name_0={urllib.parse.quote(self.WORKFLOW_NAME, safe='')}&name_1={urllib.parse.quote(self.JOB_NAME, safe='')}"
|
||||
REPORT_URL = f"https://{path}/{Path(settings.HTML_PAGE_FILE).name}?PR={self.PR_NUMBER}&sha={'latest' if latest else self.SHA}&name_0={urllib.parse.quote(self.WORKFLOW_NAME, safe='')}"
|
||||
return REPORT_URL
|
||||
|
||||
def is_local_run(self):
|
||||
|
@ -1,3 +1,4 @@
|
||||
import copy
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@ -24,6 +25,14 @@ class Artifact:
|
||||
def is_s3_artifact(self):
|
||||
return self.type == Artifact.Type.S3
|
||||
|
||||
def parametrize(self, names):
|
||||
res = []
|
||||
for name in names:
|
||||
obj = copy.deepcopy(self)
|
||||
obj.name = name
|
||||
res.append(obj)
|
||||
return res
|
||||
|
||||
@classmethod
|
||||
def define_artifact(cls, name, type, path):
|
||||
return cls.Config(name=name, type=type, path=path)
|
||||
|
@ -128,6 +128,9 @@ class HtmlRunnerHooks:
|
||||
for job in _workflow.jobs:
|
||||
if job.name not in skip_jobs:
|
||||
result = Result.generate_pending(job.name)
|
||||
# Preemptively add the general job log to the result directory to ensure
|
||||
# the post-job handler can upload it, even if the job is terminated unexpectedly
|
||||
result.set_files([Settings.RUN_LOG])
|
||||
else:
|
||||
result = Result.generate_skipped(job.name, job_cache_records[job.name])
|
||||
results.append(result)
|
||||
@ -137,14 +140,14 @@ class HtmlRunnerHooks:
|
||||
summary_result.start_time = Utils.timestamp()
|
||||
|
||||
assert _ResultS3.copy_result_to_s3_with_version(summary_result, version=0)
|
||||
page_url = env.get_report_url(settings=Settings)
|
||||
page_url = env.get_report_url(settings=Settings, latest=True)
|
||||
print(f"CI Status page url [{page_url}]")
|
||||
|
||||
res1 = GH.post_commit_status(
|
||||
name=_workflow.name,
|
||||
status=Result.Status.PENDING,
|
||||
description="",
|
||||
url=env.get_report_url(settings=Settings, latest=True),
|
||||
url=page_url,
|
||||
)
|
||||
res2 = GH.post_pr_comment(
|
||||
comment_body=f"Workflow [[{_workflow.name}]({page_url})], commit [{_Environment.get().SHA[:8]}]",
|
||||
|
@ -601,7 +601,7 @@
|
||||
td.classList.add('time-column');
|
||||
td.textContent = value ? formatDuration(value) : '';
|
||||
} else if (column === 'info') {
|
||||
td.textContent = value.includes('\n') ? '↵' : (value || '');
|
||||
td.textContent = value && value.includes('\n') ? '↵' : (value || '');
|
||||
td.classList.add('info-column');
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ def _finish_workflow(workflow, job_name):
|
||||
print(env.get_needs_statuses())
|
||||
|
||||
print("Check Workflow results")
|
||||
_ResultS3.copy_result_from_s3(
|
||||
version = _ResultS3.copy_result_from_s3_with_version(
|
||||
Result.file_name_static(workflow.name),
|
||||
)
|
||||
workflow_result = Result.from_fs(workflow.name)
|
||||
@ -333,7 +333,7 @@ def _finish_workflow(workflow, job_name):
|
||||
# dump workflow result after update - to have an updated result in post
|
||||
workflow_result.dump()
|
||||
# add error into env - should apper in the report
|
||||
env.add_info(ResultInfo.NOT_FINALIZED + f" [{result.name}]")
|
||||
env.add_info(f"{result.name}: {ResultInfo.NOT_FINALIZED}")
|
||||
update_final_report = True
|
||||
job = workflow.get_job(result.name)
|
||||
if not job or not job.allow_merge_on_failure:
|
||||
@ -358,9 +358,7 @@ def _finish_workflow(workflow, job_name):
|
||||
env.add_info(ResultInfo.GH_STATUS_ERROR)
|
||||
|
||||
if update_final_report:
|
||||
_ResultS3.copy_result_to_s3(
|
||||
workflow_result,
|
||||
)
|
||||
_ResultS3.copy_result_to_s3_with_version(workflow_result, version + 1)
|
||||
|
||||
Result.from_fs(job_name).set_status(Result.Status.SUCCESS)
|
||||
|
||||
|
@ -121,6 +121,9 @@ class Result(MetaClasses.Serializable):
|
||||
def set_success(self) -> "Result":
|
||||
return self.set_status(Result.Status.SUCCESS)
|
||||
|
||||
def set_failed(self) -> "Result":
|
||||
return self.set_status(Result.Status.FAILED)
|
||||
|
||||
def set_results(self, results: List["Result"]) -> "Result":
|
||||
self.results = results
|
||||
self.dump()
|
||||
|
@ -1,3 +1,5 @@
|
||||
import glob
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
@ -58,6 +60,9 @@ class Runner:
|
||||
workflow_config.digest_dockers[docker.name] = Digest().calc_docker_digest(
|
||||
docker, workflow.dockers
|
||||
)
|
||||
|
||||
# work around for old clickhouse jobs
|
||||
os.environ["DOCKER_TAG"] = json.dumps(workflow_config.digest_dockers)
|
||||
workflow_config.dump()
|
||||
|
||||
Result.generate_pending(job.name).dump()
|
||||
@ -119,8 +124,21 @@ class Runner:
|
||||
else:
|
||||
prefixes = [env.get_s3_prefix()] * len(required_artifacts)
|
||||
for artifact, prefix in zip(required_artifacts, prefixes):
|
||||
recursive = False
|
||||
include_pattern = ""
|
||||
if "*" in artifact.path:
|
||||
s3_path = f"{Settings.S3_ARTIFACT_PATH}/{prefix}/{Utils.normalize_string(artifact._provided_by)}/"
|
||||
recursive = True
|
||||
include_pattern = Path(artifact.path).name
|
||||
assert "*" in include_pattern
|
||||
else:
|
||||
s3_path = f"{Settings.S3_ARTIFACT_PATH}/{prefix}/{Utils.normalize_string(artifact._provided_by)}/{Path(artifact.path).name}"
|
||||
assert S3.copy_file_from_s3(s3_path=s3_path, local_path=Settings.INPUT_DIR)
|
||||
assert S3.copy_file_from_s3(
|
||||
s3_path=s3_path,
|
||||
local_path=Settings.INPUT_DIR,
|
||||
recursive=recursive,
|
||||
include_pattern=include_pattern,
|
||||
)
|
||||
|
||||
return 0
|
||||
|
||||
@ -239,9 +257,11 @@ class Runner:
|
||||
info = f"ERROR: {ResultInfo.KILLED}"
|
||||
print(info)
|
||||
result.set_info(info).set_status(Result.Status.ERROR).dump()
|
||||
else:
|
||||
# TODO: add setting with different ways of storing general praktika log: always, on error, never.
|
||||
# now let's store it on error only
|
||||
result.files = [file for file in result.files if file != Settings.RUN_LOG]
|
||||
|
||||
if not result.is_ok():
|
||||
result.set_files(files=[Settings.RUN_LOG])
|
||||
result.update_duration().dump()
|
||||
|
||||
if run_exit_code == 0:
|
||||
@ -262,8 +282,9 @@ class Runner:
|
||||
f"ls -l {artifact.path}", verbose=True
|
||||
), f"Artifact {artifact.path} not found"
|
||||
s3_path = f"{Settings.S3_ARTIFACT_PATH}/{env.get_s3_prefix()}/{Utils.normalize_string(env.JOB_NAME)}"
|
||||
for file_path in glob.glob(artifact.path):
|
||||
link = S3.copy_file_to_s3(
|
||||
s3_path=s3_path, local_path=artifact.path
|
||||
s3_path=s3_path, local_path=file_path
|
||||
)
|
||||
result.set_link(link)
|
||||
except Exception as e:
|
||||
|
@ -2,6 +2,7 @@ import dataclasses
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
from urllib.parse import quote
|
||||
|
||||
from praktika._environment import _Environment
|
||||
from praktika.settings import Settings
|
||||
@ -55,7 +56,7 @@ class S3:
|
||||
bucket = s3_path.split("/")[0]
|
||||
endpoint = Settings.S3_BUCKET_TO_HTTP_ENDPOINT[bucket]
|
||||
assert endpoint
|
||||
return f"https://{s3_full_path}".replace(bucket, endpoint)
|
||||
return quote(f"https://{s3_full_path}".replace(bucket, endpoint), safe=":/?&=")
|
||||
|
||||
@classmethod
|
||||
def put(cls, s3_path, local_path, text=False, metadata=None, if_none_matched=False):
|
||||
@ -117,15 +118,21 @@ class S3:
|
||||
return res
|
||||
|
||||
@classmethod
|
||||
def copy_file_from_s3(cls, s3_path, local_path):
|
||||
def copy_file_from_s3(
|
||||
cls, s3_path, local_path, recursive=False, include_pattern=""
|
||||
):
|
||||
assert Path(s3_path), f"Invalid S3 Path [{s3_path}]"
|
||||
if Path(local_path).is_dir():
|
||||
local_path = Path(local_path) / Path(s3_path).name
|
||||
pass
|
||||
else:
|
||||
assert Path(
|
||||
local_path
|
||||
).parent.is_dir(), f"Parent path for [{local_path}] does not exist"
|
||||
cmd = f"aws s3 cp s3://{s3_path} {local_path}"
|
||||
if recursive:
|
||||
cmd += " --recursive"
|
||||
if include_pattern:
|
||||
cmd += f" --include {include_pattern}"
|
||||
res = cls.run_command_with_retries(cmd)
|
||||
return res
|
||||
|
||||
|
@ -242,3 +242,4 @@ class JobNames:
|
||||
BUILD = "Build"
|
||||
STATELESS = "Stateless tests"
|
||||
STATEFUL = "Stateful tests"
|
||||
STRESS = "Stress tests"
|
||||
|
@ -16,6 +16,16 @@ class ArtifactNames:
|
||||
CH_ARM_RELEASE = "CH_ARM_RELEASE"
|
||||
CH_ARM_ASAN = "CH_ARM_ASAN"
|
||||
|
||||
CH_ODBC_B_AMD_DEBUG = "CH_ODBC_B_AMD_DEBUG"
|
||||
CH_ODBC_B_AMD_RELEASE = "CH_ODBC_B_AMD_RELEASE"
|
||||
CH_ODBC_B_ARM_RELEASE = "CH_ODBC_B_ARM_RELEASE"
|
||||
CH_ODBC_B_ARM_ASAN = "CH_ODBC_B_ARM_ASAN"
|
||||
|
||||
DEB_AMD_DEBUG = "DEB_AMD_DEBUG"
|
||||
DEB_AMD_RELEASE = "DEB_AMD_RELEASE"
|
||||
DEB_ARM_RELEASE = "DEB_ARM_RELEASE"
|
||||
DEB_ARM_ASAN = "DEB_ARM_ASAN"
|
||||
|
||||
|
||||
style_check_job = Job.Config(
|
||||
name=JobNames.STYLE_CHECK,
|
||||
@ -41,7 +51,7 @@ fast_test_job = Job.Config(
|
||||
build_jobs = Job.Config(
|
||||
name=JobNames.BUILD,
|
||||
runs_on=["...from params..."],
|
||||
requires=[JobNames.FAST_TEST],
|
||||
requires=[],
|
||||
command="python3 ./ci/jobs/build_clickhouse.py --build-type {PARAMETER}",
|
||||
run_in_docker="clickhouse/fasttest",
|
||||
timeout=3600 * 2,
|
||||
@ -63,10 +73,26 @@ build_jobs = Job.Config(
|
||||
).parametrize(
|
||||
parameter=["amd_debug", "amd_release", "arm_release", "arm_asan"],
|
||||
provides=[
|
||||
[ArtifactNames.CH_AMD_DEBUG],
|
||||
[ArtifactNames.CH_AMD_RELEASE],
|
||||
[ArtifactNames.CH_ARM_RELEASE],
|
||||
[ArtifactNames.CH_ARM_ASAN],
|
||||
[
|
||||
ArtifactNames.CH_AMD_DEBUG,
|
||||
ArtifactNames.DEB_AMD_DEBUG,
|
||||
ArtifactNames.CH_ODBC_B_AMD_DEBUG,
|
||||
],
|
||||
[
|
||||
ArtifactNames.CH_AMD_RELEASE,
|
||||
ArtifactNames.DEB_AMD_RELEASE,
|
||||
ArtifactNames.CH_ODBC_B_AMD_RELEASE,
|
||||
],
|
||||
[
|
||||
ArtifactNames.CH_ARM_RELEASE,
|
||||
ArtifactNames.DEB_ARM_RELEASE,
|
||||
ArtifactNames.CH_ODBC_B_ARM_RELEASE,
|
||||
],
|
||||
[
|
||||
ArtifactNames.CH_ARM_ASAN,
|
||||
ArtifactNames.DEB_ARM_ASAN,
|
||||
ArtifactNames.CH_ODBC_B_ARM_ASAN,
|
||||
],
|
||||
],
|
||||
runs_on=[
|
||||
[RunnerLabels.BUILDER_AMD],
|
||||
@ -105,12 +131,12 @@ stateless_tests_jobs = Job.Config(
|
||||
[RunnerLabels.FUNC_TESTER_ARM],
|
||||
],
|
||||
requires=[
|
||||
[ArtifactNames.CH_AMD_DEBUG],
|
||||
[ArtifactNames.CH_AMD_DEBUG],
|
||||
[ArtifactNames.CH_AMD_RELEASE],
|
||||
[ArtifactNames.CH_AMD_RELEASE],
|
||||
[ArtifactNames.CH_ARM_ASAN],
|
||||
[ArtifactNames.CH_ARM_ASAN],
|
||||
[ArtifactNames.CH_AMD_DEBUG, ArtifactNames.CH_ODBC_B_AMD_DEBUG],
|
||||
[ArtifactNames.CH_AMD_DEBUG, ArtifactNames.CH_ODBC_B_AMD_DEBUG],
|
||||
[ArtifactNames.CH_AMD_RELEASE, ArtifactNames.CH_ODBC_B_AMD_RELEASE],
|
||||
[ArtifactNames.CH_AMD_RELEASE, ArtifactNames.CH_ODBC_B_AMD_RELEASE],
|
||||
[ArtifactNames.CH_ARM_ASAN, ArtifactNames.CH_ODBC_B_ARM_ASAN],
|
||||
[ArtifactNames.CH_ARM_ASAN, ArtifactNames.CH_ODBC_B_ARM_ASAN],
|
||||
],
|
||||
)
|
||||
|
||||
@ -128,7 +154,7 @@ stateful_tests_jobs = Job.Config(
|
||||
),
|
||||
).parametrize(
|
||||
parameter=[
|
||||
"amd_debug,parallel",
|
||||
"amd_release,parallel",
|
||||
],
|
||||
runs_on=[
|
||||
[RunnerLabels.BUILDER_AMD],
|
||||
@ -138,6 +164,29 @@ stateful_tests_jobs = Job.Config(
|
||||
],
|
||||
)
|
||||
|
||||
# TODO: refactor job to be aligned with praktika style (remove wrappers, run in docker)
|
||||
stress_test_jobs = Job.Config(
|
||||
name=JobNames.STRESS,
|
||||
runs_on=[RunnerLabels.BUILDER_ARM],
|
||||
command="python3 ./tests/ci/stress_check.py {PARAMETER}",
|
||||
digest_config=Job.CacheDigestConfig(
|
||||
include_paths=[
|
||||
"./ci/jobs/functional_stateful_tests.py",
|
||||
],
|
||||
),
|
||||
).parametrize(
|
||||
parameter=[
|
||||
"arm_release",
|
||||
],
|
||||
runs_on=[
|
||||
[RunnerLabels.FUNC_TESTER_ARM],
|
||||
],
|
||||
requires=[
|
||||
[ArtifactNames.DEB_ARM_RELEASE],
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
workflow = Workflow.Config(
|
||||
name="PR",
|
||||
event=Workflow.Event.PULL_REQUEST,
|
||||
@ -148,27 +197,52 @@ workflow = Workflow.Config(
|
||||
*build_jobs,
|
||||
*stateless_tests_jobs,
|
||||
*stateful_tests_jobs,
|
||||
*stress_test_jobs,
|
||||
],
|
||||
artifacts=[
|
||||
Artifact.Config(
|
||||
name=ArtifactNames.CH_AMD_DEBUG,
|
||||
*Artifact.Config(
|
||||
name="...",
|
||||
type=Artifact.Type.S3,
|
||||
path=f"{Settings.TEMP_DIR}/build/programs/clickhouse",
|
||||
).parametrize(
|
||||
names=[
|
||||
ArtifactNames.CH_AMD_DEBUG,
|
||||
ArtifactNames.CH_AMD_RELEASE,
|
||||
ArtifactNames.CH_ARM_RELEASE,
|
||||
ArtifactNames.CH_ARM_ASAN,
|
||||
]
|
||||
),
|
||||
*Artifact.Config(
|
||||
name="...",
|
||||
type=Artifact.Type.S3,
|
||||
path=f"{Settings.TEMP_DIR}/build/programs/clickhouse-odbc-bridge",
|
||||
).parametrize(
|
||||
names=[
|
||||
ArtifactNames.CH_ODBC_B_AMD_DEBUG,
|
||||
ArtifactNames.CH_ODBC_B_AMD_RELEASE,
|
||||
ArtifactNames.CH_ODBC_B_ARM_RELEASE,
|
||||
ArtifactNames.CH_ODBC_B_ARM_ASAN,
|
||||
]
|
||||
),
|
||||
Artifact.Config(
|
||||
name=ArtifactNames.CH_AMD_RELEASE,
|
||||
name=ArtifactNames.DEB_AMD_DEBUG,
|
||||
type=Artifact.Type.S3,
|
||||
path=f"{Settings.TEMP_DIR}/build/programs/clickhouse",
|
||||
path=f"{Settings.TEMP_DIR}/output/*.deb",
|
||||
),
|
||||
Artifact.Config(
|
||||
name=ArtifactNames.CH_ARM_RELEASE,
|
||||
name=ArtifactNames.DEB_AMD_RELEASE,
|
||||
type=Artifact.Type.S3,
|
||||
path=f"{Settings.TEMP_DIR}/build/programs/clickhouse",
|
||||
path=f"{Settings.TEMP_DIR}/output/*.deb",
|
||||
),
|
||||
Artifact.Config(
|
||||
name=ArtifactNames.CH_ARM_ASAN,
|
||||
name=ArtifactNames.DEB_ARM_RELEASE,
|
||||
type=Artifact.Type.S3,
|
||||
path=f"{Settings.TEMP_DIR}/build/programs/clickhouse",
|
||||
path=f"{Settings.TEMP_DIR}/output/*.deb",
|
||||
),
|
||||
Artifact.Config(
|
||||
name=ArtifactNames.DEB_ARM_ASAN,
|
||||
type=Artifact.Type.S3,
|
||||
path=f"{Settings.TEMP_DIR}/output/*.deb",
|
||||
),
|
||||
],
|
||||
dockers=DOCKERS,
|
||||
|
@ -5,14 +5,14 @@ if (ENABLE_CLANG_TIDY)
|
||||
|
||||
find_program (CLANG_TIDY_CACHE_PATH NAMES "clang-tidy-cache")
|
||||
if (CLANG_TIDY_CACHE_PATH)
|
||||
find_program (_CLANG_TIDY_PATH NAMES "clang-tidy-18" "clang-tidy-17" "clang-tidy-16" "clang-tidy")
|
||||
find_program (_CLANG_TIDY_PATH NAMES "clang-tidy-19" "clang-tidy-18" "clang-tidy-17" "clang-tidy")
|
||||
|
||||
# Why do we use ';' here?
|
||||
# It's a cmake black magic: https://cmake.org/cmake/help/latest/prop_tgt/LANG_CLANG_TIDY.html#prop_tgt:%3CLANG%3E_CLANG_TIDY
|
||||
# The CLANG_TIDY_PATH is passed to CMAKE_CXX_CLANG_TIDY, which follows CXX_CLANG_TIDY syntax.
|
||||
set (CLANG_TIDY_PATH "${CLANG_TIDY_CACHE_PATH};${_CLANG_TIDY_PATH}" CACHE STRING "A combined command to run clang-tidy with caching wrapper")
|
||||
else ()
|
||||
find_program (CLANG_TIDY_PATH NAMES "clang-tidy-18" "clang-tidy-17" "clang-tidy-16" "clang-tidy")
|
||||
find_program (CLANG_TIDY_PATH NAMES "clang-tidy-19" "clang-tidy-18" "clang-tidy-17" "clang-tidy")
|
||||
endif ()
|
||||
|
||||
if (CLANG_TIDY_PATH)
|
||||
|
@ -17,9 +17,4 @@ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --gcc-toolchain=${TOOLCHAIN_PATH}")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --gcc-toolchain=${TOOLCHAIN_PATH}")
|
||||
set (CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} --gcc-toolchain=${TOOLCHAIN_PATH}")
|
||||
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=bfd")
|
||||
|
||||
# Currently, lld does not work with the error:
|
||||
# ld.lld: error: section size decrease is too large
|
||||
# But GNU BinUtils work.
|
||||
set (LINKER_NAME "riscv64-linux-gnu-ld.bfd" CACHE STRING "Linker name" FORCE)
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld")
|
||||
|
@ -3,10 +3,10 @@ compilers and build settings. Correctly configured Docker daemon is single depen
|
||||
|
||||
Usage:
|
||||
|
||||
Build deb package with `clang-18` in `debug` mode:
|
||||
Build deb package with `clang-19` in `debug` mode:
|
||||
```
|
||||
$ mkdir deb/test_output
|
||||
$ ./packager --output-dir deb/test_output/ --package-type deb --compiler=clang-18 --debug-build
|
||||
$ ./packager --output-dir deb/test_output/ --package-type deb --compiler=clang-19 --debug-build
|
||||
$ ls -l deb/test_output
|
||||
-rw-r--r-- 1 root root 3730 clickhouse-client_22.2.2+debug_all.deb
|
||||
-rw-r--r-- 1 root root 84221888 clickhouse-common-static_22.2.2+debug_amd64.deb
|
||||
@ -17,11 +17,11 @@ $ ls -l deb/test_output
|
||||
|
||||
```
|
||||
|
||||
Build ClickHouse binary with `clang-18` and `address` sanitizer in `relwithdebuginfo`
|
||||
Build ClickHouse binary with `clang-19` and `address` sanitizer in `relwithdebuginfo`
|
||||
mode:
|
||||
```
|
||||
$ mkdir $HOME/some_clickhouse
|
||||
$ ./packager --output-dir=$HOME/some_clickhouse --package-type binary --compiler=clang-18 --sanitizer=address
|
||||
$ ./packager --output-dir=$HOME/some_clickhouse --package-type binary --compiler=clang-19 --sanitizer=address
|
||||
$ ls -l $HOME/some_clickhouse
|
||||
-rwxr-xr-x 1 root root 787061952 clickhouse
|
||||
lrwxrwxrwx 1 root root 10 clickhouse-benchmark -> clickhouse
|
||||
|
@ -407,20 +407,20 @@ def parse_args() -> argparse.Namespace:
|
||||
parser.add_argument(
|
||||
"--compiler",
|
||||
choices=(
|
||||
"clang-18",
|
||||
"clang-18-darwin",
|
||||
"clang-18-darwin-aarch64",
|
||||
"clang-18-aarch64",
|
||||
"clang-18-aarch64-v80compat",
|
||||
"clang-18-ppc64le",
|
||||
"clang-18-riscv64",
|
||||
"clang-18-s390x",
|
||||
"clang-18-loongarch64",
|
||||
"clang-18-amd64-compat",
|
||||
"clang-18-amd64-musl",
|
||||
"clang-18-freebsd",
|
||||
"clang-19",
|
||||
"clang-19-darwin",
|
||||
"clang-19-darwin-aarch64",
|
||||
"clang-19-aarch64",
|
||||
"clang-19-aarch64-v80compat",
|
||||
"clang-19-ppc64le",
|
||||
"clang-19-riscv64",
|
||||
"clang-19-s390x",
|
||||
"clang-19-loongarch64",
|
||||
"clang-19-amd64-compat",
|
||||
"clang-19-amd64-musl",
|
||||
"clang-19-freebsd",
|
||||
),
|
||||
default="clang-18",
|
||||
default="clang-19",
|
||||
help="a compiler to use",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
@ -40,10 +40,6 @@ RUN ln -s /usr/bin/lld-${LLVM_VERSION} /usr/bin/ld.lld
|
||||
# https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/commit/992e52c0b156a5ba9c6a8a54f8c4857ddd3d371d
|
||||
RUN sed -i '/_IMPORT_CHECK_FILES_FOR_\(mlir-\|llvm-bolt\|merge-fdata\|MLIR\)/ {s|^|#|}' /usr/lib/llvm-${LLVM_VERSION}/lib/cmake/llvm/LLVMExports-*.cmake
|
||||
|
||||
# LLVM changes paths for compiler-rt libraries. For some reason clang-18.1.8 cannot catch up libraries from default install path.
|
||||
# It's very dirty workaround, better to build compiler and LLVM ourself and use it. Details: https://github.com/llvm/llvm-project/issues/95792
|
||||
RUN test ! -d /usr/lib/llvm-18/lib/clang/18/lib/x86_64-pc-linux-gnu || ln -s /usr/lib/llvm-18/lib/clang/18/lib/x86_64-pc-linux-gnu /usr/lib/llvm-18/lib/clang/18/lib/x86_64-unknown-linux-gnu
|
||||
|
||||
ARG CCACHE_VERSION=4.6.1
|
||||
RUN mkdir /tmp/ccache \
|
||||
&& cd /tmp/ccache \
|
||||
|
@ -27,7 +27,6 @@ pandas==1.5.3
|
||||
pip==24.1.1
|
||||
pipdeptree==2.23.0
|
||||
pyparsing==2.4.7
|
||||
python-apt==2.4.0+ubuntu3
|
||||
python-dateutil==2.9.0.post0
|
||||
pytz==2024.1
|
||||
requests==2.32.3
|
||||
|
@ -18,7 +18,6 @@ pip==24.1.1
|
||||
pipdeptree==2.23.0
|
||||
PyJWT==2.3.0
|
||||
pyparsing==2.4.7
|
||||
python-apt==2.4.0+ubuntu3
|
||||
SecretStorage==3.3.1
|
||||
setuptools==59.6.0
|
||||
six==1.16.0
|
||||
|
@ -17,7 +17,7 @@ stage=${stage:-}
|
||||
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
echo "$script_dir"
|
||||
repo_dir=ch
|
||||
BINARY_TO_DOWNLOAD=${BINARY_TO_DOWNLOAD:="clang-18_debug_none_unsplitted_disable_False_binary"}
|
||||
BINARY_TO_DOWNLOAD=${BINARY_TO_DOWNLOAD:="clang-19_debug_none_unsplitted_disable_False_binary"}
|
||||
BINARY_URL_TO_DOWNLOAD=${BINARY_URL_TO_DOWNLOAD:="https://clickhouse-builds.s3.amazonaws.com/$PR_TO_TEST/$SHA_TO_TEST/clickhouse_build_check/$BINARY_TO_DOWNLOAD/clickhouse"}
|
||||
|
||||
function git_clone_with_retry
|
||||
|
@ -17,7 +17,6 @@ pipdeptree==2.23.0
|
||||
pycurl==7.45.3
|
||||
PyJWT==2.3.0
|
||||
pyparsing==2.4.7
|
||||
python-apt==2.4.0+ubuntu3
|
||||
SecretStorage==3.3.1
|
||||
setuptools==59.6.0
|
||||
six==1.16.0
|
||||
|
@ -2,7 +2,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
CLICKHOUSE_PACKAGE=${CLICKHOUSE_PACKAGE:="https://clickhouse-builds.s3.amazonaws.com/$PR_TO_TEST/$SHA_TO_TEST/clickhouse_build_check/clang-18_relwithdebuginfo_none_unsplitted_disable_False_binary/clickhouse"}
|
||||
CLICKHOUSE_PACKAGE=${CLICKHOUSE_PACKAGE:="https://clickhouse-builds.s3.amazonaws.com/$PR_TO_TEST/$SHA_TO_TEST/clickhouse_build_check/clang-19_relwithdebuginfo_none_unsplitted_disable_False_binary/clickhouse"}
|
||||
CLICKHOUSE_REPO_PATH=${CLICKHOUSE_REPO_PATH:=""}
|
||||
|
||||
|
||||
|
@ -18,7 +18,6 @@ pip==24.1.1
|
||||
pipdeptree==2.23.0
|
||||
PyJWT==2.3.0
|
||||
pyparsing==2.4.7
|
||||
python-apt==2.4.0+ubuntu3
|
||||
SecretStorage==3.3.1
|
||||
setuptools==59.6.0
|
||||
six==1.16.0
|
||||
|
@ -19,7 +19,6 @@ pipdeptree==2.23.0
|
||||
Pygments==2.11.2
|
||||
PyJWT==2.3.0
|
||||
pyparsing==2.4.7
|
||||
python-apt==2.4.0+ubuntu3
|
||||
pytz==2023.4
|
||||
PyYAML==6.0.1
|
||||
scipy==1.12.0
|
||||
|
@ -2,7 +2,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
CLICKHOUSE_PACKAGE=${CLICKHOUSE_PACKAGE:="https://clickhouse-builds.s3.amazonaws.com/$PR_TO_TEST/$SHA_TO_TEST/clickhouse_build_check/clang-18_relwithdebuginfo_none_unsplitted_disable_False_binary/clickhouse"}
|
||||
CLICKHOUSE_PACKAGE=${CLICKHOUSE_PACKAGE:="https://clickhouse-builds.s3.amazonaws.com/$PR_TO_TEST/$SHA_TO_TEST/clickhouse_build_check/clang-19_relwithdebuginfo_none_unsplitted_disable_False_binary/clickhouse"}
|
||||
CLICKHOUSE_REPO_PATH=${CLICKHOUSE_REPO_PATH:=""}
|
||||
|
||||
|
||||
|
@ -20,7 +20,6 @@ pipdeptree==2.23.0
|
||||
PyJWT==2.3.0
|
||||
pyodbc==5.1.0
|
||||
pyparsing==2.4.7
|
||||
python-apt==2.4.0+ubuntu3
|
||||
SecretStorage==3.3.1
|
||||
setuptools==59.6.0
|
||||
six==1.16.0
|
||||
|
@ -17,7 +17,6 @@ pip==24.1.1
|
||||
pipdeptree==2.23.0
|
||||
PyJWT==2.3.0
|
||||
pyparsing==2.4.7
|
||||
python-apt==2.4.0+ubuntu3
|
||||
pytz==2024.1
|
||||
PyYAML==6.0.1
|
||||
SecretStorage==3.3.1
|
||||
|
@ -6,7 +6,7 @@ set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
BINARY_TO_DOWNLOAD=${BINARY_TO_DOWNLOAD:="clang-18_debug_none_unsplitted_disable_False_binary"}
|
||||
BINARY_TO_DOWNLOAD=${BINARY_TO_DOWNLOAD:="clang-19_debug_none_unsplitted_disable_False_binary"}
|
||||
BINARY_URL_TO_DOWNLOAD=${BINARY_URL_TO_DOWNLOAD:="https://clickhouse-builds.s3.amazonaws.com/$PR_TO_TEST/$SHA_TO_TEST/clickhouse_build_check/$BINARY_TO_DOWNLOAD/clickhouse"}
|
||||
|
||||
function wget_with_retry
|
||||
|
@ -34,7 +34,6 @@ pyarrow==15.0.0
|
||||
pyasn1==0.4.8
|
||||
PyJWT==2.3.0
|
||||
pyparsing==2.4.7
|
||||
python-apt==2.4.0+ubuntu3
|
||||
python-dateutil==2.8.1
|
||||
pytz==2024.1
|
||||
PyYAML==6.0.1
|
||||
|
@ -4,8 +4,9 @@ FROM ubuntu:22.04
|
||||
# ARG for quick switch to a given ubuntu mirror
|
||||
ARG apt_archive="http://archive.ubuntu.com"
|
||||
RUN sed -i "s|http://archive.ubuntu.com|$apt_archive|g" /etc/apt/sources.list
|
||||
ARG LLVM_APT_VERSION="1:19.1.4~*"
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=18
|
||||
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=19
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install \
|
||||
@ -28,7 +29,7 @@ RUN apt-get update \
|
||||
&& echo "deb https://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${LLVM_VERSION} main" >> \
|
||||
/etc/apt/sources.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install --yes --no-install-recommends --verbose-versions llvm-${LLVM_VERSION} \
|
||||
&& apt-get install --yes --no-install-recommends --verbose-versions llvm-${LLVM_VERSION}>=${LLVM_APT_VERSION} \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /var/cache/debconf /tmp/*
|
||||
|
||||
|
@ -11,7 +11,7 @@ This is for the case when you have Linux machine and want to use it to build `cl
|
||||
|
||||
The cross-build for LoongArch64 is based on the [Build instructions](../development/build.md), follow them first.
|
||||
|
||||
## Install Clang-18
|
||||
## Install Clang-19
|
||||
|
||||
Follow the instructions from https://apt.llvm.org/ for your Ubuntu or Debian setup or do
|
||||
```
|
||||
@ -21,11 +21,11 @@ sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
|
||||
## Build ClickHouse {#build-clickhouse}
|
||||
|
||||
|
||||
The llvm version required for building must be greater than or equal to 18.1.0.
|
||||
The llvm version required for building must be greater than or equal to 19.1.0.
|
||||
``` bash
|
||||
cd ClickHouse
|
||||
mkdir build-loongarch64
|
||||
CC=clang-18 CXX=clang++-18 cmake . -Bbuild-loongarch64 -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-loongarch64.cmake
|
||||
CC=clang-19 CXX=clang++-19 cmake . -Bbuild-loongarch64 -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-loongarch64.cmake
|
||||
ninja -C build-loongarch64
|
||||
```
|
||||
|
||||
|
@ -13,14 +13,14 @@ The cross-build for macOS is based on the [Build instructions](../development/bu
|
||||
|
||||
The following sections provide a walk-through for building ClickHouse for `x86_64` macOS. If you’re targeting ARM architecture, simply substitute all occurrences of `x86_64` with `aarch64`. For example, replace `x86_64-apple-darwin` with `aarch64-apple-darwin` throughout the steps.
|
||||
|
||||
## Install clang-18
|
||||
## Install clang-19
|
||||
|
||||
Follow the instructions from https://apt.llvm.org/ for your Ubuntu or Debian setup.
|
||||
For example the commands for Bionic are like:
|
||||
|
||||
``` bash
|
||||
sudo echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-17 main" >> /etc/apt/sources.list
|
||||
sudo apt-get install clang-18
|
||||
sudo apt-get install clang-19
|
||||
```
|
||||
|
||||
## Install Cross-Compilation Toolset {#install-cross-compilation-toolset}
|
||||
@ -59,7 +59,7 @@ curl -L 'https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11
|
||||
cd ClickHouse
|
||||
mkdir build-darwin
|
||||
cd build-darwin
|
||||
CC=clang-18 CXX=clang++-18 cmake -DCMAKE_AR:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ar -DCMAKE_INSTALL_NAME_TOOL=${CCTOOLS}/bin/x86_64-apple-darwin-install_name_tool -DCMAKE_RANLIB:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ranlib -DLINKER_NAME=${CCTOOLS}/bin/x86_64-apple-darwin-ld -DCMAKE_TOOLCHAIN_FILE=cmake/darwin/toolchain-x86_64.cmake ..
|
||||
CC=clang-19 CXX=clang++-19 cmake -DCMAKE_AR:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ar -DCMAKE_INSTALL_NAME_TOOL=${CCTOOLS}/bin/x86_64-apple-darwin-install_name_tool -DCMAKE_RANLIB:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ranlib -DLINKER_NAME=${CCTOOLS}/bin/x86_64-apple-darwin-ld -DCMAKE_TOOLCHAIN_FILE=cmake/darwin/toolchain-x86_64.cmake ..
|
||||
ninja
|
||||
```
|
||||
|
||||
|
@ -11,7 +11,7 @@ This is for the case when you have Linux machine and want to use it to build `cl
|
||||
|
||||
The cross-build for RISC-V 64 is based on the [Build instructions](../development/build.md), follow them first.
|
||||
|
||||
## Install Clang-18
|
||||
## Install Clang-19
|
||||
|
||||
Follow the instructions from https://apt.llvm.org/ for your Ubuntu or Debian setup or do
|
||||
```
|
||||
@ -23,7 +23,7 @@ sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
|
||||
``` bash
|
||||
cd ClickHouse
|
||||
mkdir build-riscv64
|
||||
CC=clang-18 CXX=clang++-18 cmake . -Bbuild-riscv64 -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-riscv64.cmake -DGLIBC_COMPATIBILITY=OFF -DENABLE_LDAP=OFF -DOPENSSL_NO_ASM=ON -DENABLE_JEMALLOC=ON -DENABLE_PARQUET=OFF -DENABLE_GRPC=OFF -DENABLE_HDFS=OFF -DENABLE_MYSQL=OFF
|
||||
CC=clang-19 CXX=clang++-19 cmake . -Bbuild-riscv64 -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-riscv64.cmake -DGLIBC_COMPATIBILITY=OFF -DENABLE_LDAP=OFF -DOPENSSL_NO_ASM=ON -DENABLE_JEMALLOC=ON -DENABLE_PARQUET=OFF -DENABLE_GRPC=OFF -DENABLE_HDFS=OFF -DENABLE_MYSQL=OFF
|
||||
ninja -C build-riscv64
|
||||
```
|
||||
|
||||
|
@ -54,8 +54,8 @@ to see what version you have installed before setting this environment variable.
|
||||
:::
|
||||
|
||||
``` bash
|
||||
export CC=clang-18
|
||||
export CXX=clang++-18
|
||||
export CC=clang-19
|
||||
export CXX=clang++-19
|
||||
```
|
||||
|
||||
### Install Rust compiler
|
||||
@ -109,7 +109,7 @@ The build requires the following components:
|
||||
|
||||
- Git (used to checkout the sources, not needed for the build)
|
||||
- CMake 3.20 or newer
|
||||
- Compiler: clang-18 or newer
|
||||
- Compiler: clang-19 or newer
|
||||
- Linker: lld-17 or newer
|
||||
- Ninja
|
||||
- Yasm
|
||||
|
@ -156,7 +156,7 @@ Builds ClickHouse in various configurations for use in further steps. You have t
|
||||
|
||||
### Report Details
|
||||
|
||||
- **Compiler**: `clang-18`, optionally with the name of a target platform
|
||||
- **Compiler**: `clang-19`, optionally with the name of a target platform
|
||||
- **Build type**: `Debug` or `RelWithDebInfo` (cmake).
|
||||
- **Sanitizer**: `none` (without sanitizers), `address` (ASan), `memory` (MSan), `undefined` (UBSan), or `thread` (TSan).
|
||||
- **Status**: `success` or `fail`
|
||||
@ -180,7 +180,7 @@ Performs static analysis and code style checks using `clang-tidy`. The report is
|
||||
There is a convenience `packager` script that runs the clang-tidy build in docker
|
||||
```sh
|
||||
mkdir build_tidy
|
||||
./docker/packager/packager --output-dir=./build_tidy --package-type=binary --compiler=clang-18 --debug-build --clang-tidy
|
||||
./docker/packager/packager --output-dir=./build_tidy --package-type=binary --compiler=clang-19 --debug-build --clang-tidy
|
||||
```
|
||||
|
||||
|
||||
|
@ -121,7 +121,7 @@ While inside the `build` directory, configure your build by running CMake. Befor
|
||||
export CC=clang CXX=clang++
|
||||
cmake ..
|
||||
|
||||
If you installed clang using the automatic installation script above, also specify the version of clang installed in the first command, e.g. `export CC=clang-18 CXX=clang++-18`. The clang version will be in the script output.
|
||||
If you installed clang using the automatic installation script above, also specify the version of clang installed in the first command, e.g. `export CC=clang-19 CXX=clang++-19`. The clang version will be in the script output.
|
||||
|
||||
The `CC` variable specifies the compiler for C (short for C Compiler), and `CXX` variable instructs which C++ compiler is to be used for building.
|
||||
|
||||
|
@ -468,7 +468,7 @@ SELECT JSONLength('{"a": "hello", "b": [-100, 200.0, 300]}') = 2
|
||||
|
||||
### JSONType
|
||||
|
||||
Return the type of a JSON value. If the value does not exist, `Null` will be returned.
|
||||
Return the type of a JSON value. If the value does not exist, `Null=0` will be returned (not usual [Null](../data-types/nullable.md), but `Null=0` of `Enum8('Null' = 0, 'String' = 34,...`). .
|
||||
|
||||
**Syntax**
|
||||
|
||||
@ -488,7 +488,7 @@ JSONType(json [, indices_or_keys]...)
|
||||
|
||||
**Returned value**
|
||||
|
||||
- Returns the type of a JSON value as a string, otherwise if the value doesn't exists it returns `Null`. [String](../data-types/string.md).
|
||||
- Returns the type of a JSON value as a string, otherwise if the value doesn't exists it returns `Null=0`. [Enum](../data-types/enum.md).
|
||||
|
||||
**Examples**
|
||||
|
||||
@ -520,7 +520,7 @@ JSONExtractUInt(json [, indices_or_keys]...)
|
||||
|
||||
**Returned value**
|
||||
|
||||
- Returns a UInt value if it exists, otherwise it returns `Null`. [UInt64](../data-types/string.md).
|
||||
- Returns a UInt value if it exists, otherwise it returns `0`. [UInt64](../data-types/int-uint.md).
|
||||
|
||||
**Examples**
|
||||
|
||||
@ -560,7 +560,7 @@ JSONExtractInt(json [, indices_or_keys]...)
|
||||
|
||||
**Returned value**
|
||||
|
||||
- Returns an Int value if it exists, otherwise it returns `Null`. [Int64](../data-types/int-uint.md).
|
||||
- Returns an Int value if it exists, otherwise it returns `0`. [Int64](../data-types/int-uint.md).
|
||||
|
||||
**Examples**
|
||||
|
||||
@ -600,7 +600,7 @@ JSONExtractFloat(json [, indices_or_keys]...)
|
||||
|
||||
**Returned value**
|
||||
|
||||
- Returns an Float value if it exists, otherwise it returns `Null`. [Float64](../data-types/float.md).
|
||||
- Returns an Float value if it exists, otherwise it returns `0`. [Float64](../data-types/float.md).
|
||||
|
||||
**Examples**
|
||||
|
||||
|
@ -5,24 +5,14 @@ set -e
|
||||
# Avoid dependency on locale
|
||||
LC_ALL=C
|
||||
|
||||
# Normalize output directory
|
||||
if [ -n "$OUTPUT_DIR" ]; then
|
||||
OUTPUT_DIR=$(realpath -m "$OUTPUT_DIR")
|
||||
fi
|
||||
|
||||
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
cd "$CUR_DIR"
|
||||
|
||||
ROOT_DIR=$(readlink -f "$(git rev-parse --show-cdup)")
|
||||
|
||||
PKG_ROOT='root'
|
||||
|
||||
DEB_ARCH=${DEB_ARCH:-amd64}
|
||||
OUTPUT_DIR=${OUTPUT_DIR:-$ROOT_DIR}
|
||||
[ -d "${OUTPUT_DIR}" ] || mkdir -p "${OUTPUT_DIR}"
|
||||
SANITIZER=${SANITIZER:-""}
|
||||
SOURCE=${SOURCE:-$PKG_ROOT}
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
|
||||
HELP="${0} [--test] [--rpm] [-h|--help]
|
||||
--test - adds '+test' prefix to version
|
||||
--apk - build APK packages
|
||||
@ -40,12 +30,7 @@ Used envs:
|
||||
VERSION_STRING='${VERSION_STRING}' - the package version to overwrite
|
||||
"
|
||||
|
||||
if [ -z "${VERSION_STRING}" ]; then
|
||||
# Get CLICKHOUSE_VERSION_STRING from the current git repo
|
||||
eval "$("$ROOT_DIR/tests/ci/version_helper.py" -e)"
|
||||
else
|
||||
CLICKHOUSE_VERSION_STRING=${VERSION_STRING}
|
||||
fi
|
||||
CLICKHOUSE_VERSION_STRING=${VERSION_STRING}
|
||||
export CLICKHOUSE_VERSION_STRING
|
||||
|
||||
|
||||
@ -144,28 +129,29 @@ CLICKHOUSE_VERSION_STRING+=$VERSION_POSTFIX
|
||||
echo -e "\nCurrent version is $CLICKHOUSE_VERSION_STRING"
|
||||
|
||||
for config in clickhouse*.yaml; do
|
||||
if [[ $BUILD_TYPE != 'release' ]] && [[ "$config" == "clickhouse-keeper-dbg.yaml" ]]; then
|
||||
continue
|
||||
fi
|
||||
if [ -n "$MAKE_DEB" ] || [ -n "$MAKE_TGZ" ]; then
|
||||
echo "Building deb package for $config"
|
||||
|
||||
# Preserve package path
|
||||
exec 9>&1
|
||||
PKG_PATH=$(nfpm package --target "$OUTPUT_DIR" --config "$config" --packager deb | tee /dev/fd/9)
|
||||
PKG_PATH=${PKG_PATH##*created package: }
|
||||
exec 9>&-
|
||||
PKG_PATH=$(nfpm package --target "$OUTPUT_DIR" --config "$config" --packager deb | tee /dev/stderr | grep "created package:" | sed 's/.*created package: //')
|
||||
fi
|
||||
|
||||
if [ -n "$MAKE_APK" ]; then
|
||||
echo "Building apk package for $config"
|
||||
nfpm package --target "$OUTPUT_DIR" --config "$config" --packager apk
|
||||
fi
|
||||
|
||||
if [ -n "$MAKE_ARCHLINUX" ]; then
|
||||
echo "Building archlinux package for $config"
|
||||
nfpm package --target "$OUTPUT_DIR" --config "$config" --packager archlinux
|
||||
fi
|
||||
|
||||
if [ -n "$MAKE_RPM" ]; then
|
||||
echo "Building rpm package for $config"
|
||||
nfpm package --target "$OUTPUT_DIR" --config "$config" --packager rpm
|
||||
fi
|
||||
|
||||
if [ -n "$MAKE_TGZ" ]; then
|
||||
echo "Building tarball for $config"
|
||||
deb2tgz "$PKG_PATH"
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
void executeImpl(const CommandLineOptions &, DisksClient & client) override
|
||||
{
|
||||
auto disk = client.getCurrentDiskWithPath();
|
||||
const auto & disk = client.getCurrentDiskWithPath();
|
||||
std::cout << "Disk: " << disk.getDisk()->getName() << "\nPath: " << disk.getCurrentPath() << std::endl;
|
||||
}
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
|
||||
void executeImpl(const CommandLineOptions & options, DisksClient & client) override
|
||||
{
|
||||
auto disk = client.getCurrentDiskWithPath();
|
||||
const auto & disk = client.getCurrentDiskWithPath();
|
||||
|
||||
const String & path_from = disk.getRelativeFromRoot(getValueFromCommandLineOptionsThrow<String>(options, "path-from"));
|
||||
const String & path_to = disk.getRelativeFromRoot(getValueFromCommandLineOptionsThrow<String>(options, "path-to"));
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
{
|
||||
bool recursive = options.count("recursive");
|
||||
bool show_hidden = options.count("all");
|
||||
auto disk = client.getCurrentDiskWithPath();
|
||||
const auto & disk = client.getCurrentDiskWithPath();
|
||||
String path = getValueFromCommandLineOptionsWithDefault<String>(options, "path", ".");
|
||||
|
||||
if (recursive)
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
void executeImpl(const CommandLineOptions & options, DisksClient & client) override
|
||||
{
|
||||
bool recursive = options.count("parents");
|
||||
auto disk = client.getCurrentDiskWithPath();
|
||||
const auto & disk = client.getCurrentDiskWithPath();
|
||||
|
||||
String path = disk.getRelativeFromRoot(getValueFromCommandLineOptionsThrow<String>(options, "path"));
|
||||
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
|
||||
void executeImpl(const CommandLineOptions & options, DisksClient & client) override
|
||||
{
|
||||
auto disk = client.getCurrentDiskWithPath();
|
||||
const auto & disk = client.getCurrentDiskWithPath();
|
||||
String path_from = disk.getRelativeFromRoot(getValueFromCommandLineOptionsThrow<String>(options, "path-from"));
|
||||
std::optional<String> path_to = getValueFromCommandLineOptionsWithOptional<String>(options, "path-to");
|
||||
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
|
||||
void executeImpl(const CommandLineOptions & options, DisksClient & client) override
|
||||
{
|
||||
auto disk = client.getCurrentDiskWithPath();
|
||||
const auto & disk = client.getCurrentDiskWithPath();
|
||||
const String & path = disk.getRelativeFromRoot(getValueFromCommandLineOptionsThrow<String>(options, "path"));
|
||||
bool recursive = options.count("recursive");
|
||||
if (disk.getDisk()->existsDirectory(path))
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
|
||||
void executeImpl(const CommandLineOptions & options, DisksClient & client) override
|
||||
{
|
||||
auto disk = client.getCurrentDiskWithPath();
|
||||
const auto & disk = client.getCurrentDiskWithPath();
|
||||
String path = getValueFromCommandLineOptionsThrow<String>(options, "path");
|
||||
|
||||
disk.getDisk()->createFile(disk.getRelativeFromRoot(path));
|
||||
|
@ -129,7 +129,7 @@ std::vector<String> DisksApp::getCompletions(const String & prefix) const
|
||||
}
|
||||
if (arguments.size() == 1)
|
||||
{
|
||||
String command_prefix = arguments[0];
|
||||
const String & command_prefix = arguments[0];
|
||||
return getCommandsToComplete(command_prefix);
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ enum class FileChangeType : uint8_t
|
||||
Type,
|
||||
};
|
||||
|
||||
void writeText(FileChangeType type, WriteBuffer & out)
|
||||
static void writeText(FileChangeType type, WriteBuffer & out)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -299,7 +299,7 @@ enum class LineType : uint8_t
|
||||
Code,
|
||||
};
|
||||
|
||||
void writeText(LineType type, WriteBuffer & out)
|
||||
static void writeText(LineType type, WriteBuffer & out)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -429,7 +429,7 @@ using CommitDiff = std::map<std::string /* path */, FileDiff>;
|
||||
|
||||
/** Parsing helpers */
|
||||
|
||||
void skipUntilWhitespace(ReadBuffer & buf)
|
||||
static void skipUntilWhitespace(ReadBuffer & buf)
|
||||
{
|
||||
while (!buf.eof())
|
||||
{
|
||||
@ -444,7 +444,7 @@ void skipUntilWhitespace(ReadBuffer & buf)
|
||||
}
|
||||
}
|
||||
|
||||
void skipUntilNextLine(ReadBuffer & buf)
|
||||
static void skipUntilNextLine(ReadBuffer & buf)
|
||||
{
|
||||
while (!buf.eof())
|
||||
{
|
||||
@ -462,7 +462,7 @@ void skipUntilNextLine(ReadBuffer & buf)
|
||||
}
|
||||
}
|
||||
|
||||
void readStringUntilNextLine(std::string & s, ReadBuffer & buf)
|
||||
static void readStringUntilNextLine(std::string & s, ReadBuffer & buf)
|
||||
{
|
||||
s.clear();
|
||||
while (!buf.eof())
|
||||
@ -680,7 +680,7 @@ using Snapshot = std::map<std::string /* path */, FileBlame>;
|
||||
* - the author, time and commit of the previous change to every found line (blame).
|
||||
* And update the snapshot.
|
||||
*/
|
||||
void updateSnapshot(Snapshot & snapshot, const Commit & commit, CommitDiff & file_changes)
|
||||
static void updateSnapshot(Snapshot & snapshot, const Commit & commit, CommitDiff & file_changes)
|
||||
{
|
||||
/// Renames and copies.
|
||||
for (auto & elem : file_changes)
|
||||
@ -755,7 +755,7 @@ void updateSnapshot(Snapshot & snapshot, const Commit & commit, CommitDiff & fil
|
||||
*/
|
||||
using DiffHashes = std::unordered_set<UInt128>;
|
||||
|
||||
UInt128 diffHash(const CommitDiff & file_changes)
|
||||
static UInt128 diffHash(const CommitDiff & file_changes)
|
||||
{
|
||||
SipHash hasher;
|
||||
|
||||
@ -791,7 +791,7 @@ UInt128 diffHash(const CommitDiff & file_changes)
|
||||
* :100644 100644 828dedf6b5 828dedf6b5 R100 dbms/src/Functions/GeoUtils.h dbms/src/Functions/PolygonUtils.h
|
||||
* according to the output of 'git show --raw'
|
||||
*/
|
||||
void processFileChanges(
|
||||
static void processFileChanges(
|
||||
ReadBuffer & in,
|
||||
const Options & options,
|
||||
Commit & commit,
|
||||
@ -883,7 +883,7 @@ void processFileChanges(
|
||||
* - we expect some specific format of the diff; but it may actually depend on git config;
|
||||
* - non-ASCII file names are not processed correctly (they will not be found and will be ignored).
|
||||
*/
|
||||
void processDiffs(
|
||||
static void processDiffs(
|
||||
ReadBuffer & in,
|
||||
std::optional<size_t> size_limit,
|
||||
Commit & commit,
|
||||
@ -1055,7 +1055,7 @@ void processDiffs(
|
||||
|
||||
/** Process the "git show" result for a single commit. Append the result to tables.
|
||||
*/
|
||||
void processCommit(
|
||||
static void processCommit(
|
||||
ReadBuffer & in,
|
||||
const Options & options,
|
||||
size_t commit_num,
|
||||
@ -1123,7 +1123,7 @@ void processCommit(
|
||||
/** Runs child process and allows to read the result.
|
||||
* Multiple processes can be run for parallel processing.
|
||||
*/
|
||||
auto gitShow(const std::string & hash)
|
||||
static auto gitShow(const std::string & hash)
|
||||
{
|
||||
std::string command = fmt::format(
|
||||
"git show --raw --pretty='format:%ct%x00%aN%x00%P%x00%s%x00' --patch --unified=0 {}",
|
||||
@ -1135,7 +1135,7 @@ auto gitShow(const std::string & hash)
|
||||
|
||||
/** Obtain the list of commits and process them.
|
||||
*/
|
||||
void processLog(const Options & options)
|
||||
static void processLog(const Options & options)
|
||||
{
|
||||
ResultWriter result;
|
||||
|
||||
|
@ -63,7 +63,7 @@ int printHelp(int, char **)
|
||||
}
|
||||
|
||||
|
||||
bool isClickhouseApp(std::string_view app_suffix, std::vector<char *> & argv)
|
||||
static bool isClickhouseApp(std::string_view app_suffix, std::vector<char *> & argv)
|
||||
{
|
||||
/// Use app if the first arg 'app' is passed (the arg should be quietly removed)
|
||||
if (argv.size() >= 2)
|
||||
@ -132,7 +132,7 @@ __attribute__((constructor(0))) void init_je_malloc_message() { malloc_message =
|
||||
///
|
||||
/// extern bool inside_main;
|
||||
/// class C { C() { assert(inside_main); } };
|
||||
bool inside_main = false;
|
||||
static bool inside_main = false;
|
||||
|
||||
int main(int argc_, char ** argv_)
|
||||
{
|
||||
|
@ -136,7 +136,7 @@ using ModelPtr = std::unique_ptr<IModel>;
|
||||
|
||||
|
||||
template <typename... Ts>
|
||||
UInt64 hash(Ts... xs)
|
||||
static UInt64 hash(Ts... xs)
|
||||
{
|
||||
SipHash hash;
|
||||
(hash.update(xs), ...);
|
||||
@ -271,7 +271,7 @@ public:
|
||||
|
||||
/// Pseudorandom permutation of mantissa.
|
||||
template <typename Float>
|
||||
Float transformFloatMantissa(Float x, UInt64 seed)
|
||||
static Float transformFloatMantissa(Float x, UInt64 seed)
|
||||
{
|
||||
using UInt = std::conditional_t<std::is_same_v<Float, Float32>, UInt32, UInt64>;
|
||||
constexpr size_t mantissa_num_bits = std::is_same_v<Float, Float32> ? 23 : 52;
|
||||
|
@ -32,7 +32,7 @@ namespace ErrorCodes
|
||||
* If test-mode option is added, files will be put by given url via PUT request.
|
||||
*/
|
||||
|
||||
void processFile(const fs::path & file_path, const fs::path & dst_path, bool test_mode, bool link, WriteBuffer & metadata_buf)
|
||||
static void processFile(const fs::path & file_path, const fs::path & dst_path, bool test_mode, bool link, WriteBuffer & metadata_buf)
|
||||
{
|
||||
String remote_path;
|
||||
RE2::FullMatch(file_path.string(), EXTRACT_PATH_PATTERN, &remote_path);
|
||||
@ -77,7 +77,7 @@ void processFile(const fs::path & file_path, const fs::path & dst_path, bool tes
|
||||
}
|
||||
|
||||
|
||||
void processTableFiles(const fs::path & data_path, fs::path dst_path, bool test_mode, bool link)
|
||||
static void processTableFiles(const fs::path & data_path, fs::path dst_path, bool test_mode, bool link)
|
||||
{
|
||||
std::cerr << "Data path: " << data_path << ", destination path: " << dst_path << std::endl;
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace ErrorCodes
|
||||
extern const int SYSTEM_ERROR;
|
||||
}
|
||||
|
||||
void setUserAndGroup(std::string arg_uid, std::string arg_gid)
|
||||
static void setUserAndGroup(std::string arg_uid, std::string arg_gid)
|
||||
{
|
||||
static constexpr size_t buf_size = 16384; /// Linux man page says it is enough. Nevertheless, we will check if it's not enough and throw.
|
||||
std::unique_ptr<char[]> buf(new char[buf_size]);
|
||||
|
@ -53,7 +53,7 @@ String serializeAccessEntity(const IAccessEntity & entity)
|
||||
return buf.str();
|
||||
}
|
||||
|
||||
AccessEntityPtr deserializeAccessEntityImpl(const String & definition)
|
||||
static AccessEntityPtr deserializeAccessEntityImpl(const String & definition)
|
||||
{
|
||||
ASTs queries;
|
||||
ParserAttachAccessEntity parser;
|
||||
|
@ -80,7 +80,7 @@ AuthenticationData::Digest AuthenticationData::Util::encodeBcrypt(std::string_vi
|
||||
if (ret != 0)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "BCrypt library failed: bcrypt_gensalt returned {}", ret);
|
||||
|
||||
ret = bcrypt_hashpw(text.data(), salt, reinterpret_cast<char *>(hash.data()));
|
||||
ret = bcrypt_hashpw(text.data(), salt, reinterpret_cast<char *>(hash.data())); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
if (ret != 0)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "BCrypt library failed: bcrypt_hashpw returned {}", ret);
|
||||
|
||||
@ -95,7 +95,7 @@ AuthenticationData::Digest AuthenticationData::Util::encodeBcrypt(std::string_vi
|
||||
bool AuthenticationData::Util::checkPasswordBcrypt(std::string_view password [[maybe_unused]], const Digest & password_bcrypt [[maybe_unused]])
|
||||
{
|
||||
#if USE_BCRYPT
|
||||
int ret = bcrypt_checkpw(password.data(), reinterpret_cast<const char *>(password_bcrypt.data()));
|
||||
int ret = bcrypt_checkpw(password.data(), reinterpret_cast<const char *>(password_bcrypt.data())); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
/// Before 24.6 we didn't validate hashes on creation, so it could be that the stored hash is invalid
|
||||
/// and it could not be decoded by the library
|
||||
if (ret == -1)
|
||||
|
@ -371,7 +371,7 @@ void ExternalAuthenticators::setConfiguration(const Poco::Util::AbstractConfigur
|
||||
}
|
||||
}
|
||||
|
||||
UInt128 computeParamsHash(const LDAPClient::Params & params, const LDAPClient::RoleSearchParamsList * role_search_params)
|
||||
static UInt128 computeParamsHash(const LDAPClient::Params & params, const LDAPClient::RoleSearchParamsList * role_search_params)
|
||||
{
|
||||
SipHash hash;
|
||||
params.updateHash(hash);
|
||||
|
@ -36,7 +36,7 @@ void SettingsProfileElement::init(const ASTSettingsProfileElement & ast, const A
|
||||
if (id_mode)
|
||||
return parse<UUID>(name_);
|
||||
assert(access_control);
|
||||
return access_control->getID<SettingsProfile>(name_);
|
||||
return access_control->getID<SettingsProfile>(name_); /// NOLINT(clang-analyzer-core.CallAndMessage)
|
||||
};
|
||||
|
||||
if (!ast.parent_profile.empty())
|
||||
|
@ -139,7 +139,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
AggregateFunctionPtr createAggregateFunctionDistinctDynamicTypes(
|
||||
static AggregateFunctionPtr createAggregateFunctionDistinctDynamicTypes(
|
||||
const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
|
||||
{
|
||||
assertNoParameters(name, parameters);
|
||||
|
@ -327,7 +327,7 @@ private:
|
||||
};
|
||||
|
||||
template <typename Data>
|
||||
AggregateFunctionPtr createAggregateFunctionDistinctJSONPathsAndTypes(
|
||||
static AggregateFunctionPtr createAggregateFunctionDistinctJSONPathsAndTypes(
|
||||
const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
|
||||
{
|
||||
assertNoParameters(name, parameters);
|
||||
|
@ -217,7 +217,7 @@ static void fillColumn(DB::PaddedPODArray<UInt8> & chars, DB::PaddedPODArray<UIn
|
||||
insertData(chars, offsets, str.data() + start, end - start);
|
||||
}
|
||||
|
||||
void dumpFlameGraph(
|
||||
static void dumpFlameGraph(
|
||||
const AggregateFunctionFlameGraphTree::Traces & traces,
|
||||
DB::PaddedPODArray<UInt8> & chars,
|
||||
DB::PaddedPODArray<UInt64> & offsets)
|
||||
@ -630,7 +630,7 @@ static void check(const std::string & name, const DataTypes & argument_types, co
|
||||
name, argument_types[2]->getName());
|
||||
}
|
||||
|
||||
AggregateFunctionPtr createAggregateFunctionFlameGraph(const std::string & name, const DataTypes & argument_types, const Array & params, const Settings * settings)
|
||||
static AggregateFunctionPtr createAggregateFunctionFlameGraph(const std::string & name, const DataTypes & argument_types, const Array & params, const Settings * settings)
|
||||
{
|
||||
if (!(*settings)[Setting::allow_introspection_functions])
|
||||
throw Exception(ErrorCodes::FUNCTION_NOT_ALLOWED,
|
||||
|
@ -95,7 +95,7 @@ struct GroupArraySamplerData
|
||||
|
||||
/// With a large number of values, we will generate random numbers several times slower.
|
||||
if (lim <= static_cast<UInt64>(pcg32_fast::max()))
|
||||
return rng() % lim;
|
||||
return rng() % lim; /// NOLINT(clang-analyzer-core.DivideZero)
|
||||
return (static_cast<UInt64>(rng()) * (static_cast<UInt64>(pcg32::max()) + 1ULL) + static_cast<UInt64>(rng())) % lim;
|
||||
}
|
||||
|
||||
@ -494,7 +494,7 @@ class GroupArrayGeneralImpl final
|
||||
{
|
||||
static constexpr bool limit_num_elems = Trait::has_limit;
|
||||
using Data = GroupArrayGeneralData<Node, Trait::sampler != Sampler::NONE>;
|
||||
static Data & data(AggregateDataPtr __restrict place) { return *reinterpret_cast<Data *>(place); }
|
||||
static Data & data(AggregateDataPtr __restrict place) { return *reinterpret_cast<Data *>(place); } /// NOLINT(readability-non-const-parameter)
|
||||
static const Data & data(ConstAggregateDataPtr __restrict place) { return *reinterpret_cast<const Data *>(place); }
|
||||
|
||||
DataTypePtr & data_type;
|
||||
|
@ -179,7 +179,7 @@ class SequenceNextNodeImpl final
|
||||
using Self = SequenceNextNodeImpl<T, Node>;
|
||||
|
||||
using Data = SequenceNextNodeGeneralData<Node>;
|
||||
static Data & data(AggregateDataPtr __restrict place) { return *reinterpret_cast<Data *>(place); }
|
||||
static Data & data(AggregateDataPtr __restrict place) { return *reinterpret_cast<Data *>(place); } /// NOLINT(readability-non-const-parameter)
|
||||
static const Data & data(ConstAggregateDataPtr __restrict place) { return *reinterpret_cast<const Data *>(place); }
|
||||
|
||||
static constexpr size_t base_cond_column_idx = 2;
|
||||
|
@ -694,7 +694,7 @@ class IAggregateFunctionDataHelper : public IAggregateFunctionHelper<Derived>
|
||||
protected:
|
||||
using Data = T;
|
||||
|
||||
static Data & data(AggregateDataPtr __restrict place) { return *reinterpret_cast<Data *>(place); }
|
||||
static Data & data(AggregateDataPtr __restrict place) { return *reinterpret_cast<Data *>(place); } /// NOLINT(readability-non-const-parameter)
|
||||
static const Data & data(ConstAggregateDataPtr __restrict place) { return *reinterpret_cast<const Data *>(place); }
|
||||
|
||||
public:
|
||||
|
@ -259,7 +259,7 @@ private:
|
||||
|
||||
/// With a large number of values, we will generate random numbers several times slower.
|
||||
if (limit <= static_cast<UInt64>(pcg32_fast::max()))
|
||||
return rng() % limit;
|
||||
return rng() % limit; /// NOLINT(clang-analyzer-core.DivideZero)
|
||||
return (static_cast<UInt64>(rng()) * (static_cast<UInt64>(pcg32_fast::max()) + 1ULL) + static_cast<UInt64>(rng())) % limit;
|
||||
}
|
||||
|
||||
|
@ -100,13 +100,13 @@ replxx::Replxx::completions_t LineReader::Suggest::getCompletions(const String &
|
||||
range = std::equal_range(
|
||||
to_search.begin(), to_search.end(), last_word, [prefix_length](std::string_view s, std::string_view prefix_searched)
|
||||
{
|
||||
return strncasecmp(s.data(), prefix_searched.data(), prefix_length) < 0;
|
||||
return strncasecmp(s.data(), prefix_searched.data(), prefix_length) < 0; /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
});
|
||||
else
|
||||
range = std::equal_range(
|
||||
to_search.begin(), to_search.end(), last_word, [prefix_length](std::string_view s, std::string_view prefix_searched)
|
||||
{
|
||||
return strncmp(s.data(), prefix_searched.data(), prefix_length) < 0;
|
||||
return strncmp(s.data(), prefix_searched.data(), prefix_length) < 0; /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
});
|
||||
|
||||
return replxx::Replxx::completions_t(range.first, range.second);
|
||||
|
@ -121,7 +121,7 @@ void TerminalKeystrokeInterceptor::runImpl(const DB::TerminalKeystrokeIntercepto
|
||||
if (available <= 0)
|
||||
return;
|
||||
|
||||
if (read(fd, &ch, 1) > 0)
|
||||
if (read(fd, &ch, 1) > 0) /// NOLINT(clang-analyzer-unix.BlockInCriticalSection)
|
||||
{
|
||||
auto it = map.find(ch);
|
||||
if (it != map.end())
|
||||
|
@ -440,7 +440,7 @@ bool ColumnObject::tryInsert(const Field & x)
|
||||
column->popBack(column->size() - prev_size);
|
||||
}
|
||||
|
||||
if (shared_data_paths->size() != prev_paths_size)
|
||||
if (shared_data_paths->size() != prev_paths_size) /// NOLINT(clang-analyzer-core.NullDereference)
|
||||
shared_data_paths->popBack(shared_data_paths->size() - prev_paths_size);
|
||||
if (shared_data_values->size() != prev_values_size)
|
||||
shared_data_values->popBack(shared_data_values->size() - prev_values_size);
|
||||
|
@ -815,6 +815,15 @@ bool isColumnNullableOrLowCardinalityNullable(const IColumn & column);
|
||||
template <typename Derived, typename Parent = IColumn>
|
||||
class IColumnHelper : public Parent
|
||||
{
|
||||
private:
|
||||
using Self = IColumnHelper<Derived, Parent>;
|
||||
|
||||
friend Derived;
|
||||
friend class COWHelper<Self, Derived>;
|
||||
|
||||
IColumnHelper() = default;
|
||||
IColumnHelper(const IColumnHelper &) = default;
|
||||
|
||||
/// Devirtualize insertFrom.
|
||||
MutableColumns scatter(IColumn::ColumnIndex num_columns, const IColumn::Selector & selector) const override;
|
||||
|
||||
|
@ -13,6 +13,7 @@ TEST(IColumn, dumpStructure)
|
||||
String expected_structure = "LowCardinality(size = 0, UInt8(size = 0), Unique(size = 1, String(size = 1)))";
|
||||
|
||||
std::vector<std::thread> threads;
|
||||
threads.reserve(6);
|
||||
for (size_t i = 0; i < 6; ++i)
|
||||
{
|
||||
threads.emplace_back([&]
|
||||
|
@ -724,14 +724,14 @@ void AsyncLoader::enqueue(Info & info, const LoadJobPtr & job, std::unique_lock<
|
||||
// (when high-priority job A function waits for a lower-priority job B, and B never starts due to its priority)
|
||||
// 4) Resolve "blocked pool" deadlocks -- spawn more workers
|
||||
// (when job A in pool P waits for another ready job B in P, but B never starts because there are no free workers in P)
|
||||
thread_local LoadJob * current_load_job = nullptr;
|
||||
static thread_local LoadJob * current_load_job = nullptr;
|
||||
|
||||
size_t currentPoolOr(size_t pool)
|
||||
{
|
||||
return current_load_job ? current_load_job->executionPool() : pool;
|
||||
}
|
||||
|
||||
bool detectWaitDependentDeadlock(const LoadJobPtr & waited)
|
||||
bool static detectWaitDependentDeadlock(const LoadJobPtr & waited)
|
||||
{
|
||||
if (waited.get() == current_load_job)
|
||||
return true;
|
||||
|
@ -75,10 +75,15 @@
|
||||
template <typename Derived>
|
||||
class COW : public boost::intrusive_ref_counter<Derived>
|
||||
{
|
||||
friend Derived;
|
||||
|
||||
private:
|
||||
Derived * derived() { return static_cast<Derived *>(this); }
|
||||
const Derived * derived() const { return static_cast<const Derived *>(this); }
|
||||
|
||||
COW() = default;
|
||||
COW(const COW&) = default;
|
||||
|
||||
protected:
|
||||
template <typename T>
|
||||
class mutable_ptr : public boost::intrusive_ptr<T> /// NOLINT
|
||||
@ -271,10 +276,15 @@ public:
|
||||
template <typename Base, typename Derived>
|
||||
class COWHelper : public Base
|
||||
{
|
||||
friend Derived;
|
||||
|
||||
private:
|
||||
Derived * derived() { return static_cast<Derived *>(this); }
|
||||
const Derived * derived() const { return static_cast<const Derived *>(this); }
|
||||
|
||||
COWHelper() = default;
|
||||
COWHelper(const COWHelper &) = default;
|
||||
|
||||
public:
|
||||
using Ptr = typename Base::template immutable_ptr<Derived>;
|
||||
using MutablePtr = typename Base::template mutable_ptr<Derived>;
|
||||
|
@ -161,7 +161,7 @@ public:
|
||||
|
||||
FindResultImpl(Mapped * value_, bool found_, size_t off)
|
||||
: FindResultImplBase(found_), FindResultImplOffsetBase<need_offset>(off), value(value_) {}
|
||||
Mapped & getMapped() const { return *value; }
|
||||
Mapped & getMapped() const { return *value; } /// NOLINT(clang-analyzer-core.uninitialized.UndefReturn)
|
||||
};
|
||||
|
||||
template <bool need_offset>
|
||||
|
@ -377,7 +377,7 @@ String DNSResolver::getHostName()
|
||||
return *impl->host_name;
|
||||
}
|
||||
|
||||
static const String & cacheElemToString(const String & str) { return str; }
|
||||
static String cacheElemToString(String str) { return str; }
|
||||
static String cacheElemToString(const Poco::Net::IPAddress & addr) { return addr.toString(); }
|
||||
|
||||
template <typename UpdateF, typename ElemsT>
|
||||
|
@ -22,7 +22,7 @@ namespace ErrorCodes
|
||||
}
|
||||
|
||||
/// Embedded timezones.
|
||||
std::string_view getTimeZone(const char * name);
|
||||
std::string_view getTimeZone(const char * name); /// NOLINT(misc-use-internal-linkage)
|
||||
|
||||
|
||||
namespace
|
||||
|
@ -256,7 +256,7 @@ uint64_t readOffset(std::string_view & sp, bool is64_bit)
|
||||
std::string_view readBytes(std::string_view & sp, uint64_t len)
|
||||
{
|
||||
SAFE_CHECK(len <= sp.size(), "invalid string length: {} vs. {}", len, sp.size());
|
||||
std::string_view ret(sp.data(), len);
|
||||
std::string_view ret(sp.data(), len); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
sp.remove_prefix(len);
|
||||
return ret;
|
||||
}
|
||||
@ -266,7 +266,7 @@ std::string_view readNullTerminated(std::string_view & sp)
|
||||
{
|
||||
const char * p = static_cast<const char *>(memchr(sp.data(), 0, sp.size()));
|
||||
SAFE_CHECK(p, "invalid null-terminated string");
|
||||
std::string_view ret(sp.data(), p - sp.data());
|
||||
std::string_view ret(sp.data(), p - sp.data()); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
sp = std::string_view(p + 1, sp.size());
|
||||
return ret;
|
||||
}
|
||||
@ -442,7 +442,7 @@ bool Dwarf::Section::next(std::string_view & chunk)
|
||||
is64_bit = (initial_length == uint32_t(-1));
|
||||
auto length = is64_bit ? read<uint64_t>(chunk) : initial_length;
|
||||
SAFE_CHECK(length <= chunk.size(), "invalid DWARF section");
|
||||
chunk = std::string_view(chunk.data(), length);
|
||||
chunk = std::string_view(chunk.data(), length); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
data = std::string_view(chunk.end(), data.end() - chunk.end());
|
||||
return true;
|
||||
}
|
||||
@ -937,7 +937,7 @@ bool Dwarf::findDebugInfoOffset(uintptr_t address, std::string_view aranges, uin
|
||||
// Padded to a multiple of 2 addresses.
|
||||
// Strangely enough, this is the only place in the DWARF spec that requires
|
||||
// padding.
|
||||
skipPadding(chunk, aranges.data(), 2 * sizeof(uintptr_t));
|
||||
skipPadding(chunk, aranges.data(), 2 * sizeof(uintptr_t)); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
for (;;)
|
||||
{
|
||||
auto start = read<uintptr_t>(chunk);
|
||||
@ -1681,7 +1681,7 @@ struct LineNumberAttribute
|
||||
std::variant<uint64_t, std::string_view> attr_value;
|
||||
};
|
||||
|
||||
LineNumberAttribute readLineNumberAttribute(
|
||||
LineNumberAttribute static readLineNumberAttribute(
|
||||
bool is64_bit, std::string_view & format, std::string_view & entries, std::string_view debugStr, std::string_view debugLineStr)
|
||||
{
|
||||
uint64_t content_type_code = readULEB(format);
|
||||
@ -1817,7 +1817,7 @@ void Dwarf::LineNumberVM::init()
|
||||
}
|
||||
uint64_t header_length = readOffset(data_, is64Bit_);
|
||||
SAFE_CHECK(header_length <= data_.size(), "invalid line number VM header length");
|
||||
std::string_view header(data_.data(), header_length);
|
||||
std::string_view header(data_.data(), header_length); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
data_ = std::string_view(header.end(), data_.end() - header.end());
|
||||
|
||||
minLength_ = read<uint8_t>(header);
|
||||
@ -1846,7 +1846,7 @@ void Dwarf::LineNumberVM::init()
|
||||
{
|
||||
++v4_.includeDirectoryCount;
|
||||
}
|
||||
v4_.includeDirectories = {tmp, header.data()};
|
||||
v4_.includeDirectories = {tmp, header.data()}; /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
|
||||
tmp = header.data();
|
||||
FileName fn;
|
||||
@ -1855,7 +1855,7 @@ void Dwarf::LineNumberVM::init()
|
||||
{
|
||||
++v4_.fileNameCount;
|
||||
}
|
||||
v4_.fileNames = {tmp, header.data()};
|
||||
v4_.fileNames = {tmp, header.data()}; /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
}
|
||||
else if (version_ == 5)
|
||||
{
|
||||
@ -1868,7 +1868,7 @@ void Dwarf::LineNumberVM::init()
|
||||
readULEB(header); // A content type code
|
||||
readULEB(header); // A form code using the attribute form codes
|
||||
}
|
||||
v5_.directoryEntryFormat = {tmp, header.data()};
|
||||
v5_.directoryEntryFormat = {tmp, header.data()}; /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
v5_.directoriesCount = readULEB(header);
|
||||
tmp = header.data();
|
||||
for (uint64_t i = 0; i < v5_.directoriesCount; i++)
|
||||
@ -1879,7 +1879,7 @@ void Dwarf::LineNumberVM::init()
|
||||
readLineNumberAttribute(is64Bit_, format, header, debugStr_, debugLineStr_);
|
||||
}
|
||||
}
|
||||
v5_.directories = {tmp, header.data()};
|
||||
v5_.directories = {tmp, header.data()}; /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
|
||||
v5_.fileNameEntryFormatCount = read<uint8_t>(header);
|
||||
tmp = header.data();
|
||||
@ -1890,7 +1890,7 @@ void Dwarf::LineNumberVM::init()
|
||||
readULEB(header); // A content type code
|
||||
readULEB(header); // A form code using the attribute form codes
|
||||
}
|
||||
v5_.fileNameEntryFormat = {tmp, header.data()};
|
||||
v5_.fileNameEntryFormat = {tmp, header.data()}; /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
v5_.fileNamesCount = readULEB(header);
|
||||
tmp = header.data();
|
||||
for (uint64_t i = 0; i < v5_.fileNamesCount; i++)
|
||||
@ -1901,7 +1901,7 @@ void Dwarf::LineNumberVM::init()
|
||||
readLineNumberAttribute(is64Bit_, format, header, debugStr_, debugLineStr_);
|
||||
}
|
||||
}
|
||||
v5_.fileNames = {tmp, header.data()};
|
||||
v5_.fileNames = {tmp, header.data()}; /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -650,7 +650,7 @@ namespace ErrorCodes
|
||||
APPLY_FOR_ERROR_CODES(M)
|
||||
#undef M
|
||||
}
|
||||
} error_codes_names;
|
||||
} static error_codes_names;
|
||||
|
||||
std::string_view getName(ErrorCode error_code)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ std::function<void(const std::string & msg, int code, bool remote, const Excepti
|
||||
|
||||
/// - Aborts the process if error code is LOGICAL_ERROR.
|
||||
/// - Increments error codes statistics.
|
||||
void handle_error_code(const std::string & msg, int code, bool remote, const Exception::FramePointers & trace)
|
||||
static void handle_error_code(const std::string & msg, int code, bool remote, const Exception::FramePointers & trace)
|
||||
{
|
||||
// In debug builds and builds with sanitizers, treat LOGICAL_ERROR as an assertion failure.
|
||||
// Log the message before we fail.
|
||||
|
@ -94,7 +94,7 @@ namespace ErrorCodes
|
||||
}
|
||||
|
||||
|
||||
IHTTPConnectionPoolForEndpoint::Metrics getMetricsForStorageConnectionPool()
|
||||
static IHTTPConnectionPoolForEndpoint::Metrics getMetricsForStorageConnectionPool()
|
||||
{
|
||||
return IHTTPConnectionPoolForEndpoint::Metrics{
|
||||
.created = ProfileEvents::StorageConnectionsCreated,
|
||||
@ -110,7 +110,7 @@ IHTTPConnectionPoolForEndpoint::Metrics getMetricsForStorageConnectionPool()
|
||||
}
|
||||
|
||||
|
||||
IHTTPConnectionPoolForEndpoint::Metrics getMetricsForDiskConnectionPool()
|
||||
static IHTTPConnectionPoolForEndpoint::Metrics getMetricsForDiskConnectionPool()
|
||||
{
|
||||
return IHTTPConnectionPoolForEndpoint::Metrics{
|
||||
.created = ProfileEvents::DiskConnectionsCreated,
|
||||
@ -126,7 +126,7 @@ IHTTPConnectionPoolForEndpoint::Metrics getMetricsForDiskConnectionPool()
|
||||
}
|
||||
|
||||
|
||||
IHTTPConnectionPoolForEndpoint::Metrics getMetricsForHTTPConnectionPool()
|
||||
static IHTTPConnectionPoolForEndpoint::Metrics getMetricsForHTTPConnectionPool()
|
||||
{
|
||||
return IHTTPConnectionPoolForEndpoint::Metrics{
|
||||
.created = ProfileEvents::HTTPConnectionsCreated,
|
||||
@ -142,7 +142,7 @@ IHTTPConnectionPoolForEndpoint::Metrics getMetricsForHTTPConnectionPool()
|
||||
}
|
||||
|
||||
|
||||
IHTTPConnectionPoolForEndpoint::Metrics getConnectionPoolMetrics(HTTPConnectionGroupType type)
|
||||
static IHTTPConnectionPoolForEndpoint::Metrics getConnectionPoolMetrics(HTTPConnectionGroupType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -779,7 +779,7 @@ struct Hasher
|
||||
}
|
||||
};
|
||||
|
||||
IExtendedPool::Ptr
|
||||
static IExtendedPool::Ptr
|
||||
createConnectionPool(ConnectionGroup::Ptr group, std::string host, UInt16 port, bool secure, ProxyConfiguration proxy_configuration)
|
||||
{
|
||||
if (secure)
|
||||
|
@ -172,7 +172,7 @@ struct HashTableCell
|
||||
const value_type & getValue() const { return key; }
|
||||
|
||||
/// Get the key (internally).
|
||||
static const Key & getKey(const value_type & value) { return value; }
|
||||
static const Key & getKey(const value_type & value) { return value; } /// NOLINT(bugprone-return-const-ref-from-parameter)
|
||||
|
||||
/// Are the keys at the cells equal?
|
||||
bool keyEquals(const Key & key_) const { return bitEquals(key, key_); }
|
||||
|
@ -50,7 +50,7 @@
|
||||
* After the call to keyHolderPersistKey(), must return the persistent key.
|
||||
*/
|
||||
template <typename Key>
|
||||
inline Key & ALWAYS_INLINE keyHolderGetKey(Key && key) { return key; }
|
||||
inline Key & ALWAYS_INLINE keyHolderGetKey(Key && key) { return key; } /// NOLINT(bugprone-return-const-ref-from-parameter)
|
||||
|
||||
/**
|
||||
* Make the key persistent. keyHolderGetKey() must return the persistent key
|
||||
|
@ -120,7 +120,7 @@ public:
|
||||
auto it = case_insensitive_name_mapping.find(Poco::toLower(name));
|
||||
if (it != case_insensitive_name_mapping.end())
|
||||
return it->second;
|
||||
return name;
|
||||
return name; /// NOLINT(bugprone-return-const-ref-from-parameter)
|
||||
}
|
||||
|
||||
~IFactoryWithAliases() override = default;
|
||||
|
@ -633,7 +633,7 @@ private:
|
||||
static const Interval & getInterval(const IntervalWithValue & interval_with_value)
|
||||
{
|
||||
if constexpr (is_empty_value)
|
||||
return interval_with_value;
|
||||
return interval_with_value; /// NOLINT(bugprone-return-const-ref-from-parameter)
|
||||
else
|
||||
return interval_with_value.first;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public:
|
||||
|
||||
// At least for long strings, the following should be fast. We could
|
||||
// do better by integrating the checks and the insertion.
|
||||
buffer.insert(unescaped.data(), unescaped.data() + i);
|
||||
buffer.insert(unescaped.data(), unescaped.data() + i); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
// We caught a control character if we enter this loop (slow).
|
||||
// Note that we are do not restart from the beginning, but rather we continue
|
||||
// from the point where we encountered something that requires escaping.
|
||||
|
@ -24,7 +24,7 @@ namespace OpenTelemetry
|
||||
{
|
||||
|
||||
/// This code can be executed inside fibers, we should use fiber local tracing context.
|
||||
thread_local FiberLocal<TracingContextOnThread> current_trace_context;
|
||||
thread_local static FiberLocal<TracingContextOnThread> current_trace_context;
|
||||
|
||||
bool Span::addAttribute(std::string_view name, UInt64 value) noexcept
|
||||
{
|
||||
|
@ -525,7 +525,7 @@ PageChunk * PageCache::getFreeChunk()
|
||||
PageChunk * chunk = &lru.front();
|
||||
lru.erase(lru.iterator_to(*chunk));
|
||||
|
||||
size_t prev_pin_count = chunk->pin_count.fetch_add(1);
|
||||
size_t prev_pin_count = chunk->pin_count.fetch_add(1); /// NOLINT(clang-analyzer-deadcode.DeadStores)
|
||||
chassert(prev_pin_count == 0);
|
||||
|
||||
evictChunk(chunk);
|
||||
@ -537,7 +537,7 @@ void PageCache::evictChunk(PageChunk * chunk)
|
||||
{
|
||||
if (chunk->key.has_value())
|
||||
{
|
||||
size_t erased = chunk_by_key.erase(chunk->key.value());
|
||||
size_t erased = chunk_by_key.erase(chunk->key.value()); /// NOLINT(clang-analyzer-deadcode.DeadStores)
|
||||
chassert(erased);
|
||||
chunk->key.reset();
|
||||
}
|
||||
|
@ -922,7 +922,7 @@ namespace ProfileEvents
|
||||
constexpr Event END = Event(__COUNTER__);
|
||||
|
||||
/// Global variable, initialized by zeros.
|
||||
Counter global_counters_array[END] {};
|
||||
static Counter global_counters_array[END] {};
|
||||
/// Initialize global counters statically
|
||||
Counters global_counters(global_counters_array);
|
||||
|
||||
|
@ -1287,9 +1287,9 @@ void QueryFuzzer::addTableLike(ASTPtr ast)
|
||||
if (table_like_map.size() > AST_FUZZER_PART_TYPE_CAP)
|
||||
{
|
||||
const auto iter = std::next(table_like.begin(), fuzz_rand() % table_like.size());
|
||||
const auto ast_del = *iter;
|
||||
table_like.erase(iter);
|
||||
const auto & ast_del = *iter;
|
||||
table_like_map.erase(ast_del.first);
|
||||
table_like.erase(iter);
|
||||
}
|
||||
|
||||
const auto name = ast->formatForErrorMessage();
|
||||
@ -1308,9 +1308,9 @@ void QueryFuzzer::addColumnLike(ASTPtr ast)
|
||||
if (column_like_map.size() > AST_FUZZER_PART_TYPE_CAP)
|
||||
{
|
||||
const auto iter = std::next(column_like.begin(), fuzz_rand() % column_like.size());
|
||||
const auto ast_del = *iter;
|
||||
column_like.erase(iter);
|
||||
const auto & ast_del = *iter;
|
||||
column_like_map.erase(ast_del.first);
|
||||
column_like.erase(iter);
|
||||
}
|
||||
|
||||
const auto name = ast->formatForErrorMessage();
|
||||
|
@ -53,13 +53,15 @@ private:
|
||||
template <typename ProfilerImpl>
|
||||
class QueryProfilerBase
|
||||
{
|
||||
friend ProfilerImpl;
|
||||
|
||||
public:
|
||||
QueryProfilerBase(UInt64 thread_id, int clock_type, UInt64 period, int pause_signal_);
|
||||
~QueryProfilerBase();
|
||||
|
||||
void setPeriod(UInt64 period_);
|
||||
|
||||
private:
|
||||
QueryProfilerBase(UInt64 thread_id, int clock_type, UInt64 period, int pause_signal_);
|
||||
void cleanup();
|
||||
|
||||
LoggerPtr log;
|
||||
|
@ -42,6 +42,11 @@ namespace DB
|
||||
template <typename Derived, typename MutexType = SharedMutex>
|
||||
class TSA_CAPABILITY("SharedMutexHelper") SharedMutexHelper
|
||||
{
|
||||
friend Derived;
|
||||
private:
|
||||
SharedMutexHelper() = default;
|
||||
SharedMutexHelper(const SharedMutexHelper&) = default;
|
||||
|
||||
public:
|
||||
// Exclusive ownership
|
||||
void lock() TSA_ACQUIRE() /// NOLINT
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include <sys/wait.h>
|
||||
#include <dlfcn.h>
|
||||
#include <unistd.h>
|
||||
#include <csignal>
|
||||
|
||||
#include <Common/logger_useful.h>
|
||||
#include <base/errnoToString.h>
|
||||
@ -154,6 +153,9 @@ std::unique_ptr<ShellCommand> ShellCommand::executeImpl(
|
||||
std::vector<std::unique_ptr<PipeFDs>> read_pipe_fds;
|
||||
std::vector<std::unique_ptr<PipeFDs>> write_pipe_fds;
|
||||
|
||||
read_pipe_fds.reserve(config.read_fds.size());
|
||||
write_pipe_fds.reserve(config.write_fds.size());
|
||||
|
||||
for (size_t i = 0; i < config.read_fds.size(); ++i)
|
||||
read_pipe_fds.emplace_back(std::make_unique<PipeFDs>());
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user