diff --git a/internal/querycoord/cluster.go b/internal/querycoord/cluster.go index 02879407e3..c0a361da68 100644 --- a/internal/querycoord/cluster.go +++ b/internal/querycoord/cluster.go @@ -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() } } } diff --git a/internal/querycoord/cluster_test.go b/internal/querycoord/cluster_test.go index f9fc9a05e8..9ea1d833dd 100644 --- a/internal/querycoord/cluster_test.go +++ b/internal/querycoord/cluster_test.go @@ -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)