Need to diffrerentiate between need to sync and actually syncing. Zone might need
to sync, but we're running in radosgw-admin and we don't actually sync.
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
return svc.init_raw(cct, use_cache);
}
- return svc.init(cct, use_cache);
+ return svc.init(cct, use_cache, run_sync_thread);
}
int RGWRados::init_ctl()
}
if (!bucket_instance.empty()) {
- rgw_bucket b(rgw_bucket_key(tenant_name, bucket_name, bucket_instance));
+ rgw_bucket b(rgw_bucket_key(tenant_name, bn, bucket_instance));
http_ret = store->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield);
if (http_ret < 0) {
ldpp_dout(s, 5) << "could not get bucket instance info for bucket instance id=" << bucket_instance << dendl;
}
if (!bucket_instance.empty()) {
- rgw_bucket b(rgw_bucket_key(tenant_name, bucket_name, bucket_instance));
+ rgw_bucket b(rgw_bucket_key(tenant_name, bn, bucket_instance));
http_ret = store->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield);
if (http_ret < 0) {
ldpp_dout(s, 5) << "could not get bucket instance info for bucket instance id=" << bucket_instance << dendl;
}
if (!bucket_instance.empty()) {
- rgw_bucket b(rgw_bucket_key(tenant_name, bucket_name, bucket_instance));
+ rgw_bucket b(rgw_bucket_key(tenant_name, bn, bucket_instance));
http_ret = store->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield);
if (http_ret < 0) {
ldpp_dout(s, 5) << "could not get bucket instance info for bucket instance id=" << bucket_instance << dendl;
int RGWServices_Def::init(CephContext *cct,
bool have_cache,
- bool raw)
+ bool raw,
+ bool run_sync)
{
finisher = std::make_unique<RGWSI_Finisher>(cct);
bucket_sobj = std::make_unique<RGWSI_Bucket_SObj>(cct);
bilog_rados = std::make_unique<RGWSI_BILog_RADOS>(cct);
cls = std::make_unique<RGWSI_Cls>(cct);
datalog_rados = std::make_unique<RGWSI_DataLog_RADOS>(cct);
- mdlog = std::make_unique<RGWSI_MDLog>(cct);
+ mdlog = std::make_unique<RGWSI_MDLog>(cct, run_sync);
meta = std::make_unique<RGWSI_Meta>(cct);
meta_be_sobj = std::make_unique<RGWSI_MetaBackend_SObj>(cct);
meta_be_otp = std::make_unique<RGWSI_MetaBackend_OTP>(cct);
}
-int RGWServices::do_init(CephContext *_cct, bool have_cache, bool raw)
+int RGWServices::do_init(CephContext *_cct, bool have_cache, bool raw, bool run_sync)
{
cct = _cct;
- int r = _svc.init(cct, have_cache, raw);
+ int r = _svc.init(cct, have_cache, raw, run_sync);
if (r < 0) {
return r;
}
RGWServices_Def();
~RGWServices_Def();
- int init(CephContext *cct, bool have_cache, bool raw_storage);
+ int init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync);
void shutdown();
};
RGWSI_SysObj_Core *core{nullptr};
RGWSI_User *user{nullptr};
- int do_init(CephContext *cct, bool have_cache, bool raw_storage);
+ int do_init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync);
- int init(CephContext *cct, bool have_cache) {
- return do_init(cct, have_cache, false);
+ int init(CephContext *cct, bool have_cache, bool run_sync) {
+ return do_init(cct, have_cache, false, run_sync);
}
int init_raw(CephContext *cct, bool have_cache) {
- return do_init(cct, have_cache, true);
+ return do_init(cct, have_cache, true, false);
}
void shutdown() {
_svc.shutdown();
if (error_injection &&
rand() % 10000 < cct->_conf->rgw_sync_meta_inject_err_probability * 10000.0) {
- ldpp_dout(sync_env->dpp, 0) << __FILE__ << ":" << __LINE__ << ": injecting meta sync error on key=" << raw_key << dendl;
return set_cr_error(-EIO);
}
using Svc = RGWSI_MDLog::Svc;
using Cursor = RGWPeriodHistory::Cursor;
-RGWSI_MDLog::RGWSI_MDLog(CephContext *cct) : RGWServiceInstance(cct) {
+RGWSI_MDLog::RGWSI_MDLog(CephContext *cct, bool _run_sync) : RGWServiceInstance(cct), run_sync(_run_sync) {
}
RGWSI_MDLog::~RGWSI_MDLog() {
period_history.reset(new RGWPeriodHistory(cct, period_puller.get(),
current_period));
- if (svc.zone->need_to_sync()) {
+ if (run_sync &&
+ svc.zone->need_to_sync()) {
// initialize the log period history
svc.mdlog->init_oldest_log_period();
}
// use the current period's log for mutating operations
RGWMetadataLog* current_log{nullptr};
+ bool run_sync;
+
// pulls missing periods for period_history
std::unique_ptr<RGWPeriodPuller> period_puller;
// maintains a connected history of periods
std::unique_ptr<RGWPeriodHistory> period_history;
public:
- RGWSI_MDLog(CephContext *cct);
+ RGWSI_MDLog(CephContext *cct, bool run_sync);
virtual ~RGWSI_MDLog();
struct Svc {