Skip to content

Commit ff90e89

Browse files
authored
Added section on Cleaner. (#3327)
* Added section on Cleaner. Signed-off-by: Peter Štibraný <[email protected]> * Clean white noise. Signed-off-by: Peter Štibraný <[email protected]>
1 parent 9348dec commit ff90e89

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

docs/blocks-storage/convert-stored-chunks-to-blocks.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Tools are:
2323
Looks for plan files, and distributes them to builders. Scheduler has global view of overall conversion progress.
2424
- [**Builder**](#builder)<br />
2525
Asks scheduler for next plan file to work on, fetches chunks, puts them into TSDB block, and uploads the block to the object store. It repeats this process until there are no more plans.
26+
- [**Cleaner**](#cleaner)<br />
27+
Cleaner asks scheduler for next plan file to work on, but instead of building the block, it actually **REMOVES CHUNKS** and **INDEX ENTRIES** from the Index database.
2628

2729
All tools start HTTP server (see `-server.http*` options) exposing the `/metrics` endpoint.
2830
All tools also start gRPC server (`-server.grpc*` options), but only Scheduler exposes services on it.
@@ -84,9 +86,28 @@ Builders are CPU intensive (decoding and merging chunks), and require fast disk
8486

8587
Builders's metrics have `cortex_blocksconvert_builder` prefix, and include total number of fetched chunks and their size, read position of the current plan and plan size, total number of written series and samples, number of chunks that couldn't be downloaded.
8688

89+
### Cleaner
90+
91+
Cleaner is similar to builder in that it asks scheduler for next plan to work on, but instead of building blocks, it actually **REMOVES CHUNKS and INDEX ENTRIES**. Use with caution.
92+
93+
Cleaner is started by using `blocksconvert -target=cleaner`. Like Builder, it needs Scheduler endpoint, Cortex schema file, index and chunk-store specific options. Note that Cleaner works with any index store supported by Cortex, not just BigTable.
94+
95+
- `-cleaner.scheduler-endpoint` – where to find scheduler
96+
- `-blocks-storage.*` – blocks storage configuration, used for downloading plan files
97+
- `-cleaner.plans-dir` – local directory to store plan file while it is being processed by Cleaner.
98+
- `-schema-config-file` – Cortex schema file.
99+
100+
Cleaner doesn't **scan** for index entries, but uses existing plan files to find chunks and index entries. For each series, Cleaner needs to download at least one chunk. This is because plan file doesn't contain label names and values, but chunks do. Cleaner will then delete all index entries associated with the series, and also all chunks.
101+
102+
**WARNING:** If both Builder and Cleaner run at the same time and use use the same Scheduler, **some plans will be handled by builder, and some by cleaner!** This will result in a loss of data!
103+
104+
Cleaner should only be deployed if no other Builder is running. Running multiple Cleaners at once is not supported, and will result in leftover chunks and index entries. Reason for this is that chunks can span multiple days, and chunk is fully deleted only when processing plan (day) when chunk started. Since cleaner also needs to download some chunks to be able to clean up all index entries, when using multiple cleaners, it can happen that cleaner processing older plans will delete chunks required to properly clean up data in newer plans. When using single cleaner only, this is not a problem, since scheduler sends plans to cleaner in time-reversed order.
105+
106+
**Note:** Cleaner is designed for use in very special cases, eg. when deleting chunks and index entries for a specific customer. If `blocksconvert` was used to convert ALL chunks to blocks, it is simpler to just drop the index and chunks database afterwards. In such case, Cleaner is not needed.
107+
87108
### Limitations
88109

89110
The `blocksconvert` toolset currently has the following limitations:
90111

91-
- Supports only BigTable for chunks index backend
112+
- Scanner supports only BigTable for chunks index backend, and cannot currently scan other databases.
92113
- Supports only chunks schema versions v9, v10 and v11

0 commit comments

Comments
 (0)