#include "rgw_replica_log.h"
#include "rgw_orphan.h"
#include "rgw_sync.h"
+#include "rgw_sync_log_trim.h"
#include "rgw_data_sync.h"
#include "rgw_rest_conn.h"
#include "rgw_realm_watcher.h"
OPT_BILOG_LIST,
OPT_BILOG_TRIM,
OPT_BILOG_STATUS,
+ OPT_BILOG_AUTOTRIM,
OPT_DATA_SYNC_STATUS,
OPT_DATA_SYNC_INIT,
OPT_DATA_SYNC_RUN,
return OPT_BILOG_TRIM;
if (strcmp(cmd, "status") == 0)
return OPT_BILOG_STATUS;
+ if (strcmp(cmd, "autotrim") == 0)
+ return OPT_BILOG_AUTOTRIM;
} else if (strcmp(prev_cmd, "data") == 0) {
if (strcmp(cmd, "sync") == 0) {
*need_more = true;
formatter->flush(cout);
}
+ if (opt_cmd == OPT_BILOG_AUTOTRIM) {
+ rgw::BucketTrimConfig config;
+ configure_bucket_trim(store->ctx(), config);
+
+ rgw::BucketTrimManager trim(store, config);
+ ret = trim.init();
+ if (ret < 0) {
+ cerr << "trim manager init failed with " << cpp_strerror(ret) << std::endl;
+ return -ret;
+ }
+
+ RGWCoroutinesManager crs(store->ctx(), store->get_cr_registry());
+ ret = crs.run(trim.create_admin_bucket_trim_cr());
+ if (ret < 0) {
+ cerr << "automated bilog trim failed with " << cpp_strerror(ret) << std::endl;
+ return -ret;
+ }
+ }
+
if (opt_cmd == OPT_DATALOG_LIST) {
formatter->open_array_section("entries");
bool truncated;
impl.get(), impl->status_obj);
}
+RGWCoroutine* BucketTrimManager::create_admin_bucket_trim_cr()
+{
+ // return the trim coroutine without any polling
+ return new BucketTrimCR(impl->store, impl->config,
+ impl.get(), impl->status_obj);
+}
+
} // namespace rgw
/// create a coroutine to run the bucket trim process every trim interval
RGWCoroutine* create_bucket_trim_cr();
+
+ /// create a coroutine to trim buckets directly via radosgw-admin
+ RGWCoroutine* create_admin_bucket_trim_cr();
};
/// provides persistent storage for the trim manager's current position in the