[#2234] writecache: Fix possible panic in initFlushMarks

In case we have many small objects in the write-cache, `indices` should
not be reused between iterations.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-02-14 09:23:24 +03:00 committed by fyrchik
parent 315141dc2c
commit d1d123d180
2 changed files with 2 additions and 0 deletions

View file

@ -46,6 +46,7 @@ func (c *cache) initFlushMarks() {
var batchSize = flushBatchSize
for {
m = m[:0]
indices = indices[:0]
// We put objects in batches of fixed size to not interfere with main put cycle a lot.
_ = c.db.View(func(tx *bbolt.Tx) error {