MCPcopy
hub / github.com/grafana/tempo / TombstoneBlock

Method TombstoneBlock

tempodb/backend/local/compactor.go:43–60  ·  view source on GitHub ↗

TombstoneBlock renames meta.json → meta.deleted.json. Hides the block from BlockMeta lookups while data files remain until ClearBlock. Idempotent: a missing meta.json returns nil.

(blockID uuid.UUID, tenantID string)

Source from the content-addressed store, hash-verified

41// BlockMeta lookups while data files remain until ClearBlock. Idempotent:
42// a missing meta.json returns nil.
43func (rw *Backend) TombstoneBlock(blockID uuid.UUID, tenantID string) error {
44 if len(tenantID) == 0 {
45 return errors.New("empty tenant id")
46 }
47 if blockID == uuid.Nil {
48 return errors.New("empty block id")
49 }
50 keypath := rw.rootPath(backend.KeyPathForBlock(blockID, tenantID))
51 from := filepath.Join(keypath, backend.MetaName)
52 to := filepath.Join(keypath, backend.DeletedMetaName)
53 if err := os.Rename(from, to); err != nil {
54 if os.IsNotExist(err) {
55 return nil
56 }
57 return fmt.Errorf("failed to tombstone block %s: %w", blockID, err)
58 }
59 return nil
60}
61
62// ClearTombstonedBlocks removes block dirs containing meta.deleted.json.
63// Use at startup to clean up after a crash between TombstoneBlock and

Calls 3

rootPathMethod · 0.95
KeyPathForBlockFunction · 0.92
JoinMethod · 0.65