diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index d58c628efcf..f6d0d428578 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4143,6 +4143,8 @@ PGRef OSD::handle_pg_create_info(const OSDMapRef& osdmap, false, rctx.transaction); + pg->init_collection_pool_opts(); + if (pg->is_primary()) { Mutex::Locker locker(m_perf_queries_lock); pg->set_dynamic_perf_stats_queries(m_perf_queries); @@ -8785,6 +8787,8 @@ void OSD::split_pgs( child, split_bits); + child->init_collection_pool_opts(); + child->finish_split_stats(*stat_iter, rctx.transaction); child->unlock(); } diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 54795751fef..ac8ec080e39 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1142,6 +1142,9 @@ void PG::read_state(ObjectStore *store) recovery_state.set_role(-1); } + // init pool options + store->set_collection_opts(ch, pool.info.opts); + PeeringCtx rctx; handle_initialize(rctx); // note: we don't activate here because we know the OSD will advance maps @@ -3684,12 +3687,17 @@ void PG::handle_query_state(Formatter *f) } } -void PG::on_pool_change() +void PG::init_collection_pool_opts() { auto r = osd->store->set_collection_opts(ch, pool.info.opts); - if(r < 0 && r != -EOPNOTSUPP) { + if (r < 0 && r != -EOPNOTSUPP) { derr << __func__ << " set_collection_opts returns error:" << r << dendl; } +} + +void PG::on_pool_change() +{ + init_collection_pool_opts(); plpg_on_pool_change(); } diff --git a/src/osd/PG.h b/src/osd/PG.h index 02feda140f3..e393b7b20ed 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -395,6 +395,7 @@ public: void on_role_change() override; virtual void plpg_on_role_change() = 0; + void init_collection_pool_opts(); void on_pool_change() override; virtual void plpg_on_pool_change() = 0;