From 55f658ad78d847bec5546b52a4fdb34bdf8076a8 Mon Sep 17 00:00:00 2001 From: serxa Date: Wed, 4 Dec 2024 14:45:37 +0000 Subject: [PATCH] more fixes --- utils/merge-selector-lab/floatLayerMerges.js | 2 +- utils/merge-selector-lab/float_layer_merges.html | 1 + utils/merge-selector-lab/index.html | 1 + utils/merge-selector-lab/integerLayerMerges.js | 8 +++++--- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/utils/merge-selector-lab/floatLayerMerges.js b/utils/merge-selector-lab/floatLayerMerges.js index 6b6a40dead3..90c21e7e34f 100644 --- a/utils/merge-selector-lab/floatLayerMerges.js +++ b/utils/merge-selector-lab/floatLayerMerges.js @@ -77,7 +77,7 @@ export function* floatLayerMerges({insertPartSize, layerBases}) let best_layer = layerBases.length; const active_parts = mt.sortedActiveParts(); let prev_part = null; - for (let begin = 0; begin < active_parts.length - 2; begin++) + for (let begin = 0; begin <= active_parts.length - 2; begin++) { const begin_part = active_parts[begin]; if (begin_part.merging) diff --git a/utils/merge-selector-lab/float_layer_merges.html b/utils/merge-selector-lab/float_layer_merges.html index d686797ac71..f617cf4d024 100644 --- a/utils/merge-selector-lab/float_layer_merges.html +++ b/utils/merge-selector-lab/float_layer_merges.html @@ -1,6 +1,7 @@ + Merge Selector Lab diff --git a/utils/merge-selector-lab/index.html b/utils/merge-selector-lab/index.html index 1ee679743d6..f3c31311e90 100644 --- a/utils/merge-selector-lab/index.html +++ b/utils/merge-selector-lab/index.html @@ -1,6 +1,7 @@ + Merge Selector Lab diff --git a/utils/merge-selector-lab/integerLayerMerges.js b/utils/merge-selector-lab/integerLayerMerges.js index a8a16626911..692cfd52bc6 100644 --- a/utils/merge-selector-lab/integerLayerMerges.js +++ b/utils/merge-selector-lab/integerLayerMerges.js @@ -1,4 +1,4 @@ -function layerFuncForBases(insertPartSize, layerBases) +function layerFuncForIntegerBases(insertPartSize, layerBases) { let sizes = [insertPartSize]; for (const base of layerBases) @@ -37,7 +37,7 @@ function layerFuncForBases(insertPartSize, layerBases) // Lower layers get absolute priority over higher layers. export function* integerLayerMerges({insertPartSize, layerBases}) { - const layerFunc = layerFuncForBases(insertPartSize, layerBases); + const layerFunc = layerFuncForIntegerBases(insertPartSize, layerBases); const mt = yield {type: 'getMergeTree'}; const settings = { @@ -53,11 +53,13 @@ export function* integerLayerMerges({insertPartSize, layerBases}) let best_layer = Infinity; for (const cur_range of mt.getRangesForMerge()) { - for (let begin = 0; begin < cur_range.length - settings.min_parts; begin++) + for (let begin = 0; begin <= cur_range.length - settings.min_parts; begin++) { const layer = layerFunc(cur_range[begin].bytes); if (layer >= best_layer) continue; // We already have parts to merge on this layer + if (layer >= layerBases.length) + continue; // Merging futher not requested const base = layerBases[layer]; const end = begin + base; if (end > cur_range.length)