OPT_DATA_SYNC_RUN,
OPT_DATALOG_LIST,
OPT_DATALOG_STATUS,
+ OPT_DATALOG_AUTOTRIM,
OPT_DATALOG_TRIM,
OPT_REALM_CREATE,
OPT_REALM_DELETE,
} else if (strcmp(prev_cmd, "datalog") == 0) {
if (strcmp(cmd, "list") == 0)
return OPT_DATALOG_LIST;
+ if (strcmp(cmd, "autotrim") == 0)
+ return OPT_DATALOG_AUTOTRIM;
if (strcmp(cmd, "trim") == 0)
return OPT_DATALOG_TRIM;
if (strcmp(cmd, "status") == 0)
formatter->flush(cout);
}
+ if (opt_cmd == OPT_DATALOG_AUTOTRIM) {
+ RGWCoroutinesManager crs(store->ctx(), store->get_cr_registry());
+ RGWHTTPManager http(store->ctx(), crs.get_completion_mgr());
+ int ret = http.start();
+ if (ret < 0) {
+ cerr << "failed to initialize http client with " << cpp_strerror(ret) << std::endl;
+ return -ret;
+ }
+
+ auto num_shards = g_conf()->rgw_data_log_num_shards;
+ std::vector<std::string> markers(num_shards);
+ ret = crs.run(create_admin_data_log_trim_cr(store, &http, num_shards, markers));
+ if (ret < 0) {
+ cerr << "automated datalog trim failed with " << cpp_strerror(ret) << std::endl;
+ return -ret;
+ }
+ }
+
if (opt_cmd == OPT_DATALOG_TRIM) {
utime_t start_time, end_time;
return 0;
}
+RGWCoroutine* create_admin_data_log_trim_cr(RGWRados *store,
+ RGWHTTPManager *http,
+ int num_shards,
+ std::vector<std::string>& markers)
+{
+ return new DataLogTrimCR(store, http, num_shards, markers);
+}
+
class DataLogTrimPollCR : public RGWCoroutine {
RGWRados *store;
RGWHTTPManager *http;
RGWHTTPManager *http,
int num_shards, utime_t interval);
+// factory function for datalog trim via radosgw-admin
+RGWCoroutine* create_admin_data_log_trim_cr(RGWRados *store,
+ RGWHTTPManager *http,
+ int num_shards,
+ std::vector<std::string>& markers);
+
#endif