mirror of https://github.com/milvus-io/milvus.git
Use binlog size from meta when estimate SegmentSize (#13891)
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/11956/head
parent
8a63dba149
commit
55ab425010
|
@ -741,19 +741,8 @@ func estimateSegmentsSize(segments *querypb.LoadSegmentsRequest, kvClient kv.Dat
|
|||
|
||||
// get binlog size
|
||||
for _, binlogPath := range loadInfo.BinlogPaths {
|
||||
for _, path := range binlogPath.Binlogs {
|
||||
binlogSize, err := storage.EstimateMemorySize(kvClient, path.GetLogPath())
|
||||
if err != nil {
|
||||
binlogSize, err = storage.GetBinlogSize(kvClient, path.GetLogPath())
|
||||
if err != nil {
|
||||
log.Warn("estimate binlog size wrong",
|
||||
zap.Int64("segmentID", loadInfo.GetSegmentID()),
|
||||
zap.String("binlog path", path.GetLogPath()),
|
||||
zap.Error(err))
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
segmentSize += binlogSize
|
||||
for _, binlog := range binlogPath.Binlogs {
|
||||
segmentSize += binlog.GetLogSize()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -664,7 +664,7 @@ func TestEstimateSegmentSize(t *testing.T) {
|
|||
binlog := []*datapb.FieldBinlog{
|
||||
{
|
||||
FieldID: simpleConstField.id,
|
||||
Binlogs: []*datapb.Binlog{{LogPath: "^&^%*&%&&(*^*&"}},
|
||||
Binlogs: []*datapb.Binlog{{LogPath: "by-dev/rand/path", LogSize: 1024}},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -683,8 +683,8 @@ func TestEstimateSegmentSize(t *testing.T) {
|
|||
}
|
||||
|
||||
size, err := estimateSegmentsSize(loadReq, dataKV)
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, int64(0), size)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, int64(1024), size)
|
||||
|
||||
binlog, err = saveSimpleBinLog(baseCtx, schema, dataKV)
|
||||
assert.NoError(t, err)
|
||||
|
@ -693,7 +693,7 @@ func TestEstimateSegmentSize(t *testing.T) {
|
|||
|
||||
size, err = estimateSegmentsSize(loadReq, dataKV)
|
||||
assert.NoError(t, err)
|
||||
assert.NotEqual(t, int64(0), size)
|
||||
assert.NotEqual(t, int64(1024), size)
|
||||
|
||||
indexPath, err := generateIndex(defaultSegmentID)
|
||||
assert.NoError(t, err)
|
||||
|
|
Loading…
Reference in New Issue