code: func (db *DB) CleanTombstones() (err error) {
  	db.cmtx.Lock()
  	defer db.cmtx.Unlock()
  
  	start := time.Now()
  	defer db.metrics.tombCleanTimer.Observe(time.Since(start).Seconds())
  
  	newUIDs := []ulid.ULID{}
  	defer func() {
  		// If any error is caused, we need to delete all the new directory created.
  		if err != nil {
  			for _, uid := range newUIDs {
  				dir := filepath.Join(db.Dir(), uid.String())
  				if err := os.RemoveAll(dir); err != nil {
  					level.Error(db.logger).Log("msg", "failed to delete block after failed `CleanTombstones`", "dir", dir, "err", err)
  				}
  			}
  		}
  	}()
  
  	db.mtx.RLock()
  	blocks := db.blocks[:]
  	db.mtx.RUnlock()
  
  	for _, b := range blocks {
  		if uid, er := b.CleanTombstones(db.Dir(), db.compactor); er != nil {
  			err = errors.Wrapf(er, "clean tombstones: %s", b.Dir())
  			return err
  		} else if uid != nil { // New block was created.
  			newUIDs = append(newUIDs, *uid)
  		}
  	}
  	return errors.Wrap(db.reload(), "reload blocks")
  }
docs: // CleanTombstones re-writes any blocks with tombstones.