Bug #74231
closedradosgw-admin bucket stats fails in master zonegroup for bucket located in a slave zonegroup
0%
Description
This bug affects buckets in a multi zonegroup (one zone per zonegroup) setup. It only affects buckets created with Squid or later. Buckets existing before the update to Squid are not affected.
This does not only affect the radosgw-admin command but also the corresponding RGW admin API call.
The `radosgw-admin bucket stats` command fails in the primary zonegroup for a bucket located in the secondary zonegroup. It works in the secondary zonegroup.
Steps to reproduce:
1. Have a multi zonegroup setup with zonegroups "primary" (master zonegroup) and "secondary" (slave zonegroup).
2. Create a bucket "bucket-secondary" in the "secondary" zonegroup
3. Issue `radsogw-admin bucket stats --bucket bucket-secondary` in the master zonegroup:
root@master-zonegroup:~# radosgw-admin bucket stats --bucket bucket-secondary
error getting bucket stats bucket=bucket-secondary ret=-2
failure: (2) No such file or directory:
Further information:
- The same command works as expected in the slave zonegroup where the bucket is located:
root@slave-zonegroup:~# radosgw-admin bucket stats --bucket bucket-secondary
{
"bucket": "bucket-secondary",
"tenant": "",
"versioning": "off",
"zonegroup": "4b1d265e-0343-4d78-9db3-f052da855d8e",
"placement_rule": "default-placement",
"explicit_placement": {
"data_pool": "",
"data_extra_pool": "",
"index_pool": ""
},
"id": "ad46b813-d7df-41f8-bb3e-9a804b847ce1.1442487603.3728",
"marker": "ad46b813-d7df-41f8-bb3e-9a804b847ce1.1442487603.3728",
"index_type": "Normal",
"index_generation": 0,
"num_shards": 32,
"object_lock_enabled": false,
"mfa_enabled": false,
"owner": "60b72ac4d8c558dd7962cb18b9e6312232a187e8a54b2a2c9eb677c744267cb9",
"ver": "0#1,1#1,2#1,3#1,4#1,5#1,6#1,7#1,8#1,9#1,10#1,11#1,12#1,13#1,14#1,15#1,16#1,17#1,18#1,19#1,20#1,21#1,22#1,23#1,24#1,25#1,26#1,27
#1,28#1,29#1,30#1,31#1",
"master_ver": "0#0,1#0,2#0,3#0,4#0,5#0,6#0,7#0,8#0,9#0,10#0,11#0,12#0,13#0,14#0,15#0,16#0,17#0,18#0,19#0,20#0,21#0,22#0,23#0,24#0,25#0,
26#0,27#0,28#0,29#0,30#0,31#0",
"mtime": "2025-12-15T16:04:47.349193Z",
"creation_time": "2025-12-15T16:04:47.336153Z",
"max_marker": "0#,1#,2#,3#,4#,5#,6#,7#,8#,9#,10#,11#,12#,13#,14#,15#,16#,17#,18#,19#,20#,21#,22#,23#,24#,25#,26#,27#,28#,29#,30#,31#",
"usage": {},
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
}
}
- Bucket and bucket instance metadata is present in both zonegroups and can be queried with radosgw-admin metadata get. The only difference is that num_shards is 1 in the master zonegroup (where the bucket is not located), but there are no index objects created for the bucket there.
root@master-zonegroup:~# radosgw-admin metadata get bucket.instance:bucket-secondary:ad46b813-d7df-41f8-bb3e-9a804b847ce1.1442487603.3728 | jq .data.bucket_info.num_shards
1
- Changing num_shards on the master zonegroup to 0 fixes the problem. But I'm not sure if this is the correct solution or if this causes other problems:
# bucket-instance.json is modified to have "num_shards": 0
root@master-zonegroup:~# radosgw-admin metadata put bucket.instance:bucket-secondary:ad46b813-d7df-41f8-bb3e-9a804b847ce1.1442487603.3728 --infile bucket-instance.json
root@master-zonegroup:~# radosgw-admin metadata get bucket.instance:bucket-secondary:ad46b813-d7df-41f8-bb3e-9a804b847ce1.1442487603.3728 | jq .data.bucket_info.num_shards
0
root@master-zonegroup:~# radosgw-admin bucket stats --bucket bucket-secondary
{
"bucket": "bucket-secondary",
"tenant": "",
"versioning": "off",
"zonegroup": "4b1d265e-0343-4d78-9db3-f052da855d8e",
"placement_rule": "default-placement",
"explicit_placement": {
"data_pool": "",
"data_extra_pool": "",
"index_pool": ""
},
"id": "ad46b813-d7df-41f8-bb3e-9a804b847ce1.1442487603.3728",
"marker": "ad46b813-d7df-41f8-bb3e-9a804b847ce1.1442487603.3728",
"index_type": "Normal",
"index_generation": 0,
"num_shards": 0,
"object_lock_enabled": false,
"mfa_enabled": false,
"owner": "60b72ac4d8c558dd7962cb18b9e6312232a187e8a54b2a2c9eb677c744267cb9",
"ver": "0#1",
"master_ver": "0#0",
"mtime": "2025-12-15T16:04:47.349193Z",
"creation_time": "2025-12-15T16:04:47.336153Z",
"max_marker": "0#",
"usage": {},
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
}
}
- The problem does not the other way around, when the bucket is located in the master zonegroup. In this case the bucket index is synchronized to the slave zonegroup by the zonegroup metadata sync.
I suspect this behavioral change was introduced with this PR: https://github.com/ceph/ceph/pull/50599 especially in this commit: https://github.com/ceph/ceph/pull/50599/commits/e2eb66a36175dbd7ee0cdc706b1965c978807416
This PR changes the behavior to not create a bucket index in the master zonegroup for buckets in a slave zonegroup (when the bucket create request is forwarded). This sounds like a reasonable change, but has the unintended consequence that the default bucket instance metadata configuration is used wich has num_shards=1 which is wrong as this bucket does not have an index at all.
CB Updated by Casey Bodley 10 months ago
it sounds like we probably don't want to restore the old behavior of printing empty stats. maybe just add an error message for this case, saying to run the command on a zone in the right zonegroup?
GS Updated by Gaudenz Steinlin 10 months ago
Hi Casey, thanks for looking into this issue.
I would prefer to either restore the old behavior or to at least print the basic information about the bucket. The bucket can still have usage logs in this zonegroup and it's listed with a bucket list call. The bucket stats call is useful to see that this is a bucket from another zonegroup (and to get the zonegroup id). I think the information shown above when setting the num_shards=0 is correct. IMO the fix should be to set num_shards=0 as the bucket actually does not have any shards in this zonegroup.
Any change of the information shown could be done in a followup.
CB Updated by Casey Bodley 10 months ago
- Related to Bug #74729: buckets created in non master site are missing in the master site index added
CB Updated by Casey Bodley 10 months ago
- Status changed from New to Fix Under Review
- Assignee set to Casey Bodley
- Backport set to squid tentacle
- Pull request ID set to 67189
CB Updated by Casey Bodley 10 months ago
thanks Gaudenz and Boris,
i've raised https://github.com/ceph/ceph/pull/67189 to work around this "No such file or directory" error. instead of failing when the local zone doesn't have a bucket index, the following fields are omitted: num_shards, ver, master_ver, max_marker, usage
does that work for you?
CB Updated by Casey Bodley 10 months ago
- Has duplicate Bug #74729: buckets created in non master site are missing in the master site index added
BB Updated by Boris B 10 months ago
I just discovered that his bug seems to also make it hard to get the users quota usage on the master zonegroup
~# radosgw-admin user stats --uid USER --sync-stats ERROR: could not sync user stats: 2026-02-12T09:10:48.159+0000 727f4fdd4a80 0 ERROR: could not sync bucket stats: ret=-2 (2) No such file or directory
Without `--sync-stats`
root@s3db22:~# radosgw-admin user stats --uid UID
{
"stats": {
"size": 0,
"size_actual": 0,
"size_kb": 0,
"size_kb_actual": 0,
"num_objects": 0
},
"last_stats_sync": "2026-01-27T12:06:36.265477Z",
"last_stats_update": "2026-02-10T15:12:34.964386Z"
}
Which works in the non master zonegroups
root@3cecef5afb05:~# radosgw-admin user stats --uid UID --sync-stats
{
"stats": {
...
},
"last_stats_sync": "2026-02-12T09:11:46.665351Z",
"last_stats_update": "2026-02-12T09:11:46.664793Z"
}
CB Updated by Casey Bodley 8 months ago
- Status changed from Fix Under Review to Pending Backport
UB Updated by Upkeep Bot 8 months ago
- Merge Commit set to cf0bbda4309508dd11f906f565229da2e3944101
- Fixed In set to v21.0.0-737-gcf0bbda430
- Upkeep Timestamp set to 2026-04-20T19:26:39+00:00
UB Updated by Upkeep Bot 8 months ago
- Copied to Backport #76144: tentacle: radosgw-admin bucket stats fails in master zonegroup for bucket located in a slave zonegroup added
UB Updated by Upkeep Bot 8 months ago
- Copied to Backport #76145: squid: radosgw-admin bucket stats fails in master zonegroup for bucket located in a slave zonegroup added
UB Updated by Upkeep Bot 8 months ago
- Tags (freeform) set to backport_processed
UB Updated by Upkeep Bot 3 months ago
- Status changed from Pending Backport to Resolved
- Tags (freeform) deleted (
backport_processed) - Upkeep Timestamp changed from 2026-04-20T19:26:39+00:00 to 2026-08-27T18:30:29+00:00
UB Updated by Upkeep Bot about 1 month ago
- Released In set to v21.2.0~712
- Upkeep Timestamp changed from 2026-08-27T18:30:29+00:00 to 2026-10-24T01:49:38+00:00