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

Method getOldestUnshippedBlockTime

pkg/ingester/ingester.go:642–657  ·  view source on GitHub ↗

getOldestUnshippedBlockTime returns the unix timestamp with milliseconds precision of the oldest TSDB block not shipped to the storage yet, or 0 if all blocks have been shipped.

()

Source from the content-addressed store, hash-verified

640// getOldestUnshippedBlockTime returns the unix timestamp with milliseconds precision of the oldest
641// TSDB block not shipped to the storage yet, or 0 if all blocks have been shipped.
642func (u *userTSDB) getOldestUnshippedBlockTime() uint64 {
643 shippedBlocks := u.getCachedShippedBlocks()
644 oldestTs := uint64(0)
645
646 for _, b := range u.Blocks() {
647 if _, ok := shippedBlocks[b.Meta().ULID]; ok {
648 continue
649 }
650
651 if oldestTs == 0 || b.Meta().ULID.Time() < oldestTs {
652 oldestTs = b.Meta().ULID.Time()
653 }
654 }
655
656 return oldestTs
657}
658
659func (u *userTSDB) isIdle(now time.Time, idle time.Duration) bool {
660 lu := u.lastUpdate.Load()

Callers 2

shouldCloseTSDBMethod · 0.95

Calls 2

BlocksMethod · 0.95

Tested by

no test coverage detected