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;
const std::list<rgw_obj_index_key>& entry_key_list)
{
RGWSI_RADOS::Pool index_pool;
- const auto& latest_log = bucket_info.layout.logs.back();
- const rgw::bucket_index_layout_generation& current_index =
- rgw::log_to_index_layout(latest_log);
-
+ const auto& current_index = bucket_info.get_current_index();
+ if (is_layout_indexless(current_index)) {
+ return 0;
+ }
const uint32_t num_shards = current_index.layout.normal.num_shards;
uint8_t suggest_flag = (svc.zone->get_zone().log_data ? CEPH_RGW_DIR_SUGGEST_LOG_OP : 0);
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;