Skip to content

Commit

Permalink
enhance: Send flush signal when the water level reaches the high wate…
Browse files Browse the repository at this point in the history
…rmark (milvus-io#34907)

issue: milvus-io#30633

Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
  • Loading branch information
xiaocai2333 authored Jul 23, 2024
1 parent 575ce91 commit 260a6e2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/datanode/compaction/clustering_compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (t *clusteringCompactionTask) init() error {
segIDAlloc := allocator.NewLocalAllocator(t.plan.GetPreAllocatedSegments().GetBegin(), t.plan.GetPreAllocatedSegments().GetEnd())
t.logIDAlloc = logIDAlloc
t.segIDAlloc = segIDAlloc

var pkField *schemapb.FieldSchema
if t.plan.Schema == nil {
return merr.WrapErrIllegalCompactionPlan("empty schema in compactionPlan")
Expand Down Expand Up @@ -616,7 +616,7 @@ func (t *clusteringCompactionTask) mappingSegment(
pack: pack,
id: clusterBuffer.id,
}
} else if currentBufferTotalMemorySize > t.getMemoryBufferBlockFlushThreshold() && !t.hasSignal.Load() {
} else if currentBufferTotalMemorySize > t.getMemoryBufferHighWatermark() && !t.hasSignal.Load() {
// reach flushBinlog trigger threshold
log.Debug("largest buffer need to flush",
zap.Int64("currentBufferTotalMemorySize", currentBufferTotalMemorySize))
Expand All @@ -640,8 +640,8 @@ func (t *clusteringCompactionTask) mappingSegment(
default:
// currentSize := t.getCurrentBufferWrittenMemorySize()
currentSize := t.getBufferTotalUsedMemorySize()
if currentSize < t.getMemoryBufferBlockFlushThreshold() {
log.Debug("memory is already below the block watermark, continue writing",
if currentSize < t.getMemoryBufferHighWatermark() {
log.Debug("memory is already below the high watermark, continue writing",
zap.Int64("currentSize", currentSize))
break loop
}
Expand Down Expand Up @@ -693,7 +693,7 @@ func (t *clusteringCompactionTask) getMemoryBufferLowWatermark() int64 {
}

func (t *clusteringCompactionTask) getMemoryBufferHighWatermark() int64 {
return int64(float64(t.memoryBufferSize) * 0.9)
return int64(float64(t.memoryBufferSize) * 0.7)
}

func (t *clusteringCompactionTask) getMemoryBufferBlockFlushThreshold() int64 {
Expand Down

0 comments on commit 260a6e2

Please sign in to comment.