Skip to content

TSDB unloading #3258

@pstibrany

Description

@pstibrany

In some situations it is possible that ingester stops receiving data for a specific user. For example when user stops sending the data, but also when using shuffle-sharding and ingester stops being part of the shard for given user.

When no series are appended to TSDB for some time (defaults to 1h), Cortex will flush the TSDB head – which creates block and uploads it – but TSDB is still open. This consumes memory.

Ideally Cortex would close such TSDB and release the resources. However there are some problems:

  • If TSDB needs to be opened again, this will create a problem with metrics.
  • When querying data, ingester will return no results for given user. This may cause invalid results reported back, especially for "fresh" data (within "query store after" duration).
  • When ingester restarts, it reopens all TSDBs it finds on the disk.
  • More?

Problem with metrics is solveable by using multiple registries per user, and keeping old one around for aggregations to work properly.

Problem with querying can be solved by closing TSDB only after query-store-after period since last TSDB update. Ingester would need to know this value (or have similar flag).

Problem with restarts can be solved by simply deleting local TSDB for given user, when it TSDB is closed. This is safe as long as all blocks have been fully shipped to the long-term storage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions