MCPcopy Create free account
hub / github.com/cortexproject/cortex / shouldCloseTSDB

Method shouldCloseTSDB

pkg/ingester/ingester.go:670–690  ·  view source on GitHub ↗

Checks if TSDB can be closed.

(idleTimeout time.Duration)

Source from the content-addressed store, hash-verified

668
669// Checks if TSDB can be closed.
670func (u *userTSDB) shouldCloseTSDB(idleTimeout time.Duration) tsdbCloseCheckResult {
671 if u.deletionMarkFound.Load() {
672 return tsdbTenantMarkedForDeletion
673 }
674
675 if !u.isIdle(time.Now(), idleTimeout) {
676 return tsdbNotIdle
677 }
678
679 // If head is not compacted, we cannot close this yet.
680 if u.Head().NumSeries() > 0 {
681 return tsdbNotCompacted
682 }
683
684 // Ensure that all blocks have been shipped.
685 if oldest := u.getOldestUnshippedBlockTime(); oldest > 0 {
686 return tsdbNotShipped
687 }
688
689 return tsdbIdle
690}
691
692// TSDBState holds data structures used by the TSDB storage engine
693type TSDBState struct {

Callers 1

Calls 4

isIdleMethod · 0.95
HeadMethod · 0.95
LoadMethod · 0.80

Tested by

no test coverage detected