@@ -415,7 +415,7 @@ static int init_target_layout(rgw::sal::RadosStore* store,
415415 RGWBucketInfo& bucket_info,
416416 std::map<std::string, bufferlist>& bucket_attrs,
417417 ReshardFaultInjector& fault,
418- uint32_t new_num_shards,
418+ const uint32_t new_num_shards,
419419 const DoutPrefixProvider* dpp, optional_yield y)
420420{
421421 auto prev = bucket_info.layout ; // make a copy for cleanup
@@ -591,7 +591,7 @@ static int init_reshard(rgw::sal::RadosStore* store,
591591 RGWBucketInfo& bucket_info,
592592 std::map<std::string, bufferlist>& bucket_attrs,
593593 ReshardFaultInjector& fault,
594- uint32_t new_num_shards,
594+ const uint32_t new_num_shards,
595595 const DoutPrefixProvider *dpp, optional_yield y)
596596{
597597 if (new_num_shards == 0 ) {
@@ -617,6 +617,7 @@ static int init_reshard(rgw::sal::RadosStore* store,
617617 revert_target_layout (store, bucket_info, bucket_attrs, fault, dpp, y);
618618 return ret;
619619 }
620+
620621 return 0 ;
621622} // init_reshard
622623
@@ -884,7 +885,7 @@ int RGWBucketReshardLock::renew(const Clock::time_point& now) {
884885
885886int RGWBucketReshard::do_reshard (const rgw::bucket_index_layout_generation& current,
886887 const rgw::bucket_index_layout_generation& target,
887- int max_entries,
888+ int max_op_entries, // max num to process per op
888889 bool verbose,
889890 ostream *out,
890891 Formatter *formatter,
@@ -898,9 +899,9 @@ int RGWBucketReshard::do_reshard(const rgw::bucket_index_layout_generation& curr
898899 /* update bucket info -- in progress*/
899900 list<rgw_cls_bi_entry> entries;
900901
901- if (max_entries < 0 ) {
902+ if (max_op_entries <= 0 ) {
902903 ldpp_dout (dpp, 0 ) << __func__ <<
903- " : can't reshard, negative max_entries " << dendl;
904+ " : can't reshard, non-positive max_op_entries " << dendl;
904905 return -EINVAL;
905906 }
906907
@@ -926,7 +927,9 @@ int RGWBucketReshard::do_reshard(const rgw::bucket_index_layout_generation& curr
926927 const std::string null_object_filter; // empty string since we're not filtering by object
927928 while (is_truncated) {
928929 entries.clear ();
929- int ret = store->getRados ()->bi_list (dpp, bucket_info, i, null_object_filter, marker, max_entries, &entries, &is_truncated, y);
930+ int ret = store->getRados ()->bi_list (
931+ dpp, bucket_info, i, null_object_filter, marker, max_op_entries,
932+ &entries, &is_truncated, y);
930933 if (ret == -ENOENT) {
931934 ldpp_dout (dpp, 1 ) << " WARNING: " << __func__ << " failed to find shard "
932935 << i << " , skipping" << dendl;
@@ -1032,7 +1035,7 @@ int RGWBucketReshard::get_status(const DoutPrefixProvider *dpp, list<cls_rgw_buc
10321035
10331036int RGWBucketReshard::execute (int num_shards,
10341037 ReshardFaultInjector& fault,
1035- int max_op_entries,
1038+ int max_op_entries, // max num to process per op
10361039 const cls_rgw_reshard_initiator initiator,
10371040 const DoutPrefixProvider *dpp,
10381041 optional_yield y,
@@ -1309,7 +1312,7 @@ void RGWReshardWait::stop()
13091312}
13101313
13111314int RGWReshard::process_entry (const cls_rgw_reshard_entry& entry,
1312- int max_entries,
1315+ int max_op_entries, // max num to process per op
13131316 const DoutPrefixProvider* dpp,
13141317 optional_yield y)
13151318{
@@ -1462,7 +1465,7 @@ int RGWReshard::process_entry(const cls_rgw_reshard_entry& entry,
14621465 RGWBucketReshard br (store, bucket_info, bucket_attrs, nullptr );
14631466
14641467 ReshardFaultInjector f; // no fault injected
1465- ret = br.execute (entry.new_num_shards , f, max_entries , entry.initiator ,
1468+ ret = br.execute (entry.new_num_shards , f, max_op_entries , entry.initiator ,
14661469 dpp, y, false , nullptr , nullptr , this );
14671470 if (ret < 0 ) {
14681471 ldpp_dout (dpp, 0 ) << __func__ <<
@@ -1481,10 +1484,14 @@ int RGWReshard::process_entry(const cls_rgw_reshard_entry& entry,
14811484
14821485int RGWReshard::process_single_logshard (int logshard_num, const DoutPrefixProvider *dpp, optional_yield y)
14831486{
1484- string marker;
1485- bool truncated = true ;
1487+ std:: string marker;
1488+ bool is_truncated = true ;
14861489
1487- constexpr uint32_t max_entries = 1000 ;
1490+ // This is the number to request per op, whether it's reshard queue
1491+ // entries or bucket index entries. Should not be confused with the
1492+ // number of entries we allow in a bucket index shard. This value is
1493+ // passed in and used deeper into the call chain as well.
1494+ constexpr uint32_t max_op_entries = 1000 ;
14881495
14891496 string logshard_oid;
14901497 get_logshard_oid (logshard_num, &logshard_oid);
@@ -1500,15 +1507,15 @@ int RGWReshard::process_single_logshard(int logshard_num, const DoutPrefixProvid
15001507
15011508 do {
15021509 std::list<cls_rgw_reshard_entry> entries;
1503- ret = list (dpp, logshard_num, marker, max_entries , entries, &truncated );
1510+ ret = list (dpp, logshard_num, marker, max_op_entries , entries, &is_truncated );
15041511 if (ret < 0 ) {
15051512 ldpp_dout (dpp, 10 ) << " cannot list all reshards in logshard oid=" <<
15061513 logshard_oid << dendl;
15071514 continue ;
15081515 }
15091516
1510- for (auto & entry : entries) { // logshard entries
1511- process_entry (entry, max_entries , dpp, y);
1517+ for (const auto & entry : entries) { // logshard entries
1518+ process_entry (entry, max_op_entries , dpp, y);
15121519
15131520 Clock::time_point now = Clock::now ();
15141521 if (logshard_lock.should_renew (now)) {
@@ -1520,7 +1527,7 @@ int RGWReshard::process_single_logshard(int logshard_num, const DoutPrefixProvid
15201527
15211528 entry.get_key (&marker);
15221529 } // entry for loop
1523- } while (truncated );
1530+ } while (is_truncated );
15241531
15251532 logshard_lock.unlock ();
15261533 return 0 ;
@@ -1592,8 +1599,9 @@ void *RGWReshard::ReshardWorker::entry() {
15921599 utime_t start = ceph_clock_now ();
15931600 reshard->process_all_logshards (this , null_yield);
15941601
1595- if (reshard->going_down ())
1602+ if (reshard->going_down ()) {
15961603 break ;
1604+ }
15971605
15981606 utime_t end = ceph_clock_now ();
15991607 utime_t elapsed = end - start;
0 commit comments