Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
correct for delayed lastUpdate updates
Browse files Browse the repository at this point in the history
  • Loading branch information
replay committed Nov 13, 2019
1 parent 7044f44 commit 86655a9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions idx/cassandra/cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,17 @@ func (c *CasIdx) updateCassandra(now uint32, inMemory bool, archive idx.Archive,
return archive
}

func (c *CasIdx) Find(orgId uint32, pattern string, from int64) ([]idx.Node, error) {
// The lastUpdate timestamp does not get updated in the cassandra index every time when
// a data point is received, there can be a delay of up to c.updateInterval32. To avoid
// falsely excluding a metric based on its lastUpdate timestamp we offset the from time
// by updateInterval32, this way we err on the "too inclusive" side
if from > int64(c.updateInterval32) {
from -= int64(c.updateInterval32)
}
return c.MemoryIndex.Find(orgId, pattern, from)
}

func (c *CasIdx) rebuildIndex() {
log.Info("cassandra-idx: Rebuilding Memory Index from metricDefinitions in Cassandra")
pre := time.Now()
Expand Down

0 comments on commit 86655a9

Please sign in to comment.