Skip to content

Commit

Permalink
Revert "Prepare slice id eagerly to have a stable and predictable wri…
Browse files Browse the repository at this point in the history
…te buffer usage" (juicedata#4720)
  • Loading branch information
davies authored Apr 17, 2024
1 parent 13b8fdc commit 3f65f05
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
3 changes: 0 additions & 3 deletions pkg/chunk/cached_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,6 @@ func (s *wSlice) upload(indx int) {
blen := s.blockSize(indx)
key := s.key(indx)
pages := s.pages[indx]
if pages == nil {
panic(fmt.Sprintf("block #%d is nil, concurrent upload?", indx))
}
s.pages[indx] = nil
s.pendings++

Expand Down
5 changes: 2 additions & 3 deletions pkg/vfs/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,6 @@ func (s *sliceWriter) write(ctx meta.Context, off uint32, data []uint8) syscall.
s.slen = off + uint32(len(data))
}
s.lastMod = time.Now()
if s.id == 0 {
go s.prepareID(ctx, false)
}
if s.slen == meta.ChunkSize {
s.freezed = true
go s.flushData()
Expand All @@ -148,6 +145,8 @@ func (s *sliceWriter) write(ctx meta.Context, off uint32, data []uint8) syscall.
logger.Warnf("write: chunk: %d off: %d %s", s.id, off, err)
return syscall.EIO
}
} else if int(off) <= f.w.blockSize {
go s.prepareID(ctx, false)
}
}
return 0
Expand Down

0 comments on commit 3f65f05

Please sign in to comment.