Improve wait_for_mutation check

Fast return if there isn't any mutation (it's likely it has finished already)
This commit is contained in:
Raúl Marín 2021-07-30 15:36:51 +02:00
parent 66e675e54e
commit be126cbbc5

View File

@ -10,7 +10,7 @@ function wait_for_mutation()
for i in {1..100}
do
sleep 0.1
if [[ $(${CLICKHOUSE_CLIENT} --query="SELECT min(is_done) FROM system.mutations WHERE database='$database' AND table='$table' AND mutation_id='$mutation_id'") -eq 1 ]]; then
if [[ $(${CLICKHOUSE_CLIENT} --query="SELECT min(is_done) + (count() == 0) FROM system.mutations WHERE database='$database' AND table='$table' AND mutation_id='$mutation_id'") -eq 1 ]]; then
break
fi