Skip to content

Retention for Snapshot Lifecycle Management #43663

Closed
@dakrone

Description

@dakrone

SLM as a standalone snapshot taking tool is taking shape as described in #38461. However, to fully utilize SLM, we should implement retention for the snapshots that SLM takes.

Policy definition would change to something like:

PUT /_slm/policy/snapshot-every-day
{
  "schedule": "0 30 2 * * ?",
  "name": "<production-snap-{now/d}>",
  "repository": "my-s3-repository",
  "config": {
    "indices": ["foo-*", "important"]
  },
  // Newly configured retention options
  "retention": {
    // Snapshots should be deleted after 14 days
    "expire_after": "14d",
    // Keep a maximum of thirty snapshots
    "max_count": 30,
    // Keep a minimum of the four most recent snapshots
    "min_count": 4
  }
}

Snapshot retention would kick in based on a schedule (supporting cron expressions) and configured with the newly introduced slm.retention_schedule cluster setting. This would allow administrators to configure when snapshots are deleted (so as not to interfere with other cluster operations).

Potentially, SLM retention would need to cap the amount of time spent deleting snapshots (probably with another cluster setting) so long-running deletes don't cause issues with other cluster operations.

Potential list of snapshot conditions:

  • age-based retention (delete snapshots after N days)
  • minimum number of snapshots to keep
  • maximum number of snapshots to allow (delete oldest if there are too many)

Some things to work out

  • What should we do with FAILED/PARTIAL snapshots? Should they be treated as subject to retention? Separate retention?

For the first release, treating PARTIAL as failed and not eligible for retention

  • Are there retry policies for deletion, or should we wait for the next invocation of the retention task
  • Does the order of old snapshot deletion matter?

Oldest snapshots will be deleted first


Task Checklist

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions