<a id="automatic-repair"></a>

# Automatic Repair

Traditionally, launching [repairs](https://docs.scylladb.com/manual/branch-2026.4/operating-scylla/procedures/maintenance/repair.md) in a ScyllaDB cluster is left to an external process, typically done via [Scylla Manager](https://manager.docs.scylladb.com/stable/repair/index.html).

Automatic repair offers built-in scheduling in ScyllaDB itself. If the time since the start of the last successful repair of a tablet is greater than the configured repair interval, ScyllaDB will start a repair for the [tablet table](https://docs.scylladb.com/manual/branch-2026.4/architecture/tablets.md) automatically.
Repairs are spread over time and among nodes and shards, to avoid load spikes or any adverse effects on user workloads.

## Configuring with CQL

Automatic repair is controlled by two [cluster configuration options](https://docs.scylladb.com/manual/branch-2026.4/cql/cluster-config.md):

* `auto_repair_enabled` (boolean): whether tablets of a table are scheduled for automatic repair.
* `auto_repair_threshold_in_seconds` (integer, seconds): a tablet becomes eligible for automatic repair when this
  much time has passed since the start of its last successful repair. A repair restricted to some hosts or
  datacenters does not count, and a tablet that was never repaired is eligible immediately. `0` disables
  time-based automatic repair at that scope.

Both can be set for the whole cluster, for a keyspace, or for a single table. A value set for a table
overrides the keyspace value, which overrides the cluster value:

```cql
ALTER CLUSTER WITH auto_repair_enabled = true;
ALTER CLUSTER WITH auto_repair_threshold_in_seconds = 86400;
ALTER KEYSPACE ks WITH auto_repair_enabled = false;
ALTER TABLE ks.important WITH auto_repair_enabled = true AND auto_repair_threshold_in_seconds = 3600;
```

This enables automatic repair for every tablet table with a repair period of 1 day, turns it off for
keyspace `ks`, and turns it back on for `ks.important` with a repair period of 1 hour. The setting is
stored in the cluster schema, so it applies to every node without editing per-node configuration files.

Setting an option to `NULL` removes it from that scope, so the next broader scope applies again:

```cql
ALTER TABLE ks.important WITH auto_repair_threshold_in_seconds = NULL;
```

When an option is set at any scope, `DESCRIBE TABLE` and `DESCRIBE KEYSPACE` show its effective
value and which scope it comes from.

## Deprecated scylla.yaml options

Earlier releases configured automatic repair through two options in `scylla.yaml`:

```yaml
auto_repair_enabled_default: true
auto_repair_threshold_default_in_seconds: 86400
```

These options are deprecated and will be removed in a future release. They still apply when no
scope sets the corresponding CQL option, and a node that has them set logs a warning at startup.
A value set with `ALTER CLUSTER`, `ALTER KEYSPACE` or `ALTER TABLE` always takes precedence
over them. While the value comes from `scylla.yaml`, `DESCRIBE` shows nothing for the option;
query `system.config` on each node to see it.

To migrate, run the equivalent statements once from any node and then remove the options from
`scylla.yaml` on every node:

```cql
ALTER CLUSTER WITH auto_repair_enabled = true;
ALTER CLUSTER WITH auto_repair_threshold_in_seconds = 86400;
```

To disable automatic repair by default for the whole cluster, run `ALTER CLUSTER WITH auto_repair_enabled = false`.
A keyspace or table that stores its own `auto_repair_enabled = true` keeps automatic repair; set that
option to `NULL` at both the keyspace and table scopes to make it follow the cluster value again.

Automatic repair relies on [Incremental Repair](https://docs.scylladb.com/manual/branch-2026.4/features/incremental-repair.md) and as such it only works with [tablet](https://docs.scylladb.com/manual/branch-2026.4/architecture/tablets.md) tables.
