]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/logging: part upload operation name should be REST.PUT.PART 63268/head
authorYuval Lifshitz <ylifshit@ibm.com>
Tue, 13 May 2025 16:45:27 +0000 (16:45 +0000)
committerYuval Lifshitz <ylifshit@ibm.com>
Thu, 22 May 2025 18:20:30 +0000 (18:20 +0000)
(in standard mode)

Fixes: https://tracker.ceph.com/issues/71312
Signed-off-by: Yuval Lifshitz <ylifshit@ibm.com>
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 d26128e1f89ba4181d2433ac1acd1e80eeed0e2d..80bee075d5e0fc2c0915e02d4b71296e2f1d41b7 100644 (file)
@@ -627,8 +627,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 81c32f5449b8684d7b70cfa714ba307bc0db29ca..d52d26330872136ec8bd0e4f175e62969846be67 100644 (file)
@@ -4797,8 +4797,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 a302257e428bc33264f5d5f09b1d8fb02ab6447d..c92263484562aa4dccc74070899dd63c1cfd01ed 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