From 67edaa82133a4bef1760c7227c6f306864a708ef Mon Sep 17 00:00:00 2001 From: Mark Holt <135143369+mh0lt@users.noreply.github.com> Date: Wed, 16 Oct 2024 15:38:42 +0100 Subject: [PATCH] Dont reopen idx with refs (#12346) It looks like the closeIdx function here will close indexes while they are referenced by transactions. This adds a check to stop that. --- turbo/snapshotsync/freezeblocks/block_snapshots.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/turbo/snapshotsync/freezeblocks/block_snapshots.go b/turbo/snapshotsync/freezeblocks/block_snapshots.go index b7d44c1e304..aabeb4d88e7 100644 --- a/turbo/snapshotsync/freezeblocks/block_snapshots.go +++ b/turbo/snapshotsync/freezeblocks/block_snapshots.go @@ -354,6 +354,10 @@ func (s *DirtySegment) reopenIdxIfNeed(dir string, optimistic bool) (err error) } func (s *DirtySegment) reopenIdx(dir string) (err error) { + if s.refcount.Load() > 0 { + return nil + } + s.closeIdx() if s.Decompressor == nil { return nil