]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
nautilus: osd: set collection pool opts on collection create, pg load 32123/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:43:51 +0000 (14:43 +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 3cf724f221c8135fde273d7be17a47f3d1115f11..c9d7843ba9d547e11aedcdc63388ffac653dd392 100644 (file)
@@ -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();
   }
index cd52976ffcb810ade08002a4d4c2f78655b4af3c..90d73a5d338e4b8c41b765627765e9c45f0a9608 100644 (file)
@@ -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;
index e14291f7653fa206656b3c198601f5ab125ebe99..4857250d073962691272d71da8a02b2b74f11ab0 100644 (file)
@@ -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;