Skip to content

Commit

Permalink
avoid reset pool data
Browse files Browse the repository at this point in the history
  • Loading branch information
roseduan committed Sep 21, 2023
1 parent 581142a commit 0753d5a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func (seg *segment) writeToBuffer(data []byte, chunkBuffer *bytebufferpool.ByteB
}
}

// return the start position of the chunk, for reading.
// return the start position of the chunk, then the user can use it to read the data.
position := &ChunkPosition{
SegmentId: seg.id,
BlockNumber: seg.currentBlockNumber,
Expand Down Expand Up @@ -242,7 +242,6 @@ func (seg *segment) writeToBuffer(data []byte, chunkBuffer *bytebufferpool.ByteB
blockCount += 1
currBlockSize = (currBlockSize + chunkSize + chunkHeaderSize) % blockSize
}

position.ChunkSize = blockCount*chunkHeaderSize + dataSize
}

Expand Down Expand Up @@ -281,7 +280,6 @@ func (seg *segment) writeAll(data [][]byte) (positions []*ChunkPosition, err err
seg.currentBlockNumber = originBlockNumber
seg.currentBlockSize = originBlockSize
}
chunkBuffer.Reset()
bytebufferpool.Put(chunkBuffer)
}()

Expand Down Expand Up @@ -319,7 +317,6 @@ func (seg *segment) Write(data []byte) (pos *ChunkPosition, err error) {
seg.currentBlockNumber = originBlockNumber
seg.currentBlockSize = originBlockSize
}
chunkBuffer.Reset()
bytebufferpool.Put(chunkBuffer)
}()

Expand Down

0 comments on commit 0753d5a

Please sign in to comment.