]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: set collection pool opts on collection create, pg load 29093/head
authorSage Weil <sage@redhat.com>
Wed, 17 Jul 2019 17:50:18 +0000 (12:50 -0500)
committerSage Weil <sage@redhat.com>
Wed, 17 Jul 2019 17:54:28 +0000 (12:54 -0500)
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.

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 d58c628efcf367c19ca4671488c96b6c5dd3054f..f6d0d428578e399a39eb2e37bfb2de2cae06c530 100644 (file)
@@ -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();
   }
index 54795751fefa4ce0e91efdb427d7ed4ea7e2d091..ac8ec080e39f0371f5c4fd505881f357227561a6 100644 (file)
@@ -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();
 }
 
index 02feda140f31fff1db520380967f6c575bd9d94b..e393b7b20edec148937384f806b6765856c6d6be 100644 (file)
@@ -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;