]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw/logging: make sure source bucket is in the target's list
authorYuval Lifshitz <ylifshit@ibm.com>
Thu, 30 Oct 2025 09:45:48 +0000 (09:45 +0000)
committerN Balachandran <nithya.balachandran@ibm.com>
Fri, 2 Jan 2026 06:06:12 +0000 (11:36 +0530)
if a target log bucket is deleted, and then recreated with the same name,
the attribute holding the sources will not exist.
this is fixing it, but updating the list anytime we try to flush
or add a record.
if the source is already in the list, there will be no update to the attribute.

Fixes: https://tracker.ceph.com/issues/73675
Signed-off-by: Yuval Lifshitz <ylifshit@ibm.com>
(cherry picked from commit cf44913720c13bdf317ff44498543c06eabe7ec7)

src/rgw/radosgw-admin/radosgw-admin.cc
src/rgw/rgw_bucket_logging.cc
src/rgw/rgw_rest_bucket_logging.cc

index 2cf7443a6c7946ab2a2f1954e1fe246384e5e84a..eb5c8057fdf53965147b3f86c203a9e8c586f3ed 100644 (file)
@@ -7816,6 +7816,12 @@ int main(int argc, const char **argv)
       return 0;
     }
 
+    // make sure that the logging source attribute is up-to-date
+    if (ret = rgw::bucketlogging::update_bucket_logging_sources(dpp(), target_bucket, bucket->get_key(), true, null_yield); ret < 0) {
+      cerr << "WARNING: failed to update logging sources attribute '" << RGW_ATTR_BUCKET_LOGGING_SOURCES
+        << "' in logging target '" << target_bucket->get_key() << "'. error: " << cpp_strerror(ret) << std::endl;
+    }
+
     std::string obj_name;
     RGWObjVersionTracker objv_tracker;
     ret = target_bucket->get_logging_object_name(obj_name, configuration.target_prefix, null_yield, dpp(), &objv_tracker);
index 9e898181003323de7842a0d7f19e825693e132f7..707c1d4b7140bea5565d334b8580034964e0b329 100644 (file)
@@ -501,6 +501,12 @@ int log_record(rgw::sal::Driver* driver,
     return ret;
   }
 
+  // make sure that the logging source attribute is up-to-date
+  if (ret = update_bucket_logging_sources(dpp, target_bucket, s->bucket->get_key(), true, y); ret < 0) {
+    ldpp_dout(dpp, 5) << "WARNING: failed to update logging sources attribute '" << RGW_ATTR_BUCKET_LOGGING_SOURCES
+        << "' in logging bucket '" << target_bucket_id << "'. error: " << ret << dendl;
+  }
+
   const auto region = driver->get_zone()->get_zonegroup().get_api_name();
   std::string obj_name;
   RGWObjVersionTracker objv_tracker;
index c49c53d963c9e97f6ea1b05c03c24813ada5d619..b2584eba1647cf621c85fb65a6b36860816aa8d6 100644 (file)
@@ -417,6 +417,11 @@ class RGWPostBucketLoggingOp : public RGWDefaultResponseOp {
 
   void execute(optional_yield y) override {
     const auto& target_bucket_id = target_bucket->get_key();
+    // make sure that the logging source attribute is up-to-date
+    if (const auto ret = rgw::bucketlogging::update_bucket_logging_sources(this, target_bucket, source_bucket->get_key(), true, y); ret < 0) {
+      ldpp_dout(this, 5) << "WARNING: failed to update logging sources attribute '" << RGW_ATTR_BUCKET_LOGGING_SOURCES
+        << "' in logging target '" << target_bucket_id << "'. error: " << ret << dendl;
+    }
     std::string obj_name;
     RGWObjVersionTracker objv_tracker;
     op_ret = target_bucket->get_logging_object_name(obj_name, configuration.target_prefix, y, this, &objv_tracker);