Skip to content

Commit 31e8809

Browse files
backup: fix check flush (#671)
Signed-off-by: huanghaoyuanhhy <[email protected]>
1 parent ce835ca commit 31e8809

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

core/client/grpc.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -504,33 +504,33 @@ func (g *GrpcClient) checkFlush(ctx context.Context, segIDs []int64, flushTS uin
504504
ticker := time.NewTicker(time.Second)
505505
defer ticker.Stop()
506506

507-
select {
508-
case <-ctx.Done():
509-
return ctx.Err()
510-
case <-ticker.C:
511-
resp, err := g.srv.GetFlushState(ctx, &milvuspb.GetFlushStateRequest{
512-
SegmentIDs: segIDs,
513-
FlushTs: flushTS,
514-
CollectionName: ns.CollName(),
515-
})
516-
if err != nil {
517-
g.logger.Warn("get flush state failed, will retry", zap.Error(err))
518-
}
519-
if resp.GetFlushed() {
520-
return nil
521-
}
507+
for {
508+
select {
509+
case <-ctx.Done():
510+
return ctx.Err()
511+
case <-ticker.C:
512+
resp, err := g.srv.GetFlushState(ctx, &milvuspb.GetFlushStateRequest{
513+
SegmentIDs: segIDs,
514+
FlushTs: flushTS,
515+
CollectionName: ns.CollName(),
516+
})
517+
if err != nil {
518+
g.logger.Warn("get flush state failed, will retry", zap.Error(err))
519+
}
520+
if resp.GetFlushed() {
521+
return nil
522+
}
522523

523-
cost := time.Since(start)
524-
if cost > 30*time.Minute {
525-
g.logger.Warn("waiting for the flush to complete took too much time!",
526-
zap.Duration("cost", cost),
527-
zap.String("ns", ns.String()),
528-
zap.Int64s("segment_ids", segIDs),
529-
zap.Uint64("flush_ts", flushTS))
524+
cost := time.Since(start)
525+
if cost > 30*time.Minute {
526+
g.logger.Warn("waiting for the flush to complete took too much time!",
527+
zap.Duration("cost", cost),
528+
zap.String("ns", ns.String()),
529+
zap.Int64s("segment_ids", segIDs),
530+
zap.Uint64("flush_ts", flushTS))
531+
}
530532
}
531533
}
532-
533-
return errors.New("client: into an dead end, should not reach here")
534534
}
535535

536536
func (g *GrpcClient) ListCollections(ctx context.Context, db string) (*milvuspb.ShowCollectionsResponse, error) {

0 commit comments

Comments
 (0)