From 1e7663d382580217751a3ef570b53400767e6f7f Mon Sep 17 00:00:00 2001 From: Yuval Lifshitz Date: Wed, 12 Feb 2025 15:33:55 +0000 Subject: [PATCH] rgw/logging: flush command should print flushed log object name and not the next pending log object name Signed-off-by: Yuval Lifshitz --- src/rgw/radosgw-admin/radosgw-admin.cc | 5 +++-- src/rgw/rgw_rest_bucket_logging.cc | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/rgw/radosgw-admin/radosgw-admin.cc b/src/rgw/radosgw-admin/radosgw-admin.cc index 2c14e61506a..45f4d7f16cd 100644 --- a/src/rgw/radosgw-admin/radosgw-admin.cc +++ b/src/rgw/radosgw-admin/radosgw-admin.cc @@ -7741,13 +7741,14 @@ int main(int argc, const char **argv) cerr << "ERROR: failed to get pending logging object name from target bucket '" << configuration.target_bucket << "'" << std::endl; return -ret; } + const auto old_obj = obj_name; ret = rgw::bucketlogging::rollover_logging_object(configuration, target_bucket, obj_name, dpp(), null_yield, true, &objv_tracker); if (ret < 0) { - cerr << "ERROR: failed to flush pending logging object '" << obj_name + cerr << "ERROR: failed to flush pending logging object '" << old_obj << "' to target bucket '" << configuration.target_bucket << "'" << std::endl; return -ret; } - cout << "flushed pending logging object '" << obj_name + cout << "flushed pending logging object '" << old_obj << "' to target bucket '" << configuration.target_bucket << "'" << std::endl; return 0; } diff --git a/src/rgw/rgw_rest_bucket_logging.cc b/src/rgw/rgw_rest_bucket_logging.cc index afd79b0a548..505107d8967 100644 --- a/src/rgw/rgw_rest_bucket_logging.cc +++ b/src/rgw/rgw_rest_bucket_logging.cc @@ -344,13 +344,14 @@ class RGWPostBucketLoggingOp : public RGWDefaultResponseOp { ldpp_dout(this, 1) << "ERROR: failed to get pending logging object name from target bucket '" << target_bucket_id << "'" << dendl; return; } + const auto old_obj = obj_name; op_ret = rgw::bucketlogging::rollover_logging_object(configuration, target_bucket, obj_name, this, null_yield, true, &objv_tracker); if (op_ret < 0) { - ldpp_dout(this, 1) << "ERROR: failed to flush pending logging object '" << obj_name + ldpp_dout(this, 1) << "ERROR: failed to flush pending logging object '" << old_obj << "' to target bucket '" << target_bucket_id << "'" << dendl; return; } - ldpp_dout(this, 20) << "INFO: flushed pending logging object '" << obj_name + ldpp_dout(this, 20) << "INFO: flushed pending logging object '" << old_obj << "' to target bucket '" << configuration.target_bucket << "'" << dendl; } };