From df6ccfa10471240095113822d2ee0028e98eeb50 Mon Sep 17 00:00:00 2001 From: SimFG Date: Fri, 30 Dec 2022 14:15:31 +0800 Subject: [PATCH] Fix wrong bool param in the `getDistribution` method (#21463) Signed-off-by: SimFG --- internal/querycoordv2/dist/dist_handler.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/querycoordv2/dist/dist_handler.go b/internal/querycoordv2/dist/dist_handler.go index a8c60c309f..b6218e486b 100644 --- a/internal/querycoordv2/dist/dist_handler.go +++ b/internal/querycoordv2/dist/dist_handler.go @@ -68,8 +68,8 @@ func (dh *distHandler) start(ctx context.Context) { logger.Info("close dist handelr") return case <-ticker.C: - dh.getDistribution(ctx, func(isSuccess bool) { - if !isSuccess { + dh.getDistribution(ctx, func(isFail bool) { + if isFail { failures++ node := dh.nodeManager.Get(dh.nodeID) if node != nil { @@ -207,7 +207,7 @@ func (dh *distHandler) updateLeaderView(resp *querypb.GetDataDistributionRespons dh.dist.LeaderViewManager.Update(resp.GetNodeID(), updates...) } -func (dh *distHandler) getDistribution(ctx context.Context, fn func(isSuccess bool)) { +func (dh *distHandler) getDistribution(ctx context.Context, fn func(isFail bool)) { dh.mu.Lock() defer dh.mu.Unlock() cctx, cancel := context.WithTimeout(ctx, distReqTimeout) @@ -218,15 +218,15 @@ func (dh *distHandler) getDistribution(ctx context.Context, fn func(isSuccess bo }) cancel() - isSuccess := err != nil || resp.GetStatus().GetErrorCode() != commonpb.ErrorCode_Success - if isSuccess { + isFail := err != nil || resp.GetStatus().GetErrorCode() != commonpb.ErrorCode_Success + if isFail { dh.logFailureInfo(resp, err) } else { dh.handleDistResp(resp) } if fn != nil { - fn(isSuccess) + fn(isFail) } }