diff --git a/src/blockstore/blockstore.h b/src/blockstore/blockstore.h index b216ffb4..edf6afc9 100644 --- a/src/blockstore/blockstore.h +++ b/src/blockstore/blockstore.h @@ -187,7 +187,6 @@ public: // MUST be called only when nobody makes any modifications to the DB for this pool virtual void* reshard_start(pool_id_t pool, uint32_t pg_count, uint32_t pg_stripe_size, uint64_t chunk_limit) = 0; virtual bool reshard_continue(void *reshard_state, uint64_t chunk_limit) = 0; - virtual void reshard_abort(void *reshard_state) = 0; // Event loop virtual void loop() = 0; diff --git a/src/blockstore/blockstore_heap.cpp b/src/blockstore/blockstore_heap.cpp index a768c18e..7bb511f9 100644 --- a/src/blockstore/blockstore_heap.cpp +++ b/src/blockstore/blockstore_heap.cpp @@ -1080,16 +1080,6 @@ bool blockstore_heap_t::reshard_check(pool_id_t pool, uint32_t pg_count, uint32_ set_it->second.pg_stripe_size == pg_stripe_size); } -void blockstore_heap_t::reshard_abort(void* reshard_state) -{ - heap_reshard_state_t *st = (heap_reshard_state_t*)reshard_state; - for (auto sh_it = st->old_shards.begin(); sh_it != st->old_shards.end(); sh_it++) - { - block_index[sh_it->first] = std::move(sh_it->second); - } - delete st; -} - heap_entry_t *blockstore_heap_t::lock_and_read_entry(object_id oid) { auto obj = read_entry(oid); diff --git a/src/blockstore/blockstore_heap.h b/src/blockstore/blockstore_heap.h index ff753c29..30c208ae 100644 --- a/src/blockstore/blockstore_heap.h +++ b/src/blockstore/blockstore_heap.h @@ -248,7 +248,6 @@ public: void* reshard_start(pool_id_t pool, uint32_t pg_count, uint32_t pg_stripe_size, uint64_t chunk_limit); bool reshard_continue(void* reshard_state, uint64_t chunk_limit); bool reshard_check(pool_id_t pool, uint32_t pg_count, uint32_t pg_stripe_size); - void reshard_abort(void* reshard_state); void set_no_inode_stats(const std::vector & pool_ids); void recalc_inode_space_stats(uint64_t pool_id, bool per_inode); // read an object entry and lock it against removal diff --git a/src/blockstore/blockstore_impl.cpp b/src/blockstore/blockstore_impl.cpp index 258f7ce8..2c399088 100644 --- a/src/blockstore/blockstore_impl.cpp +++ b/src/blockstore/blockstore_impl.cpp @@ -406,8 +406,3 @@ bool blockstore_impl_t::reshard_continue(void *reshard_state, uint64_t chunk_lim { return heap->reshard_continue(reshard_state, chunk_limit); } - -void blockstore_impl_t::reshard_abort(void *reshard_state) -{ - return heap->reshard_abort(reshard_state); -} diff --git a/src/blockstore/blockstore_impl.h b/src/blockstore/blockstore_impl.h index a7036d6d..daade625 100644 --- a/src/blockstore/blockstore_impl.h +++ b/src/blockstore/blockstore_impl.h @@ -191,7 +191,6 @@ public: void* reshard_start(pool_id_t pool, uint32_t pg_count, uint32_t pg_stripe_size, uint64_t chunk_limit); bool reshard_continue(void *reshard_state, uint64_t chunk_limit); - void reshard_abort(void *reshard_state); // Event loop void loop(); diff --git a/src/blockstore/v1/impl.cpp b/src/blockstore/v1/impl.cpp index 15107a01..efb94fb6 100644 --- a/src/blockstore/v1/impl.cpp +++ b/src/blockstore/v1/impl.cpp @@ -480,17 +480,6 @@ resume_1: return true; } -void blockstore_impl_t::reshard_abort(void *reshard_state) -{ - bs_reshard_state_t *st = (bs_reshard_state_t*)reshard_state; - for (auto sh_it = st->old_shards.begin(); sh_it != st->old_shards.end(); sh_it++) - { - auto & to = clean_db_shards[sh_it->first]; - to.swap(sh_it->second); - } - delete st; -} - void blockstore_impl_t::process_list(blockstore_op_t *op) { uint32_t list_pg = op->pg_number+1; diff --git a/src/blockstore/v1/impl.h b/src/blockstore/v1/impl.h index 4ee8a612..47821db3 100644 --- a/src/blockstore/v1/impl.h +++ b/src/blockstore/v1/impl.h @@ -290,7 +290,6 @@ public: // Reshard database for a pool void* reshard_start(pool_id_t pool, uint32_t pg_count, uint32_t pg_stripe_size, uint64_t chunk_limit); bool reshard_continue(void *reshard_state, uint64_t chunk_limit); - void reshard_abort(void *reshard_state); // Event loop void loop(); diff --git a/src/osd/osd_cluster.cpp b/src/osd/osd_cluster.cpp index 7cf25a84..1097ae2b 100644 --- a/src/osd/osd_cluster.cpp +++ b/src/osd/osd_cluster.cpp @@ -809,21 +809,17 @@ again: goto again; } auto & pool_cfg = pool_it->second; - bool done = false; - if (pool_cfg.real_pg_count != pool_cfg.applied_pg_count || - pool_cfg.pg_stripe_size != pool_cfg.applied_pg_stripe_size) + bool done = bs->reshard_continue(pool_cfg.reshard_state, pg_reshard_chunk_size); + if (done && + (pool_cfg.real_pg_count != pool_cfg.applied_pg_count || + pool_cfg.pg_stripe_size != pool_cfg.applied_pg_stripe_size)) { // PG count changed again, reshard again - bs->reshard_abort(pool_cfg.reshard_state); pool_cfg.applied_pg_count = pool_cfg.real_pg_count; pool_cfg.applied_pg_stripe_size = pool_cfg.pg_stripe_size; pool_cfg.reshard_state = bs->reshard_start(pool_id, pool_cfg.real_pg_count, pool_cfg.pg_stripe_size, pg_reshard_chunk_size); done = !pool_cfg.reshard_state; } - else - { - done = bs->reshard_continue(pool_cfg.reshard_state, pg_reshard_chunk_size); - } if (done) { // Pool is resharded