Skip to content

Commit d1dad0f

Browse files
committed
asim: add rebalance_objective and delay for rebalance_mode
This commit adds rebalance_objective as a setting and allows changes to rebalance_mode to be scheduled as a delayed simulation event. This enables testing transitions between mma enabled and disabled mode. Epic: none Release note: none
1 parent b275e7b commit d1dad0f

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

pkg/kv/kvserver/asim/tests/datadriven_simulation_test.go

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -495,15 +495,26 @@ func TestDataDriven(t *testing.T) {
495495
}
496496
return ""
497497
case "setting":
498-
scanIfExists(t, d, "replicate_queue_enabled", &settingsGen.Settings.ReplicateQueueEnabled)
499-
scanIfExists(t, d, "lease_queue_enabled", &settingsGen.Settings.LeaseQueueEnabled)
500-
scanIfExists(t, d, "split_queue_enabled", &settingsGen.Settings.SplitQueueEnabled)
501-
scanIfExists(t, d, "rebalance_mode", &settingsGen.Settings.LBRebalancingMode)
502-
scanIfExists(t, d, "rebalance_interval", &settingsGen.Settings.LBRebalancingInterval)
503-
scanIfExists(t, d, "split_qps_threshold", &settingsGen.Settings.SplitQPSThreshold)
504-
scanIfExists(t, d, "rebalance_range_threshold", &settingsGen.Settings.RangeRebalanceThreshold)
505-
scanIfExists(t, d, "gossip_delay", &settingsGen.Settings.StateExchangeDelay)
506-
scanIfExists(t, d, "range_size_split_threshold", &settingsGen.Settings.RangeSizeSplitThreshold)
498+
var delay time.Duration
499+
if isDelayed := scanIfExists(t, d, "delay", &delay); isDelayed {
500+
var rebalanceMode int64
501+
scanIfExists(t, d, "rebalance_mode", &rebalanceMode)
502+
eventGen.ScheduleEvent(settingsGen.Settings.StartTime, delay, event.SetSimulationSettingsEvent{
503+
Key: "LBRebalancingMode",
504+
Value: rebalanceMode,
505+
})
506+
} else {
507+
scanIfExists(t, d, "replicate_queue_enabled", &settingsGen.Settings.ReplicateQueueEnabled)
508+
scanIfExists(t, d, "lease_queue_enabled", &settingsGen.Settings.LeaseQueueEnabled)
509+
scanIfExists(t, d, "split_queue_enabled", &settingsGen.Settings.SplitQueueEnabled)
510+
scanIfExists(t, d, "rebalance_mode", &settingsGen.Settings.LBRebalancingMode)
511+
scanIfExists(t, d, "rebalance_interval", &settingsGen.Settings.LBRebalancingInterval)
512+
scanIfExists(t, d, "split_qps_threshold", &settingsGen.Settings.SplitQPSThreshold)
513+
scanIfExists(t, d, "rebalance_range_threshold", &settingsGen.Settings.RangeRebalanceThreshold)
514+
scanIfExists(t, d, "gossip_delay", &settingsGen.Settings.StateExchangeDelay)
515+
scanIfExists(t, d, "range_size_split_threshold", &settingsGen.Settings.RangeSizeSplitThreshold)
516+
scanIfExists(t, d, "rebalance_objective", &settingsGen.Settings.LBRebalancingObjective)
517+
}
507518
return ""
508519
case "print":
509520
var buf strings.Builder

0 commit comments

Comments
 (0)