]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: set bulk pool flag when creating data pool
authorMark Kogan <mkogan@redhat.com>
Mon, 15 May 2023 18:46:16 +0000 (18:46 +0000)
committerMark Kogan <mkogan@ibm.com>
Sun, 4 Jun 2023 08:49:47 +0000 (11:49 +0300)
fixes: https://tracker.ceph.com/issues/58692

Signed-off-by: Mark Kogan <mkogan@redhat.com>
(cherry picked from commit b904bbe7ab702fd559f40d1ab77e85c6813481d8)

src/rgw/driver/rados/rgw_rados.cc
src/rgw/driver/rados/rgw_rados.h
src/rgw/driver/rados/rgw_sal_rados.cc
src/rgw/driver/rados/rgw_tools.cc
src/rgw/driver/rados/rgw_tools.h

index 00bcc0ba5b02755790c560930b8c866bf32f0204..45157045beb3c8889aece8ba4d1bdf3a8abb34b9 100644 (file)
@@ -630,7 +630,7 @@ RGWDataSyncStatusManager* RGWRados::get_data_sync_manager(const rgw_zone_id& sou
 int RGWRados::get_required_alignment(const DoutPrefixProvider *dpp, const rgw_pool& pool, uint64_t *alignment)
 {
   IoCtx ioctx;
-  int r = open_pool_ctx(dpp, pool, ioctx, false);
+  int r = open_pool_ctx(dpp, pool, ioctx, false, true);
   if (r < 0) {
     ldpp_dout(dpp, 0) << "ERROR: open_pool_ctx() returned " << r << dendl;
     return r;
@@ -1400,10 +1400,10 @@ int RGWRados::open_notif_pool_ctx(const DoutPrefixProvider *dpp)
 }
 
 int RGWRados::open_pool_ctx(const DoutPrefixProvider *dpp, const rgw_pool& pool, librados::IoCtx& io_ctx,
-                           bool mostly_omap)
+                           bool mostly_omap, bool bulk)
 {
   constexpr bool create = true; // create the pool if it doesn't exist
-  return rgw_init_ioctx(dpp, get_rados_handle(), pool, io_ctx, create, mostly_omap);
+  return rgw_init_ioctx(dpp, get_rados_handle(), pool, io_ctx, create, mostly_omap, bulk);
 }
 
 /**** logs ****/
@@ -2380,7 +2380,7 @@ int RGWRados::get_obj_head_ioctx(const DoutPrefixProvider *dpp,
     return -EIO;
   }
 
-  int r = open_pool_ctx(dpp, pool, *ioctx, false);
+  int r = open_pool_ctx(dpp, pool, *ioctx, false, true);
   if (r < 0) {
     ldpp_dout(dpp, 0) << "ERROR: unable to open data-pool=" << pool.to_str() <<
       " for obj=" << obj << " with error-code=" << r << dendl;
@@ -6470,7 +6470,7 @@ int RGWRados::Object::Read::read(int64_t ofs, int64_t end,
     auto iter = state.io_ctxs.find(read_obj.pool);
     if (iter == state.io_ctxs.end()) {
       state.cur_ioctx = &state.io_ctxs[read_obj.pool];
-      r = store->open_pool_ctx(dpp, read_obj.pool, *state.cur_ioctx, false);
+      r = store->open_pool_ctx(dpp, read_obj.pool, *state.cur_ioctx, false, true);
       if (r < 0) {
         ldpp_dout(dpp, 20) << "ERROR: failed to open pool context for pool=" << read_obj.pool << " r=" << r << dendl;
         return r;
@@ -8086,7 +8086,7 @@ int RGWRados::pool_iterate_begin(const DoutPrefixProvider *dpp, const rgw_pool&
   librados::IoCtx& io_ctx = ctx.io_ctx;
   librados::NObjectIterator& iter = ctx.iter;
 
-  int r = open_pool_ctx(dpp, pool, io_ctx, false);
+  int r = open_pool_ctx(dpp, pool, io_ctx, false, false);
   if (r < 0)
     return r;
 
@@ -8100,7 +8100,7 @@ int RGWRados::pool_iterate_begin(const DoutPrefixProvider *dpp, const rgw_pool&
   librados::IoCtx& io_ctx = ctx.io_ctx;
   librados::NObjectIterator& iter = ctx.iter;
 
-  int r = open_pool_ctx(dpp, pool, io_ctx, false);
+  int r = open_pool_ctx(dpp, pool, io_ctx, false, false);
   if (r < 0)
     return r;
 
index 886ab16cce9b1dff091ffecd10d444f15916ddd7..14198ba48439529e1aa1df3fadb5192768c4318e 100644 (file)
@@ -352,7 +352,7 @@ class RGWRados
   int open_notif_pool_ctx(const DoutPrefixProvider *dpp);
 
   int open_pool_ctx(const DoutPrefixProvider *dpp, const rgw_pool& pool, librados::IoCtx&  io_ctx,
-                   bool mostly_omap);
+                   bool mostly_omap, bool bulk);
 
 
   ceph::mutex lock = ceph::make_mutex("rados_timer_lock");
index ef9941df94c6884a00a47987e1e3329f538e508d..9822f15a625fc34be314161d38df5ef0c1589026 100644 (file)
@@ -2952,7 +2952,7 @@ MPRadosSerializer::MPRadosSerializer(const DoutPrefixProvider *dpp, RadosStore*
   oid = raw_obj.oid;
   store->getRados()->get_obj_data_pool(obj->get_bucket()->get_placement_rule(),
                                       obj->get_obj(), &meta_pool);
-  store->getRados()->open_pool_ctx(dpp, meta_pool, ioctx, true);
+  store->getRados()->open_pool_ctx(dpp, meta_pool, ioctx, true, true);
 }
 
 int MPRadosSerializer::try_lock(const DoutPrefixProvider *dpp, utime_t dur, optional_yield y)
index 1c2951c4bcd172c09e7d6a953f888c21c3835e57..66651da5cc8ca7003ef6ba0957db7934c7047837 100644 (file)
@@ -21,7 +21,8 @@ using namespace std;
 int rgw_init_ioctx(const DoutPrefixProvider *dpp,
                    librados::Rados *rados, const rgw_pool& pool,
                    librados::IoCtx& ioctx, bool create,
-                  bool mostly_omap)
+                   bool mostly_omap,
+                   bool bulk)
 {
   int r = rados->ioctx_create(pool.name.c_str(), ioctx);
   if (r == -ENOENT && create) {
@@ -73,6 +74,18 @@ int rgw_init_ioctx(const DoutPrefixProvider *dpp,
                 << pool.name << dendl;
       }
     }
+    if (bulk) {
+      // set bulk
+      bufferlist inbl;
+      int r = rados->mon_command(
+        "{\"prefix\": \"osd pool set\", \"pool\": \"" +
+        pool.name + "\", \"var\": \"bulk\", \"val\": \"true\"}",
+        inbl, NULL, NULL);
+      if (r < 0) {
+        ldpp_dout(dpp, 10) << __func__ << " warning: failed to set 'bulk' on "
+                 << pool.name << dendl;
+      }
+    }
   } else if (r < 0) {
     return r;
   }
index d96912cb866bea9b27c57b74882b101bb4c79f27..66600856d162e40bd71fcbce4221101b82ec9d9a 100644 (file)
@@ -25,8 +25,9 @@ struct obj_version;
 int rgw_init_ioctx(const DoutPrefixProvider *dpp,
                    librados::Rados *rados, const rgw_pool& pool,
                    librados::IoCtx& ioctx,
-                  bool create = false,
-                  bool mostly_omap = false);
+                   bool create = false,
+                   bool mostly_omap = false,
+                   bool bulk = false);
 
 #define RGW_NO_SHARD -1