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 {
|
if err != nil {
|
||||||
return 0, 0, err
|
return 0, 0, err
|
||||||
}
|
}
|
||||||
idStart := typeutil.UniqueID(timestamp)
|
idEnd := typeutil.UniqueID(timestamp) + 1
|
||||||
idEnd := idStart + int64(count)
|
idStart := idEnd - int64(count)
|
||||||
return idStart, idEnd, nil
|
return idStart, idEnd, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,4 +49,16 @@ func TestGlobalTSOAllocator_All(t *testing.T) {
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, count, uint32(idEnd-idStart))
|
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
|
}, nil
|
||||||
}
|
}
|
||||||
// log.Printf("AllocTimestamp : %d", ts)
|
// log.Printf("AllocTimestamp : %d", ts)
|
||||||
|
|
||||||
|
//return first available time stamp
|
||||||
|
ts = ts - uint64(in.Count) + 1
|
||||||
return &rootcoordpb.AllocTimestampResponse{
|
return &rootcoordpb.AllocTimestampResponse{
|
||||||
Status: &commonpb.Status{
|
Status: &commonpb.Status{
|
||||||
ErrorCode: commonpb.ErrorCode_Success,
|
ErrorCode: commonpb.ErrorCode_Success,
|
||||||
|
|
|
@ -60,6 +60,9 @@ func executeTask(t reqTask) error {
|
||||||
case <-t.Ctx().Done():
|
case <-t.Ctx().Done():
|
||||||
return fmt.Errorf("context canceled")
|
return fmt.Errorf("context canceled")
|
||||||
case err := <-errChan:
|
case err := <-errChan:
|
||||||
|
if t.Core().ctx.Err() != nil || t.Ctx().Err() != nil {
|
||||||
|
return fmt.Errorf("context canceled")
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue