Project

General

Profile

Actions

Tasks #12232

open

radosgw-admin bucket stats give incorrect max_markers when bucket index sharding is enabled.

Added by Jeegn Chen almost 9 years ago. Updated almost 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
% Done:

0%

Tags:
Reviewed:
Affected Versions:
Pull request ID:

Description

int RGWRados::get_bucket_stats(rgw_bucket& bucket, string *bucket_ver, string *master_ver,
map<RGWObjCategory, RGWStorageStats>& stats, string *max_marker) {
map<string, rgw_bucket_dir_header> headers;
map<int, string> bucket_instance_ids;
int r = cls_bucket_head(bucket, headers, &bucket_instance_ids);
if (r < 0)
return r;

assert(headers.size() == bucket_instance_ids.size());
map&lt;string, rgw_bucket_dir_header&gt;::iterator iter = headers.begin();<<<<&lt;The keys of the map are strings like &quot;.dir.za.5124.2.1&quot;, &quot;.dir.za.5124.2.2&quot;, &quot;.dir.za.5124.2.10&quot; 
map&lt;int, string&gt;::iterator viter = bucket_instance_ids.begin();<<<<<<<<<&lt;The keys of the map are integers like 0, 1, 2, 10
BucketIndexShardsManager ver_mgr;
BucketIndexShardsManager master_ver_mgr;
BucketIndexShardsManager marker_mgr;
char buf[64];
for(; iter != headers.end(); ++iter, ++viter) { <<<<&lt;For integers, 2 will be before 10. But for strings, &quot;.dir.za.5124.2.10&quot; is before &quot;.dir.za.5124.2.2&quot; instead. Thus, the 2 iterators will go ahead in different orders and give incorrect results finally.
accumulate_raw_stats(iter->second, stats);
snprintf(buf, sizeof(buf), "%lu", iter->second.ver);
ver_mgr.add(viter->first, string(buf));
snprintf(buf, sizeof(buf), "%lu", iter->second.master_ver);
master_ver_mgr.add(viter->first, string(buf));
marker_mgr.add(viter->first, iter->second.max_marker);
}
ver_mgr.to_string(bucket_ver);
master_ver_mgr.to_string(master_ver);
marker_mgr.to_string(max_marker);
return 0;
}
Actions #1

Updated by Loïc Dachary almost 9 years ago

  • Project changed from Stable releases to rgw
Actions

Also available in: Atom PDF