From: Mark Kogan Date: Mon, 15 May 2023 18:46:16 +0000 (+0000) Subject: rgw: set bulk pool flag when creating data pool X-Git-Tag: v19.0.0~1132^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b904bbe7ab702fd559f40d1ab77e85c6813481d8;p=ceph.git rgw: set bulk pool flag when creating data pool fixes: https://tracker.ceph.com/issues/58692 Signed-off-by: Mark Kogan --- diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index 3b706cb86fb8..e281cd584950 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -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; @@ -1409,10 +1409,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 ****/ @@ -2389,7 +2389,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; @@ -6484,7 +6484,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; @@ -8111,7 +8111,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; @@ -8125,7 +8125,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; diff --git a/src/rgw/driver/rados/rgw_rados.h b/src/rgw/driver/rados/rgw_rados.h index 96244b15a4ab..5dfde0c0f3ee 100644 --- a/src/rgw/driver/rados/rgw_rados.h +++ b/src/rgw/driver/rados/rgw_rados.h @@ -359,7 +359,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")}; diff --git a/src/rgw/driver/rados/rgw_sal_rados.cc b/src/rgw/driver/rados/rgw_sal_rados.cc index 4ad65b99fc3b..2b8663a814b5 100644 --- a/src/rgw/driver/rados/rgw_sal_rados.cc +++ b/src/rgw/driver/rados/rgw_sal_rados.cc @@ -2959,7 +2959,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) diff --git a/src/rgw/driver/rados/rgw_tools.cc b/src/rgw/driver/rados/rgw_tools.cc index 1c2951c4bcd1..66651da5cc8c 100644 --- a/src/rgw/driver/rados/rgw_tools.cc +++ b/src/rgw/driver/rados/rgw_tools.cc @@ -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; } diff --git a/src/rgw/driver/rados/rgw_tools.h b/src/rgw/driver/rados/rgw_tools.h index d96912cb866b..66600856d162 100644 --- a/src/rgw/driver/rados/rgw_tools.h +++ b/src/rgw/driver/rados/rgw_tools.h @@ -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