Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: retry RGWRemoteMetaLog::read_log_info() while master is down #8453

Merged
merged 1 commit into from Apr 8, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 20 additions & 5 deletions src/rgw/rgw_sync.cc
Expand Up @@ -1868,13 +1868,28 @@ int RGWRemoteMetaLog::run_sync()
}

RGWObjectCtx obj_ctx(store, NULL);
int r = 0;

// get shard count and oldest log period from master
rgw_mdlog_info mdlog_info;
int r = read_log_info(&mdlog_info);
if (r < 0) {
lderr(store->ctx()) << "ERROR: fail to fetch master log info (r=" << r << ")" << dendl;
return r;
for (;;) {
if (going_down.read()) {
ldout(store->ctx(), 1) << __func__ << "(): going down" << dendl;
return 0;
}
r = read_log_info(&mdlog_info);
if (r == -EIO) {
// keep retrying if master isn't alive
ldout(store->ctx(), 10) << __func__ << "(): waiting for master.." << dendl;
backoff.backoff_sleep();
continue;
}
backoff.reset();
if (r < 0) {
lderr(store->ctx()) << "ERROR: fail to fetch master log info (r=" << r << ")" << dendl;
return r;
}
break;
}

do {
Expand Down Expand Up @@ -1924,7 +1939,7 @@ int RGWRemoteMetaLog::run_sync()
auto num_shards = sync_status.sync_info.num_shards;
if (num_shards != mdlog_info.num_shards) {
lderr(store->ctx()) << "ERROR: can't sync, mismatch between num shards, master num_shards=" << mdlog_info.num_shards << " local num_shards=" << num_shards << dendl;
return r;
return -EINVAL;
}

RGWPeriodHistory::Cursor cursor;
Expand Down