From: Matt Benjamin Date: Thu, 15 Dec 2022 19:55:16 +0000 (-0500) Subject: rgw/notifications: fetch object state to get size, in rgw_lc.cc X-Git-Tag: v18.1.0~163^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4fe472e249026ca97ee878c77917cc1e0839ce20;p=ceph-ci.git rgw/notifications: fetch object state to get size, in rgw_lc.cc Failure to call get_obj_state() leaves object size and other members uninitialized, and appears to result in in lc delete notifications with 0 for object size. Fixes: https://tracker.ceph.com/issues/58287 Signed-off-by: Matt Benjamin (cherry picked from commit b20a66767f782c06258fb0a5551ee45d6dccb91c) --- diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 1baa0164dd8..4db82856503 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -548,6 +548,13 @@ static int remove_expired_obj( } obj = bucket->get_object(obj_key); + + RGWObjState* obj_state{nullptr}; + ret = obj->get_obj_state(dpp, &obj_state, null_yield, true); + if (ret < 0) { + return ret; + } + std::unique_ptr del_op = obj->get_delete_op(); del_op->params.versioning_status @@ -578,7 +585,7 @@ static int remove_expired_obj( "ERROR: publishing notification failed, with error: " << ret << dendl; } else { // send request to notification manager - (void) notify->publish_commit(dpp, obj->get_obj_size(), + (void) notify->publish_commit(dpp, obj_state->size, ceph::real_clock::now(), obj->get_attrs()[RGW_ATTR_ETAG].to_str(), version_id);