Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hammer: rgw: orphan tool should be careful about removing head objects #6351

Merged
1 commit merged into from Dec 2, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 22 additions & 3 deletions src/rgw/rgw_orphan.cc
Expand Up @@ -277,9 +277,28 @@ int RGWOrphanSearch::build_all_oids_index()
string oid = i->get_oid();
string locator = i->get_locator();

string name = oid;
if (locator.size())
name += " (@" + locator + ")";
ssize_t pos = oid.find('_');
if (pos < 0) {
cout << "unidentified oid: " << oid << ", skipping" << std::endl;
/* what is this object, oids should be in the format of <bucket marker>_<obj>,
* skip this entry
*/
continue;
}
string stripped_oid = oid.substr(pos + 1);
string name, instance, ns;
if (!rgw_obj::parse_raw_oid(stripped_oid, &name, &instance, &ns)) {
cout << "cannot parse oid: " << oid << ", skipping" << std::endl;
continue;
}

if (ns.empty()) {
/* skipping head objects, we don't want to remove these as they are mutable and
* cleaning them up is racy (can race with object removal and a later recreation)
*/
cout << "skipping head object: oid=" << oid << std::endl;
continue;
}

string oid_fp = obj_fingerprint(oid);

Expand Down