# There can be different background processes which can hold the references to parts
# for a short period of time. To avoid flakyness we check that refcount became 1 at least once during long INSERT query.
# It proves that the INSERT query doesn't hold redundant references to parts.
while[[$counter -lt $retries]];do
query_result=$($CLICKHOUSE_CLIENT -q "SELECT name, active, refcount FROM system.parts WHERE database = '$CLICKHOUSE_DATABASE' AND table = 't_insert_storage_snapshot' FORMAT CSV")