diff --git a/pkg/ingester/user_tsdb.go b/pkg/ingester/user_tsdb.go index c3459ad4bfe..bb553935090 100644 --- a/pkg/ingester/user_tsdb.go +++ b/pkg/ingester/user_tsdb.go @@ -630,5 +630,13 @@ func (u *userTSDB) computeOwnedSeries() int { } func (u *userTSDB) resetSymbolTable() { - u.symbolTable.Store(labels.NewSymbolTable()) + var st *labels.SymbolTable + if u.db != nil && u.db.Head() != nil { + // Compact all labels in head into one SymbolTable. + st = u.Head().RebuildSymbolTable() + } else { + st = labels.NewSymbolTable() + } + // Then use that for new series going forward. + u.symbolTable.Store(st) }