mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
volume: find a non-empty offset when binary searching by timestamp
fix https://github.com/chrislusf/seaweedfs/issues/2364
This commit is contained in:
parent
84d2e1bdd0
commit
b530f12327
|
@ -194,6 +194,16 @@ func (v *Volume) BinarySearchByAppendAtNs(sinceNs uint64) (offset Offset, isLast
|
||||||
err = fmt.Errorf("read entry %d: %v", m, err)
|
err = fmt.Errorf("read entry %d: %v", m, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
for ; offset.IsZero() && m < h; m++ {
|
||||||
|
offset, err = v.readOffsetFromIndex(m)
|
||||||
|
if err != nil {
|
||||||
|
err = fmt.Errorf("read entry %d: %v", m, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if offset.IsZero() {
|
||||||
|
return Offset{}, true, nil
|
||||||
|
}
|
||||||
|
|
||||||
mNs, nsReadErr := v.readAppendAtNs(offset)
|
mNs, nsReadErr := v.readAppendAtNs(offset)
|
||||||
if nsReadErr != nil {
|
if nsReadErr != nil {
|
||||||
|
|
Loading…
Reference in a new issue