Skip to content

Commit 176087d

Browse files
committed
Removed copy of perftest
1 parent 2d08876 commit 176087d

File tree

1 file changed

+0
-82
lines changed

1 file changed

+0
-82
lines changed

test_mysql_ch_replicator.py

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -728,88 +728,6 @@ def test_datetime_exception():
728728
binlog_replicator_runner.stop()
729729

730730

731-
def test_performance():
732-
config_file = 'tests_config_perf.yaml'
733-
num_records = 100000
734-
735-
cfg = config.Settings()
736-
cfg.load(config_file)
737-
738-
mysql = mysql_api.MySQLApi(
739-
database=None,
740-
mysql_settings=cfg.mysql,
741-
)
742-
743-
ch = clickhouse_api.ClickhouseApi(
744-
database=TEST_DB_NAME,
745-
clickhouse_settings=cfg.clickhouse,
746-
)
747-
748-
prepare_env(cfg, mysql, ch)
749-
750-
mysql.execute(f'''
751-
CREATE TABLE `{TEST_TABLE_NAME}` (
752-
id int NOT NULL AUTO_INCREMENT,
753-
name varchar(2048),
754-
age int,
755-
PRIMARY KEY (id)
756-
);
757-
''')
758-
759-
binlog_replicator_runner = BinlogReplicatorRunner(cfg_file=config_file)
760-
binlog_replicator_runner.run()
761-
762-
time.sleep(1)
763-
764-
mysql.execute(f"INSERT INTO `{TEST_TABLE_NAME}` (name, age) VALUES ('TEST_VALUE_1', 33);", commit=True)
765-
766-
def _get_last_insert_name():
767-
record = get_last_insert_from_binlog(cfg=cfg, db_name=TEST_DB_NAME)
768-
if record is None:
769-
return None
770-
return record[1].decode('utf-8')
771-
772-
assert_wait(lambda: _get_last_insert_name() == 'TEST_VALUE_1', retry_interval=0.5)
773-
774-
binlog_replicator_runner.stop()
775-
776-
time.sleep(1)
777-
778-
print("populating mysql data")
779-
780-
base_value = 'a' * 2000
781-
782-
for i in range(num_records):
783-
if i % 2000 == 0:
784-
print(f'populated {i} elements')
785-
mysql.execute(
786-
f"INSERT INTO `{TEST_TABLE_NAME}` (name, age) "
787-
f"VALUES ('TEST_VALUE_{i}_{base_value}', {i});", commit=i % 20 == 0,
788-
)
789-
#`replication-test_db`
790-
mysql.execute(f"INSERT INTO `{TEST_TABLE_NAME}` (name, age) VALUES ('TEST_VALUE_FINAL', 0);", commit=True)
791-
792-
print("running db_replicator")
793-
t1 = time.time()
794-
binlog_replicator_runner = BinlogReplicatorRunner(cfg_file=config_file)
795-
binlog_replicator_runner.run()
796-
797-
assert_wait(lambda: _get_last_insert_name() == 'TEST_VALUE_FINAL', retry_interval=0.5, max_wait_time=1000)
798-
t2 = time.time()
799-
800-
binlog_replicator_runner.stop()
801-
802-
time_delta = t2 - t1
803-
rps = num_records / time_delta
804-
805-
print('\n\n')
806-
print("*****************************")
807-
print("records per second:", int(rps))
808-
print("total time (seconds):", round(time_delta, 2))
809-
print("*****************************")
810-
print('\n\n')
811-
812-
813731

814732
def test_different_types_1():
815733
cfg = config.Settings()

0 commit comments

Comments
 (0)