Skip to content

Commit

Permalink
rgw_admin: get sync_status locally itself
Browse files Browse the repository at this point in the history
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
  • Loading branch information
theanalyst committed Jan 12, 2017
1 parent e6af9b4 commit e21135b
Showing 1 changed file with 7 additions and 25 deletions.
32 changes: 7 additions & 25 deletions src/rgw/rgw_admin.cc
Expand Up @@ -1830,38 +1830,20 @@ static void get_md_sync_status(list<string>& status)
return;
}

string local_period = sync_status.sync_info.period;
map<int, RGWMetadataLogInfo> master_shards_info;
string master_period;
RGWRealm master_realm;
string remote,url,access_key,secret_key,realm_id,realm_name;

/* Set the master zonegroup as the remote */
RGWPeriod current_period(local_period);
ret = current_period.init(g_ceph_context, store);
if (ret < 0) {
status.push_back(string("failed to fetch local sync status") + cpp_strerror(-ret));
return;
}

remote = current_period.get_master_zonegroup();
ret = do_realm_get(remote, url, access_key, secret_key, realm_id, realm_name, master_realm);
if (ret < 0){
status.push_back(string("failed to fetch realm info from master: ") + cpp_strerror(-ret));
return;
}
ret = sync.read_master_log_shards_info(&master_period, &master_shards_info);
map<int, RGWMetadataLogInfo> master_shards_info;
string master_start_period;
ret = sync.read_master_log_shards_info(&master_start_period, &master_shards_info);
if (ret < 0){
status.push_back(string("failed to fetch master sync status: ") + cpp_strerror(-ret));
return;
}

/* master_period was set to the earliest period, set it to current */
master_period = master_realm.get_current_period();
map<int, string> shards_behind;

if (sync_status.sync_info.period != master_period) {
status.push_back(string("master is on a different period: master_period=" + master_period + " local_period=" + local_period));
if (store->get_current_period_id() != sync_status.sync_info.period) {
status.push_back(string("master is on a different period: master_period=" +
store->get_current_period_id() + " local_period=" +
sync_status.sync_info.period));
} else {
for (auto local_iter : sync_status.sync_markers) {
int shard_id = local_iter.first;
Expand Down

0 comments on commit e21135b

Please sign in to comment.