Update tsidCache comments, add a comment for testListDirEntrie

Signed-off-by: Artem Fetishev <rtm@victoriametrics.com>
This commit is contained in:
Artem Fetishev 2025-01-28 16:01:13 +01:00
parent 7215d23ab6
commit 2a35999eae
No known key found for this signature in database
GPG key ID: 6171AFD8802C7A69
2 changed files with 12 additions and 3 deletions

View file

@ -2313,13 +2313,20 @@ func createAllIndexesForMetricName(is *indexSearch, mn *MetricName, tsid *TSID,
}
func (s *Storage) putSeriesToCache(metricNameRaw []byte, genTSID *generationTSID, generation, date uint64) {
// Store the TSID for the current indexdb into cache,
// so future rows for that TSID are ingested via fast path.
// Store the TSID indexdb into cache, so future rows for that TSID are
// ingested via fast path.
//
// With partition index there is no need to store generation in this cache.
// We still need to put generation in cache to preserve the cache entry data
// format in order address cases when users, once tried partition index,
// decided to switch back to legacy monolithic index. Thus, we store 0
// generation.
genTSID.generation = 0
s.putTSIDToCache(genTSID, metricNameRaw)
// Register the (generation, date, metricID) entry in the cache,
// so next time the entry is found there instead of searching for it in the indexdb.
// so next time the entry is found there instead of searching for it in the
// indexdb.
s.dateMetricIDCache.Set(generation, date, genTSID.TSID.MetricID)
}

View file

@ -1662,6 +1662,8 @@ func testCountAllMetricNamesNoExtDB(is *indexSearch, tr TimeRange) int {
return len(metricNames)
}
// testListDirEntries returns the all paths inside `root` dir. The `root` dir
// itself and paths that start with `ignorePrefix` are omitted.
func testListDirEntries(t *testing.T, root string, ignorePrefix ...string) []string {
t.Helper()
var paths []string