first_mutation_id=$($CLICKHOUSE_CLIENT --query "SELECT mutation_id FROM system.mutations where table='mutation_table' and database='$CLICKHOUSE_DATABASE'")
# Here we have long sleeps, but they shouldn't lead to flaps. We just check that
# background mutation finalization function will be triggered at least once. In
# rare cases this test doesn't check anything, but will report OK.
$CLICKHOUSE_CLIENT --query "SELECT is_done, parts_to_do FROM system.mutations where table='mutation_table' and database='$CLICKHOUSE_DATABASE' FORMAT TSVWithNames"
$CLICKHOUSE_CLIENT --query "SELECT type, new_part_name FROM system.replication_queue WHERE table='mutation_table' and database='$CLICKHOUSE_DATABASE'"
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS mutation_table"