Skip to content

Commit

Permalink
Lightning: Skip apply ioworkers when seek(0, io.SeekCurrent) (pingcap…
Browse files Browse the repository at this point in the history
  • Loading branch information
xuanyu66 authored Nov 19, 2024
1 parent cfa52d0 commit 0e3efb6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/lightning/mydump/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ func (pr PooledReader) Read(p []byte) (n int, err error) {

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

0 comments on commit 0e3efb6

Please sign in to comment.