@@ -220,6 +220,7 @@ def prepare_memtier_benchmark_parameters(
220220 override_memtier_test_time = 0 ,
221221 override_test_runs = 1 ,
222222):
223+ arbitrary_command = False
223224 benchmark_command = [
224225 full_benchmark_path ,
225226 "--port" ,
@@ -256,7 +257,9 @@ def prepare_memtier_benchmark_parameters(
256257 benchmark_command_str = " " .join (benchmark_command )
257258 if "arguments" in clientconfig :
258259 benchmark_command_str = benchmark_command_str + " " + clientconfig ["arguments" ]
259- logging .info (override_memtier_test_time )
260+
261+ if "--command" in benchmark_command_str :
262+ arbitrary_command = True
260263
261264 if override_test_runs > 1 :
262265 benchmark_command_str = re .sub (
@@ -330,7 +333,7 @@ def prepare_memtier_benchmark_parameters(
330333 benchmark_command_str ,
331334 )
332335
333- return None , benchmark_command_str
336+ return None , benchmark_command_str , arbitrary_command
334337
335338
336339def process_self_contained_coordinator_stream (
@@ -425,13 +428,41 @@ def process_self_contained_coordinator_stream(
425428 ssl_ca_certs = tls_cacert ,
426429 ssl_check_hostname = False ,
427430 )
431+ setup_name = "oss-standalone"
428432 r .ping ()
429433 redis_conns = [r ]
434+ if oss_cluster_api_enabled :
435+ redis_conns = []
436+ logging .info ("updating redis connections from cluster slots" )
437+ slots = r .cluster ("slots" )
438+ for slot in slots :
439+ # Master for slot range represented as nested networking information starts at pos 2
440+ # example: [0, 5460, [b'127.0.0.1', 30001, b'eccd21c2e7e9b7820434080d2e394cb8f2a7eff2', []]]
441+ slot_network_info = slot [2 ]
442+ prefered_endpoint = slot_network_info [0 ]
443+ prefered_port = slot_network_info [1 ]
444+ shard_conn = redis .StrictRedis (
445+ host = prefered_endpoint ,
446+ port = prefered_port ,
447+ password = password ,
448+ ssl = tls_enabled ,
449+ ssl_cert_reqs = ssl_cert_reqs ,
450+ ssl_keyfile = tls_key ,
451+ ssl_certfile = tls_cert ,
452+ ssl_ca_certs = tls_cacert ,
453+ ssl_check_hostname = False ,
454+ )
455+ redis_conns .append (shard_conn )
456+ logging .info (
457+ "There are a total of {} shards" .format (len (redis_conns ))
458+ )
459+ setup_name = "oss-cluster"
460+
430461 redis_pids = []
431- first_redis_pid = r .info ()["process_id" ]
432- redis_pids .append (first_redis_pid )
462+ for conn in redis_conns :
463+ redis_pid = conn .info ()["process_id" ]
464+ redis_pids .append (redis_pid )
433465
434- setup_name = "oss-standalone"
435466 github_actor = f"{ tf_triggering_env } -{ running_platform } "
436467 dso = "redis-server"
437468 profilers_artifacts_matrix = []
@@ -457,12 +488,15 @@ def process_self_contained_coordinator_stream(
457488 )
458489 if args .flushall_on_every_test_start :
459490 logging .info ("Sending FLUSHALL to the DB" )
460- r .flushall ()
491+ for conn in redis_conns :
492+ conn .flushall ()
461493
462494 benchmark_required_memory = get_benchmark_required_memory (
463495 benchmark_config
464496 )
465- maxmemory = get_maxmemory (r )
497+ maxmemory = 0
498+ for conn in redis_conns :
499+ maxmemory = maxmemory + get_maxmemory (conn )
466500 if benchmark_required_memory > maxmemory :
467501 logging .warning (
468502 "Skipping test {} given maxmemory of server is bellow the benchmark required memory: {} < {}" .format (
@@ -536,7 +570,7 @@ def process_self_contained_coordinator_stream(
536570 continue
537571
538572 if "preload_tool" in benchmark_config ["dbconfig" ]:
539- data_prepopulation_step (
573+ res = data_prepopulation_step (
540574 benchmark_config ,
541575 benchmark_tool_workdir ,
542576 client_cpuset_cpus ,
@@ -555,12 +589,20 @@ def process_self_contained_coordinator_stream(
555589 password ,
556590 oss_cluster_api_enabled ,
557591 )
592+ if res is False :
593+ logging .warning (
594+ "Skipping this test given preload result was false"
595+ )
596+ continue
558597 execute_init_commands (
559598 benchmark_config , r , dbconfig_keyname = "dbconfig"
560599 )
561600
562601 used_memory_check (
563- test_name , benchmark_required_memory , r , "start of benchmark"
602+ test_name ,
603+ benchmark_required_memory ,
604+ redis_conns ,
605+ "start of benchmark" ,
564606 )
565607
566608 logging .info ("Checking if there is a keyspace check being enforced" )
@@ -597,6 +639,7 @@ def process_self_contained_coordinator_stream(
597639 local_benchmark_output_filename
598640 )
599641 )
642+ arbitrary_command = False
600643
601644 if "memtier_benchmark" not in benchmark_tool :
602645 # prepare the benchmark command
@@ -617,6 +660,7 @@ def process_self_contained_coordinator_stream(
617660 (
618661 _ ,
619662 benchmark_command_str ,
663+ arbitrary_command ,
620664 ) = prepare_memtier_benchmark_parameters (
621665 benchmark_config ["clientconfig" ],
622666 full_benchmark_path ,
@@ -635,6 +679,16 @@ def process_self_contained_coordinator_stream(
635679 override_test_runs ,
636680 )
637681
682+ if (
683+ arbitrary_command
684+ and oss_cluster_api_enabled
685+ and "memtier" in benchmark_tool
686+ ):
687+ logging .warning (
688+ "Forcing skip this test given there is an arbitrary commmand and memtier usage. Check https://github.com/RedisLabs/memtier_benchmark/pull/117 ."
689+ )
690+ continue
691+
638692 client_container_image = extract_client_container_image (
639693 benchmark_config
640694 )
@@ -704,12 +758,16 @@ def process_self_contained_coordinator_stream(
704758 logging .info ("Printing client tool stdout output" )
705759
706760 used_memory_check (
707- test_name , benchmark_required_memory , r , "end of benchmark"
761+ test_name ,
762+ benchmark_required_memory ,
763+ redis_conns ,
764+ "end of benchmark" ,
708765 )
709766
710767 if args .flushall_on_every_test_end :
711768 logging .info ("Sending FLUSHALL to the DB" )
712- r .flushall ()
769+ for r in redis_conns :
770+ r .flushall ()
713771 datapoint_time_ms = start_time_ms
714772
715773 post_process_benchmark_results (
@@ -886,8 +944,10 @@ def get_benchmark_required_memory(benchmark_config):
886944 return benchmark_required_memory
887945
888946
889- def used_memory_check (test_name , benchmark_required_memory , r , stage ):
890- used_memory = r .info ("memory" )["used_memory" ]
947+ def used_memory_check (test_name , benchmark_required_memory , redis_conns , stage ):
948+ used_memory = 0
949+ for conn in redis_conns :
950+ used_memory = used_memory + conn .info ("memory" )["used_memory" ]
891951 used_memory_gb = int (math .ceil (float (used_memory ) / 1024.0 / 1024.0 / 1024.0 ))
892952 logging .info ("Benchmark used memory at {}: {}g" .format (stage , used_memory_gb ))
893953 if used_memory > benchmark_required_memory :
@@ -974,6 +1034,7 @@ def data_prepopulation_step(
9741034 password = None ,
9751035 oss_cluster_api_enabled = False ,
9761036):
1037+ result = True
9771038 # setup the benchmark
9781039 (
9791040 start_time ,
@@ -995,7 +1056,11 @@ def data_prepopulation_step(
9951056
9961057 if "memtier_benchmark" in preload_tool :
9971058 override_memtier_test_time_preload = 0
998- (_ , preload_command_str ,) = prepare_memtier_benchmark_parameters (
1059+ (
1060+ _ ,
1061+ preload_command_str ,
1062+ arbitrary_command ,
1063+ ) = prepare_memtier_benchmark_parameters (
9991064 benchmark_config ["dbconfig" ]["preload_tool" ],
10001065 full_benchmark_path ,
10011066 port ,
@@ -1011,6 +1076,12 @@ def data_prepopulation_step(
10111076 resp_version ,
10121077 override_memtier_test_time_preload ,
10131078 )
1079+ if arbitrary_command is True and oss_cluster_api_enabled :
1080+ logging .warning (
1081+ "Skipping this test given it implies arbitrary command on an cluster setup. Not supported on memtier: https://github.com/RedisLabs/memtier_benchmark/pull/117"
1082+ )
1083+ result = False
1084+ return result
10141085
10151086 logging .info (
10161087 "Using docker image {} as benchmark PRELOAD image (cpuset={}) with the following args: {}" .format (
@@ -1049,6 +1120,7 @@ def data_prepopulation_step(
10491120 client_container_stdout ,
10501121 )
10511122 )
1123+ return result
10521124
10531125
10541126def generate_cpuset_cpus (ceil_db_cpu_limit , current_cpu_pos ):
0 commit comments