decrease stop max-tries back to default, do not clear old parts at shutdown

This commit is contained in:
Sema Checherinda 2022-11-28 15:39:22 +01:00
parent b1d11ce0e1
commit dc52a40c04
2 changed files with 1 additions and 27 deletions

View File

@ -131,13 +131,7 @@ function stop()
# Preserve the pid, since the server can hung after the PID will be deleted.
pid="$(cat /var/run/clickhouse-server/clickhouse-server.pid)"
# --max-tries is supported only since 22.12
if dpkg --compare-versions "$(clickhouse local -q 'select version()')" ge "22.12"; then
# Increase default waiting timeout for sanitizers and debug builds
clickhouse stop --max-tries 180 --do-not-kill && return
else
clickhouse stop --do-not-kill && return
fi
clickhouse stop --do-not-kill && return
# We failed to stop the server with SIGTERM. Maybe it hang, let's collect stacktraces.
kill -TERM "$(pidof gdb)" ||:

View File

@ -185,26 +185,6 @@ void StorageMergeTree::shutdown()
if (deduplication_log)
deduplication_log->shutdown();
try
{
/// We clear all old parts after stopping all background operations.
/// It's important, because background operations can produce temporary
/// parts which will remove themselves in their destructors. If so, we
/// may have race condition between our remove call and background
/// process.
/// Do not clear old parts in case when server is shutting down because it failed to start due to some exception.
if (Context::getGlobalContextInstance()->getApplicationType() == Context::ApplicationType::SERVER
&& Context::getGlobalContextInstance()->isServerCompletelyStarted())
clearOldPartsFromFilesystem(true);
}
catch (...)
{
/// Example: the case of readonly filesystem, we have failure removing old parts.
/// Should not prevent table shutdown.
tryLogCurrentException(log);
}
}