if (op_ret) {
return;
}
+ op_ret = bucket->update_container_stats(s);
}
int RGWListBucket::verify_permission(optional_yield y)
owner = _owner;
}
- /** Load this bucket from the backing store. Requires the key to be set, fills other fields */
- virtual int load_bucket(const DoutPrefixProvider* dpp, optional_yield y) = 0;
+ /** Load this bucket from the backing store. Requires the key to be set, fills other fields.
+ * If @a get_stats is true, then statistics on the bucket are also looked up. */
+ virtual int load_bucket(const DoutPrefixProvider* dpp, optional_yield y, bool get_stats = false) = 0;
/** Read the bucket stats from the backing Store, synchronous */
virtual int read_stats(const DoutPrefixProvider *dpp, int shard_id,
std::string* bucket_ver, std::string* master_ver,
return 0;
}
- int DBBucket::load_bucket(const DoutPrefixProvider *dpp, optional_yield y)
+ int DBBucket::load_bucket(const DoutPrefixProvider *dpp, optional_yield y, bool get_stats)
{
int ret = 0;
DoutPrefixProvider *dpp) override;
virtual RGWAccessControlPolicy& get_acl(void) override { return acls; }
virtual int set_acl(const DoutPrefixProvider *dpp, RGWAccessControlPolicy& acl, optional_yield y) override;
- virtual int load_bucket(const DoutPrefixProvider *dpp, optional_yield y) override;
+ virtual int load_bucket(const DoutPrefixProvider *dpp, optional_yield y, bool get_stats = false) override;
virtual int read_stats(const DoutPrefixProvider *dpp, int shard_id,
std::string *bucket_ver, std::string *master_ver,
std::map<RGWObjCategory, RGWStorageStats>& stats,
return ret;
}
-int RadosBucket::load_bucket(const DoutPrefixProvider* dpp, optional_yield y)
+int RadosBucket::load_bucket(const DoutPrefixProvider* dpp, optional_yield y, bool get_stats)
{
auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
int ret;
bucket_version = ep_ot.read_version;
- ret = store->ctl()->bucket->read_bucket_stats(info.bucket, &ent, y, dpp);
+ if (get_stats) {
+ ret = store->ctl()->bucket->read_bucket_stats(info.bucket, &ent, y, dpp);
+ }
return ret;
}
DoutPrefixProvider *dpp) override;
virtual RGWAccessControlPolicy& get_acl(void) override { return acls; }
virtual int set_acl(const DoutPrefixProvider* dpp, RGWAccessControlPolicy& acl, optional_yield y) override;
- virtual int load_bucket(const DoutPrefixProvider* dpp, optional_yield y) override;
+ virtual int load_bucket(const DoutPrefixProvider* dpp, optional_yield y, bool get_stats = false) override;
virtual int read_stats(const DoutPrefixProvider *dpp, int shard_id,
std::string* bucket_ver, std::string* master_ver,
std::map<RGWObjCategory, RGWStorageStats>& stats,
marker = i.first;
auto& bucket_ent = i.second;
- ret = bucket_ent->load_bucket(dpp, y);
+ ret = bucket_ent->load_bucket(dpp, y, true /* load user stats */);
if (ret < 0) {
ldpp_dout(dpp, 0) << "ERROR: could not get bucket stats: ret=" << ret << dendl;
return ret;