]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/notifications: dont send notifications if op has failed 54966/head
authorYuval Lifshitz <ylifshit@redhat.com>
Tue, 19 Dec 2023 16:31:20 +0000 (16:31 +0000)
committerYuval Lifshitz <ylifshit@ibm.com>
Thu, 4 Jan 2024 15:56:12 +0000 (15:56 +0000)
Fixes: https://tracker.ceph.com/issues/63855
Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
src/rgw/rgw_op.cc

index 0a1c3b1cf45910370c5116ca8842101f329557d0..5c504769fcd7fe7cec29dbfb9309fc21921584e8 100644 (file)
@@ -4532,6 +4532,9 @@ void RGWPutObj::execute(optional_yield y)
                                (user_data.empty() ? nullptr : &user_data), nullptr, nullptr,
                                rctx);
   tracepoint(rgw_op, processor_complete_exit, s->req_id.c_str());
+  if (op_ret < 0) {
+    return;
+  }
 
   // send request to notification manager
   int ret = res->publish_commit(this, s->obj_size, mtime, etag, s->object->get_instance());
@@ -5383,6 +5386,10 @@ void RGWDeleteObj::execute(optional_yield y)
     rgw::op_counters::inc(counters, l_rgw_op_del_obj_b, obj_size);
     rgw::op_counters::tinc(counters, l_rgw_op_del_obj_lat, s->time_elapsed());
 
+    if (op_ret < 0) {
+      return;
+    }
+
     // send request to notification manager
     int ret = res->publish_commit(this, obj_size, ceph::real_clock::now(), etag, version_id);
     if (ret < 0) {
@@ -5835,6 +5842,10 @@ void RGWCopyObj::execute(optional_yield y)
           this,
           s->yield);
 
+  if (op_ret < 0) {
+    return;
+  }
+
   // send request to notification manager
   int ret = res->publish_commit(this, obj_size, mtime, etag, s->object->get_instance());
   if (ret < 0) {
@@ -7266,13 +7277,13 @@ void RGWDeleteMultiObj::handle_individual_object(const rgw_obj_key& o, optional_
   if (op_ret == -ENOENT) {
     op_ret = 0;
   }
-
-
-  // send request to notification manager
-  int ret = res->publish_commit(this, obj_size, ceph::real_clock::now(), etag, version_id);
-  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
+  if (op_ret == 0) {
+    // send request to notification manager
+    int ret = res->publish_commit(this, obj_size, ceph::real_clock::now(), etag, version_id);
+    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
+    }
   }
   
   send_partial_response(o, del_op->result.delete_marker, del_op->result.version_id, op_ret, formatter_flush_cond);