Skip to content

Commit

Permalink
fix(share/eds): don't use in-memory buffer for mount after shard reco…
Browse files Browse the repository at this point in the history
…ver (#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.
  • Loading branch information
walldiss committed Aug 10, 2023
1 parent 426c337 commit 32834eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion share/eds/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 32834eb

Please sign in to comment.