Files
scylladb/tools
Botond Dénes c776550b58 Merge 'Add basic support for snapshot ttl to auto_snapshot and api' from Benny Halevy
The snapshot TTL is applied to the snapshot manifest.json as the `expires_at` attribute.
It will be used in the future by an external service like scylla-manager or siren to manage the snapshot life cycle.

In Scylla, it is used just to garbage collect orphaned snapshots that were not backed up and cleaned up in time.
A garbage collector thread was added to snapshot_ctl that cleans up the snapshot when it expires.

The series adds 2 paths setting the snapshot ttl:
- db/config: add auto_snapshot_ttl
- api, nodetool: add snapshot ttl option

The new functionality in Scylla is comparable to the corresponding features in Cassandra (comparison based on https://github.com/scylladb/scylladb/issues/13409):

1) Cassandra added in release 4.1 the auto_snapshot_ttl option which is described in [cassandra.apache.org/doc/latest/cassandra/configuration/cass_yaml_file.html#auto_snapshot_ttl](https://cassandra.apache.org/doc/latest/cassandra/configuration/cass_yaml_file.html#auto_snapshot_ttl)  as:
> Adds a time-to-live (TTL) to auto snapshots generated by table truncation or drop (when enabled). After the TTL is elapsed, the snapshot is automatically cleared.

The behavior is now the same in Scylla

> By default, auto snapshots do not have TTL

In scylla, existing clusters will have no auto_snapshot_ttl, however new clusters installed with the updated scylla.conf will have a default auto_snapshot_ttl of 10 days (864000 seconds)

> Accepted units: d (days), h (hours) or m (minutes)

The configuration option is always in seconds, no support for unit suffix.
TTL values passed to the api directly or via and nodetool can be optionally followed by 's' for seconds (the default), 'm' for minutes, 'h' for hours, or 'd' for days.

> [issues.apache.org/jira/browse/CASSANDRA-16789](https://issues.apache.org/jira/browse/CASSANDRA-16789), commit ad24942481 - add a thread that every minute checks to see if there are TTLed snapshots to be deleted, and also add support in nodetool.

In scylla, the background thread wakes up if there are scheduled expirations.
Clearing of expired snapshots on restart is not implemented yet.

> This is for automatically-created snapshots. Additionally, Cassandra added the ability to set a ttl on manually created snapshots by the nodetool snapshot command - by adding a --ttl ...option to that command.

The equivalent functionality is to pass a --ttl option when taking a snapshot.
There is no support to set a TTL on an existing snapshot (nor there is a plan to do so).

> `nodetool listsnapshots` was also updated to list the snapshots' TTLs. See [issues.apache.org/jira/browse/CASSANDRA-16789](https://issues.apache.org/jira/browse/CASSANDRA-16789), commit ad24942481.

TODO, see https://scylladb.atlassian.net/browse/SCYLLADB-1078

Fixes SCYLLADB-190
Fixes SCYLLADB-191
Fixes SCYLLADB-787
Fixes SCYLLADB-789

* New feature, no backport required

Closes scylladb/scylladb#28759

* github.com:scylladb/scylladb:
  db: snapshot-ctl: add cancel_expiration
  api, nodetool: add snapshot ttl option
  test/cqlpy/test_virtual_tables: add verfication of snapshot directory
  test/cqlpy/test_virtual_tables: consistenly pass a set of expected tables to verify_snapshots
  db: snapshot_ctl: add deletion of expired snapshots
  database: apply auto_snapshot_ttl
  db/config: add auto_snapshot_ttl
  db/config: make auto_snapshot live-updateable
2026-06-03 17:04:12 +03:00
..
2026-04-12 14:54:50 +03:00
2026-04-12 19:46:33 +03:00
2026-04-12 19:46:33 +03:00
2026-04-12 19:46:33 +03:00
2026-04-12 19:46:33 +03:00
2026-04-12 19:46:33 +03:00
2026-04-12 19:46:33 +03:00