Skip to content

Commit 3233601

Browse files
authored
Merge pull request ceph#62368 from ivancich/wip-radoslist-improvements
rgw: radoslist improvements primarily to better support gap list tool Reviewed-by: Shilpa Jagannath <[email protected]>
2 parents aab2b26 + 60b1bc4 commit 3233601

File tree

2 files changed

+30
-21
lines changed

2 files changed

+30
-21
lines changed

src/rgw/radosgw-admin/orphan.cc

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -930,9 +930,9 @@ int RGWOrphanSearch::finish()
930930

931931
int RGWRadosList::handle_stat_result(const DoutPrefixProvider *dpp,
932932
RGWRados::Object::Stat::Result& result,
933-
std::string& bucket_name,
934-
rgw_obj_key& obj_key,
935-
std::set<string>& obj_oids)
933+
const std::string& bucket_name,
934+
const rgw_obj_key& obj_key,
935+
std::set<string>& obj_oids)
936936
{
937937
obj_oids.clear();
938938

@@ -956,9 +956,6 @@ int RGWRadosList::handle_stat_result(const DoutPrefixProvider *dpp,
956956
return 0;
957957
}
958958

959-
bucket_name = bucket.name;
960-
obj_key = result.obj.key;
961-
962959
if (!result.manifest) {
963960
/* a very very old object, or part of a multipart upload during upload */
964961
obj_oids.insert(oid);
@@ -992,7 +989,7 @@ int RGWRadosList::handle_stat_result(const DoutPrefixProvider *dpp,
992989
ldpp_dout(dpp, 25) << "radoslist DLO oid=\"" << oid <<
993990
"\" added bucket=\"" << bucket_name << "\" prefix=\"" <<
994991
prefix << "\" to process list" << dendl;
995-
} else if ((attr_it = result.attrs.find(RGW_ATTR_USER_MANIFEST)) !=
992+
} else if ((attr_it = result.attrs.find(RGW_ATTR_SLO_MANIFEST)) !=
996993
result.attrs.end()) {
997994
// *** handle SLO object ***
998995

@@ -1060,24 +1057,35 @@ int RGWRadosList::pop_and_handle_stat_op(
10601057
RGWObjectCtx& obj_ctx,
10611058
std::deque<RGWRados::Object::Stat>& ops)
10621059
{
1063-
std::string bucket_name;
1064-
rgw_obj_key obj_key;
10651060
std::set<std::string> obj_oids;
10661061
RGWRados::Object::Stat& front_op = ops.front();
10671062

10681063
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-
}
1064+
// note: even if we get an error, front_op.result.obj will still be
1065+
// populated with correct data
1066+
const std::string bucket_name = front_op.result.obj.bucket.name;
1067+
const rgw_obj_key obj_key = front_op.result.obj.key;
10761068

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: " <<
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);
1074+
1075+
ldpp_dout(dpp, -1) << "ERROR: " << __func__ <<
1076+
": stat of head object resulted in ENOENT; oid=" << oid << dendl;
1077+
} else if (ret < 0) {
1078+
ldpp_dout(dpp, -1) << "ERROR: " << __func__ <<
1079+
": stat_async() returned error: " <<
10801080
cpp_strerror(-ret) << dendl;
1081+
goto done;
1082+
} else {
1083+
ret = handle_stat_result(dpp, front_op.result, bucket_name, obj_key, obj_oids);
1084+
if (ret < 0) {
1085+
ldpp_dout(dpp, -1) << "ERROR: " << __func__ <<
1086+
": handle_stat_result() returned error: " <<
1087+
cpp_strerror(-ret) << dendl;
1088+
}
10811089
}
10821090

10831091
// output results
@@ -1099,6 +1107,7 @@ int RGWRadosList::pop_and_handle_stat_op(
10991107
obj_ctx.invalidate(front_op.result.obj);
11001108

11011109
ops.pop_front();
1110+
11021111
return ret;
11031112
}
11041113

src/rgw/radosgw-admin/orphan.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ class RGWRadosList {
259259

260260
int handle_stat_result(const DoutPrefixProvider *dpp,
261261
RGWRados::Object::Stat::Result& result,
262-
std::string& bucket_name,
263-
rgw_obj_key& obj_key,
262+
const std::string& bucket_name,
263+
const rgw_obj_key& obj_key,
264264
std::set<std::string>& obj_oids);
265265
int pop_and_handle_stat_op(const DoutPrefixProvider *dpp,
266266
RGWObjectCtx& obj_ctx,

0 commit comments

Comments
 (0)