mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
fix: write ahead buffer unittest failure (#45978)
issue: #45977 Signed-off-by: chyezh <chyezh@outlook.com>
This commit is contained in:
parent
f62297db92
commit
10a781d22c
@ -98,6 +98,7 @@ func (w *WriteAheadBuffer) ReadFromExclusiveTimeTick(ctx context.Context, timeti
|
|||||||
}
|
}
|
||||||
return &WriteAheadBufferReader{
|
return &WriteAheadBufferReader{
|
||||||
nextOffset: nextOffset,
|
nextOffset: nextOffset,
|
||||||
|
lastTimeTick: timetick,
|
||||||
snapshot: snapshot,
|
snapshot: snapshot,
|
||||||
underlyingBuf: w,
|
underlyingBuf: w,
|
||||||
}, nil
|
}, nil
|
||||||
|
|||||||
@ -104,6 +104,9 @@ func TestWriteAheadBuffer(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
if rand.Int31n(2) == 0 {
|
||||||
|
time.Sleep(20 * time.Millisecond)
|
||||||
|
}
|
||||||
r1, err := wb.ReadFromExclusiveTimeTick(context.Background(), 1)
|
r1, err := wb.ReadFromExclusiveTimeTick(context.Background(), 1)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.NotNil(t, r1)
|
assert.NotNil(t, r1)
|
||||||
@ -130,7 +133,7 @@ func TestWriteAheadBuffer(t *testing.T) {
|
|||||||
|
|
||||||
// Read from half of the timetick
|
// Read from half of the timetick
|
||||||
<-ch
|
<-ch
|
||||||
assert.Equal(t, totalCnt, len(timeticks))
|
assert.Equal(t, totalCnt, len(timeticks)+1)
|
||||||
|
|
||||||
targetTimeTickIdx := len(timeticks) / 2
|
targetTimeTickIdx := len(timeticks) / 2
|
||||||
for targetTimeTickIdx < len(timeticks) && timeticks[targetTimeTickIdx+1] == timeticks[targetTimeTickIdx] {
|
for targetTimeTickIdx < len(timeticks) && timeticks[targetTimeTickIdx+1] == timeticks[targetTimeTickIdx] {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user