Skip to content

Commit

Permalink
enhance:[cherry-pick]Send flush signal when the water level reaches t…
Browse files Browse the repository at this point in the history
…he high watermark (#34908)

issue: #30633 

master pr: #34907

Signed-off-by: Cai Zhang <[email protected]>
  • Loading branch information
xiaocai2333 authored Jul 23, 2024
1 parent 88da025 commit 6986dfd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/datanode/compaction/clustering_compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,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 @@ -632,8 +632,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 @@ -685,7 +685,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 6986dfd

Please sign in to comment.