From 85032c74a42f1b25e8da333a1a44318f378681a9 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Mon, 27 Mar 2023 10:56:37 -0400 Subject: [PATCH] rgw/admin: 'data sync status' formats binary error repo entries Fixes: https://tracker.ceph.com/issues/59174 Signed-off-by: Casey Bodley --- src/rgw/driver/rados/rgw_data_sync.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/rgw/driver/rados/rgw_data_sync.cc b/src/rgw/driver/rados/rgw_data_sync.cc index fd2ac091dabb6..889283b3a7a4f 100644 --- a/src/rgw/driver/rados/rgw_data_sync.cc +++ b/src/rgw/driver/rados/rgw_data_sync.cc @@ -1153,6 +1153,9 @@ std::ostream& operator<<(std::ostream& out, const bucket_shard_str& rhs) { } return out; } +#if FMT_VERSION >= 90000 +template <> struct fmt::formatter : fmt::ostream_formatter {}; +#endif struct all_bucket_info { RGWBucketInfo bucket_info; @@ -3738,8 +3741,18 @@ int RGWReadRecoveringBucketShardsCoroutine::operate(const DoutPrefixProvider *dp count += error_entries.size(); marker = *error_entries.rbegin(); - recovering_buckets.insert(std::make_move_iterator(error_entries.begin()), - std::make_move_iterator(error_entries.end())); + for (const std::string& key : error_entries) { + rgw_bucket_shard bs; + std::optional gen; + if (int r = rgw::error_repo::decode_key(key, bs, gen); r < 0) { + // insert the key as-is + recovering_buckets.insert(std::move(key)); + } else if (gen) { + recovering_buckets.insert(fmt::format("{}[{}]", bucket_shard_str{bs}, *gen)); + } else { + recovering_buckets.insert(fmt::format("{}[full]", bucket_shard_str{bs})); + } + } } while (omapkeys->more && count < max_entries); return set_cr_done(); -- 2.39.5