mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 03:48:37 +08:00
enhance: Preallocate delete data slice to avoid growslice (#37043)
Related to #36887 Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
0d8f20f7ce
commit
5dd3f44cc1
@ -1183,8 +1183,9 @@ func (loader *segmentLoader) LoadDeltaLogs(ctx context.Context, segment Segment,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
blob := &storage.Blob{
|
blob := &storage.Blob{
|
||||||
Key: bLog.GetLogPath(),
|
Key: bLog.GetLogPath(),
|
||||||
Value: value,
|
Value: value,
|
||||||
|
RowNum: bLog.EntriesNum,
|
||||||
}
|
}
|
||||||
return blob, nil
|
return blob, nil
|
||||||
})
|
})
|
||||||
@ -1203,7 +1204,14 @@ func (loader *segmentLoader) LoadDeltaLogs(ctx context.Context, segment Segment,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
deltaData := &storage.DeleteData{}
|
rowNums := lo.SumBy(blobs, func(blob *storage.Blob) int64 {
|
||||||
|
return blob.RowNum
|
||||||
|
})
|
||||||
|
deltaData := &storage.DeleteData{
|
||||||
|
Pks: make([]storage.PrimaryKey, 0, rowNums),
|
||||||
|
Tss: make([]uint64, 0, rowNums),
|
||||||
|
}
|
||||||
|
|
||||||
reader, err := storage.CreateDeltalogReader(blobs)
|
reader, err := storage.CreateDeltalogReader(blobs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user