From bbf1de4645c257f6ef80dec5d01762f3f3809b5e Mon Sep 17 00:00:00 2001 From: Vlad <13818348+walldiss@users.noreply.github.com> Date: Thu, 10 Aug 2023 20:24:52 +0800 Subject: [PATCH] fix(share/eds): don't use in-memory buffer for mount after shard recover (#2554) When shard recovered in dagstore, it was read from in-memory mount, that could have been read 0 times and had no in-memory buffer. (cherry picked from commit 32834eb6722ec34450e7253cd164b705a81eb6d5) --- share/eds/store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/eds/store.go b/share/eds/store.go index 12993e8069..69e3c6b4a4 100644 --- a/share/eds/store.go +++ b/share/eds/store.go @@ -569,7 +569,7 @@ type inMemoryOnceMount struct { } func (m *inMemoryOnceMount) Fetch(ctx context.Context) (mount.Reader, error) { - if !m.readOnce.Swap(true) { + if m.buf != nil && !m.readOnce.Swap(true) { reader := &inMemoryReader{Reader: bytes.NewReader(m.buf.Bytes())} // release memory for gc, otherwise buffer will stick forever m.buf = nil