Skip to content

Commit 60b1bc4

Browse files
committed
rgw: radolist clean up, calculate obj info slightly earlier
With recent changes, it's better to determine bucket and object names earlier. Signed-off-by: J. Eric Ivancich <[email protected]>
1 parent de2023f commit 60b1bc4

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

src/rgw/radosgw-admin/orphan.cc

Lines changed: 8 additions & 12 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);
@@ -1060,22 +1057,21 @@ 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);
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;
1068+
10691069
if (ret == -ENOENT) {
10701070
const auto& result = front_op.result;
10711071
const rgw_bucket& bucket = result.obj.bucket;
10721072
const std::string oid = bucket.marker + "_" + result.obj.get_oid();
10731073
obj_oids.insert(oid);
10741074

1075-
// needed for the processing below
1076-
bucket_name = result.obj.bucket.name;
1077-
obj_key = result.obj.key;
1078-
10791075
ldpp_dout(dpp, -1) << "ERROR: " << __func__ <<
10801076
": stat of head object resulted in ENOENT; oid=" << oid << dendl;
10811077
} else if (ret < 0) {

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)