Do not die on invalid pool configurations

Vitaliy Filippov 2024-01-02 00:50:23 +03:00
parent 31c2751b9b
commit 9fe779a691
1 changed files with 6 additions and 2 deletions

View File

@ -1349,8 +1349,8 @@ class Mon
// Something has changed // Something has changed
console.log('Pool configuration or OSD tree changed, re-optimizing'); console.log('Pool configuration or OSD tree changed, re-optimizing');
// First re-optimize PGs, but don't look at history yet // First re-optimize PGs, but don't look at history yet
const optimize_results = await Promise.all(Object.keys(this.state.config.pools) const optimize_results = (await Promise.all(Object.keys(this.state.config.pools)
.map(pool_id => this.generate_pool_pgs(pool_id, osd_tree, levels))); .map(pool_id => this.generate_pool_pgs(pool_id, osd_tree, levels)))).filter(r => r);
// Then apply the modification in the form of an optimistic transaction, // Then apply the modification in the form of an optimistic transaction,
// each time considering new pg/history modifications (OSDs modify it during rebalance) // each time considering new pg/history modifications (OSDs modify it during rebalance)
while (!await this.apply_pool_pgs(optimize_results, up_osds, osd_tree, tree_hash)) while (!await this.apply_pool_pgs(optimize_results, up_osds, osd_tree, tree_hash))
@ -1436,6 +1436,10 @@ class Mon
async apply_pool_pgs(results, up_osds, osd_tree, tree_hash) async apply_pool_pgs(results, up_osds, osd_tree, tree_hash)
{ {
if (!results.length)
{
return true;
}
for (const pool_id in (this.state.config.pgs||{}).items||{}) for (const pool_id in (this.state.config.pgs||{}).items||{})
{ {
// We should stop all PGs when deleting a pool or changing its PG count // We should stop all PGs when deleting a pool or changing its PG count