MarkCompacted marks the old blocks as compacted and adds the new blocks to the blocklist. No backend changes are made.
(tenantID string, oldBlocks, newBlocks []*backend.BlockMeta)
| 349 | |
| 350 | // MarkCompacted marks the old blocks as compacted and adds the new blocks to the blocklist. No backend changes are made. |
| 351 | func (rw *readerWriter) MarkBlocklistCompacted(tenantID string, oldBlocks, newBlocks []*backend.BlockMeta) error { |
| 352 | // Converted outgoing blocks into compacted entries. |
| 353 | newCompactions := make([]*backend.CompactedBlockMeta, 0, len(oldBlocks)) |
| 354 | for _, newBlock := range oldBlocks { |
| 355 | newCompactions = append(newCompactions, &backend.CompactedBlockMeta{ |
| 356 | BlockMeta: *newBlock, |
| 357 | CompactedTime: time.Now(), |
| 358 | }) |
| 359 | } |
| 360 | |
| 361 | rw.blocklist.Update(tenantID, newBlocks, oldBlocks, newCompactions, nil) |
| 362 | |
| 363 | return nil |
| 364 | } |
| 365 | |
| 366 | func markCompacted(rw *readerWriter, tenantID string, oldBlocks, newBlocks []*backend.BlockMeta) error { |
| 367 | // Check if we have any errors, but continue marking the blocks as compacted |