Skip to content

Commit 9696628

Browse files
authored
Merge pull request ceph#54966 from yuvalif/wip-yuval-63855
rgw/notifications: dont send notifications if op has failed reviewed-by: cbodley
2 parents eaf6e41 + b378395 commit 9696628

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

src/rgw/rgw_op.cc

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4532,6 +4532,9 @@ void RGWPutObj::execute(optional_yield y)
45324532
(user_data.empty() ? nullptr : &user_data), nullptr, nullptr,
45334533
rctx);
45344534
tracepoint(rgw_op, processor_complete_exit, s->req_id.c_str());
4535+
if (op_ret < 0) {
4536+
return;
4537+
}
45354538

45364539
// send request to notification manager
45374540
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)
53835386
rgw::op_counters::inc(counters, l_rgw_op_del_obj_b, obj_size);
53845387
rgw::op_counters::tinc(counters, l_rgw_op_del_obj_lat, s->time_elapsed());
53855388

5389+
if (op_ret < 0) {
5390+
return;
5391+
}
5392+
53865393
// send request to notification manager
53875394
int ret = res->publish_commit(this, obj_size, ceph::real_clock::now(), etag, version_id);
53885395
if (ret < 0) {
@@ -5835,6 +5842,10 @@ void RGWCopyObj::execute(optional_yield y)
58355842
this,
58365843
s->yield);
58375844

5845+
if (op_ret < 0) {
5846+
return;
5847+
}
5848+
58385849
// send request to notification manager
58395850
int ret = res->publish_commit(this, obj_size, mtime, etag, s->object->get_instance());
58405851
if (ret < 0) {
@@ -7266,13 +7277,13 @@ void RGWDeleteMultiObj::handle_individual_object(const rgw_obj_key& o, optional_
72667277
if (op_ret == -ENOENT) {
72677278
op_ret = 0;
72687279
}
7269-
7270-
7271-
// send request to notification manager
7272-
int ret = res->publish_commit(this, obj_size, ceph::real_clock::now(), etag, version_id);
7273-
if (ret < 0) {
7274-
ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl;
7275-
// too late to rollback operation, hence op_ret is not set here
7280+
if (op_ret == 0) {
7281+
// send request to notification manager
7282+
int ret = res->publish_commit(this, obj_size, ceph::real_clock::now(), etag, version_id);
7283+
if (ret < 0) {
7284+
ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl;
7285+
// too late to rollback operation, hence op_ret is not set here
7286+
}
72767287
}
72777288

72787289
send_partial_response(o, del_op->result.delete_marker, del_op->result.version_id, op_ret, formatter_flush_cond);

0 commit comments

Comments
 (0)