From 4cf9e14efa446d99e334e383de349187444abf31 Mon Sep 17 00:00:00 2001 From: kpango Date: Tue, 13 Dec 2022 21:10:50 +0900 Subject: [PATCH] fix Signed-off-by: kpango --- pkg/agent/core/ngt/service/ngt.go | 2 +- pkg/agent/core/ngt/service/ngt_test.go | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pkg/agent/core/ngt/service/ngt.go b/pkg/agent/core/ngt/service/ngt.go index 1169be2de7..54f29b0d63 100644 --- a/pkg/agent/core/ngt/service/ngt.go +++ b/pkg/agent/core/ngt/service/ngt.go @@ -831,7 +831,7 @@ func (n *ngt) CreateIndex(ctx context.Context, poolSize uint32) (err error) { wf := atomic.AddUint64(&n.wfci, 1) if wf > 1 { atomic.AddUint64(&n.wfci, ^uint64(0)) - log.Warnf("concurrent create index waiting detected this request will be ignored, concurrent: %d", wf) + log.Debugf("concurrent create index waiting detected this request will be ignored, concurrent: %d", wf) return nil } err = func() error { diff --git a/pkg/agent/core/ngt/service/ngt_test.go b/pkg/agent/core/ngt/service/ngt_test.go index 1ff7f48159..6052b9f351 100644 --- a/pkg/agent/core/ngt/service/ngt_test.go +++ b/pkg/agent/core/ngt/service/ngt_test.go @@ -18,6 +18,7 @@ package service import ( + "fmt" "context" "reflect" "sync" @@ -11493,13 +11494,14 @@ func Test_ngt_InsertUpsert(t *testing.T) { if count >= test.args.bulkSize { wg.Add(1) - go func() { + eg.Go(func()error{ defer wg.Done() err = n.CreateAndSaveIndex(ctx, test.args.poolSize) if err != nil { tt.Errorf("error creating index: %v", err) } - }() + return nil + }) count = 0 } } @@ -11525,13 +11527,14 @@ func Test_ngt_InsertUpsert(t *testing.T) { if count >= test.args.bulkSize { wgu.Add(1) - go func() { + eg.Go(func()error{ defer wgu.Done() err = n.CreateAndSaveIndex(ctx, test.args.poolSize) if err != nil { tt.Errorf("error creating index: %v", err) } - }() + return nil + }) count = 0 } } @@ -11548,9 +11551,9 @@ func Test_ngt_InsertUpsert(t *testing.T) { func createRandomData(num int) []index { result := make([]index, 0) f32s, _ := vector.GenF32Vec(vector.Gaussian, num, 128) - for _, vec := range f32s { + for idx, vec := range f32s { result = append(result, index{ - uuid: uuid.New().String(), + uuid: fmt.Sprintf("%s-%s:%d:%d,%d",uuid.New().String(), uuid.New().String(), idx, idx/100,idx%100), vec: vec, }) }