]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/cloud: Handle RGWRESTStreamS3PutObj initialization failures 56657/head
authorSoumya Koduri <skoduri@redhat.com>
Wed, 3 Apr 2024 07:45:38 +0000 (13:15 +0530)
committerSoumya Koduri <skoduri@redhat.com>
Wed, 3 Apr 2024 10:39:27 +0000 (16:09 +0530)
With the recent code added to handle connection errors
(commit#e200499bb3c5703862b92a4d7fb534d98601f1bf), RGWRESTStreamS3PutObj
initialization could fail at times if there were any failed requests to the
cloud endpoint within CONN_STATUS_EXPIRE_SECS period.

This fix is to handle such errors and abort the transition/sync
requests which can be retried later by LC/Sync worker threads.

Signed-off-by: Soumya Koduri <skoduri@redhat.com>
src/rgw/driver/rados/rgw_lc_tier.cc
src/rgw/driver/rados/rgw_sync_module_aws.cc

index 67df0244595723c88c2f9f2931e58b87596b1c9f..9fbc931ebcb959f1451fe24e39a7da99d553e5a8 100644 (file)
@@ -486,6 +486,7 @@ int RGWLCStreamRead::read(off_t ofs, off_t end, RGWGetDataCB *out_cb) {
 }
 
 int RGWLCCloudStreamPut::init() {
+  int ret = -1;
   /* init output connection */
   if (multipart.is_multipart) {
     char buf[32];
@@ -493,9 +494,14 @@ int RGWLCCloudStreamPut::init() {
     rgw_http_param_pair params[] = { { "uploadId", multipart.upload_id.c_str() },
                                      { "partNumber", buf },
                                      { nullptr, nullptr } };
-    conn.put_obj_send_init(dest_obj, params, &out_req);
+    ret = conn.put_obj_send_init(dest_obj, params, &out_req);
   } else {
-    conn.put_obj_send_init(dest_obj, nullptr, &out_req);
+    ret = conn.put_obj_send_init(dest_obj, nullptr, &out_req);
+  }
+
+  if (ret < 0 || !out_req) {
+    ldpp_dout(dpp, 0) << "ERROR: failed to create RGWRESTStreamS3PutObj request" << dendl;
+    return ret;
   }
 
   return 0;
@@ -651,6 +657,7 @@ void RGWLCCloudStreamPut::init_send_attrs(const DoutPrefixProvider *dpp,
 
 void RGWLCCloudStreamPut::send_ready(const DoutPrefixProvider *dpp, const rgw_rest_obj& rest_obj) {
   auto r = static_cast<RGWRESTStreamS3PutObj *>(out_req);
+  ceph_assert(r);
 
   std::map<std::string, std::string> new_attrs;
   if (!multipart.is_multipart) {
index 3c269a7494986d026d24fdd61cd2897289c03458..19be83351e1d3be13f5cba0906313c7afc2fefb9 100644 (file)
@@ -821,6 +821,7 @@ public:
   int init() override {
     /* init output connection */
     RGWRESTStreamS3PutObj *out_req{nullptr};
+    int ret = -1;
 
     if (multipart.is_multipart) {
       char buf[32];
@@ -828,9 +829,13 @@ public:
       rgw_http_param_pair params[] = { { "uploadId", multipart.upload_id.c_str() },
                                        { "partNumber", buf },
                                        { nullptr, nullptr } };
-      target->conn->put_obj_send_init(dest_obj, params, &out_req);
+      ret = target->conn->put_obj_send_init(dest_obj, params, &out_req);
     } else {
-      target->conn->put_obj_send_init(dest_obj, nullptr, &out_req);
+      ret = target->conn->put_obj_send_init(dest_obj, nullptr, &out_req);
+    }
+
+    if (ret < 0 || !out_req) {
+      return ret;
     }
 
     set_req(out_req);