Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Add logging for cache reset
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesGuthrie committed Oct 3, 2022
1 parent fac8f09 commit c498b09
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/pgmodel/ingestor/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,17 @@ func (p *pgxDispatcher) runSeriesEpochSync() {

func (p *pgxDispatcher) refreshSeriesEpoch(existingEpoch *model.SeriesEpoch) (*model.SeriesEpoch, error) {
dbEpoch, err := p.getServerEpoch()
log.Info("msg", "Refreshing series cache epoch")
if err != nil {
log.Info("msg", "An error occurred refreshing, will reset series and inverted labels caches")
// Trash the cache just in case an epoch change occurred, seems safer
p.scache.Reset()
// Also trash the inverted labels cache, which can also be invalidated when the series cache is
p.invertedLabelsCache.Reset()
return nil, err
}
if existingEpoch == nil || *dbEpoch != *existingEpoch {
log.Info("msg", "The local epoch is no longer up-to-date, will reset series and inverted labels caches")
p.scache.Reset()
// If the series cache needs to be invalidated, so does the inverted labels cache
p.invertedLabelsCache.Reset()
Expand Down

0 comments on commit c498b09

Please sign in to comment.