Fix pg_size changing from 3 to 2

This commit is contained in:
Vitaliy Filippov
2022-01-03 17:56:54 +03:00
parent 5473d5b4a2
commit 08e467270a
2 changed files with 49 additions and 13 deletions
+27
View File
@@ -0,0 +1,27 @@
// Copyright (c) Vitaliy Filippov, 2019+
// License: VNPL-1.1 (see README.md for details)
const LPOptimizer = require('./lp-optimizer.js');
const osd_tree = {
100: { 1: 1 },
200: { 2: 1 },
300: { 3: 1 },
};
async function run()
{
let res;
console.log('16 PGs, size=3');
res = await LPOptimizer.optimize_initial({ osd_tree, pg_size: 3, pg_count: 16 });
LPOptimizer.print_change_stats(res, false);
console.log('\nChanging size to 2');
res = await LPOptimizer.optimize_change({ prev_pgs: res.int_pgs, osd_tree, pg_size: 2 });
LPOptimizer.print_change_stats(res, false);
if (res.space < 3*14/16)
{
throw new Error('Redistribution failed');
}
}
run().catch(console.error);