#undef dout_prefix
#define dout_prefix (*_dout << "trim: ")
+using namespace std;
+
using rgw::BucketTrimConfig;
using BucketChangeCounter = BoundedKeyCounter<std::string, int>;
/// rados watcher for bucket trim notifications
class BucketTrimWatcher : public librados::WatchCtx2 {
- rgw::sal::RGWRadosStore *const store;
+ rgw::sal::RadosStore* const store;
const rgw_raw_obj& obj;
rgw_rados_ref ref;
uint64_t handle{0};
boost::container::flat_map<TrimNotifyType, HandlerPtr> handlers;
public:
- BucketTrimWatcher(rgw::sal::RGWRadosStore *store, const rgw_raw_obj& obj,
+ BucketTrimWatcher(rgw::sal::RadosStore* store, const rgw_raw_obj& obj,
TrimCounters::Server *counters)
: store(store), obj(obj) {
handlers.emplace(NotifyTrimCounters, new TrimCounters::Handler(counters));
class BucketTrimShardCollectCR : public RGWShardCollectCR {
static constexpr int MAX_CONCURRENT_SHARDS = 16;
const DoutPrefixProvider *dpp;
- rgw::sal::RGWRadosStore *const store;
+ rgw::sal::RadosStore* const store;
const RGWBucketInfo& bucket_info;
const std::vector<std::string>& markers; //< shard markers to trim
size_t i{0}; //< index of current shard marker
public:
BucketTrimShardCollectCR(const DoutPrefixProvider *dpp,
- rgw::sal::RGWRadosStore *store, const RGWBucketInfo& bucket_info,
+ rgw::sal::RadosStore* store, const RGWBucketInfo& bucket_info,
const std::vector<std::string>& markers)
: RGWShardCollectCR(store->ctx(), MAX_CONCURRENT_SHARDS),
dpp(dpp), store(store), bucket_info(bucket_info), markers(markers)
/// trim the bilog of all of the given bucket instance's shards
class BucketTrimInstanceCR : public RGWCoroutine {
- rgw::sal::RGWRadosStore *const store;
+ rgw::sal::RadosStore* const store;
RGWHTTPManager *const http;
BucketTrimObserver *const observer;
std::string bucket_instance;
std::vector<std::string> min_markers; //< min marker per shard
public:
- BucketTrimInstanceCR(rgw::sal::RGWRadosStore *store, RGWHTTPManager *http,
+ BucketTrimInstanceCR(rgw::sal::RadosStore* store, RGWHTTPManager *http,
BucketTrimObserver *observer,
const std::string& bucket_instance,
const DoutPrefixProvider *dpp)
/// trim each bucket instance while limiting the number of concurrent operations
class BucketTrimInstanceCollectCR : public RGWShardCollectCR {
- rgw::sal::RGWRadosStore *const store;
+ rgw::sal::RadosStore* const store;
RGWHTTPManager *const http;
BucketTrimObserver *const observer;
std::vector<std::string>::const_iterator bucket;
std::vector<std::string>::const_iterator end;
const DoutPrefixProvider *dpp;
public:
- BucketTrimInstanceCollectCR(rgw::sal::RGWRadosStore *store, RGWHTTPManager *http,
+ BucketTrimInstanceCollectCR(rgw::sal::RadosStore* store, RGWHTTPManager *http,
BucketTrimObserver *observer,
const std::vector<std::string>& buckets,
int max_concurrent,
do {
// get the next key and marker
- r = mgr->list_keys_next(handle, 1, keys, &truncated);
+ r = mgr->list_keys_next(dpp, handle, 1, keys, &truncated);
if (r < 0) {
ldpp_dout(dpp, 10) << "failed to list metadata: "
<< cpp_strerror(r) << dendl;
auto g = make_scope_guard([=] { mgr->list_keys_complete(handle); });
do {
// get the next key and marker
- r = mgr->list_keys_next(handle, 1, keys, &truncated);
+ r = mgr->list_keys_next(dpp, handle, 1, keys, &truncated);
if (r < 0) {
ldpp_dout(dpp, 10) << "failed to list metadata: "
<< cpp_strerror(r) << dendl;
};
class BucketTrimCR : public RGWCoroutine {
- rgw::sal::RGWRadosStore *const store;
+ rgw::sal::RadosStore* const store;
RGWHTTPManager *const http;
const BucketTrimConfig& config;
BucketTrimObserver *const observer;
static const std::string section; //< metadata section for bucket instances
public:
- BucketTrimCR(rgw::sal::RGWRadosStore *store, RGWHTTPManager *http,
+ BucketTrimCR(rgw::sal::RadosStore* store, RGWHTTPManager *http,
const BucketTrimConfig& config, BucketTrimObserver *observer,
const rgw_raw_obj& obj, const DoutPrefixProvider *dpp)
: RGWCoroutine(store->ctx()), store(store), http(http), config(config),
}
class BucketTrimPollCR : public RGWCoroutine {
- rgw::sal::RGWRadosStore *const store;
+ rgw::sal::RadosStore* const store;
RGWHTTPManager *const http;
const BucketTrimConfig& config;
BucketTrimObserver *const observer;
const DoutPrefixProvider *dpp;
public:
- BucketTrimPollCR(rgw::sal::RGWRadosStore *store, RGWHTTPManager *http,
+ BucketTrimPollCR(rgw::sal::RadosStore* store, RGWHTTPManager *http,
const BucketTrimConfig& config,
BucketTrimObserver *observer, const rgw_raw_obj& obj,
const DoutPrefixProvider *dpp)
class BucketTrimManager::Impl : public TrimCounters::Server,
public BucketTrimObserver {
public:
- rgw::sal::RGWRadosStore *const store;
+ rgw::sal::RadosStore* const store;
const BucketTrimConfig config;
const rgw_raw_obj status_obj;
/// protect data shared between data sync, trim, and watch/notify threads
std::mutex mutex;
- Impl(rgw::sal::RGWRadosStore *store, const BucketTrimConfig& config)
+ Impl(rgw::sal::RadosStore* store, const BucketTrimConfig& config)
: store(store), config(config),
- status_obj(store->svc()->zone->get_zone_params().log_pool, BucketTrimStatus::oid),
+ status_obj(store->get_zone()->get_params().log_pool, BucketTrimStatus::oid),
counter(config.counter_size),
trimmed(config.recent_size, config.recent_duration),
watcher(store, status_obj, this)
}
};
-BucketTrimManager::BucketTrimManager(rgw::sal::RGWRadosStore *store,
+BucketTrimManager::BucketTrimManager(rgw::sal::RadosStore* store,
const BucketTrimConfig& config)
: impl(new Impl(store, config))
{