]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mimic: osd: set collection pool opts on collection create, pg load 32125/head
authorSage Weil <sage@redhat.com>
Mon, 9 Dec 2019 12:48:20 +0000 (13:48 +0100)
committerDan van der Ster <daniel.vanderster@cern.ch>
Mon, 9 Dec 2019 13:42:10 +0000 (14:42 +0100)
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 <sage@redhat.com>
src/osd/OSD.cc
src/osd/PG.cc
src/osd/PG.h

index a421c9b50b040e87b83ca02bf592f59b644fdcc7..a73cb509b0f8f34772110c99d7528d0e94dc0ecb 100644 (file)
@@ -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();
   }
index ebbf71ff19a7aa06c37226d2e862e353428d188f..dafdbdc657c701566e4c1c6189d5a3e86c3ace3a 100644 (file)
@@ -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;
index 28a2507aa2d958f57bfb6d6e246edacaa2fb379a..e031650dd9040f5d70ab42fbbb72e88e19f97e5a 100644 (file)
@@ -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;