Split large Etcd operations while altering segment info (#20278)

/kind bug

issue: #20275
Signed-off-by: Yuchen Gao <yuchen.gao@zilliz.com>

Signed-off-by: Yuchen Gao <yuchen.gao@zilliz.com>
This commit is contained in:
Ten Thousand Leaves 2022-11-03 11:01:35 +08:00 committed by GitHub
parent 94aafb50c9
commit 9751bec04c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,7 +113,14 @@ func (kc *Catalog) AlterSegments(ctx context.Context, newSegments []*datapb.Segm
maps.Copy(kvs, segmentKvs)
}
return kc.Txn.MultiSave(kvs)
saveFn := func(partialKvs map[string]string) error {
return kc.Txn.MultiSave(partialKvs)
}
if err := etcd.SaveByBatch(kvs, saveFn); err != nil {
return err
}
return nil
}
func (kc *Catalog) AlterSegment(ctx context.Context, newSegment *datapb.SegmentInfo, oldSegment *datapb.SegmentInfo) error {