enhance: Set the timeout for SyncSegments based on the number of segments (#34228)

issue: #32809 

master pr: #34226

Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
pull/34277/head
cai.zhang 2024-06-28 14:18:06 +08:00 committed by GitHub
parent 9cb3658d74
commit 85aa929749
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -217,7 +217,8 @@ func (c *SessionManagerImpl) SyncSegments(nodeID int64, req *datapb.SyncSegments
zap.Int64("nodeID", nodeID),
zap.Int64("planID", req.GetPlanID()),
)
ctx, cancel := context.WithTimeout(context.Background(), Params.DataCoordCfg.CompactionRPCTimeout.GetAsDuration(time.Second))
timeout := Params.DataCoordCfg.CompactionRPCTimeout.GetAsDuration(time.Second) * time.Duration(max(len(req.GetSegmentInfos())/10, 1))
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
cli, err := c.getClient(ctx, nodeID)
if err != nil {
@ -226,7 +227,7 @@ func (c *SessionManagerImpl) SyncSegments(nodeID int64, req *datapb.SyncSegments
}
err = retry.Do(context.Background(), func() error {
ctx, cancel := context.WithTimeout(context.Background(), Params.DataCoordCfg.CompactionRPCTimeout.GetAsDuration(time.Second))
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
resp, err := cli.SyncSegments(ctx, req)

View File

@ -3148,10 +3148,10 @@ During compaction, the size of segment # of rows is able to exceed segment max #
p.ChannelCheckpointMaxLag.Init(base.mgr)
p.SyncSegmentsInterval = ParamItem{
Key: "dataCoord.sync.interval",
Version: "2.4.3",
Key: "dataCoord.syncSegmentsInterval",
Version: "2.4.6",
Doc: "The time interval for regularly syncing segments",
DefaultValue: "600", // 10 * 60 seconds
DefaultValue: "300", // 5 * 60 seconds
}
p.SyncSegmentsInterval.Init(base.mgr)