diff --git a/mon/PGUtil.js b/mon/PGUtil.js index b029b229..dbf55cce 100644 --- a/mon/PGUtil.js +++ b/mon/PGUtil.js @@ -8,7 +8,7 @@ module.exports = { function scale_pg_count(prev_pgs, prev_pg_history, new_pg_history, new_pg_count) { const old_pg_count = prev_pgs.length; - // Add all possibly intersecting PGs into the history of new PGs + // Add all possibly intersecting PGs to the history of new PGs if (!(new_pg_count % old_pg_count)) { // New PG count is a multiple of the old PG count @@ -16,7 +16,7 @@ function scale_pg_count(prev_pgs, prev_pg_history, new_pg_history, new_pg_count) for (let i = 0; i < new_pg_count; i++) { const old_i = Math.floor(new_pg_count / mul); - new_pg_history[i] = JSON.parse(JSON.stringify(prev_pg_history[1+old_i])); + new_pg_history[i] = prev_pg_history[old_i] ? JSON.parse(JSON.stringify(prev_pg_history[old_i])) : undefined; } } else if (!(old_pg_count % new_pg_count)) diff --git a/mon/mon.js b/mon/mon.js index bf7b79cf..33f63685 100644 --- a/mon/mon.js +++ b/mon/mon.js @@ -840,7 +840,7 @@ class Mon this.save_new_pgs_txn(etcd_request, pool_id, up_osds, prev_pgs, optimize_result.int_pgs, pg_history); } this.state.config.pgs.hash = tree_hash; - await this.save_pg_config(); + await this.save_pg_config(etcd_request); } else { diff --git a/src/osd_cluster.cpp b/src/osd_cluster.cpp index e61b4364..0f333d7e 100644 --- a/src/osd_cluster.cpp +++ b/src/osd_cluster.cpp @@ -802,11 +802,11 @@ void osd_t::report_pg_states() if (pg_it->second.state == PG_OFFLINE) { // Remove offline PGs after reporting their state - this->pgs.erase(pg_it); if (pg_it->second.scheme == POOL_SCHEME_JERASURE) { use_jerasure(pg_it->second.pg_size, pg_it->second.pg_size-pg_it->second.parity_chunks, false); } + this->pgs.erase(pg_it); } } }