return r;
}
+
+RGWSyncLogTrimCR::RGWSyncLogTrimCR(RGWRados *store, const std::string& oid,
+ const std::string& to_marker,
+ std::string *last_trim_marker)
+ : RGWRadosTimelogTrimCR(store, oid, real_time{}, real_time{},
+ std::string{}, to_marker),
+ cct(store->ctx()), last_trim_marker(last_trim_marker)
+{
+}
+
+int RGWSyncLogTrimCR::request_complete()
+{
+ int r = RGWRadosTimelogTrimCR::request_complete();
+ if (r < 0 && r != -ENODATA) {
+ return r;
+ }
+ if (*last_trim_marker < to_marker) {
+ *last_trim_marker = to_marker;
+ }
+ return 0;
+}
+
+
int RGWAsyncStatObj::_send_request()
{
return store->raw_obj_stat(obj, psize, pmtime, pepoch,
int request_complete() override;
};
+// wrapper to update last_trim_marker on success
+class RGWSyncLogTrimCR : public RGWRadosTimelogTrimCR {
+ CephContext *cct;
+ std::string *last_trim_marker;
+ public:
+ RGWSyncLogTrimCR(RGWRados *store, const std::string& oid,
+ const std::string& to_marker, std::string *last_trim_marker);
+ int request_complete() override;
+};
+
class RGWAsyncStatObj : public RGWAsyncRadosRequest {
RGWRados *store;
rgw_obj obj;
}
}
-// wrapper to update last_trim_marker on success
-class LastTimelogTrimCR : public RGWRadosTimelogTrimCR {
- CephContext *cct;
- std::string *last_trim_marker;
- public:
- LastTimelogTrimCR(RGWRados *store, const std::string& oid,
- const std::string& to_marker, std::string *last_trim_marker)
- : RGWRadosTimelogTrimCR(store, oid, real_time{}, real_time{},
- std::string{}, to_marker),
- cct(store->ctx()), last_trim_marker(last_trim_marker)
- {}
- int request_complete() override {
- int r = RGWRadosTimelogTrimCR::request_complete();
- if (r < 0 && r != -ENODATA) {
- ldout(cct, 1) << "failed to trim datalog: " << cpp_strerror(r) << dendl;
- return r;
- }
- ldout(cct, 10) << "datalog trimmed to marker " << to_marker << dendl;
- *last_trim_marker = to_marker;
- return 0;
- }
-};
-
class DataLogTrimCR : public RGWCoroutine {
RGWRados *store;
RGWHTTPManager *http;
ldout(cct, 10) << "trimming log shard " << i
<< " at marker=" << stable
<< " last_trim=" << last_trim[i] << dendl;
- using TrimCR = LastTimelogTrimCR;
+ using TrimCR = RGWSyncLogTrimCR;
spawn(new TrimCR(store, store->data_log->get_oid(i),
stable, &last_trim[i]),
true);