Skip to content

Commit de2023f

Browse files
committed
rgw: modify radoslist to better support the rgw-gap-list tool
When the `radosgw-admin bucket radoslist ...` sub-command was introduced, it was written specifically for finding orphans. It has since been updated to work for finding gaps, that is indexed RGW objects that are missing one or more supporting rados objects. When a head object was not found, it was ignored. Now it does produce output with the oid and related information for the missing head object. Signed-off-by: J. Eric Ivancich <[email protected]>
1 parent 9d1ac19 commit de2023f

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

src/rgw/radosgw-admin/orphan.cc

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,18 +1066,30 @@ int RGWRadosList::pop_and_handle_stat_op(
10661066
RGWRados::Object::Stat& front_op = ops.front();
10671067

10681068
int ret = front_op.wait(dpp);
1069-
if (ret < 0) {
1070-
if (ret != -ENOENT) {
1071-
ldpp_dout(dpp, -1) << "ERROR: stat_async() returned error: " <<
1072-
cpp_strerror(-ret) << dendl;
1073-
}
1074-
goto done;
1075-
}
1069+
if (ret == -ENOENT) {
1070+
const auto& result = front_op.result;
1071+
const rgw_bucket& bucket = result.obj.bucket;
1072+
const std::string oid = bucket.marker + "_" + result.obj.get_oid();
1073+
obj_oids.insert(oid);
10761074

1077-
ret = handle_stat_result(dpp, front_op.result, bucket_name, obj_key, obj_oids);
1078-
if (ret < 0) {
1079-
ldpp_dout(dpp, -1) << "ERROR: handle_stat_result() returned error: " <<
1075+
// needed for the processing below
1076+
bucket_name = result.obj.bucket.name;
1077+
obj_key = result.obj.key;
1078+
1079+
ldpp_dout(dpp, -1) << "ERROR: " << __func__ <<
1080+
": stat of head object resulted in ENOENT; oid=" << oid << dendl;
1081+
} else if (ret < 0) {
1082+
ldpp_dout(dpp, -1) << "ERROR: " << __func__ <<
1083+
": stat_async() returned error: " <<
10801084
cpp_strerror(-ret) << dendl;
1085+
goto done;
1086+
} else {
1087+
ret = handle_stat_result(dpp, front_op.result, bucket_name, obj_key, obj_oids);
1088+
if (ret < 0) {
1089+
ldpp_dout(dpp, -1) << "ERROR: " << __func__ <<
1090+
": handle_stat_result() returned error: " <<
1091+
cpp_strerror(-ret) << dendl;
1092+
}
10811093
}
10821094

10831095
// output results
@@ -1099,6 +1111,7 @@ int RGWRadosList::pop_and_handle_stat_op(
10991111
obj_ctx.invalidate(front_op.result.obj);
11001112

11011113
ops.pop_front();
1114+
11021115
return ret;
11031116
}
11041117

0 commit comments

Comments
 (0)