Why does thanos-compact exclude the recently producted block before compressing a block #6734
Replies: 2 comments 4 replies
-
If you read the comment 3 lines above, it says:
|
Beta Was this translation helpful? Give feedback.
-
@hanyuting8 I believe it is the same code as what we have in Prometheus https://github.com/prometheus/prometheus/blob/main/tsdb/compact.go#L221. And Thanos copies that algorithm directly.
As the comment says, it excludes the latest block (2h before now) from the compaction. So that even if anything goes wrong in the latest block, operators (or Prometheus admins) have 2h of time to fix or backup data if needed. Rather than compacting the latest block into a new one, which might cause bigger impact if things went wrong. I don't think it is 100% necessary. If you think it is safe for your own usecase, you can change the algorithm to include the latest block as Thanos code is 100% open source. But if you want to make a change to Thanos upstream code, it probably require some discussion with Prometheus community. Hope my answer clarifies. |
Beta Was this translation helpful? Give feedback.
-
Why does thanos-compact exclude the recently producted block before compressing a block.
Its corresponding code is the plan function in planner.go
metasByMinTime = metasByMinTime[:len(metasByMinTime)-1]
Beta Was this translation helpful? Give feedback.
All reactions