]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/logging: part upload operation name should be REST.PUT.PART
authorYuval Lifshitz <ylifshit@ibm.com>
Tue, 13 May 2025 16:45:27 +0000 (16:45 +0000)
committerYuval Lifshitz <ylifshit@ibm.com>
Mon, 23 Jun 2025 14:03:44 +0000 (14:03 +0000)
(in standard mode)

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

src/rgw/rgw_bucket_logging.cc
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_process.cc
src/rgw/rgw_rest.h

index 840a3493f7705591f3bf7286c62da1bc3f7713f6..d2429aad40ab736d64f52a0216ddfd008d271351 100644 (file)
@@ -628,8 +628,8 @@ int log_record(rgw::sal::Driver* driver,
     bool async_completion,
     bool log_source_bucket) {
   if (!s->bucket) {
-    // logging only bucket operations
-    return 0;
+    ldpp_dout(dpp, 1) << "ERROR: only bucket operations are logged in bucket logging" << dendl;
+    return -EINVAL;
   }
   // check if bucket logging is needed
   const auto& bucket_attrs = s->bucket->get_attrs();
index 859ade5a7998a8f7186662be63bc58533662a103..232aca1f4662d2b1a243c09cf00fbef058c3fccf 100644 (file)
@@ -4835,8 +4835,23 @@ void RGWPutObj::execute(optional_yield y)
     return;
   }
 
+  auto ret = rgw::bucketlogging::log_record(driver,
+      rgw::bucketlogging::LoggingType::Standard,
+      s->object.get(),
+      s,
+      (multipart ? "REST.PUT.PART" : canonical_name()),
+      etag,
+      s->object->get_size(),
+      this,
+      y,
+      true,
+      false);
+  if (ret  < 0) {
+    ldpp_dout(this, 5) << "WARNING: in Standard mode, put object operation ignores bucket logging failure: " << ret << dendl;
+ }
+
   // send request to notification manager
-  int ret = res->publish_commit(this, s->obj_size, mtime, etag, s->object->get_instance());
+  ret = res->publish_commit(this, s->obj_size, mtime, etag, s->object->get_instance());
   if (ret < 0) {
     ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl;
     // too late to rollback operation, hence op_ret is not set here
index 87d2dfccfb8e5e5daa8a89ace3137d9a820c3d0e..c8a5a4a960094c54b1c244d1c61bae322e703f08 100644 (file)
@@ -309,6 +309,8 @@ public:
   virtual const char* name() const = 0;
   virtual RGWOpType get_type() { return RGW_OP_UNKNOWN; }
   virtual std::string canonical_name() const { return fmt::format("REST.{}.{}", s->info.method, name()); }
+  // by default we log all bucket operations
+  virtual bool always_do_bucket_logging() const { return s->bucket != nullptr; }
 
   virtual uint32_t op_mask() { return 0; }
 
@@ -1327,6 +1329,7 @@ public:
   RGWOpType get_type() override { return RGW_OP_PUT_OBJ; }
   uint32_t op_mask() override { return RGW_OP_TYPE_WRITE; }
   dmc::client_id dmclock_client() override { return dmc::client_id::data; }
+  bool always_do_bucket_logging() const override { return false; }
 };
 
 class RGWPostObj : public RGWOp {
index 46a754bf543880cdd46dbca72ae468954bf9810f..704a6a7c2eea41ff1c8419a0f9cb4376f0cb871c 100644 (file)
@@ -466,7 +466,7 @@ done:
     rgw_log_op(rest, s, op, penv.olog.get());
   }
 
-  if (op) {
+  if (op && op->always_do_bucket_logging()) {
     std::ignore = rgw::bucketlogging::log_record(driver, 
         rgw::bucketlogging::LoggingType::Standard,
         s->object.get(),
index d0c1e49c065a1eb123e7863bddb42c410fc157e6..de3938262a68bcec28ddc4b94374e0791331e308 100644 (file)
@@ -248,7 +248,10 @@ public:
   int get_params(optional_yield y) override;
   int get_data(bufferlist& bl) override;
 
-  virtual std::string canonical_name() const override { return fmt::format("REST.{}.OBJECT", s->info.method); }
+  virtual std::string canonical_name() const override {
+    const bool multipart = !multipart_upload_id.empty();
+    return fmt::format("REST.{}.{}", s->info.method, multipart ? "PART" : "OBJECT");
+  }
 };
 
 class RGWPostObj_ObjStore : public RGWPostObj