Skip to content

Commit f19d3f8

Browse files
authored
Merge pull request ceph#58354 from ivancich/wip-appropriate-min-objs-shard
rgw: make sure min objs per shard is appropriate Reviewed-by: Casey Bodley <[email protected]>
2 parents e476d12 + 81e2bc1 commit f19d3f8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/rgw/driver/rados/rgw_reshard.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const string reshard_lock_name = "reshard_process";
3333
const string bucket_instance_lock_name = "bucket_instance_lock";
3434

3535
// key reduction values; NB maybe expose some in options
36-
constexpr uint64_t min_objs_per_shard = 10000;
36+
constexpr uint64_t default_min_objs_per_shard = 10000;
3737
constexpr uint32_t min_dynamic_shards = 11;
3838

3939
/* All primes up to 2000 used to attempt to make dynamic sharding use
@@ -96,9 +96,7 @@ void RGWBucketReshard::calculate_preferred_shards(
9696
const DoutPrefixProvider* dpp,
9797
const uint32_t max_dynamic_shards,
9898
const uint64_t max_objs_per_shard,
99-
// const uint64_t min_objs_per_shard,
10099
const bool is_multisite,
101-
// const uint64_t min_dynamic_shards, FIX THIS!!!!!!
102100
const uint64_t num_objs,
103101
const uint32_t current_num_shards,
104102
bool& need_resharding,
@@ -110,6 +108,11 @@ void RGWBucketReshard::calculate_preferred_shards(
110108
constexpr uint32_t multisite_multiplier = 8;
111109
const char* verb = "n/a";
112110

111+
// in case admin lowers max_objs_per_shard, we need to avoid thrashing
112+
const uint64_t min_objs_per_shard =
113+
std::min(default_min_objs_per_shard,
114+
(uint64_t) std::ceil(max_objs_per_shard / 100.0));
115+
113116
if (current_num_shards < max_dynamic_shards &&
114117
num_objs > current_num_shards * max_objs_per_shard) {
115118
need_resharding = true;

0 commit comments

Comments
 (0)