diff --git a/internal/datanode/compaction/clustering_compactor.go b/internal/datanode/compaction/clustering_compactor.go index 0e4541c43e..4c37c81f04 100644 --- a/internal/datanode/compaction/clustering_compactor.go +++ b/internal/datanode/compaction/clustering_compactor.go @@ -857,7 +857,7 @@ func (t *clusteringCompactionTask) flushLargestBuffers(ctx context.Context) erro t.clusterBufferLocks.RUnlock(buffer.id) } sort.Slice(bufferIDs, func(i, j int) bool { - return bufferRowNums[i] > bufferRowNums[j] + return bufferRowNums[bufferIDs[i]] > bufferRowNums[bufferIDs[j]] }) log.Info("start flushLargestBuffers", zap.Ints("bufferIDs", bufferIDs), zap.Int64("currentMemorySize", currentMemorySize))