def thread_pooling_qa(self, socket, db): # Thread Pooling QA thread_handling_option = [ 'pool-of-threads', 'one-thread-per-connection' ] thread_pool_size = [2, 4, 8] thread_pool_max_threads = [2, 4, 8] for tp_option, tp_size, tp_max_thread in \ itertools.product(thread_handling_option, thread_pool_size, thread_pool_max_threads): my_extra = "--thread_handling=" + tp_option + " --thread_pool_size=" + str(tp_size) + \ " --thread_pool_max_threads=" + str(tp_max_thread) # Start PXC cluster for encryption test utility_cmd.check_testcase(0, "Thread pooling options : " + my_extra) dbconnection_check = db_connection.DbConnection( USER, WORKDIR + '/node1/mysql.sock') server_startup = pxc_startup.StartCluster(parent_dir, WORKDIR, BASEDIR, int(NODE), debug) result = server_startup.sanity_check() utility_cmd.check_testcase(result, "Startup sanity check") result = server_startup.create_config('none') utility_cmd.check_testcase(result, "Configuration file creation") result = server_startup.initialize_cluster() utility_cmd.check_testcase(result, "Initializing cluster") for i in range(1, int(NODE) + 1): n_name = open(WORKDIR + '/conf/node' + str(i) + '.cnf', 'a+') n_name.write('admin_address=127.0.0.1\n') n_name.write('admin_port=' + str(33062 + i) + '\n') n_name.close() result = server_startup.start_cluster(my_extra) utility_cmd.check_testcase(result, "Cluster startup") result = dbconnection_check.connection_check() utility_cmd.check_testcase(result, "Database connection") self.sysbench_run(WORKDIR + '/node1/mysql.sock', 'test', 33063) utility_cmd.stop_pxc(WORKDIR, BASEDIR, NODE)
def startup(self, replication_conf): # Start PXC cluster for upgrade test dbconnection_check = db_connection.DbConnection( USER, WORKDIR + '/node1/mysql.sock') server_startup = pxc_startup.StartCluster(parent_dir, WORKDIR, PXC_LOWER_BASE, int(NODE), debug) result = server_startup.sanity_check() utility_cmd.check_testcase(result, "Startup sanity check") if encryption == 'YES': result = server_startup.create_config('encryption') utility_cmd.check_testcase(result, "Configuration file creation") else: result = server_startup.create_config('none') utility_cmd.check_testcase(result, "Configuration file creation") result = server_startup.add_myextra_configuration( parent_dir + '/suite/replication/' + replication_conf) utility_cmd.check_testcase(result, "PXC: Adding custom configuration") result = server_startup.initialize_cluster() utility_cmd.check_testcase(result, "Initializing cluster") result = server_startup.start_cluster() utility_cmd.check_testcase(result, "Cluster startup") result = dbconnection_check.connection_check() utility_cmd.check_testcase(result, "Database connection")
def start_random_test(self, socket, db): my_extra = "--innodb_buffer_pool_size=8G --innodb_log_file_size=1G" dbconnection_check = db_connection.DbConnection(USER, socket) server_startup = pxc_startup.StartCluster(parent_dir, WORKDIR, BASEDIR, int(NODE), debug) result = server_startup.sanity_check() utility_cmd.check_testcase(result, "Startup sanity check") result = server_startup.initialize_cluster() utility_cmd.check_testcase(result, "Initializing cluster") if encryption == 'YES': result = server_startup.create_config('encryption') utility_cmd.check_testcase(result, "Configuration file creation") else: result = server_startup.create_config('none') utility_cmd.check_testcase(result, "Configuration file creation") result = server_startup.start_cluster(my_extra) utility_cmd.check_testcase(result, "Cluster startup") result = dbconnection_check.connection_check() utility_cmd.check_testcase(result, "Database connection") # Sysbench load test sysbench = sysbench_run.SysbenchRun(BASEDIR, WORKDIR, socket, debug) result = sysbench.sanity_check(db) utility_cmd.check_testcase(result, "Sysbench run sanity check") result = sysbench.sysbench_load(db, 64, 64, SYSBENCH_LOAD_TEST_TABLE_SIZE) utility_cmd.check_testcase(result, "Sysbench data load") utility_cmd.stop_pxc(WORKDIR, BASEDIR, NODE) wsrep_provider_options = { "gcache.keep_pages_size": [0, 1, 2], "gcache.recover": ["yes", "no"], "gcache.page_size": ["512M", "1024M"], "gcache.size": ["512M", "1024M", "2048M"], #"repl.commit_order": [0, 1, 2, 3] } keys = wsrep_provider_options.keys() values = (wsrep_provider_options[key] for key in keys) wsrep_combinations = [ dict(zip(keys, combination)) for combination in itertools.product(*values) ] wsrep_provider_option = '' for wsrep_combination in range(0, len(wsrep_combinations)): for wsrep_option, wsrep_value in wsrep_combinations[ wsrep_combination].items(): wsrep_provider_option += wsrep_option + "=" + str( wsrep_value) + ";" print(datetime.now().strftime("%H:%M:%S ") + " WSREP Provider combination(" + wsrep_provider_option + ")") if encryption == 'YES': result = server_startup.create_config('encryption', wsrep_provider_option) utility_cmd.check_testcase(result, "Updated configuration file") else: result = server_startup.create_config('none', wsrep_provider_option) utility_cmd.check_testcase(result, "Updated configuration file") result = server_startup.start_cluster() utility_cmd.check_testcase(result, "Cluster startup") result = dbconnection_check.connection_check() utility_cmd.check_testcase(result, "Database connection check") result = sysbench.sysbench_oltp_read_write( db, 64, 64, SYSBENCH_LOAD_TEST_TABLE_SIZE, 300, 'Yes') utility_cmd.check_testcase(result, "Sysbench oltp run initiated") query = 'pidof sysbench' sysbench_pid = os.popen(query).read().rstrip() time.sleep(100) shutdown_node = BASEDIR + '/bin/mysqladmin --user=root --socket=' + \ WORKDIR + '/node3/mysql.sock shutdown > /dev/null 2>&1' if debug == 'YES': print(shutdown_node) result = os.system(shutdown_node) utility_cmd.check_testcase( result, "Shutdown cluster node for IST/SST check") time.sleep(5) kill_sysbench = "kill -9 " + sysbench_pid if debug == 'YES': print("Terminating sysbench run : " + kill_sysbench) os.system(kill_sysbench) self.startup_check(3) wsrep_provider_option = '' time.sleep(5) result = utility_cmd.check_table_count( BASEDIR, db, socket, WORKDIR + '/node2/mysql.sock') utility_cmd.check_testcase(result, "Checksum run for DB: test") utility_cmd.stop_pxc(WORKDIR, BASEDIR, NODE)
print("------------------------------") print("PXC Random MySQLD options test") print("------------------------------") mysql_options = open(parent_dir + '/conf/mysql_options_pxc80.txt') for mysql_option in mysql_options: if os.path.exists(WORKDIR + '/random_mysql_error'): os.system('rm -rf ' + WORKDIR + '/random_mysql_error >/dev/null 2>&1') os.mkdir(WORKDIR + '/random_mysql_error') else: os.mkdir(WORKDIR + '/random_mysql_error') random_mysql_option_qa = RandomMySQLDOptionQA() # Start PXC cluster for random mysqld options QA dbconnection_check = db_connection.DbConnection( USER, WORKDIR + '/node1/mysql.sock') server_startup = pxc_startup.StartCluster(parent_dir, WORKDIR, BASEDIR, int(NODE), debug) result = server_startup.sanity_check() utility_cmd.check_testcase(result, "Startup sanity check") if encryption == 'YES': result = server_startup.create_config('encryption') utility_cmd.check_testcase(result, "Configuration file creation") else: result = server_startup.create_config('none') utility_cmd.check_testcase(result, "Configuration file creation") cnf_name = open(WORKDIR + '/conf/custom.cnf', 'a+') cnf_name.write('\n') cnf_name.write(mysql_option) cnf_name.close() # result = utility_cmd.create_custom_cnf(parent_dir, WORKDIR)
def encryption_qa(self): # Encryption QA # Create data insert procedure rqg_dataload = rqg_datagen.RQGDataGen(BASEDIR, WORKDIR, USER) encryption_tmp_ts = [ 'innodb_temp_tablespace_encrypt=ON', 'innodb_temp_tablespace_encrypt=OFF' ] encryption_bin_log = ['binlog_encryption=ON', 'binlog_encryption=OFF'] encryption_default_tbl = [ 'default_table_encryption=ON', 'default_table_encryption=OFF' ] encryption_redo_log = [ 'innodb_redo_log_encrypt=ON', 'innodb_redo_log_encrypt=OFF' ] encryption_undo_log = [ 'innodb_undo_log_encrypt=ON', 'innodb_undo_log_encrypt=OFF' ] encryption_sys_ts = [ 'innodb_sys_tablespace_encrypt=ON', 'innodb_sys_tablespace_encrypt=OFF' ] for encryption_tmp_ts_value, encryption_bin_log_value, encryption_default_tbl_value, \ encryption_redo_log_value, encryption_undo_log_value, encryption_sys_ts_value in \ itertools.product(encryption_tmp_ts, encryption_bin_log, encryption_default_tbl, encryption_redo_log, encryption_undo_log, encryption_sys_ts): encryption_combination = encryption_tmp_ts_value + " " + encryption_bin_log_value + \ " " + encryption_default_tbl_value + " " + encryption_redo_log_value + \ " " + encryption_undo_log_value + " " + encryption_sys_ts_value utility_cmd.check_testcase( 0, "Encryption options : " + encryption_combination) # Start PXC cluster for encryption test dbconnection_check = db_connection.DbConnection( USER, WORKDIR + '/node1/mysql.sock') server_startup = pxc_startup.StartCluster(parent_dir, WORKDIR, BASEDIR, int(NODE), debug) result = server_startup.sanity_check() utility_cmd.check_testcase(result, "Startup sanity check") result = server_startup.create_config('encryption') utility_cmd.check_testcase(result, "Configuration file creation") cnf_name = open(WORKDIR + '/conf/random_encryption.cnf', 'w+') cnf_name.write('[mysqld]\n') cnf_name.write("early-plugin-load=keyring_file.so" + '\n') cnf_name.write("keyring_file_data=keyring" + '\n') cnf_name.write(encryption_tmp_ts_value + '\n') cnf_name.write(encryption_bin_log_value + '\n') cnf_name.write(encryption_default_tbl_value + '\n') cnf_name.write(encryption_redo_log_value + '\n') cnf_name.write(encryption_undo_log_value + '\n') cnf_name.write(encryption_sys_ts_value + '\n') cnf_name.close() for i in range(1, int(NODE) + 1): os.system( "sed -i 's#pxc_encrypt_cluster_traffic = OFF#pxc_encrypt_cluster_traffic = ON#g' " + WORKDIR + '/conf/node' + str(i) + '.cnf') n_name = open(WORKDIR + '/conf/node' + str(i) + '.cnf', 'a+') n_name.write('!include ' + WORKDIR + '/conf/random_encryption.cnf\n') n_name.close() if encryption_sys_ts_value == "innodb_sys_tablespace_encrypt=ON": init_extra = "--innodb_sys_tablespace_encrypt=ON " \ "--early-plugin-load=keyring_file.so " \ " --keyring_file_data=keyring" result = server_startup.initialize_cluster(init_extra) else: result = server_startup.initialize_cluster() utility_cmd.check_testcase(result, "Initializing cluster") result = server_startup.start_cluster() utility_cmd.check_testcase(result, "Cluster startup") result = dbconnection_check.connection_check() utility_cmd.check_testcase(result, "Database connection") self.sysbench_run(WORKDIR + '/node1/mysql.sock', 'test') rqg_dataload.pxc_dataload(WORKDIR + '/node1/mysql.sock') # Add prepared statement SQLs create_ps = BASEDIR + "/bin/mysql --user=root --socket=" + \ WORKDIR + '/node1/mysql.sock' + ' < ' + parent_dir + \ '/util/prepared_statements.sql > /dev/null 2>&1' if debug == 'YES': print(create_ps) result = os.system(create_ps) utility_cmd.check_testcase(result, "Creating prepared statements") # Random data load if os.path.isfile(parent_dir + '/util/createsql.py'): generate_sql = createsql.GenerateSQL('/tmp/dataload.sql', 1000) generate_sql.OutFile() generate_sql.CreateTable() sys.stdout = sys.__stdout__ data_load_query = BASEDIR + "/bin/mysql --user=root --socket=" + \ WORKDIR + '/node1/mysql.sock' + ' test -f < /tmp/dataload.sql >/dev/null 2>&1' if debug == 'YES': print(data_load_query) result = os.system(data_load_query) utility_cmd.check_testcase(result, "Sample data load") utility_cmd.stop_pxc(WORKDIR, BASEDIR, NODE)