Skip to content

Commit 7723772

Browse files
authored
Lightning: Skip apply ioworkers when seek(0, io.SeekCurrent) (pingcap#57454) (pingcap#57930)
close pingcap#57413
1 parent 1e733c8 commit 7723772

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

br/pkg/lightning/mydump/reader.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ func (pr PooledReader) Read(p []byte) (n int, err error) {
187187

188188
// Seek implements io.Seeker
189189
func (pr PooledReader) Seek(offset int64, whence int) (int64, error) {
190-
if pr.ioWorkers != nil {
190+
// Seek(0, io.SeekCurrent) is used to get the current offset, which will not cause any Disk I/O.
191+
if pr.ioWorkers != nil && !(offset == 0 && whence == io.SeekCurrent) {
191192
w := pr.ioWorkers.Apply()
192193
defer pr.ioWorkers.Recycle(w)
193194
}

0 commit comments

Comments
 (0)