# In this test, we run the randomized testing framework with the weighted_rand
# option.  Note that due to the limited sample size, these may not be observed
# accurately. But we expect the distribution of ranges across stores should be
# roughly proportional to the weight.
change_static_option stores_per_node=3 nodes=1
----

# Due to replication factor of 3, it is impossible to satisfy the weighted rand
# distribution. So number of ranges across the stores remains the same.
rand_ranges replication_factor=3 placement_type=weighted_rand weighted_rand=(0.1, 0.2, 0.7)
----

eval duration=5m num_iterations=3 verbose=(test_settings,initial_state)
----
test settings
	num_iterations=3 duration=5m0s
----------------------------------
generating cluster configurations using static option
	nodes=1, stores_per_node=3
generating ranges configurations using randomized option
	placement_type=weighted_rand, range_gen_type=uniform, key_space=uniform, replication_factor=3, weightedRand=[0.1 0.2 0.7]
generating load configurations using static option
	rw_ratio=0.00, rate=0.00, min_block=1, max_block=1, min_key=1, max_key=200000, skewed_access=false
generating events configurations using static option
generating settings configurations using static option
----------------------------------
sample1: start running
initial state at 2022-03-21 11:00:00:
	stores(3)=[s1n1=(replicas(563)),s2n1=(replicas(563)),s3n1=(replicas(563))]
sample1: pass
----------------------------------
sample2: start running
initial state at 2022-03-21 11:00:00:
	stores(3)=[s1n1=(replicas(299)),s2n1=(replicas(299)),s3n1=(replicas(299))]
sample2: pass
----------------------------------
sample3: start running
initial state at 2022-03-21 11:00:00:
	stores(3)=[s1n1=(replicas(521)),s2n1=(replicas(521)),s3n1=(replicas(521))]
sample3: pass
----------------------------------

clear
----

change_static_option stores_per_node=2 nodes=3
----

# We expect ranges distributed to the last three stores to be larger than the
# first few stores. The ratio is not exact due to the best-effort nature of the
# range information distribution.
rand_ranges replication_factor=3 placement_type=weighted_rand weighted_rand=(0,0,0,0.3,0.3,0.4)
----

eval duration=5m num_iterations=3 verbose=(test_settings,initial_state,config_gen)
----
test settings
	num_iterations=3 duration=5m0s
----------------------------------
generating cluster configurations using static option
	nodes=3, stores_per_node=2
generating ranges configurations using randomized option
	placement_type=weighted_rand, range_gen_type=uniform, key_space=uniform, replication_factor=3, weightedRand=[0 0 0 0.3 0.3 0.4]
generating load configurations using static option
	rw_ratio=0.00, rate=0.00, min_block=1, max_block=1, min_key=1, max_key=200000, skewed_access=false
generating events configurations using static option
generating settings configurations using static option
----------------------------------
sample1: start running
configurations generated using seed 5571782338101878760
	basic cluster with nodes=3, stores_per_node=2
	weighted randomized ranges with placement_type=weighted_rand, weighted_rand=[0 0 0 0.3 0.3 0.4], ranges=563, key_space=160411, replication_factor=3, bytes=0
	basic load with rw_ratio=0.00, rate=0.00, skewed_access=false, min_block_size=1, max_block_size=1, min_key=1, max_key=200000
	number of mutation events=0, number of assertion events=0
initial state at 2022-03-21 11:00:00:
	stores(6)=[s1n1=(replicas(22)),s2n1=(replicas(23)),s3n2=(replicas(23)),s4n2=(replicas(529)),s5n3=(replicas(563)),s6n3=(replicas(529))]
sample1: pass
----------------------------------
sample2: start running
configurations generated using seed 4299969443970870044
	basic cluster with nodes=3, stores_per_node=2
	weighted randomized ranges with placement_type=weighted_rand, weighted_rand=[0 0 0 0.3 0.3 0.4], ranges=299, key_space=9542, replication_factor=3, bytes=0
	basic load with rw_ratio=0.00, rate=0.00, skewed_access=false, min_block_size=1, max_block_size=1, min_key=1, max_key=200000
	number of mutation events=0, number of assertion events=0
initial state at 2022-03-21 11:00:00:
	stores(6)=[s1n1=(replicas(53)),s2n1=(replicas(52)),s3n2=(replicas(52)),s4n2=(replicas(299)),s5n3=(replicas(142)),s6n3=(replicas(299))]
sample2: pass
----------------------------------
sample3: start running
configurations generated using seed 4157513341729910236
	basic cluster with nodes=3, stores_per_node=2
	weighted randomized ranges with placement_type=weighted_rand, weighted_rand=[0 0 0 0.3 0.3 0.4], ranges=521, key_space=82660, replication_factor=3, bytes=0
	basic load with rw_ratio=0.00, rate=0.00, skewed_access=false, min_block_size=1, max_block_size=1, min_key=1, max_key=200000
	number of mutation events=0, number of assertion events=0
initial state at 2022-03-21 11:00:00:
	stores(6)=[s1n1=(replicas(91)),s2n1=(replicas(91)),s3n2=(replicas(92)),s4n2=(replicas(521)),s5n3=(replicas(247)),s6n3=(replicas(521))]
sample3: pass
----------------------------------
