]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Thread optional_yield through RGWMetadataLog operations 52036/head
authorAdam C. Emerson <aemerson@redhat.com>
Mon, 12 Jun 2023 20:44:17 +0000 (16:44 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Tue, 13 Jun 2023 14:35:48 +0000 (10:35 -0400)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/rgw/driver/rados/rgw_metadata.cc
src/rgw/driver/rados/rgw_rest_log.cc
src/rgw/driver/rados/rgw_sync.cc
src/rgw/rgw_admin.cc
src/rgw/rgw_mdlog.h
src/rgw/services/svc_mdlog.cc
src/rgw/services/svc_mdlog.h
src/rgw/services/svc_meta_be_sobj.cc

index e3e49316eac5ea109b830a3812f39164f4e3a947..996f73e9abea79b509e634818d7e50c9b31a4721 100644 (file)
@@ -44,7 +44,7 @@ void rgw_shard_name(const string& prefix, unsigned shard_id, string& name)
   name = prefix + buf;
 }
 
-int RGWMetadataLog::add_entry(const DoutPrefixProvider *dpp, const string& hash_key, const string& section, const string& key, bufferlist& bl) {
+int RGWMetadataLog::add_entry(const DoutPrefixProvider *dpp, const string& hash_key, const string& section, const string& key, bufferlist& bl, optional_yield y) {
   if (!svc.zone->need_to_log_metadata())
     return 0;
 
@@ -54,7 +54,7 @@ int RGWMetadataLog::add_entry(const DoutPrefixProvider *dpp, const string& hash_
   rgw_shard_name(prefix, cct->_conf->rgw_md_log_max_shards, hash_key, oid, &shard_id);
   mark_modified(shard_id);
   real_time now = real_clock::now();
-  return svc.cls->timelog.add(dpp, oid, now, section, key, bl, null_yield);
+  return svc.cls->timelog.add(dpp, oid, now, section, key, bl, y);
 }
 
 int RGWMetadataLog::get_shard_id(const string& hash_key, int *shard_id)
@@ -98,7 +98,8 @@ int RGWMetadataLog::list_entries(const DoutPrefixProvider *dpp, void *handle,
                                 int max_entries,
                                 list<cls_log_entry>& entries,
                                 string *last_marker,
-                                bool *truncated) {
+                                bool *truncated,
+                                optional_yield y) {
   LogListCtx *ctx = static_cast<LogListCtx *>(handle);
 
   if (!max_entries) {
@@ -109,7 +110,7 @@ int RGWMetadataLog::list_entries(const DoutPrefixProvider *dpp, void *handle,
   std::string next_marker;
   int ret = svc.cls->timelog.list(dpp, ctx->cur_oid, ctx->from_time, ctx->end_time,
                                   max_entries, entries, ctx->marker,
-                                  &next_marker, truncated, null_yield);
+                                  &next_marker, truncated, y);
   if ((ret < 0) && (ret != -ENOENT))
     return ret;
 
@@ -124,14 +125,14 @@ int RGWMetadataLog::list_entries(const DoutPrefixProvider *dpp, void *handle,
   return 0;
 }
 
-int RGWMetadataLog::get_info(const DoutPrefixProvider *dpp, int shard_id, RGWMetadataLogInfo *info)
+int RGWMetadataLog::get_info(const DoutPrefixProvider *dpp, int shard_id, RGWMetadataLogInfo *info, optional_yield y)
 {
   string oid;
   get_shard_oid(shard_id, oid);
 
   cls_log_header header;
 
-  int ret = svc.cls->timelog.info(dpp, oid, &header, null_yield);
+  int ret = svc.cls->timelog.info(dpp, oid, &header, y);
   if ((ret < 0) && (ret != -ENOENT))
     return ret;
 
@@ -173,13 +174,13 @@ int RGWMetadataLog::get_info_async(const DoutPrefixProvider *dpp, int shard_id,
 }
 
 int RGWMetadataLog::trim(const DoutPrefixProvider *dpp, int shard_id, const real_time& from_time, const real_time& end_time,
-                         const string& start_marker, const string& end_marker)
+                         const string& start_marker, const string& end_marker, optional_yield y)
 {
   string oid;
   get_shard_oid(shard_id, oid);
 
   return svc.cls->timelog.trim(dpp, oid, from_time, end_time, start_marker,
-                               end_marker, nullptr, null_yield);
+                               end_marker, nullptr, y);
 }
   
 int RGWMetadataLog::lock_exclusive(const DoutPrefixProvider *dpp, int shard_id, timespan duration, string& zone_id, string& owner_id) {
index f4099807dadc7b1b9970249e3364669ac0a99202..c2e9b7cfa187d496cef3f4ddb714fdf1fa97a791 100644 (file)
@@ -91,7 +91,7 @@ void RGWOp_MDLog_List::execute(optional_yield y) {
   meta_log.init_list_entries(shard_id, {}, {}, marker, &handle);
 
   op_ret = meta_log.list_entries(this, handle, max_entries, entries,
-                                   &last_marker, &truncated);
+                                &last_marker, &truncated, y);
 
   meta_log.complete_list_entries(handle);
 }
@@ -166,7 +166,7 @@ void RGWOp_MDLog_ShardInfo::execute(optional_yield y) {
   }
   RGWMetadataLog meta_log{s->cct, static_cast<rgw::sal::RadosStore*>(driver)->svc()->zone, static_cast<rgw::sal::RadosStore*>(driver)->svc()->cls, period};
 
-  op_ret = meta_log.get_info(this, shard_id, &info);
+  op_ret = meta_log.get_info(this, shard_id, &info, y);
 }
 
 void RGWOp_MDLog_ShardInfo::send_response() {
@@ -232,7 +232,7 @@ void RGWOp_MDLog_Delete::execute(optional_yield y) {
   }
   RGWMetadataLog meta_log{s->cct, static_cast<rgw::sal::RadosStore*>(driver)->svc()->zone, static_cast<rgw::sal::RadosStore*>(driver)->svc()->cls, period};
 
-  op_ret = meta_log.trim(this, shard_id, {}, {}, {}, marker);
+  op_ret = meta_log.trim(this, shard_id, {}, {}, {}, marker, y);
 }
 
 void RGWOp_MDLog_Lock::execute(optional_yield y) {
index 262e00ba9dc20634c854c1673a92403e9a6f74a6..dfd79194b8cdd6ed61e94e7ce7cccc134ac0bcf2 100644 (file)
@@ -390,7 +390,7 @@ protected:
 
     mdlog->init_list_entries(shard_id, from_time, end_time, marker, &handle);
 
-    int ret = mdlog->list_entries(dpp, handle, max_entries, entries, &marker, &truncated);
+    int ret = mdlog->list_entries(dpp, handle, max_entries, entries, &marker, &truncated, null_yield);
 
     mdlog->complete_list_entries(handle);
 
index eddb2e791d780b53dba89336703a0883dbcd3b98..0e393bc35974f4c4fb7a0c266d6b74e03c0f759b 100644 (file)
@@ -8786,7 +8786,7 @@ next:
       meta_log->init_list_entries(i, {}, {}, marker, &handle);
       bool truncated;
       do {
-         int ret = meta_log->list_entries(dpp(), handle, 1000, entries, NULL, &truncated);
+       int ret = meta_log->list_entries(dpp(), handle, 1000, entries, NULL, &truncated, null_yield);
         if (ret < 0) {
           cerr << "ERROR: meta_log->list_entries(): " << cpp_strerror(-ret) << std::endl;
           return -ret;
@@ -8832,7 +8832,7 @@ next:
 
     for (; i < g_ceph_context->_conf->rgw_md_log_max_shards; i++) {
       RGWMetadataLogInfo info;
-      meta_log->get_info(dpp(), i, &info);
+      meta_log->get_info(dpp(), i, &info, null_yield);
 
       ::encode_json("info", info, formatter.get());
 
@@ -8911,7 +8911,7 @@ next:
 
     // trim until -ENODATA
     do {
-      ret = meta_log->trim(dpp(), shard_id, {}, {}, {}, marker);
+      ret = meta_log->trim(dpp(), shard_id, {}, {}, {}, marker, null_yield);
     } while (ret == 0);
     if (ret < 0 && ret != -ENODATA) {
       cerr << "ERROR: meta_log->trim(): " << cpp_strerror(-ret) << std::endl;
index 6a6fb67d17a4e444599384d8167f76281cfa9634..152126890b75bda270d8763a42b4ba5d017ce2c6 100644 (file)
@@ -102,7 +102,7 @@ public:
     oid = prefix + buf;
   }
 
-  int add_entry(const DoutPrefixProvider *dpp, const std::string& hash_key, const std::string& section, const std::string& key, bufferlist& bl);
+  int add_entry(const DoutPrefixProvider *dpp, const std::string& hash_key, const std::string& section, const std::string& key, bufferlist& bl, optional_yield y);
   int get_shard_id(const std::string& hash_key, int *shard_id);
   int store_entries_in_shard(const DoutPrefixProvider *dpp, std::list<cls_log_entry>& entries, int shard_id, librados::AioCompletion *completion);
 
@@ -128,10 +128,11 @@ public:
                    int max_entries,
                    std::list<cls_log_entry>& entries,
                   std::string *out_marker,
-                  bool *truncated);
+                  bool *truncated,
+                  optional_yield y);
 
-  int trim(const DoutPrefixProvider *dpp, int shard_id, const real_time& from_time, const real_time& end_time, const std::string& start_marker, const std::string& end_marker);
-  int get_info(const DoutPrefixProvider *dpp, int shard_id, RGWMetadataLogInfo *info);
+  int trim(const DoutPrefixProvider *dpp, int shard_id, const real_time& from_time, const real_time& end_time, const std::string& start_marker, const std::string& end_marker, optional_yield y);
+  int get_info(const DoutPrefixProvider *dpp, int shard_id, RGWMetadataLogInfo *info, optional_yield y);
   int get_info_async(const DoutPrefixProvider *dpp, int shard_id, RGWMetadataLogInfoCompletion *completion);
   int lock_exclusive(const DoutPrefixProvider *dpp, int shard_id, timespan duration, std::string&zone_id, std::string& owner_id);
   int unlock(const DoutPrefixProvider *dpp, int shard_id, std::string& zone_id, std::string& owner_id);
index 09a68d3d7132cb6105e0fa1cf2e918ebb8e5fb12..06459f5239ea4205f88fa9f24e91adb87fcd58e9 100644 (file)
@@ -529,10 +529,10 @@ RGWMetadataLog* RGWSI_MDLog::get_log(const std::string& period)
   return &insert.first->second;
 }
 
-int RGWSI_MDLog::add_entry(const DoutPrefixProvider *dpp, const string& hash_key, const string& section, const string& key, bufferlist& bl)
+int RGWSI_MDLog::add_entry(const DoutPrefixProvider *dpp, const string& hash_key, const string& section, const string& key, bufferlist& bl, optional_yield y)
 {
   ceph_assert(current_log); // must have called init()
-  return current_log->add_entry(dpp, hash_key, section, key, bl);
+  return current_log->add_entry(dpp, hash_key, section, key, bl, y);
 }
 
 int RGWSI_MDLog::get_shard_id(const string& hash_key, int *shard_id)
index 703d6f6059ecc8138c4d9f1d796f83b04ec3a7ef..8b37ba11e565922f4f92c5e95f770ed20cb08ef0 100644 (file)
@@ -102,7 +102,7 @@ public:
                     RGWObjVersionTracker *objv_tracker,
                    optional_yield y, bool exclusive = false);
 
-  int add_entry(const DoutPrefixProvider *dpp, const std::string& hash_key, const std::string& section, const std::string& key, bufferlist& bl);
+  int add_entry(const DoutPrefixProvider *dpp, const std::string& hash_key, const std::string& section, const std::string& key, bufferlist& bl, optional_yield y);
 
   int get_shard_id(const std::string& hash_key, int *shard_id);
 
index c0ff402fc58e023e93595ddb9b93e95a317f0f58..45410c182384bdb927217ef93cd777acac6f1c2b 100644 (file)
@@ -57,7 +57,7 @@ int RGWSI_MetaBackend_SObj::pre_modify(const DoutPrefixProvider *dpp, RGWSI_Meta
   bufferlist logbl;
   encode(log_data, logbl);
 
-  ret = mdlog_svc->add_entry(dpp, ctx->module->get_hash_key(key), ctx->module->get_section(), key, logbl);
+  ret = mdlog_svc->add_entry(dpp, ctx->module->get_hash_key(key), ctx->module->get_section(), key, logbl, y);
   if (ret < 0)
     return ret;
 
@@ -80,7 +80,7 @@ int RGWSI_MetaBackend_SObj::post_modify(const DoutPrefixProvider *dpp,
   bufferlist logbl;
   encode(log_data, logbl);
 
-  int r = mdlog_svc->add_entry(dpp, ctx->module->get_hash_key(key), ctx->module->get_section(), key, logbl);
+  int r = mdlog_svc->add_entry(dpp, ctx->module->get_hash_key(key), ctx->module->get_section(), key, logbl, y);
   if (ret < 0)
     return ret;