From 00e874f76a5802ee13dc12c6ddad29bbc9282c92 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 9 Dec 2019 13:48:20 +0100 Subject: [PATCH] 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 --- src/osd/OSD.cc | 4 ++++ src/osd/PG.cc | 12 ++++++++++-- src/osd/PG.h | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index a421c9b50b0..a73cb509b0f 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 ebbf71ff19a..dafdbdc657c 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 28a2507aa2d..e031650dd90 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; -- 2.47.3