return ret;
}
- if (bucket->get_info().is_indexless()) {
+ const auto& index = bucket->get_info().get_current_index();
+ if (is_layout_indexless(index)) {
cerr << "error, indexless buckets do not maintain stats; bucket=" <<
bucket->get_name() << std::endl;
return -EINVAL;
}
- const auto& index = bucket->get_info().get_current_index();
std::string bucket_ver, master_ver;
std::string max_marker;
ret = bucket->read_stats(dpp, index, RGW_NO_SHARD, &bucket_ver, &master_ver, stats, &max_marker);
for (const auto& iter : m_buckets) {
auto& bucket = iter.second;
- uint32_t num_shards = 1;
uint64_t num_objects = 0;
marker = bucket->get_name(); /* Casey's location for marker update,
if (ret < 0)
continue;
+ const auto& index = bucket->get_info().get_current_index();
+ if (is_layout_indexless(index)) {
+ continue; // indexless buckets don't have stats
+ }
+
/* need stats for num_entries */
string bucket_ver, master_ver;
std::map<RGWObjCategory, RGWStorageStats> stats;
- const auto& latest_log = bucket->get_info().layout.logs.back();
- const auto& index = log_to_index_layout(latest_log);
ret = bucket->read_stats(dpp, index, RGW_NO_SHARD, &bucket_ver, &master_ver, stats, nullptr);
if (ret < 0)
num_objects += s.second.num_objects;
}
- num_shards = bucket->get_info().layout.current_index.layout.normal.num_shards;
+ const uint32_t num_shards = rgw::num_shards(index.layout.normal);
uint64_t objs_per_shard =
(num_shards) ? num_objects/num_shards : num_objects;
{
ldpp_dout(&dp, 20) << "initiating async quota refresh for bucket=" << bucket << dendl;
- const auto& latest_log = rbucket->get_info().layout.logs.back();
- const auto& index = log_to_index_layout(latest_log);
+ const auto& index = rbucket->get_info().get_current_index();
+ if (is_layout_indexless(index)) {
+ return 0;
+ }
+
r = rbucket->read_stats_async(&dp, index, RGW_NO_SHARD, this);
if (r < 0) {
ldpp_dout(&dp, 0) << "could not get bucket info for bucket=" << bucket.name << dendl;
return r;
}
+ stats = RGWStorageStats();
+
+ const auto& index = bucket->get_info().get_current_index();
+ if (is_layout_indexless(index)) {
+ return 0;
+ }
+
string bucket_ver;
string master_ver;
- const auto& latest_log = bucket->get_info().layout.logs.back();
- const auto& index = log_to_index_layout(latest_log);
-
map<RGWObjCategory, RGWStorageStats> bucket_stats;
r = bucket->read_stats(dpp, index, RGW_NO_SHARD, &bucket_ver,
&master_ver, bucket_stats, nullptr);
return r;
}
- stats = RGWStorageStats();
-
for (const auto& pair : bucket_stats) {
const RGWStorageStats& s = pair.second;
" entry_key_list.size()=" << entry_key_list.size() << dendl_bitx;
ldout_bitx(bitx, dpp, 25) << "BACKTRACE: " << __func__ << ": " << ClibBackTrace(0) << dendl_bitx;
- const rgw::bucket_index_layout_generation& latest_layout = bucket_info.layout.current_index;
- if (latest_layout.layout.type != rgw::BucketIndexType::Normal ||
- latest_layout.layout.normal.hash_type != rgw::BucketHashType::Mod) {
- ldout_bitx(bitx, dpp, 0) << "ERROR: " << __func__ << " index for bucket=" <<
- bucket_info.bucket << " is not a normal modulo index" << dendl_bitx;
+ const auto& current_index = bucket_info.get_current_index();
+ if (is_layout_indexless(current_index)) {
return -EINVAL;
}
- const uint32_t num_shards = latest_layout.layout.normal.num_shards;
+ const uint32_t num_shards = current_index.layout.normal.num_shards;
RGWSI_RADOS::Pool index_pool;
std::map<int, std::string> index_oids;
if (ret < 0)
return ret;
- const auto& latest_log = info.layout.logs.back();
- const auto& index = log_to_index_layout(latest_log);
-
+ const auto& index = info.get_current_index();
ret = read_stats(dpp, index, RGW_NO_SHARD, &bucket_ver, &master_ver, stats, NULL);
if (ret < 0)
return ret;