From: Sage Weil Date: Mon, 9 Dec 2019 12:48:20 +0000 (+0100) Subject: mimic: osd: set collection pool opts on collection create, pg load X-Git-Tag: v13.2.9~62^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F32125%2Fhead;p=ceph.git mimic: 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 a421c9b50b040..a73cb509b0f8f 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4201,6 +4201,8 @@ PGRef OSD::handle_pg_create_info(const OSDMapRef& osdmap, false, rctx.transaction); + pg->init_collection_pool_opts(); + pg->handle_initialize(&rctx); pg->handle_activate_map(&rctx); @@ -8526,6 +8528,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 ebbf71ff19a7a..dafdbdc657c70 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -3795,6 +3795,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 @@ -6526,14 +6529,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 28a2507aa2d95..e031650dd9040 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -3010,6 +3010,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;