mirror of https://github.com/milvus-io/milvus.git
parent
7f99d9d714
commit
fac350cc58
|
@ -48,8 +48,8 @@ func (gia *GlobalIDAllocator) Alloc(count uint32) (typeutil.UniqueID, typeutil.U
|
|||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
idStart := typeutil.UniqueID(timestamp)
|
||||
idEnd := idStart + int64(count)
|
||||
idEnd := typeutil.UniqueID(timestamp) + 1
|
||||
idStart := idEnd - int64(count)
|
||||
return idStart, idEnd, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -49,4 +49,16 @@ func TestGlobalTSOAllocator_All(t *testing.T) {
|
|||
assert.Nil(t, err)
|
||||
assert.Equal(t, count, uint32(idEnd-idStart))
|
||||
})
|
||||
|
||||
t.Run("Alloc2", func(t *testing.T) {
|
||||
count1 := uint32(2 << 18)
|
||||
id1, err := gTestIDAllocator.allocator.GenerateTSO(count1)
|
||||
assert.Nil(t, err)
|
||||
|
||||
count2 := uint32(2 << 8)
|
||||
id2, err := gTestIDAllocator.allocator.GenerateTSO(count2)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, id2-id1, uint64(count2))
|
||||
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1750,6 +1750,9 @@ func (c *Core) AllocTimestamp(ctx context.Context, in *rootcoordpb.AllocTimestam
|
|||
}, nil
|
||||
}
|
||||
// log.Printf("AllocTimestamp : %d", ts)
|
||||
|
||||
//return first available time stamp
|
||||
ts = ts - uint64(in.Count) + 1
|
||||
return &rootcoordpb.AllocTimestampResponse{
|
||||
Status: &commonpb.Status{
|
||||
ErrorCode: commonpb.ErrorCode_Success,
|
||||
|
|
|
@ -60,6 +60,9 @@ func executeTask(t reqTask) error {
|
|||
case <-t.Ctx().Done():
|
||||
return fmt.Errorf("context canceled")
|
||||
case err := <-errChan:
|
||||
if t.Core().ctx.Err() != nil || t.Ctx().Err() != nil {
|
||||
return fmt.Errorf("context canceled")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue