Skip to content

Commit 5ac9984

Browse files
authored
Merge pull request ceph#53929 from ivancich/wip-indexless-test
rgw: only buckets with reshardable layouts need to be considered for resharing Reviewed-by: Casey Bodley <[email protected]>
2 parents d7e8829 + ee4f5d7 commit 5ac9984

File tree

5 files changed

+29
-7
lines changed

5 files changed

+29
-7
lines changed

src/rgw/driver/rados/rgw_rados.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10065,6 +10065,10 @@ int RGWRados::check_bucket_shards(const RGWBucketInfo& bucket_info,
1006510065
return 0;
1006610066
}
1006710067

10068+
if (! is_layout_reshardable(bucket_info.layout)) {
10069+
return 0;
10070+
}
10071+
1006810072
bool need_resharding = false;
1006910073
uint32_t num_source_shards = rgw::current_num_shards(bucket_info.layout);
1007010074
const uint32_t max_dynamic_shards =

src/rgw/driver/rados/rgw_reshard.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -994,11 +994,11 @@ int RGWBucketReshard::execute(int num_shards,
994994
return 0;
995995
} // execute
996996

997-
bool RGWBucketReshard::can_reshard(const RGWBucketInfo& bucket,
998-
const RGWSI_Zone* zone_svc)
997+
bool RGWBucketReshard::should_zone_reshard_now(const RGWBucketInfo& bucket,
998+
const RGWSI_Zone* zone_svc)
999999
{
10001000
return !zone_svc->need_to_log_data() ||
1001-
bucket.layout.logs.size() < max_bilog_history;
1001+
bucket.layout.logs.size() < max_bilog_history;
10021002
}
10031003

10041004

@@ -1240,7 +1240,7 @@ int RGWReshard::process_entry(const cls_rgw_reshard_entry& entry,
12401240
return 0;
12411241
}
12421242

1243-
if (!RGWBucketReshard::can_reshard(bucket_info, store->svc()->zone)) {
1243+
if (!RGWBucketReshard::should_zone_reshard_now(bucket_info, store->svc()->zone)) {
12441244
ldpp_dout(dpp, 1) << "Bucket " << bucket_info.bucket << " is not "
12451245
"eligible for resharding until peer zones finish syncing one "
12461246
"or more of its old log generations" << dendl;

src/rgw/driver/rados/rgw_reshard.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ class RGWBucketReshard {
175175
// too large by refusing to reshard the bucket until the old logs get trimmed
176176
static constexpr size_t max_bilog_history = 4;
177177

178-
static bool can_reshard(const RGWBucketInfo& bucket,
179-
const RGWSI_Zone* zone_svc);
178+
static bool should_zone_reshard_now(const RGWBucketInfo& bucket,
179+
const RGWSI_Zone* zone_svc);
180180
}; // RGWBucketReshard
181181

182182

src/rgw/rgw_admin.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3006,6 +3006,14 @@ int check_reshard_bucket_params(rgw::sal::Driver* driver,
30063006
return ret;
30073007
}
30083008

3009+
if (! is_layout_reshardable((*bucket)->get_info().layout)) {
3010+
std::cerr << "Bucket '" << (*bucket)->get_name() <<
3011+
"' currently has layout '" <<
3012+
current_layout_desc((*bucket)->get_info().layout) <<
3013+
"', which does not support resharding." << std::endl;
3014+
return -EINVAL;
3015+
}
3016+
30093017
int num_source_shards = rgw::current_num_shards((*bucket)->get_info().layout);
30103018

30113019
if (num_shards <= num_source_shards && !yes_i_really_mean_it) {
@@ -8105,7 +8113,8 @@ int main(int argc, const char **argv)
81058113
"have the resharding feature enabled." << std::endl;
81068114
return ENOTSUP;
81078115
}
8108-
if (!RGWBucketReshard::can_reshard(bucket->get_info(), zone_svc) &&
8116+
8117+
if (!RGWBucketReshard::should_zone_reshard_now(bucket->get_info(), zone_svc) &&
81098118
!yes_i_really_mean_it) {
81108119
std::cerr << "Bucket '" << bucket->get_name() << "' already has too many "
81118120
"log generations (" << bucket->get_info().layout.logs.size() << ") "

src/rgw/rgw_bucket_layout.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,5 +278,14 @@ inline uint32_t current_num_shards(const BucketLayout& layout) {
278278
inline bool is_layout_indexless(const bucket_index_layout_generation& layout) {
279279
return layout.layout.type == BucketIndexType::Indexless;
280280
}
281+
inline bool is_layout_reshardable(const bucket_index_layout_generation& layout) {
282+
return layout.layout.type == BucketIndexType::Normal;
283+
}
284+
inline bool is_layout_reshardable(const BucketLayout& layout) {
285+
return is_layout_reshardable(layout.current_index);
286+
}
287+
inline std::string_view current_layout_desc(const BucketLayout& layout) {
288+
return rgw::to_string(layout.current_index.layout.type);
289+
}
281290

282291
} // namespace rgw

0 commit comments

Comments
 (0)