From 358929d90d797592a35aaaf54b27670eeabcf730 Mon Sep 17 00:00:00 2001 From: Cai Zhang Date: Thu, 31 Oct 2024 11:18:00 +0800 Subject: [PATCH] Use ts as msgID for request Signed-off-by: Cai Zhang --- internal/proxy/task_scheduler.go | 8 ++------ internal/proxy/task_scheduler_test.go | 18 ------------------ 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/internal/proxy/task_scheduler.go b/internal/proxy/task_scheduler.go index 05a8199844f94..d36b9980533e9 100644 --- a/internal/proxy/task_scheduler.go +++ b/internal/proxy/task_scheduler.go @@ -177,18 +177,14 @@ func (queue *baseTaskQueue) Enqueue(t task) error { var id UniqueID if t.CanSkipAllocTimestamp() { ts = tsoutil.ComposeTS(time.Now().UnixMilli(), 0) - id, err = globalMetaCache.AllocID(t.TraceCtx()) - if err != nil { - return err - } } else { ts, err = queue.tsoAllocatorIns.AllocOne(t.TraceCtx()) if err != nil { return err } - // we always use same msg id and ts for now. - id = UniqueID(ts) } + // we always use same msg id and ts for now. + id = UniqueID(ts) t.SetTs(ts) t.SetID(id) diff --git a/internal/proxy/task_scheduler_test.go b/internal/proxy/task_scheduler_test.go index 9b16150b4cf5e..6952a931d690f 100644 --- a/internal/proxy/task_scheduler_test.go +++ b/internal/proxy/task_scheduler_test.go @@ -625,7 +625,6 @@ func TestTaskScheduler_SkipAllocTimestamp(t *testing.T) { collID: collID, consistencyLevel: commonpb.ConsistencyLevel_Eventually, }, nil) - mockMetaCache.EXPECT().AllocID(mock.Anything).Return(1, nil).Twice() t.Run("query", func(t *testing.T) { qt := &queryTask{ @@ -658,21 +657,4 @@ func TestTaskScheduler_SkipAllocTimestamp(t *testing.T) { err := queue.Enqueue(st) assert.NoError(t, err) }) - - mockMetaCache.EXPECT().AllocID(mock.Anything).Return(0, fmt.Errorf("mock error")).Once() - t.Run("failed", func(t *testing.T) { - st := &searchTask{ - SearchRequest: &internalpb.SearchRequest{ - Base: &commonpb.MsgBase{}, - }, - request: &milvuspb.SearchRequest{ - DbName: dbName, - CollectionName: collName, - UseDefaultConsistency: true, - }, - } - - err := queue.Enqueue(st) - assert.Error(t, err) - }) }