Skip to content

Commit

Permalink
rgw: display data sync recovering shards in radosgw-admin sync status
Browse files Browse the repository at this point in the history
Signed-off-by: lvshanchun <lvshanchun@gmail.com>
  • Loading branch information
Leeshine committed Jan 18, 2018
1 parent 7a58cb7 commit 517ce71
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/rgw/rgw_admin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2084,6 +2084,13 @@ static void get_data_sync_status(const string& source_zone, list<string>& status
return;
}

set<int> recovering_shards;
ret = sync.read_recovering_shards(&sync_status, recovering_shards);
if (ret < 0 && ret != ENOENT) {
push_ss(ss, status, tab) << string("failed read recovering shards: ") + cpp_strerror(-ret);
return;
}

string status_str;
switch (sync_status.sync_info.state) {
case rgw_data_sync_info::StateInit:
Expand Down Expand Up @@ -2169,9 +2176,10 @@ static void get_data_sync_status(const string& source_zone, list<string>& status
}

int total_behind = shards_behind.size() + (sync_status.sync_info.num_shards - num_inc);
if (total_behind == 0) {
int total_recovering = recovering_shards.size();
if (total_behind == 0 && total_recovering == 0) {
push_ss(ss, status, tab) << "data is caught up with source";
} else {
} else if (total_behind > 0) {
push_ss(ss, status, tab) << "data is behind on " << total_behind << " shards";

push_ss(ss, status, tab) << "behind shards: " << "[" << shards_behind_set << "]" ;
Expand Down Expand Up @@ -2201,6 +2209,11 @@ static void get_data_sync_status(const string& source_zone, list<string>& status
}
}

if (total_recovering > 0) {
push_ss(ss, status, tab) << total_recovering << " shards are recovering";
push_ss(ss, status, tab) << "recovering shards: " << "[" << recovering_shards << "]";
}

flush_ss(ss, status);
}

Expand Down

0 comments on commit 517ce71

Please sign in to comment.