Fix pg_size changing from 3 to 2
This commit is contained in:
@@ -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);
|
||||
Reference in New Issue
Block a user