Repository navigation
squid: rgw: fix 'bucket stats' when bucket index doesn't exist - #68504
Conversation
Signed-off-by: Casey Bodley <[email protected]> (cherry picked from commit a3509f6) Conflicts: src/rgw/driver/rados/rgw_bucket.cc bucket stats on squid missing reshard_status and judge_reshard_lock_time
Signed-off-by: Casey Bodley <[email protected]> (cherry picked from commit ca6d509) Conflicts: src/rgw/driver/rados/rgw_bucket.cc missing restore stats
buckets that reside in other zonegroups probably don't have a local bucket index, so we should avoid trying to read stats from them Fixes: https://tracker.ceph.com/issues/74231 Signed-off-by: Casey Bodley <[email protected]> (cherry picked from commit 01d4deb) Conflicts: src/rgw/driver/rados/rgw_bucket.cc missing reshard_status and judge_reshard_lock_time
Signed-off-by: Casey Bodley <[email protected]> (cherry picked from commit bedcac2)
There was a problem hiding this comment.
Automated Backport Parity Review - Backport Deviation Alert
A conflict or unapproved deviation was detected during the simulation of this backport. The code in this PR does not match a clean cherry-pick of the upstream commits.
How to proceed:
- Authors (Genuine Conflicts): If this is a genuine conflict requiring manual resolution, ensure your resolution is correct. You must explain the conflict resolution in the commit message (e.g., leave the standard Git
Conflicts:block intact) and include an explanation for changes. - Authors (Need Help?): Reach out to the Component Lead for technical guidance on complex code conflicts.
- Component Leads (Review): Please review the Range Diff below to verify the author's manual conflict resolution is correct for this release branch. If the deviation is intentional, documented, and approved then the component lead or @ceph/ceph-release-manager can bypass this check by commenting
/audit override.
Be familiar with the rules and guidelines for writing backports.
Affected File(s)
src/rgw/driver/rados/rgw_bucket.cc
Range Diff
Click to expand
--- Original (a3509f69)
+++ Backport (1128957d)
@@ -1,3 +1,7 @@
rgw: bucket_stats() uses local variable 'index'
Signed-off-by: Casey Bodley <[email protected]>
+(cherry picked from commit a3509f6944f7db71a5930445037c4264b67252cf)
+
+Conflicts:
+ src/rgw/driver/rados/rgw_bucket.cc bucket stats on squid missing reshard_status and judge_reshard_lock_time
================================================================================
RANGE DIFF
================================================================================
1: a3509f6944f < -: ----------- rgw: bucket_stats() uses local variable 'index'
-: ----------- > 1: 1128957d334 rgw: bucket_stats() uses local variable 'index'Automated Backport Parity Review - Backport Deviation Alert
A conflict or unapproved deviation was detected during the simulation of this backport. The code in this PR does not match a clean cherry-pick of the upstream commits.
How to proceed:
- Authors (Genuine Conflicts): If this is a genuine conflict requiring manual resolution, ensure your resolution is correct. You must explain the conflict resolution in the commit message (e.g., leave the standard Git
Conflicts:block intact) and include an explanation for changes. - Authors (Need Help?): Reach out to the Component Lead for technical guidance on complex code conflicts.
- Component Leads (Review): Please review the Range Diff below to verify the author's manual conflict resolution is correct for this release branch. If the deviation is intentional, documented, and approved then the component lead or @ceph/ceph-release-manager can bypass this check by commenting
/audit override.
Be familiar with the rules and guidelines for writing backports.
Affected File(s)
src/rgw/driver/rados/rgw_bucket.cc
Range Diff
Click to expand
--- Original (ca6d5092)
+++ Backport (c2149ab3)
@@ -1,3 +1,7 @@
rgw/rados: pass SiteConfig into bucket_stats()
Signed-off-by: Casey Bodley <[email protected]>
+(cherry picked from commit ca6d50921286d31cf26096f80ed5a4287f539abd)
+
+Conflicts:
+ src/rgw/driver/rados/rgw_bucket.cc missing restore stats
================================================================================
RANGE DIFF
================================================================================
1: ca6d5092128 ! 1: c2149ab3b20 rgw/rados: pass SiteConfig into bucket_stats()
@@ Commit message
rgw/rados: pass SiteConfig into bucket_stats()
Signed-off-by: Casey Bodley <[email protected]>
+ (cherry picked from commit ca6d50921286d31cf26096f80ed5a4287f539abd)
+
+ Conflicts:
+ src/rgw/driver/rados/rgw_bucket.cc missing restore stats
## src/rgw/driver/rados/rgw_bucket.cc ##
-@@ src/rgw/driver/rados/rgw_bucket.cc: static int bucket_restore_stats(rgw::sal::Driver* driver,
- return 0;
+@@ src/rgw/driver/rados/rgw_bucket.cc: int RGWBucketAdminOp::sync_bucket(rgw::sal::Driver* driver, RGWBucketAdminOpStat
+ return bucket.sync(op_state, dpp, y, err_msg);
}
-static int bucket_stats(rgw::sal::Driver* driver,
+static int bucket_stats(rgw::sal::Driver* driver, const rgw::SiteConfig& site,
- const std::string& tenant_name, const std::string& bucket_name,
- bool dump_restore_stats, Formatter* formatter,
+ const std::string& tenant_name,
+- const std::string& bucket_name, Formatter* formatter,
++ const std::string& bucket_name,
++ Formatter* formatter,
const DoutPrefixProvider* dpp, optional_yield y) {
+ std::unique_ptr<rgw::sal::Bucket> bucket;
+ map<RGWObjCategory, RGWStorageStats> stats;
@@ src/rgw/driver/rados/rgw_bucket.cc: int RGWBucketAdminOp::limit_check(rgw::sal::Driver* driver,
static int list_owner_bucket_info(const DoutPrefixProvider* dpp,
optional_yield y,
@@ src/rgw/driver/rados/rgw_bucket.cc: static int list_owner_bucket_info(const Dout
for (const auto& ent : listing.buckets) {
if (show_stats) {
-- bucket_stats(driver, tenant, ent.bucket.name, false, formatter, dpp, y);
-+ bucket_stats(driver, site, tenant, ent.bucket.name, false, formatter, dpp, y);
+- bucket_stats(driver, tenant, ent.bucket.name, formatter, dpp, y);
++ bucket_stats(driver, site, tenant, ent.bucket.name, formatter, dpp, y);
} else {
formatter->dump_string("bucket", ent.bucket.name);
}
@@ src/rgw/driver/rados/rgw_bucket.cc: int RGWBucketAdminOp::info(rgw::sal::Driver*
const bool show_stats = op_state.will_fetch_stats();
const rgw_user& user_id = op_state.get_user_id();
if (!bucket_name.empty()) {
-- ret = bucket_stats(driver, user_id.tenant, bucket_name, op_state.restore_stats, formatter, dpp, y);
-+ ret = bucket_stats(driver, site, user_id.tenant, bucket_name, op_state.restore_stats, formatter, dpp, y);
+- ret = bucket_stats(driver, user_id.tenant, bucket_name, formatter, dpp, y);
++ ret = bucket_stats(driver, site, user_id.tenant, bucket_name, formatter, dpp, y);
if (ret < 0) {
return ret;
}
@@ src/rgw/driver/rados/rgw_bucket.cc: int RGWBucketAdminOp::info(rgw::sal::Driver*
&truncated);
for (auto& bucket_name : buckets) {
if (show_stats) {
-- bucket_stats(driver, user_id.tenant, bucket_name, op_state.restore_stats, formatter, dpp, y);
-+ bucket_stats(driver, site, user_id.tenant, bucket_name, op_state.restore_stats, formatter, dpp, y);
+- bucket_stats(driver, user_id.tenant, bucket_name, formatter, dpp, y);
++ bucket_stats(driver, site, user_id.tenant, bucket_name, formatter, dpp, y);
} else {
formatter->dump_string("bucket", bucket_name);
}
@@ src/rgw/driver/rados/rgw_bucket.h: public:
## src/rgw/driver/rados/rgw_rest_bucket.cc ##
@@ src/rgw/driver/rados/rgw_rest_bucket.cc: void RGWOp_Bucket_Info::execute(optional_yield y)
+ op_state.set_bucket_name(bucket);
op_state.set_fetch_stats(fetch_stats);
- op_state.set_restore_stats(fetch_restore_stats);
- op_ret = RGWBucketAdminOp::info(driver, op_state, flusher, y, this);
+ op_ret = RGWBucketAdminOp::info(driver, *s->penv.site, op_state, flusher, y, this);
@@ src/rgw/driver/rados/rgw_rest_bucket.cc: void RGWOp_Bucket_Info::execute(optiona
class RGWOp_Get_Policy : public RGWRESTOp {
- ## src/rgw/radosgw-admin/radosgw-admin.cc ##
-@@ src/rgw/radosgw-admin/radosgw-admin.cc: int main(int argc, const char **argv)
+ ## src/rgw/rgw_admin.cc ##
+@@ src/rgw/rgw_admin.cc: int main(int argc, const char **argv)
bucket_op.max_entries = max_entries;
else
bucket_op.max_entries = 0; /* for backward compatibility */
@@ src/rgw/radosgw-admin/radosgw-admin.cc: int main(int argc, const char **argv)
} else {
int ret = init_bucket(tenant, bucket_name, bucket_id, &bucket);
if (ret < 0) {
-@@ src/rgw/radosgw-admin/radosgw-admin.cc: int main(int argc, const char **argv)
+@@ src/rgw/rgw_admin.cc: int main(int argc, const char **argv)
+ else
bucket_op.max_entries = 0; /* for backward compatibility */
- bucket_op.set_restore_stats(bool(show_restore_stats));
- int r = RGWBucketAdminOp::info(driver, bucket_op, stream_flusher, null_yield, dpp());
+ int r = RGWBucketAdminOp::info(driver, *site, bucket_op, stream_flusher, null_yield, dpp());Automated Backport Parity Review - Backport Deviation Alert
A conflict or unapproved deviation was detected during the simulation of this backport. The code in this PR does not match a clean cherry-pick of the upstream commits.
How to proceed:
- Authors (Genuine Conflicts): If this is a genuine conflict requiring manual resolution, ensure your resolution is correct. You must explain the conflict resolution in the commit message (e.g., leave the standard Git
Conflicts:block intact) and include an explanation for changes. - Authors (Need Help?): Reach out to the Component Lead for technical guidance on complex code conflicts.
- Component Leads (Review): Please review the Range Diff below to verify the author's manual conflict resolution is correct for this release branch. If the deviation is intentional, documented, and approved then the component lead or @ceph/ceph-release-manager can bypass this check by commenting
/audit override.
Be familiar with the rules and guidelines for writing backports.
Affected File(s)
src/rgw/driver/rados/rgw_bucket.cc
Range Diff
Click to expand
--- Original (01d4deb7)
+++ Backport (38fba88d)
@@ -6,3 +6,7 @@
Fixes: https://tracker.ceph.com/issues/74231
Signed-off-by: Casey Bodley <[email protected]>
+(cherry picked from commit 01d4deb7daa735f6c4e01541427cd6b309ed4526)
+
+Conflicts:
+ src/rgw/driver/rados/rgw_bucket.cc missing reshard_status and judge_reshard_lock_time
================================================================================
RANGE DIFF
================================================================================
1: 01d4deb7daa ! 1: 38fba88d621 rgw: 'bucket stats' omits usage for buckets on other zonegroups
@@ Commit message
Fixes: https://tracker.ceph.com/issues/74231
Signed-off-by: Casey Bodley <[email protected]>
+ (cherry picked from commit 01d4deb7daa735f6c4e01541427cd6b309ed4526)
+
+ Conflicts:
+ src/rgw/driver/rados/rgw_bucket.cc missing reshard_status and judge_reshard_lock_time
## src/rgw/driver/rados/rgw_bucket.cc ##
@@ src/rgw/driver/rados/rgw_bucket.cc: static int bucket_stats(rgw::sal::Driver* driver, const rgw::SiteConfig& site,
const RGWBucketInfo& bucket_info = bucket->get_info();
+- const auto& index = bucket->get_info().get_current_index();
+ // buckets on a different zonegroup won't have a local bucket index for stats
+ const bool local_zonegroup = (site.get_zonegroup().id == bucket_info.zonegroup);
+ const bool has_index = local_zonegroup;
+
- const auto& index = bucket_info.get_current_index();
++ const auto& index = bucket_info.get_current_index();
if (is_layout_indexless(index)) {
cerr << "error, indexless buckets do not maintain stats; bucket=" <<
+ bucket->get_name() << std::endl;
@@ src/rgw/driver/rados/rgw_bucket.cc: static int bucket_stats(rgw::sal::Driver* driver, const rgw::SiteConfig& site,
std::string bucket_ver, master_ver;
std::string max_marker;
-- ret = bucket->read_stats(dpp, y, index, RGW_NO_SHARD, &bucket_ver, &master_ver, stats, &max_marker);
+- ret = bucket->read_stats(dpp, index, RGW_NO_SHARD, &bucket_ver, &master_ver, stats, &max_marker);
- if (ret < 0) {
- cerr << "error getting bucket stats bucket=" << bucket->get_name() << " ret=" << ret << std::endl;
- return ret;
+
+ if (has_index) {
-+ ret = bucket->read_stats(dpp, y, index, RGW_NO_SHARD, &bucket_ver, &master_ver, stats, &max_marker);
++ ret = bucket->read_stats(dpp, index, RGW_NO_SHARD, &bucket_ver, &master_ver, stats, &max_marker);
+ if (ret < 0) {
+ cerr << "error getting bucket stats bucket=" << bucket->get_name() << " ret=" << ret << std::endl;
+ return ret;
@@ src/rgw/driver/rados/rgw_bucket.cc: static int bucket_stats(rgw::sal::Driver* dr
formatter->dump_stream("index_type") << index.layout.type;
formatter->dump_int("index_generation", index.gen);
- formatter->dump_int("num_shards", index.layout.normal.num_shards);
- formatter->dump_string("reshard_status", to_string(bucket_info.layout.resharding));
- logrecord_ut.gmtime(formatter->dump_stream("judge_reshard_lock_time"));
formatter->dump_bool("object_lock_enabled", bucket_info.obj_lock_enabled());
formatter->dump_bool("mfa_enabled", bucket_info.mfa_enabled());
- ::encode_json("owner", bucket_info.owner, formatter);
+ ::encode_json("owner", bucket->get_info().owner, formatter);
- formatter->dump_string("ver", bucket_ver);
- formatter->dump_string("master_ver", master_ver);
+
@@ src/rgw/driver/rados/rgw_bucket.cc: static int bucket_stats(rgw::sal::Driver* dr
ctime_ut.gmtime(formatter->dump_stream("creation_time"));
- formatter->dump_string("max_marker", max_marker);
- dump_bucket_usage(stats, formatter);
- encode_json("bucket_quota", bucket_info.quota, formatter);
+ encode_json("bucket_quota", bucket->get_info().quota, formatter);
// bucket tagsCommit Parity Visualizer
| BACKPORT PR #68504 | SOURCE PR | SOURCE STATUS |
|---|---|---|
| 1128957 rgw: bucket_stats() uses local variable 'index' | PR #67189 | a3509f6 rgw: bucket_stats() uses local variable 'index' |
| c2149ab rgw/rados: pass SiteConfig into bucket_stats() | ca6d509 rgw/rados: pass SiteConfig into bucket_stats() | |
| 38fba88 rgw: 'bucket stats' omits usage for buckets on other zonegroups | 01d4deb rgw: 'bucket stats' omits usage for buckets on other zonegroups | |
| d9fb761 rgw: reenable 'bucket stats' on indexless buckets | bedcac2 rgw: reenable 'bucket stats' on indexless buckets |
🛟 Need Help?
If you need technical help resolving these issues, please consult with the Component Lead. If you need administrative overrides, please see the #ceph-upstream-releases channel on Slack and request a review from the @ceph/ceph-release-manager.
📋 Component Lead / Release Manager
To override the audit failure, apply releng-audit-override label or comment /audit override.
When you are ready for a new audit, please remove the releng-audit-fail label or comment /audit retest.
CI Run Log: View Workflow Details
|
pr testing completed and approved by @ivancich , more details In : https://tracker.ceph.com/issues/76715 |
|
jenkins test api |
|
jenkins test make check |
backport tracker: https://tracker.ceph.com/issues/76145
backport of #67189
parent tracker: https://tracker.ceph.com/issues/74231
this backport was staged using ceph-backport.sh version 16.0.0.6848
find the latest version at https://github.com/ceph/ceph/blob/main/src/script/ceph-backport.sh