diff --git a/dockers/index/job/correction/Dockerfile b/dockers/index/job/correction/Dockerfile index 56eb6d3bca..b221f68b3c 100644 --- a/dockers/index/job/correction/Dockerfile +++ b/dockers/index/job/correction/Dockerfile @@ -89,9 +89,9 @@ LABEL maintainer="${MAINTAINER}" ENV APP_NAME index-correction -COPY --from=builder /usr/bin/${APP_NAME} /go/bin/${APP_NAME} +COPY --from=builder /usr/bin/${APP_NAME} /usr/bin/${APP_NAME} COPY --from=builder /tmp/config.yaml /etc/server/config.yaml USER nonroot:nonroot -ENTRYPOINT ["/go/bin/index-correction"] +ENTRYPOINT ["/usr/bin/index-correction"] diff --git a/pkg/index/job/correction/service/corrector.go b/pkg/index/job/correction/service/corrector.go index 0ea917a8fb..d0c9ee39a3 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