File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -502,7 +502,7 @@ public:
502
502
named_value<int > maximum_replication_factor_warn_threshold;
503
503
named_value<int > maximum_replication_factor_fail_threshold;
504
504
505
- named_value<int > tablets_initial_scale_factor;
505
+ named_value<double > tablets_initial_scale_factor;
506
506
named_value<unsigned > tablets_per_shard_goal;
507
507
named_value<uint64_t > target_tablet_size_in_bytes;
508
508
Original file line number Diff line number Diff line change @@ -597,7 +597,7 @@ class load_balancer {
597
597
load_balancer_stats_manager& _stats;
598
598
std::unordered_set<host_id> _skiplist;
599
599
bool _use_table_aware_balancing = true ;
600
- int _initial_scale = 1 ;
600
+ double _initial_scale = 1 ;
601
601
private:
602
602
tablet_replica_set get_replicas_for_tablet_load (const tablet_info& ti, const tablet_transition_info* trinfo) const {
603
603
// We reflect migrations in the load as if they already happened,
@@ -707,7 +707,7 @@ class load_balancer {
707
707
_use_table_aware_balancing = use_table_aware_balancing;
708
708
}
709
709
710
- void set_initial_scale (int initial_scale) {
710
+ void set_initial_scale (double initial_scale) {
711
711
_initial_scale = initial_scale;
712
712
}
713
713
@@ -1092,7 +1092,6 @@ class load_balancer {
1092
1092
size_t tablet_count = 0 ;
1093
1093
const sstring* winning_dc = nullptr ;
1094
1094
1095
- min_per_shard_tablet_count = std::max (1.0 , min_per_shard_tablet_count);
1096
1095
for (auto && [dc, shards_in_dc] : shards_per_dc) {
1097
1096
auto rf_in_dc = rs.get_replication_factor (dc);
1098
1097
if (!rf_in_dc) {
Original file line number Diff line number Diff line change @@ -2678,6 +2678,12 @@ SEASTAR_THREAD_TEST_CASE(test_tablet_option_and_config_changes) {
2678
2678
cfg.tablets_per_shard_goal (100 );
2679
2679
rebalance_tablets (e, &load_stats);
2680
2680
BOOST_REQUIRE_EQUAL (get_tablet_count (), 16 );
2681
+
2682
+ // initial scale can be smaller than 1.
2683
+ // 0.5 tablet/shard * 3 shards = 1.5 tablets =~ 2 tablets.
2684
+ cfg.tablets_initial_scale_factor (0.5 );
2685
+ rebalance_tablets (e, &load_stats);
2686
+ BOOST_REQUIRE_EQUAL (get_tablet_count (), 2 );
2681
2687
}, cfg).get ();
2682
2688
}
2683
2689
You can’t perform that action at this time.
0 commit comments