From f09745f61318761c13b561f93ae7905ae78c1ad8 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 16 May 2023 11:50:15 -0700 Subject: [PATCH] lib/{mergeset,storage}: make it clear that DebugFlush() doesn't store all the recently ingested data to disk DebugFlush() makes sure that the recently ingested data becomes visible to search. Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4272 --- lib/mergeset/table.go | 9 +++++++-- lib/storage/storage.go | 9 ++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/mergeset/table.go b/lib/mergeset/table.go index a10ce4a586..4e77f7be8a 100644 --- a/lib/mergeset/table.go +++ b/lib/mergeset/table.go @@ -594,9 +594,14 @@ func (tb *Table) mergePartsOptimal(pws []*partWrapper) error { return nil } -// DebugFlush flushes all the added items to the storage, so they become visible to search. +// DebugFlush makes sure all the recently added data is visible to search. // -// This function is only for debugging and testing. +// Note: this function doesn't store all the in-memory data to disk - it just converts +// recently added items to searchable parts, which can be stored either in memory +// (if they are quite small) or to persistent disk. +// +// This function is for debugging and testing purposes only, +// since it may slow down data ingestion when used frequently. func (tb *Table) DebugFlush() { tb.flushPendingItems(nil, true) diff --git a/lib/storage/storage.go b/lib/storage/storage.go index c7d1bee8f0..e6b2aaba49 100644 --- a/lib/storage/storage.go +++ b/lib/storage/storage.go @@ -298,7 +298,14 @@ func (s *Storage) updateDeletedMetricIDs(metricIDs *uint64set.Set) { s.deletedMetricIDsUpdateLock.Unlock() } -// DebugFlush flushes recently added storage data, so it becomes visible to search. +// DebugFlush makes sure all the recently added data is visible to search. +// +// Note: this function doesn't store all the in-memory data to disk - it just converts +// recently added items to searchable parts, which can be stored either in memory +// (if they are quite small) or to persistent disk. +// +// This function is for debugging and testing purposes only, +// since it may slow down data ingestion when used frequently. func (s *Storage) DebugFlush() { s.tb.flushPendingRows() s.idb().tb.DebugFlush()