From: Sage Weil Date: Mon, 9 Dec 2019 12:48:20 +0000 (+0100) Subject: nautilus: osd: set collection pool opts on collection create, pg load X-Git-Tag: v14.2.8~20^2~13^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=11811e612efdcb1f9138b8b22e0e580d53390324;p=ceph.git nautilus: osd: set collection pool opts on collection create, pg load We need to tell the ObjectStore's Collections what the pool options are for things like the bluestore compression mode and so on to take effect. Apply these - when we create new collections, due to a new pg or a split - when we start up and open an existing collection We already apply these changes when there is a pool change. (This is a manual backport of 512d89af9ac0d19df44dedc67fe349022c656907). Fixes: https://tracker.ceph.com/issues/40483 Signed-off-by: Sage Weil --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 3cf724f221c8..c9d7843ba9d5 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4757,6 +4757,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); @@ -9406,6 +9408,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 cd52976ffcb8..90d73a5d338e 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -4147,6 +4147,9 @@ void PG::read_state(ObjectStore *store) set_role(-1); } + // init pool options + store->set_collection_opts(ch, pool.info.opts); + PG::RecoveryCtx rctx(0, 0, 0, new ObjectStore::Transaction); handle_initialize(&rctx); // note: we don't activate here because we know the OSD will advance maps @@ -6992,14 +6995,19 @@ void PG::handle_query_state(Formatter *f) recovery_state.handle_event(q, 0); } -void PG::update_store_with_options() +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::update_store_with_options() +{ + init_collection_pool_opts(); +} + struct C_DeleteMore : public Context { PGRef pg; epoch_t epoch; diff --git a/src/osd/PG.h b/src/osd/PG.h index e14291f7653f..4857250d0739 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -3138,6 +3138,9 @@ protected: // abstract bits friend class FlushState; +public: + void init_collection_pool_opts(); +protected: virtual void on_role_change() = 0; virtual void on_pool_change() = 0; virtual void on_change(ObjectStore::Transaction *t) = 0;