enhance: compaction performance by remove paramtable get (#37882)

pr: #37163

Signed-off-by: yangxuan <xuan.yang@zilliz.com>
This commit is contained in:
XuanYang-cn 2024-11-28 10:38:37 +08:00 committed by GitHub
parent 165afbba91
commit 40fe656de9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -287,13 +287,14 @@ type SegmentWriter struct {
tsFrom typeutil.Timestamp
tsTo typeutil.Timestamp
pkstats *storage.PrimaryKeyStats
segmentID int64
partitionID int64
collectionID int64
sch *schemapb.CollectionSchema
rowCount *atomic.Int64
syncedSize *atomic.Int64
pkstats *storage.PrimaryKeyStats
segmentID int64
partitionID int64
collectionID int64
sch *schemapb.CollectionSchema
rowCount *atomic.Int64
syncedSize *atomic.Int64
maxBinlogSize uint64
}
func (w *SegmentWriter) GetRowNum() int64 {
@ -341,12 +342,12 @@ func (w *SegmentWriter) Finish() (*storage.Blob, error) {
}
func (w *SegmentWriter) IsFull() bool {
return w.writer.WrittenMemorySize() > paramtable.Get().DataNodeCfg.BinLogMaxSize.GetAsUint64()
return w.writer.WrittenMemorySize() > w.maxBinlogSize
}
func (w *SegmentWriter) FlushAndIsFull() bool {
w.writer.Flush()
return w.writer.WrittenMemorySize() > paramtable.Get().DataNodeCfg.BinLogMaxSize.GetAsUint64()
return w.writer.WrittenMemorySize() > w.maxBinlogSize
}
func (w *SegmentWriter) IsEmpty() bool {
@ -418,13 +419,14 @@ func NewSegmentWriter(sch *schemapb.CollectionSchema, maxCount int64, segID, par
tsFrom: math.MaxUint64,
tsTo: 0,
pkstats: stats,
sch: sch,
segmentID: segID,
partitionID: partID,
collectionID: collID,
rowCount: atomic.NewInt64(0),
syncedSize: atomic.NewInt64(0),
pkstats: stats,
sch: sch,
segmentID: segID,
partitionID: partID,
collectionID: collID,
rowCount: atomic.NewInt64(0),
syncedSize: atomic.NewInt64(0),
maxBinlogSize: paramtable.Get().DataNodeCfg.BinLogMaxSize.GetAsUint64(),
}
return &segWriter, nil