diff options
author | J. Eric Ivancich <ivancich@redhat.com> | 2019-09-19 00:25:50 +0200 |
---|---|---|
committer | J. Eric Ivancich <ivancich@redhat.com> | 2020-05-04 19:20:08 +0200 |
commit | e396064d9afa6fcba7b6bb1e3a500ef9e718e0d2 (patch) | |
tree | 5fd0c81f87eccb4822f9cbe6a569d71accc7897f /src/rgw/rgw_orphan.h | |
parent | rgw: add const-correctness to rgw_obj_manifest and svc_tier_rados (diff) | |
download | ceph-e396064d9afa6fcba7b6bb1e3a500ef9e718e0d2.tar.xz ceph-e396064d9afa6fcba7b6bb1e3a500ef9e718e0d2.zip |
rgw: add `rgw-orphan-list` tool & `radosgw-admin bucket radoslist ...`
Adds a `radosgw-admin` subcommand and walks the associated bucket
indices and manifests to generate the list of rados objects that
represent the rgw objects in the bucket(s).
Also adds a tool named `rgw-orphan-list`, which uses the radoslist
subcommand, that produces a list in a local file of what appear to be
rgw orphans.
Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
Diffstat (limited to 'src/rgw/rgw_orphan.h')
-rw-r--r-- | src/rgw/rgw_orphan.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/rgw/rgw_orphan.h b/src/rgw/rgw_orphan.h index d27e71d6a4a..ae1e61b780e 100644 --- a/src/rgw/rgw_orphan.h +++ b/src/rgw/rgw_orphan.h @@ -210,5 +210,82 @@ public: }; +class RGWRadosList { + + /* + * process_t describes how to process a irectory, we will either + * process the whole thing (entire_container == true) or a portion + * of it (entire_container == false). When we only process a + * portion, we will list the specific keys and/or specific lexical + * prefixes. + */ + struct process_t { + bool entire_container; + std::set<rgw_obj_key> filter_keys; + std::set<std::string> prefixes; + + process_t() : + entire_container(false) + {} + }; + + std::map<std::string,process_t> bucket_process_map; + std::set<std::string> visited_oids; + + void add_bucket_entire(const std::string& bucket_name) { + auto p = bucket_process_map.emplace(std::make_pair(bucket_name, + process_t())); + p.first->second.entire_container = true; + } + + void add_bucket_prefix(const std::string& bucket_name, + const std::string& prefix) { + auto p = bucket_process_map.emplace(std::make_pair(bucket_name, + process_t())); + p.first->second.prefixes.insert(prefix); + } + + void add_bucket_filter(const std::string& bucket_name, + const rgw_obj_key& obj_key) { + auto p = bucket_process_map.emplace(std::make_pair(bucket_name, + process_t())); + p.first->second.filter_keys.insert(obj_key); + } + + rgw::sal::RGWRadosStore* store; + + uint16_t max_concurrent_ios; + uint64_t stale_secs; + std::string tenant_name; + + int handle_stat_result(RGWRados::Object::Stat::Result& result, + std::set<string>& obj_oids); + int pop_and_handle_stat_op(RGWObjectCtx& obj_ctx, + std::deque<RGWRados::Object::Stat>& ops); + +public: + + RGWRadosList(rgw::sal::RGWRadosStore* _store, + int _max_ios, + uint64_t _stale_secs, + const std::string& _tenant_name) : + store(_store), + max_concurrent_ios(_max_ios), + stale_secs(_stale_secs), + tenant_name(_tenant_name) + {} + + int process_bucket(const std::string& bucket_instance_id, + const std::string& prefix, + const std::set<rgw_obj_key>& entries_filter); + + int do_incomplete_multipart(rgw::sal::RGWRadosStore* store, + RGWBucketInfo& bucket_info); + + int build_linked_oids_index(); + + int run(const std::string& bucket_id); + int run(); +}; // class RGWRadosList #endif |