Files
zooqueen 38c257c602 Hanzo Datastore overlay on ClickHouse 26.5.3.1
Real fork of ClickHouse/ClickHouse with the Hanzo overlay applied on top of the
26.5 release lineage (parent is upstream/26.5, so future upstream syncs are clean
3-way merges). Overlay: cmd/zap-bridge (:9999 ZAP duplex), Dockerfile.hanzo +
hanzoai/debian13 bases, hanzo/ config + schema, white-label hanzo-datastore
branding, arcd CI, hanzo-* packaging.

FOLLOW-UP: re-apply Phase-1 CMake decisions (single-binary ENABLE_DATASTORE_KEEPER=OFF;
disabled external engines) + full build on hanzo-build-linux-amd64.
2026-06-21 13:19:10 -07:00

78 lines
2.7 KiB
Bash

#!/bin/bash
# shellcheck source=./utils.lib
source /repo/tests/docker_scripts/utils.lib
function run_with_retry()
{
local retries="$1" && shift
local retry=0
until [ "$retry" -ge "$retries" ]; do
if "$@"; then
return
else
retry=$((retry + 1))
sleep 5
fi
done
echo "Command '$*' failed after $retries retries, exiting" >&2
return 1
}
function attach_gdb_to_clickhouse()
{
IS_ASAN=$(clickhouse local --query "SELECT count() FROM system.build_options WHERE name = 'CXX_FLAGS' AND position('sanitize=address' IN value)")
if [[ "$IS_ASAN" = "1" ]];
then
echo "ASAN build detected. Not using gdb since it disables LeakSanitizer detections"
else
# Set follow-fork-mode to parent, because we attach to clickhouse-server, not to watchdog
# and clickhouse-server can do fork-exec, for example, to run some bridge.
# Do not set nostop noprint for all signals, because some it may cause gdb to hang,
# explicitly ignore non-fatal signals that are used by server.
# Number of SIGRTMIN can be determined only in runtime.
RTMIN=$(kill -l SIGRTMIN)
# shellcheck disable=SC2016
echo "
set follow-fork-mode parent
handle SIGHUP nostop noprint pass
handle SIGINT nostop noprint pass
handle SIGQUIT nostop noprint pass
handle SIGPIPE nostop noprint pass
handle SIGTERM nostop noprint pass
handle SIGUSR1 nostop noprint pass
handle SIGUSR2 nostop noprint pass
handle SIG$RTMIN nostop noprint pass
info signals
# safeExit is called if graceful shutdown times out. Print stack traces in that case.
break safeExit
continue
backtrace full
info registers
p "top 1 KiB of the stack:"
p/x *(uint64_t[128]*)"'$sp'"
maintenance info sections
thread apply all backtrace full
disassemble /s
up
disassemble /s
up
disassemble /s
p \"done\"
detach
quit
" > script.gdb
# FIXME Hung check may work incorrectly because of attached gdb
# We cannot attach another gdb to get stacktraces if some queries hung
gdb -batch -command script.gdb -p "$(cat /var/run/clickhouse-server/clickhouse-server.pid)" | ts '%Y-%m-%d %H:%M:%S' >> /test_output/gdb.log &
sleep 5
# gdb will send SIGSTOP, spend some time loading debug info and then send SIGCONT, wait for it (up to send_timeout, 300s)
run_with_retry 60 clickhouse-client --query "SELECT 'Connected to clickhouse-server after attaching gdb'"
fi
}
# vi: ft=bash