radosgw-admin: sync status displays id of shard furthest behind

'radosgw-admin sync status' gives you a timestamp for the "oldest
incremental change not applied", but doesn't tell you which shard that
came from. add [shard-id] to the output

Fixes: https://tracker.ceph.com/issues/43360

Signed-off-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
Casey Bodley 2019-12-17 13:30:48 -05:00
parent 92b0638efd
commit d61beb74f6

View File

@ -2104,22 +2104,24 @@ static void get_md_sync_status(list<string>& status)
if (ret < 0) {
derr << "ERROR: failed to fetch master next positions (" << cpp_strerror(-ret) << ")" << dendl;
} else {
ceph::real_time oldest;
std::optional<std::pair<int, ceph::real_time>> oldest;
for (auto iter : master_pos) {
rgw_mdlog_shard_data& shard_data = iter.second;
if (!shard_data.entries.empty()) {
rgw_mdlog_entry& entry = shard_data.entries.front();
if (ceph::real_clock::is_zero(oldest)) {
oldest = entry.timestamp;
} else if (!ceph::real_clock::is_zero(entry.timestamp) && entry.timestamp < oldest) {
oldest = entry.timestamp;
if (!oldest) {
oldest.emplace(iter.first, entry.timestamp);
} else if (!ceph::real_clock::is_zero(entry.timestamp) && entry.timestamp < oldest->second) {
oldest.emplace(iter.first, entry.timestamp);
}
}
}
if (!ceph::real_clock::is_zero(oldest)) {
push_ss(ss, status) << "oldest incremental change not applied: " << oldest;
if (oldest) {
push_ss(ss, status) << "oldest incremental change not applied: "
<< oldest->second << " [" << oldest->first << ']';
}
}
}
@ -2257,22 +2259,24 @@ static void get_data_sync_status(const string& source_zone, list<string>& status
if (ret < 0) {
derr << "ERROR: failed to fetch next positions (" << cpp_strerror(-ret) << ")" << dendl;
} else {
ceph::real_time oldest;
std::optional<std::pair<int, ceph::real_time>> oldest;
for (auto iter : master_pos) {
rgw_datalog_shard_data& shard_data = iter.second;
if (!shard_data.entries.empty()) {
rgw_datalog_entry& entry = shard_data.entries.front();
if (ceph::real_clock::is_zero(oldest)) {
oldest = entry.timestamp;
} else if (!ceph::real_clock::is_zero(entry.timestamp) && entry.timestamp < oldest) {
oldest = entry.timestamp;
if (!oldest) {
oldest.emplace(iter.first, entry.timestamp);
} else if (!ceph::real_clock::is_zero(entry.timestamp) && entry.timestamp < oldest->second) {
oldest.emplace(iter.first, entry.timestamp);
}
}
}
if (!ceph::real_clock::is_zero(oldest)) {
push_ss(ss, status, tab) << "oldest incremental change not applied: " << oldest;
if (oldest) {
push_ss(ss, status, tab) << "oldest incremental change not applied: "
<< oldest->second << " [" << oldest->first << ']';
}
}
}