diff --git a/pump/storage/vlog.go b/pump/storage/vlog.go index 76bfabca0..c33726a66 100644 --- a/pump/storage/vlog.go +++ b/pump/storage/vlog.go @@ -430,7 +430,11 @@ func (vlog *valueLog) scanRequests(start valuePointer, fn func(*request) error) }) } -// currently we only use this in NewAppend** to scan the record which not write to KV but in the value log, so it's OK to hold the vlog.filesLock lock +// scan visits binlogs in order starting from the specified position. +// There are two limitations to the usage of scan: +// 1. Binlogs added in new logFiles after scan starts are not visible, so don't assume +// that every single binlog added would be visited +// 2. If GC is running concurrently, logFiles may be closed and deleted, thus breaking the scanning. func (vlog *valueLog) scan(start valuePointer, fn func(vp valuePointer, record *Record) error) error { vlog.filesLock.RLock() fids := vlog.sortedFids()