Skip to main content
The mutation was accepted and keeps running. Only the synchronous wait gave up: mutations_sync = 2 asks the query to wait for every replica of the table, and one of them is not active. To wait only for the replicas that are running, use mutations_sync = 3.

The error

A statement such as
ends with:
The message names replicas of the table that are registered in ClickHouse Keeper but are not active at the moment. On a ReplicatedMergeTree table it does not have to name all of them, because the wait stops at the first inactive replica.

What happened to the mutation

The server creates the mutation first and waits afterwards. When the wait cannot be completed, the mutation is neither cancelled nor rolled back: the active replicas apply it, and an inactive replica applies it when it becomes active again. Do not submit the statement again because of this error. That would create a second mutation. Check the progress instead:

Which statements wait for replicas

Three settings control the wait, one for each kind of statement: They take the same values: Because lightweight_deletes_sync is 2 by default in self-managed ClickHouse, a plain DELETE FROM on a replicated table ends with this error whenever a replica is inactive, although you did not change any setting. With alter_sync = 2 the query first waits for the inactive replicas for replication_wait_for_inactive_replica_timeout seconds (120 by default). Then it fails with the same error code and a different message: Timeout exceeded while waiting for replicas ... to process entry ... Probably some replicas are inactive.

Wait only for the active replicas

Set the value 3 for the setting that matches the statement:
The query returns when all replicas that are active have applied the change, and it does not fail because of the others. You can also set the value for the session or in a settings profile. If it is enough that the server you are connected to has applied the change, use 1.
On ReplicatedMergeTree tables, the value 3 waits only for the active replicas starting from ClickHouse 26.10. In 26.9 it behaved like 2, and in earlier versions it did not wait at all.

Bring back or remove the inactive replica

In self-managed ClickHouse, an inactive replica is a server that is stopped or cannot reach ClickHouse Keeper, a detached table, or a replica that was decommissioned without removing its registration. The replica_is_active column of system.replicas maps every replica of a table to 1 or 0:
Start the replica again, or, if it will never come back, remove its registration with SYSTEM DROP REPLICA.

ClickHouse Cloud

With the ClickHouse Cloud defaults listed above, a statement waits for all replicas only if a query, a session, a settings profile or a client tool sets the value 2. Replicas in ClickHouse Cloud are not always running. Services idle, and in a warehouse several services with their own replicas share the same tables and the same ClickHouse Keeper. The warehouses page describes a related case, in which CREATE, RENAME and DROP DATABASE queries can be blocked by idle or stopped services. If the replicas named in the error message are not running at the moment, use the value 3: the statement waits for the replicas that are running, and the others apply the change when they become active.