mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-11 15:34:56 +00:00
app/vmselect/promql: increment key prefix for faster reset for rollup result cache
This commit is contained in:
parent
648d11b8e0
commit
cef010d5f7
1 changed files with 3 additions and 2 deletions
|
@ -165,7 +165,7 @@ var rollupResultCacheResets = metrics.NewCounter(`vm_cache_resets_total{type="pr
|
||||||
// ResetRollupResultCache resets rollup result cache.
|
// ResetRollupResultCache resets rollup result cache.
|
||||||
func ResetRollupResultCache() {
|
func ResetRollupResultCache() {
|
||||||
rollupResultCacheResets.Inc()
|
rollupResultCacheResets.Inc()
|
||||||
rollupResultCacheV.c.Reset()
|
atomic.AddUint64(&rollupResultCacheKeyPrefix, 1)
|
||||||
logger.Infof("rollupResult cache has been cleared")
|
logger.Infof("rollupResult cache has been cleared")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,10 +329,11 @@ var (
|
||||||
var tooBigRollupResults = metrics.NewCounter("vm_too_big_rollup_results_total")
|
var tooBigRollupResults = metrics.NewCounter("vm_too_big_rollup_results_total")
|
||||||
|
|
||||||
// Increment this value every time the format of the cache changes.
|
// Increment this value every time the format of the cache changes.
|
||||||
const rollupResultCacheVersion = 7
|
const rollupResultCacheVersion = 8
|
||||||
|
|
||||||
func marshalRollupResultCacheKey(dst []byte, expr metricsql.Expr, window, step int64, filters []storage.TagFilter) []byte {
|
func marshalRollupResultCacheKey(dst []byte, expr metricsql.Expr, window, step int64, filters []storage.TagFilter) []byte {
|
||||||
dst = append(dst, rollupResultCacheVersion)
|
dst = append(dst, rollupResultCacheVersion)
|
||||||
|
dst = encoding.MarshalUint64(dst, rollupResultCacheKeyPrefix)
|
||||||
dst = encoding.MarshalInt64(dst, window)
|
dst = encoding.MarshalInt64(dst, window)
|
||||||
dst = encoding.MarshalInt64(dst, step)
|
dst = encoding.MarshalInt64(dst, step)
|
||||||
dst = expr.AppendString(dst)
|
dst = expr.AppendString(dst)
|
||||||
|
|
Loading…
Reference in a new issue