lib/storage: small code cleanups

This commit is contained in:
Aliaksandr Valialkin 2022-10-24 01:16:23 +03:00
parent 05512fdd74
commit 89a1108b1a
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1
2 changed files with 9 additions and 2 deletions

View file

@ -25,10 +25,12 @@ type blockStreamMerger struct {
func (bsm *blockStreamMerger) reset() {
bsm.Block = nil
for i := range bsm.bsrHeap {
bsm.bsrHeap[i] = nil
}
bsm.bsrHeap = bsm.bsrHeap[:0]
bsm.retentionDeadline = 0
bsm.nextBlockNoop = false
bsm.err = nil

View file

@ -859,7 +859,9 @@ func (pt *partition) ForceMergeAllParts() error {
return nil
}
// If len(pws) == 1, then the merge must run anyway. This allows removing the deleted series and performing de-duplication if needed.
// If len(pws) == 1, then the merge must run anyway.
// This allows applying the configured retention, removing the deleted series
// and performing de-duplication if needed.
if err := pt.mergePartsOptimal(pws, pt.stopCh); err != nil {
return fmt.Errorf("cannot force merge %d parts from partition %q: %w", len(pws), pt.name, err)
}
@ -1604,8 +1606,11 @@ func openParts(pathPrefix1, pathPrefix2, path string) ([]*partWrapper, error) {
continue
}
fn := fi.Name()
if fn == "tmp" || fn == "txn" || fn == "snapshots" {
if fn == "snapshots" {
// "snapshots" dir is skipped for backwards compatibility. Now it is unused.
continue
}
if fn == "tmp" || fn == "txn" {
// Skip special dirs.
continue
}