From 52fb48a33cf3b9a3c6cba6060d4dd2a1d8de6273 Mon Sep 17 00:00:00 2001 From: Xiaofan <83447078+xiaofan-luan@users.noreply.github.com> Date: Mon, 17 Apr 2023 02:14:31 -0700 Subject: [PATCH] Add more log when search result is empty (#23421) Signed-off-by: xiaofan-luan --- internal/proxy/task_scheduler.go | 2 -- internal/proxy/task_search.go | 7 +++---- internal/querynode/impl.go | 10 ++++++++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/internal/proxy/task_scheduler.go b/internal/proxy/task_scheduler.go index 7286dd5a7..46ecf850c 100644 --- a/internal/proxy/task_scheduler.go +++ b/internal/proxy/task_scheduler.go @@ -528,8 +528,6 @@ func (sched *taskScheduler) queryLoop() { if !sched.dqQueue.utEmpty() { t := sched.scheduleDqTask() go sched.processTask(t, sched.dqQueue) - } else { - log.Debug("query queue is empty ...") } } } diff --git a/internal/proxy/task_search.go b/internal/proxy/task_search.go index 5c96aeb3d..d01db60e8 100644 --- a/internal/proxy/task_search.go +++ b/internal/proxy/task_search.go @@ -409,7 +409,7 @@ func (t *searchTask) Execute(ctx context.Context) error { t.resultBuf = make(chan *internalpb.SearchResults, len(shard2Leaders)) t.toReduceResults = make([]*internalpb.SearchResults, 0, len(shard2Leaders)) if err := t.searchShardPolicy(ctx, t.shardMgr, t.searchShard, shard2Leaders); err != nil { - log.Warn("failed to do search", zap.String("Shards", fmt.Sprintf("%v", shard2Leaders)), zap.Error(err)) + log.Warn("failed to do search", zap.String("Shards", fmt.Sprintf("%v", shard2Leaders)), zap.Int64("msgId", t.ID()), zap.Error(err)) return err } return nil @@ -422,8 +422,7 @@ func (t *searchTask) Execute(ctx context.Context) error { cancel() } if searchErr != nil { - log.Warn("first search failed, updating shardleader caches and retry search", - zap.Error(searchErr)) + log.Warn("first search failed, updating shardleader caches and retry search", zap.Int64("msgId", t.ID()), zap.Error(searchErr)) globalMetaCache.DeprecateShardCache(t.collectionName) } return searchErr @@ -466,7 +465,7 @@ func (t *searchTask) PostExecute(ctx context.Context) error { metrics.SearchLabel).Observe(float64(tr.RecordSpan().Milliseconds())) if len(validSearchResults) <= 0 { - log.Ctx(ctx).Warn("search result is empty", zap.Int64("msgID", t.ID())) + log.Ctx(ctx).Warn("search result is empty", zap.String("collection", t.collectionName), zap.String("DSL", t.Dsl), zap.Int64("msgID", t.ID())) t.fillInEmptyResult(Nq) return nil diff --git a/internal/querynode/impl.go b/internal/querynode/impl.go index 3e1fd512c..45a344692 100644 --- a/internal/querynode/impl.go +++ b/internal/querynode/impl.go @@ -792,6 +792,16 @@ func (node *QueryNode) Search(ctx context.Context, req *querypb.SearchRequest) ( rateCol.Add(metricsinfo.SearchThroughput, float64(proto.Size(req))) metrics.QueryNodeExecuteCounter.WithLabelValues(strconv.FormatInt(Params.QueryNodeCfg.GetNodeID(), 10), metrics.SearchLabel).Add(float64(proto.Size(req))) } + + if ret.SlicedBlob == nil { + log.Ctx(ctx).Info("search result is empty", + zap.Strings("vChannels", req.GetDmlChannels()), + zap.Int64s("segmentIDs", req.GetSegmentIDs()), + zap.Int64("collection", req.Req.CollectionID), + zap.Strings("shard", req.DmlChannels), + zap.Bool("from shard leader", req.FromShardLeader), + zap.String("dsl", req.Req.Dsl)) + } return ret, nil } -- GitLab