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 (celestiaorg#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 32834eb)
  • Loading branch information
walldiss committed Sep 22, 2023
1 parent 26fed8d commit bbf1de4
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 bbf1de4

Please sign in to comment.