From 2b4402c2814dc1c18c8c4627fa4af936d8572117 Mon Sep 17 00:00:00 2001 From: kpango Date: Wed, 7 Aug 2024 09:02:29 +0900 Subject: [PATCH] [DO NOT MERGE] [BUGFIX] v1.7.12 Last Agent's index correction process not enought Signed-off-by: kpango --- pkg/index/job/correction/service/corrector.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/index/job/correction/service/corrector.go b/pkg/index/job/correction/service/corrector.go index 0ea917a8fb7..d0c9ee39a3d 100644 --- a/pkg/index/job/correction/service/corrector.go +++ b/pkg/index/job/correction/service/corrector.go @@ -309,7 +309,12 @@ type vectorReplica struct { func (c *correct) checkConsistency(ctx context.Context, targetReplica *vectorReplica, targetAgentIdx int) error { // leftAgentAddrs is the agents' addr that hasn't been corrected yet. leftAgentAddrs := c.sortedByIndexCntAddrs[targetAgentIdx+1:] - + if len(leftAgentAddrs) == 0 { + if err := c.correctReplica(ctx, targetReplica, nil); err != nil { + return fmt.Errorf("failed to fix final agent's index replica: %w", err) + } + return nil + } // Vector with time after this should not be processed correctionStartTime, err := correctionStartTime(ctx) if err != nil { @@ -441,7 +446,7 @@ func (c *correct) correctReplica( if addr == targetReplica.addr { continue } - if slices.ContainsFunc(foundReplicas, func(replica *vectorReplica) bool { + if foundReplicas != nil && slices.ContainsFunc(foundReplicas, func(replica *vectorReplica) bool { return replica.addr == addr }) { continue