From ca3a87291f5990aae3281636d8250021ac873cb3 Mon Sep 17 00:00:00 2001 From: lvshanchun Date: Mon, 18 Dec 2017 16:36:19 +0800 Subject: [PATCH] rgw: add lagging shard ids in rgw sync status Signed-off-by: lvshanchun (cherry picked from commit 99f3c3f8e97159cda401b280ea25f9822b14b90d) --- src/rgw/rgw_admin.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 282621b67a73..493a010674e5 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -1941,13 +1941,16 @@ static void get_md_sync_status(list& status) int num_full = 0; int num_inc = 0; int total_shards = 0; + set shards_behind_set; for (auto marker_iter : sync_status.sync_markers) { full_total += marker_iter.second.total_entries; total_shards++; + int shard_id = marker_iter.first; if (marker_iter.second.state == rgw_meta_sync_marker::SyncState::FullSync) { num_full++; full_complete += marker_iter.second.pos; + shards_behind_set.insert(shard_id); } else { full_complete += marker_iter.second.total_entries; } @@ -1999,6 +2002,7 @@ static void get_md_sync_status(list& status) if (local_iter.second.state == rgw_meta_sync_marker::SyncState::IncrementalSync && master_marker > local_iter.second.marker) { shards_behind[shard_id] = local_iter.second.marker; + shards_behind_set.insert(shard_id); } } } @@ -2008,6 +2012,8 @@ static void get_md_sync_status(list& status) push_ss(ss, status) << "metadata is caught up with master"; } else { push_ss(ss, status) << "metadata is behind on " << total_behind << " shards"; + + push_ss(ss, status) << "behind shards: " << "[" << shards_behind_set << "]"; map master_pos; ret = sync.read_master_log_shards_next(sync_status.sync_info.period, shards_behind, &master_pos); @@ -2093,13 +2099,16 @@ static void get_data_sync_status(const string& source_zone, list& status int num_full = 0; int num_inc = 0; int total_shards = 0; + set shards_behind_set; for (auto marker_iter : sync_status.sync_markers) { + int shard_id = marker_iter.first; full_total += marker_iter.second.total_entries; total_shards++; if (marker_iter.second.state == rgw_data_sync_marker::SyncState::FullSync) { num_full++; full_complete += marker_iter.second.pos; + shards_behind_set.insert(shard_id); } else { full_complete += marker_iter.second.total_entries; } @@ -2147,6 +2156,7 @@ static void get_data_sync_status(const string& source_zone, list& status if (local_iter.second.state == rgw_data_sync_marker::SyncState::IncrementalSync && master_marker > local_iter.second.marker) { shards_behind[shard_id] = local_iter.second.marker; + shards_behind_set.insert(shard_id); } } @@ -2156,6 +2166,8 @@ static void get_data_sync_status(const string& source_zone, list& status } else { push_ss(ss, status, tab) << "data is behind on " << total_behind << " shards"; + push_ss(ss, status, tab) << "behind shards: " << "[" << shards_behind_set << "]" ; + map master_pos; ret = sync.read_source_log_shards_next(shards_behind, &master_pos); if (ret < 0) { -- 2.47.3