From 8466013561829820fb61406cbe4fe19dfc76f807 Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Mon, 9 Oct 2023 19:58:04 +0900 Subject: [PATCH 01/20] fixed: removed deprecated clock method --- pymysqlreplication/tests/benchmark.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pymysqlreplication/tests/benchmark.py b/pymysqlreplication/tests/benchmark.py index 3cd47bd9..c109985c 100644 --- a/pymysqlreplication/tests/benchmark.py +++ b/pymysqlreplication/tests/benchmark.py @@ -25,12 +25,12 @@ def consume_events(): only_events=[UpdateRowsEvent], only_tables=["test"], ) - start = time.clock() + start = time.perf_counter() i = 0.0 for binlogevent in stream: i += 1.0 if i % 1000 == 0: - print(f"{i / (time.clock()- start)} event by seconds ({i} total)") + print(f"{i / (time.perf_counter()- start)} event by seconds ({i} total)") stream.close() From c8fdf167636ab53639c1de03d0eb4423c203297c Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Mon, 9 Oct 2023 20:04:25 +0900 Subject: [PATCH 02/20] refactor: changed to f-string --- pymysqlreplication/tests/binlogfilereader.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pymysqlreplication/tests/binlogfilereader.py b/pymysqlreplication/tests/binlogfilereader.py index 9eed60d3..ddfe49e6 100644 --- a/pymysqlreplication/tests/binlogfilereader.py +++ b/pymysqlreplication/tests/binlogfilereader.py @@ -72,8 +72,7 @@ def _read_event(self): event = SimpleBinLogEvent(header) event.set_pos(event_pos) if event.event_size < headerlength: - messagefmt = "Event size {0} is too small" - message = messagefmt.format(event.event_size) + message = f"Event size {event.event_size} is too small" raise EventSizeTooSmallError(message) else: body = self._file.read(event.event_size - headerlength) @@ -89,8 +88,7 @@ def _read_magic(self): if magic == self._expected_magic: self._pos += len(magic) else: - messagefmt = "Magic bytes {0!r} did not match expected {1!r}" - message = messagefmt.format(magic, self._expected_magic) + message = f"Magic bytes {magic!r} did not match expected {self._expected_magic!r}" raise BadMagicBytesError(message) def __iter__(self): From c1f1a88c9b11e481039b26c756dd02afa59161ad Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Mon, 9 Oct 2023 21:10:01 +0900 Subject: [PATCH 03/20] refactor: fixed bitCountInByte multiline --- docker-compose-test.yml | 23 +- docker-compose.yml | 12 - pymysqlreplication/bitmap.py | 274 ++------------------- pymysqlreplication/tests/base.py | 27 +- pymysqlreplication/tests/test_basic.py | 61 ++--- pymysqlreplication/tests/test_data_type.py | 133 +--------- 6 files changed, 51 insertions(+), 479 deletions(-) diff --git a/docker-compose-test.yml b/docker-compose-test.yml index 7495cba6..c9ac44ef 100644 --- a/docker-compose-test.yml +++ b/docker-compose-test.yml @@ -21,22 +21,6 @@ x-mariadb: &mariadb --binlog-format=row services: - percona-5.7-ctl: - <<: *mysql - image: percona:5.7 - ports: - - "3307:3306" - networks: - - default - - percona-5.7: - <<: *mysql - image: percona:5.7 - ports: - - "3306:3306" - networks: - - default - percona-8.0: <<: *mysql image: percona:8.0 @@ -67,9 +51,6 @@ services: dockerfile: test.Dockerfile args: BASE_IMAGE: python:3.11-alpine - MYSQL_5_7: percona-5.7 - MYSQL_5_7_CTL: percona-5.7-ctl - MYSQL_5_7_CTL_PORT: 3306 MYSQL_8_0: percona-8.0 MYSQL_8_0_PORT: 3306 MARIADB_10_6: mariadb-10.6 @@ -83,7 +64,7 @@ services: while : do - if mysql -h percona-5.7 --user=root --execute "SELECT version();" 2>&1 >/dev/null && mysql -h percona-5.7-ctl --user=root --execute "SELECT version();" 2>&1 >/dev/null && mysql -h percona-8.0 --user=root --execute "SELECT version();" 2>&1 >/dev/null; then + if mysql -h percona-8.0 --user=root --execute "SELECT version();" 2>&1 >/dev/null; then break fi sleep 1 @@ -96,8 +77,6 @@ services: networks: - default depends_on: - - percona-5.7 - - percona-5.7-ctl - percona-8.0 networks: diff --git a/docker-compose.yml b/docker-compose.yml index 102ff631..9ee13f1d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,18 +21,6 @@ x-mariadb: &mariadb --binlog-format=row services: - percona-5.7: - <<: *mysql - image: percona:5.7 - ports: - - "3306:3306" - - percona-5.7-ctl: - <<: *mysql - image: percona:5.7 - ports: - - "3307:3306" - percona-8.0: <<: *mysql image: percona:8.0 diff --git a/pymysqlreplication/bitmap.py b/pymysqlreplication/bitmap.py index b02da8a1..804968d7 100644 --- a/pymysqlreplication/bitmap.py +++ b/pymysqlreplication/bitmap.py @@ -1,261 +1,23 @@ +# fmt: off bitCountInByte = [ - 0, - 1, - 1, - 2, - 1, - 2, - 2, - 3, - 1, - 2, - 2, - 3, - 2, - 3, - 3, - 4, - 1, - 2, - 2, - 3, - 2, - 3, - 3, - 4, - 2, - 3, - 3, - 4, - 3, - 4, - 4, - 5, - 1, - 2, - 2, - 3, - 2, - 3, - 3, - 4, - 2, - 3, - 3, - 4, - 3, - 4, - 4, - 5, - 2, - 3, - 3, - 4, - 3, - 4, - 4, - 5, - 3, - 4, - 4, - 5, - 4, - 5, - 5, - 6, - 1, - 2, - 2, - 3, - 2, - 3, - 3, - 4, - 2, - 3, - 3, - 4, - 3, - 4, - 4, - 5, - 2, - 3, - 3, - 4, - 3, - 4, - 4, - 5, - 3, - 4, - 4, - 5, - 4, - 5, - 5, - 6, - 2, - 3, - 3, - 4, - 3, - 4, - 4, - 5, - 3, - 4, - 4, - 5, - 4, - 5, - 5, - 6, - 3, - 4, - 4, - 5, - 4, - 5, - 5, - 6, - 4, - 5, - 5, - 6, - 5, - 6, - 6, - 7, - 1, - 2, - 2, - 3, - 2, - 3, - 3, - 4, - 2, - 3, - 3, - 4, - 3, - 4, - 4, - 5, - 2, - 3, - 3, - 4, - 3, - 4, - 4, - 5, - 3, - 4, - 4, - 5, - 4, - 5, - 5, - 6, - 2, - 3, - 3, - 4, - 3, - 4, - 4, - 5, - 3, - 4, - 4, - 5, - 4, - 5, - 5, - 6, - 3, - 4, - 4, - 5, - 4, - 5, - 5, - 6, - 4, - 5, - 5, - 6, - 5, - 6, - 6, - 7, - 2, - 3, - 3, - 4, - 3, - 4, - 4, - 5, - 3, - 4, - 4, - 5, - 4, - 5, - 5, - 6, - 3, - 4, - 4, - 5, - 4, - 5, - 5, - 6, - 4, - 5, - 5, - 6, - 5, - 6, - 6, - 7, - 3, - 4, - 4, - 5, - 4, - 5, - 5, - 6, - 4, - 5, - 5, - 6, - 5, - 6, - 6, - 7, - 4, - 5, - 5, - 6, - 5, - 6, - 6, - 7, - 5, - 6, - 6, - 7, - 6, - 7, - 7, - 8, + 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8, ] +# fmt: on # Calculate total bit counts in a bitmap diff --git a/pymysqlreplication/tests/base.py b/pymysqlreplication/tests/base.py index b288be84..6d6ec6db 100644 --- a/pymysqlreplication/tests/base.py +++ b/pymysqlreplication/tests/base.py @@ -11,7 +11,7 @@ def get_databases(): databases = {} with open( - os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.json") + os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.json") ) as f: databases = json.load(f) return databases @@ -54,7 +54,6 @@ def setUp(self, charset="utf8"): self.connect_conn_control(db) self.stream = None self.resetBinLog() - self.isMySQL56AndMore() self.__is_mariaDB = None def getMySQLVersion(self): @@ -63,16 +62,6 @@ def getMySQLVersion(self): """ return self.execute("SELECT VERSION()").fetchone()[0].split("-")[0] - def isMySQL56AndMore(self): - version = float(self.getMySQLVersion().rsplit(".", 1)[0]) - if version >= 5.6: - return True - return False - - def isMySQL57(self): - version = float(self.getMySQLVersion().rsplit(".", 1)[0]) - return version == 5.7 - def isMySQL80AndMore(self): version = float(self.getMySQLVersion().rsplit(".", 1)[0]) return version >= 8.0 @@ -87,16 +76,10 @@ def isMySQL8014AndMore(self): def isMariaDB(self): if self.__is_mariaDB is None: self.__is_mariaDB = ( - "MariaDB" in self.execute("SELECT VERSION()").fetchone()[0] + "MariaDB" in self.execute("SELECT VERSION()").fetchone()[0] ) return self.__is_mariaDB - @property - def supportsGTID(self): - if not self.isMySQL56AndMore(): - return False - return self.execute("SELECT @@global.gtid_mode ").fetchone()[0] == "ON" - def connect_conn_control(self, db): if self.conn_control is not None: self.conn_control.close() @@ -126,12 +109,6 @@ def resetBinLog(self): self.database, server_id=1024, ignored_events=self.ignoredEvents() ) - def set_sql_mode(self): - """set sql_mode to test with same sql_mode (mysql 5.7 sql_mode default is changed)""" - version = float(self.getMySQLVersion().rsplit(".", 1)[0]) - if version == 5.7: - self.execute("SET @@sql_mode='NO_ENGINE_SUBSTITUTION'") - def bin_log_format(self): query = "SELECT @@binlog_format" cursor = self.execute(query) diff --git a/pymysqlreplication/tests/test_basic.py b/pymysqlreplication/tests/test_basic.py index 80bfe657..d275465f 100644 --- a/pymysqlreplication/tests/test_basic.py +++ b/pymysqlreplication/tests/test_basic.py @@ -246,10 +246,8 @@ def test_write_row_event(self): self.assertIsInstance(self.stream.fetchone(), TableMapEvent) event = self.stream.fetchone() - if self.isMySQL56AndMore(): - self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V2) - else: - self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V1) + + self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V2) self.assertIsInstance(event, WriteRowsEvent) self.assertEqual(event.schema, "pymysqlreplication_test") self.assertEqual(event.table, "test") @@ -279,10 +277,8 @@ def test_delete_row_event(self): self.assertIsInstance(self.stream.fetchone(), TableMapEvent) event = self.stream.fetchone() - if self.isMySQL56AndMore(): - self.assertEqual(event.event_type, DELETE_ROWS_EVENT_V2) - else: - self.assertEqual(event.event_type, DELETE_ROWS_EVENT_V1) + + self.assertEqual(event.event_type, DELETE_ROWS_EVENT_V2) self.assertIsInstance(event, DeleteRowsEvent) if event.table_map[event.table_id].column_name_flag: self.assertEqual(event.rows[0]["values"]["id"], 1) @@ -309,10 +305,8 @@ def test_update_row_event(self): self.assertIsInstance(self.stream.fetchone(), TableMapEvent) event = self.stream.fetchone() - if self.isMySQL56AndMore(): - self.assertEqual(event.event_type, UPDATE_ROWS_EVENT_V2) - else: - self.assertEqual(event.event_type, UPDATE_ROWS_EVENT_V1) + + self.assertEqual(event.event_type, DELETE_ROWS_EVENT_V2) self.assertIsInstance(event, UpdateRowsEvent) if event.table_map[event.table_id].column_name_flag: self.assertEqual(event.rows[0]["before_values"]["id"], 1) @@ -339,10 +333,8 @@ def test_minimal_image_write_row_event(self): self.assertIsInstance(self.stream.fetchone(), TableMapEvent) event = self.stream.fetchone() - if self.isMySQL56AndMore(): - self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V2) - else: - self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V1) + + self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V2) self.assertIsInstance(event, WriteRowsEvent) self.assertEqual(event.schema, "pymysqlreplication_test") self.assertEqual(event.table, "test") @@ -373,10 +365,8 @@ def test_minimal_image_delete_row_event(self): self.assertIsInstance(self.stream.fetchone(), TableMapEvent) event = self.stream.fetchone() - if self.isMySQL56AndMore(): - self.assertEqual(event.event_type, DELETE_ROWS_EVENT_V2) - else: - self.assertEqual(event.event_type, DELETE_ROWS_EVENT_V1) + + self.assertEqual(event.event_type, DELETE_ROWS_EVENT_V2) self.assertIsInstance(event, DeleteRowsEvent) if event.table_map[event.table_id].column_name_flag: self.assertEqual(event.rows[0]["values"]["id"], 1) @@ -404,10 +394,8 @@ def test_minimal_image_update_row_event(self): self.assertIsInstance(self.stream.fetchone(), TableMapEvent) event = self.stream.fetchone() - if self.isMySQL56AndMore(): - self.assertEqual(event.event_type, UPDATE_ROWS_EVENT_V2) - else: - self.assertEqual(event.event_type, UPDATE_ROWS_EVENT_V1) + + self.assertEqual(event.event_type, UPDATE_ROWS_EVENT_V2) self.assertIsInstance(event, UpdateRowsEvent) if event.table_map[event.table_id].column_name_flag: self.assertEqual(event.rows[0]["before_values"]["id"], 1) @@ -583,7 +571,7 @@ def create_binlog_packet_wrapper(pkt): # Assume a bit flip occurred while data was being transmitted q(1001000) -> U(0110111) modified_byte = b"U" wrong_event_data = ( - correct_event_data[:1] + modified_byte + correct_event_data[2:] + correct_event_data[:1] + modified_byte + correct_event_data[2:] ) packet = MysqlPacket(correct_event_data, 0) @@ -650,10 +638,8 @@ def test_insert_multiple_row_event(self): self.assertIsInstance(self.stream.fetchone(), TableMapEvent) event = self.stream.fetchone() - if self.isMySQL56AndMore(): - self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V2) - else: - self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V1) + + self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V2) self.assertIsInstance(event, WriteRowsEvent) self.assertEqual(len(event.rows), 2) if event.table_map[event.table_id].column_name_flag: @@ -685,10 +671,8 @@ def test_update_multiple_row_event(self): self.assertIsInstance(self.stream.fetchone(), TableMapEvent) event = self.stream.fetchone() - if self.isMySQL56AndMore(): - self.assertEqual(event.event_type, UPDATE_ROWS_EVENT_V2) - else: - self.assertEqual(event.event_type, UPDATE_ROWS_EVENT_V1) + + self.assertEqual(event.event_type, UPDATE_ROWS_EVENT_V2) self.assertIsInstance(event, UpdateRowsEvent) self.assertEqual(len(event.rows), 2) if event.table_map[event.table_id].column_name_flag: @@ -725,10 +709,7 @@ def test_delete_multiple_row_event(self): self.assertIsInstance(self.stream.fetchone(), TableMapEvent) event = self.stream.fetchone() - if self.isMySQL56AndMore(): - self.assertEqual(event.event_type, DELETE_ROWS_EVENT_V2) - else: - self.assertEqual(event.event_type, DELETE_ROWS_EVENT_V1) + self.assertEqual(event.event_type, DELETE_ROWS_EVENT_V2) self.assertIsInstance(event, DeleteRowsEvent) self.assertEqual(len(event.rows), 2) if event.table_map[event.table_id].column_name_flag: @@ -851,10 +832,6 @@ def test_separate_ctl_settings_no_error(self): class TestGtidBinLogStreamReader(base.PyMySQLReplicationTestCase): def setUp(self): super().setUp() - if not self.supportsGTID: - raise unittest.SkipTest( - "database does not support GTID, skipping GTID tests" - ) def test_read_query_event(self): query = "CREATE TABLE test (id INT NOT NULL, data VARCHAR (50) NOT NULL, PRIMARY KEY (id))" @@ -1395,7 +1372,7 @@ def test_start_encryption_event(self): try: with open( - f"{encryption_key_file_path}/.mariadb/no_encryption_key.key", "r" + f"{encryption_key_file_path}/.mariadb/no_encryption_key.key", "r" ) as key_file: first_line = key_file.readline() key_version_from_key_file = int(first_line.split(";")[0]) diff --git a/pymysqlreplication/tests/test_data_type.py b/pymysqlreplication/tests/test_data_type.py index cece10c3..120ded97 100644 --- a/pymysqlreplication/tests/test_data_type.py +++ b/pymysqlreplication/tests/test_data_type.py @@ -51,10 +51,8 @@ def create_and_insert_value(self, create_query, insert_query): self.assertIsInstance(self.stream.fetchone(), TableMapEvent) event = self.stream.fetchone() - if self.isMySQL56AndMore(): - self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V2) - else: - self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V1) + + self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V2) self.assertIsInstance(event, WriteRowsEvent) return event @@ -287,55 +285,6 @@ def test_timestamp(self): datetime.datetime(1984, 12, 3, 12, 33, 7), ) - def test_timestamp_mysql56(self): - if not self.isMySQL56AndMore(): - self.skipTest("Not supported in this version of MySQL") - self.set_sql_mode() - create_query = """CREATE TABLE test (test0 TIMESTAMP(0), - test1 TIMESTAMP(1), - test2 TIMESTAMP(2), - test3 TIMESTAMP(3), - test4 TIMESTAMP(4), - test5 TIMESTAMP(5), - test6 TIMESTAMP(6));""" - insert_query = """INSERT INTO test VALUES('1984-12-03 12:33:07', - '1984-12-03 12:33:07.1', - '1984-12-03 12:33:07.12', - '1984-12-03 12:33:07.123', - '1984-12-03 12:33:07.1234', - '1984-12-03 12:33:07.12345', - '1984-12-03 12:33:07.123456')""" - event = self.create_and_insert_value(create_query, insert_query) - if event.table_map[event.table_id].column_name_flag: - self.assertEqual( - event.rows[0]["values"]["test0"], - datetime.datetime(1984, 12, 3, 12, 33, 7), - ) - self.assertEqual( - event.rows[0]["values"]["test1"], - datetime.datetime(1984, 12, 3, 12, 33, 7, 100000), - ) - self.assertEqual( - event.rows[0]["values"]["test2"], - datetime.datetime(1984, 12, 3, 12, 33, 7, 120000), - ) - self.assertEqual( - event.rows[0]["values"]["test3"], - datetime.datetime(1984, 12, 3, 12, 33, 7, 123000), - ) - self.assertEqual( - event.rows[0]["values"]["test4"], - datetime.datetime(1984, 12, 3, 12, 33, 7, 123400), - ) - self.assertEqual( - event.rows[0]["values"]["test5"], - datetime.datetime(1984, 12, 3, 12, 33, 7, 123450), - ) - self.assertEqual( - event.rows[0]["values"]["test6"], - datetime.datetime(1984, 12, 3, 12, 33, 7, 123456), - ) - def test_longlong(self): create_query = "CREATE TABLE test (id BIGINT UNSIGNED NOT NULL, test BIGINT)" insert_query = ( @@ -375,32 +324,6 @@ def test_zero_date(self): self.assertEqual(event.rows[0]["values"]["test"], None) self.assertEqual(event.rows[0]["values"]["test2"], None) - def test_zero_month(self): - if not self.isMySQL57(): - self.skipTest( - "Not supported in this version of MySQL 8" - ) # pymysql.err.OperationalError - self.set_sql_mode() - create_query = "CREATE TABLE test (id INTEGER, test DATE, test2 DATE);" - insert_query = "INSERT INTO test (id, test2) VALUES(1, '2015-00-21')" - event = self.create_and_insert_value(create_query, insert_query) - if event.table_map[event.table_id].column_name_flag: - self.assertEqual(event.rows[0]["values"]["test"], None) - self.assertEqual(event.rows[0]["values"]["test2"], None) - - def test_zero_day(self): - if not self.isMySQL57(): - self.skipTest( - "Not supported in this version of MySQL 8" - ) # pymysql.err.OperationalError - self.set_sql_mode() - create_query = "CREATE TABLE test (id INTEGER, test DATE, test2 DATE);" - insert_query = "INSERT INTO test (id, test2) VALUES(1, '2015-05-00')" - event = self.create_and_insert_value(create_query, insert_query) - if event.table_map[event.table_id].column_name_flag: - self.assertEqual(event.rows[0]["values"]["test"], None) - self.assertEqual(event.rows[0]["values"]["test2"], None) - def test_time(self): create_query = "CREATE TABLE test (test1 TIME, test2 TIME);" insert_query = "INSERT INTO test VALUES('838:59:59', '-838:59:59')" @@ -420,8 +343,6 @@ def test_time(self): ) def test_time2(self): - if not self.isMySQL56AndMore(): - self.skipTest("Not supported in this version of MySQL") create_query = "CREATE TABLE test (test1 TIME(6), test2 TIME(6));" insert_query = """ INSERT INTO test VALUES('838:59:59.000000', '-838:59:59.000000'); @@ -460,38 +381,7 @@ def test_datetime(self): datetime.datetime(1984, 12, 3, 12, 33, 7), ) - def test_zero_datetime(self): - if not self.isMySQL57(): - self.skipTest( - "Not supported in this version of MySQL 8" - ) # pymysql.err.OperationalError Invalid default value for 'test' - self.set_sql_mode() - create_query = ( - "CREATE TABLE test (id INTEGER, test DATETIME NOT NULL DEFAULT 0);" - ) - insert_query = "INSERT INTO test (id) VALUES(1)" - event = self.create_and_insert_value(create_query, insert_query) - if event.table_map[event.table_id].column_name_flag: - self.assertEqual(event.rows[0]["values"]["test"], None) - - def test_broken_datetime(self): - if not self.isMySQL57(): - self.skipTest( - "Not supported in this version of MySQL 8" - ) # pymysql.err.OperationalError Incorrect datetime value: '2013-00-00 00:00:00' for column 'test' - self.set_sql_mode() - create_query = "CREATE TABLE test (test DATETIME NOT NULL);" - insert_query = "INSERT INTO test VALUES('2013-00-00 00:00:00')" - event = self.create_and_insert_value(create_query, insert_query) - if event.table_map[event.table_id].column_name_flag: - self.assertEqual(event.rows[0]["values"]["test"], None) - def test_year(self): - if self.isMySQL57(): - # https://dev.mysql.com/doc/refman/5.7/en/migrating-to-year4.html - self.skipTest( - "YEAR(2) is unsupported in mysql 5.7" - ) # pymysql.err.OperationalError: (1818, 'Supports only YEAR or YEAR(4) column.') create_query = "CREATE TABLE test (a YEAR(4), b YEAR)" insert_query = "INSERT INTO test VALUES(1984, 1984)" event = self.create_and_insert_value(create_query, insert_query) @@ -612,7 +502,7 @@ def test_json_large(self): ) # Make it large enough to reach 2^16 length create_query = "CREATE TABLE test (id int, value json);" insert_query = ( - """INSERT INTO test (id, value) VALUES (1, '%s');""" % json.dumps(data) + """INSERT INTO test (id, value) VALUES (1, '%s');""" % json.dumps(data) ) event = self.create_and_insert_value(create_query, insert_query) if event.table_map[event.table_id].column_name_flag: @@ -637,7 +527,7 @@ def test_json_large_with_literal(self): ) # Make it large with literal create_query = "CREATE TABLE test (id int, value json);" insert_query = ( - """INSERT INTO test (id, value) VALUES (1, '%s');""" % json.dumps(data) + """INSERT INTO test (id, value) VALUES (1, '%s');""" % json.dumps(data) ) event = self.create_and_insert_value(create_query, insert_query) if event.table_map[event.table_id].column_name_flag: @@ -662,7 +552,7 @@ def test_json_types(self): data = {"foo": t} create_query = "CREATE TABLE test (id int, value json);" insert_query = ( - """INSERT INTO test (id, value) VALUES (1, '%s');""" % json.dumps(data) + """INSERT INTO test (id, value) VALUES (1, '%s');""" % json.dumps(data) ) event = self.create_and_insert_value(create_query, insert_query) if event.table_map[event.table_id].column_name_flag: @@ -688,7 +578,7 @@ def test_json_basic(self): for data in types: create_query = "CREATE TABLE test (id int, value json);" insert_query = ( - """INSERT INTO test (id, value) VALUES (1, '%s');""" % json.dumps(data) + """INSERT INTO test (id, value) VALUES (1, '%s');""" % json.dumps(data) ) event = self.create_and_insert_value(create_query, insert_query) if event.table_map[event.table_id].column_name_flag: @@ -711,8 +601,8 @@ def test_json_long_string(self): # The string length needs to be larger than what can fit in a single byte. string_value = "super_long_string" * 100 insert_query = ( - 'INSERT INTO test (id, value) VALUES (1, \'{"my_key": "%s"}\');' - % (string_value,) + 'INSERT INTO test (id, value) VALUES (1, \'{"my_key": "%s"}\');' + % (string_value,) ) event = self.create_and_insert_value(create_query, insert_query) if event.table_map[event.table_id].column_name_flag: @@ -962,10 +852,9 @@ def create_and_insert_value(self, create_query, insert_query): self.assertIsInstance(self.stream.fetchone(), TableMapEvent) event = self.stream.fetchone() - if self.isMySQL56AndMore(): - self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V2) - else: - self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V1) + + self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V2) + self.assertIsInstance(event, WriteRowsEvent) return event From a98999898b7b3f6f6ece1fbc2dd918d63976ffa3 Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Mon, 9 Oct 2023 21:11:00 +0900 Subject: [PATCH 04/20] remove: removed mysql 5.7 dependency --- pymysqlreplication/binlogstream.py | 4 ++-- pymysqlreplication/tests/base.py | 4 ++-- pymysqlreplication/tests/test_basic.py | 4 ++-- pymysqlreplication/tests/test_data_type.py | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pymysqlreplication/binlogstream.py b/pymysqlreplication/binlogstream.py index 94c70550..a70babb6 100644 --- a/pymysqlreplication/binlogstream.py +++ b/pymysqlreplication/binlogstream.py @@ -312,7 +312,7 @@ def __checksum_enabled(self): if result is None: return False - var, value = result[:2] + _, value = result[:2] if value == "NONE": return False return True @@ -587,7 +587,7 @@ def fetchone(self): else: pkt = self._stream_connection._read_packet() except pymysql.OperationalError as error: - code, message = error.args + code, _ = error.args if code in MYSQL_EXPECTED_ERROR_CODES: self._stream_connection.close() self.__connected_stream = False diff --git a/pymysqlreplication/tests/base.py b/pymysqlreplication/tests/base.py index 6d6ec6db..40772418 100644 --- a/pymysqlreplication/tests/base.py +++ b/pymysqlreplication/tests/base.py @@ -11,7 +11,7 @@ def get_databases(): databases = {} with open( - os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.json") + os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.json") ) as f: databases = json.load(f) return databases @@ -76,7 +76,7 @@ def isMySQL8014AndMore(self): def isMariaDB(self): if self.__is_mariaDB is None: self.__is_mariaDB = ( - "MariaDB" in self.execute("SELECT VERSION()").fetchone()[0] + "MariaDB" in self.execute("SELECT VERSION()").fetchone()[0] ) return self.__is_mariaDB diff --git a/pymysqlreplication/tests/test_basic.py b/pymysqlreplication/tests/test_basic.py index d275465f..60ab6110 100644 --- a/pymysqlreplication/tests/test_basic.py +++ b/pymysqlreplication/tests/test_basic.py @@ -571,7 +571,7 @@ def create_binlog_packet_wrapper(pkt): # Assume a bit flip occurred while data was being transmitted q(1001000) -> U(0110111) modified_byte = b"U" wrong_event_data = ( - correct_event_data[:1] + modified_byte + correct_event_data[2:] + correct_event_data[:1] + modified_byte + correct_event_data[2:] ) packet = MysqlPacket(correct_event_data, 0) @@ -1372,7 +1372,7 @@ def test_start_encryption_event(self): try: with open( - f"{encryption_key_file_path}/.mariadb/no_encryption_key.key", "r" + f"{encryption_key_file_path}/.mariadb/no_encryption_key.key", "r" ) as key_file: first_line = key_file.readline() key_version_from_key_file = int(first_line.split(";")[0]) diff --git a/pymysqlreplication/tests/test_data_type.py b/pymysqlreplication/tests/test_data_type.py index 120ded97..950cc997 100644 --- a/pymysqlreplication/tests/test_data_type.py +++ b/pymysqlreplication/tests/test_data_type.py @@ -502,7 +502,7 @@ def test_json_large(self): ) # Make it large enough to reach 2^16 length create_query = "CREATE TABLE test (id int, value json);" insert_query = ( - """INSERT INTO test (id, value) VALUES (1, '%s');""" % json.dumps(data) + """INSERT INTO test (id, value) VALUES (1, '%s');""" % json.dumps(data) ) event = self.create_and_insert_value(create_query, insert_query) if event.table_map[event.table_id].column_name_flag: @@ -527,7 +527,7 @@ def test_json_large_with_literal(self): ) # Make it large with literal create_query = "CREATE TABLE test (id int, value json);" insert_query = ( - """INSERT INTO test (id, value) VALUES (1, '%s');""" % json.dumps(data) + """INSERT INTO test (id, value) VALUES (1, '%s');""" % json.dumps(data) ) event = self.create_and_insert_value(create_query, insert_query) if event.table_map[event.table_id].column_name_flag: @@ -552,7 +552,7 @@ def test_json_types(self): data = {"foo": t} create_query = "CREATE TABLE test (id int, value json);" insert_query = ( - """INSERT INTO test (id, value) VALUES (1, '%s');""" % json.dumps(data) + """INSERT INTO test (id, value) VALUES (1, '%s');""" % json.dumps(data) ) event = self.create_and_insert_value(create_query, insert_query) if event.table_map[event.table_id].column_name_flag: @@ -578,7 +578,7 @@ def test_json_basic(self): for data in types: create_query = "CREATE TABLE test (id int, value json);" insert_query = ( - """INSERT INTO test (id, value) VALUES (1, '%s');""" % json.dumps(data) + """INSERT INTO test (id, value) VALUES (1, '%s');""" % json.dumps(data) ) event = self.create_and_insert_value(create_query, insert_query) if event.table_map[event.table_id].column_name_flag: @@ -601,8 +601,8 @@ def test_json_long_string(self): # The string length needs to be larger than what can fit in a single byte. string_value = "super_long_string" * 100 insert_query = ( - 'INSERT INTO test (id, value) VALUES (1, \'{"my_key": "%s"}\');' - % (string_value,) + 'INSERT INTO test (id, value) VALUES (1, \'{"my_key": "%s"}\');' + % (string_value,) ) event = self.create_and_insert_value(create_query, insert_query) if event.table_map[event.table_id].column_name_flag: From 611b7e06cb5fff6f34ef9c228e911040bdae247e Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Mon, 9 Oct 2023 21:17:40 +0900 Subject: [PATCH 05/20] feat: added version verification for mysql 8.0.16 --- pymysqlreplication/tests/base.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pymysqlreplication/tests/base.py b/pymysqlreplication/tests/base.py index 40772418..477f9688 100644 --- a/pymysqlreplication/tests/base.py +++ b/pymysqlreplication/tests/base.py @@ -73,6 +73,13 @@ def isMySQL8014AndMore(self): return True return version == 8.0 and version_detail >= 14 + def isMySQL8016AndMore(self): + version = float(self.getMySQLVersion().rsplit(".", 1)[0]) + version_detail = int(self.getMySQLVersion().rsplit(".", 1)[1]) + if version > 8.0: + return True + return version == 8.0 and version_detail >= 16 + def isMariaDB(self): if self.__is_mariaDB is None: self.__is_mariaDB = ( From 3ec7a05ad3d41f684f246d084451b3479c54f0d4 Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Mon, 9 Oct 2023 21:18:40 +0900 Subject: [PATCH 06/20] fixed: test_partition_id is available above mysql16 --- pymysqlreplication/tests/test_data_type.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pymysqlreplication/tests/test_data_type.py b/pymysqlreplication/tests/test_data_type.py index 950cc997..15cb5166 100644 --- a/pymysqlreplication/tests/test_data_type.py +++ b/pymysqlreplication/tests/test_data_type.py @@ -695,7 +695,7 @@ def test_encoding_utf8(self): self.assertMultiLineEqual(event.rows[0]["values"]["test"], string) def test_partition_id(self): - if not self.isMySQL80AndMore(): + if not self.isMySQL8016AndMore(): self.skipTest("Not supported in this version of MySQL") create_query = "CREATE TABLE test (id INTEGER) \ PARTITION BY RANGE (id) ( \ @@ -859,7 +859,7 @@ def create_and_insert_value(self, create_query, insert_query): return event def test_partition_id(self): - if not self.isMySQL80AndMore(): + if not self.isMySQL8016AndMore(): self.skipTest("Not supported in this version of MySQL") create_query = "CREATE TABLE test (id INTEGER) \ PARTITION BY RANGE (id) ( \ From 460ae2fb19ad6dcda7bcca615c869ef1f56cbc23 Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Mon, 9 Oct 2023 21:34:31 +0900 Subject: [PATCH 07/20] fixed: removed 5.7 dependency in workflow --- .github/workflows/pytest.yml | 18 +++++------------- pymysqlreplication/tests/config.json | 18 ------------------ 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 23a24e34..1d2d77db 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -1,5 +1,5 @@ name: PyTest -on: [push, pull_request] +on: [ push, pull_request ] env: PYTEST_SKIP_OPTION: "not test_no_trailing_rotate_event and not test_end_log_pos and not test_query_event_latin1" jobs: @@ -8,10 +8,10 @@ jobs: fail-fast: false matrix: include: - - {name: 'CPython 3.7', python: '3.7'} - - {name: 'CPython 3.11', python: '3.11'} - - {name: 'Pypy 3.7', python: 'pypy-3.7'} - - {name: 'Pypy 3.9', python: 'pypy-3.9'} + - { name: 'CPython 3.7', python: '3.7' } + - { name: 'CPython 3.11', python: '3.11' } + - { name: 'Pypy 3.7', python: 'pypy-3.7' } + - { name: 'Pypy 3.9', python: 'pypy-3.9' } name: ${{ matrix.name }} runs-on: ubuntu-latest timeout-minutes: 3 @@ -46,14 +46,6 @@ jobs: pip install . pip install pytest - - name: Run tests for mysql-5 - working-directory: pymysqlreplication/tests - run: pytest -k "$PYTEST_SKIP_OPTION" --db=mysql-5 - - - name: Run tests for mysql-5-ctl - working-directory: pymysqlreplication/tests - run: pytest -k "$PYTEST_SKIP_OPTION" --db=mysql-5-ctl - - name: Run tests for mysql-8 working-directory: pymysqlreplication/tests run: pytest -k "$PYTEST_SKIP_OPTION" --db=mysql-8 diff --git a/pymysqlreplication/tests/config.json b/pymysqlreplication/tests/config.json index 5bfd93a4..d4c46229 100644 --- a/pymysqlreplication/tests/config.json +++ b/pymysqlreplication/tests/config.json @@ -1,22 +1,4 @@ { - "mysql-5": { - "host": "localhost", - "user": "root", - "passwd": "", - "port": 3306, - "use_unicode": true, - "charset": "utf8", - "db": "pymysqlreplication_test" - }, - "mysql-5-ctl": { - "host": "localhost", - "user": "root", - "passwd": "", - "port": 3307, - "use_unicode": true, - "charset": "utf8", - "db": "pymysqlreplication_test" - }, "mariadb-10": { "host": "localhost", "user": "root", From 1c526530ea7b21b317fa87c620930faec6a26b0f Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Tue, 10 Oct 2023 01:10:06 +0900 Subject: [PATCH 08/20] remove: removed python2 and mysql5.7 --- pymysqlreplication/event.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pymysqlreplication/event.py b/pymysqlreplication/event.py index 668c929f..a8b95425 100644 --- a/pymysqlreplication/event.py +++ b/pymysqlreplication/event.py @@ -98,9 +98,8 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs) self.gno = struct.unpack("= (5, 7): - self.last_committed = struct.unpack(" Date: Tue, 10 Oct 2023 01:11:44 +0900 Subject: [PATCH 09/20] remove: removed python2 and mysql5.7 --- pymysqlreplication/tests/test_basic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pymysqlreplication/tests/test_basic.py b/pymysqlreplication/tests/test_basic.py index 60ab6110..cdd9b814 100644 --- a/pymysqlreplication/tests/test_basic.py +++ b/pymysqlreplication/tests/test_basic.py @@ -306,7 +306,7 @@ def test_update_row_event(self): event = self.stream.fetchone() - self.assertEqual(event.event_type, DELETE_ROWS_EVENT_V2) + self.assertEqual(event.event_type, UPDATE_ROWS_EVENT_V2) self.assertIsInstance(event, UpdateRowsEvent) if event.table_map[event.table_id].column_name_flag: self.assertEqual(event.rows[0]["before_values"]["id"], 1) @@ -1462,7 +1462,7 @@ def test_query_event_latin1(self): event = self.stream.fetchone() assert event.query.startswith("CREATE TABLE test") - assert event.query == r"CREATE TABLE test_latin1_\xd6\xc6\xdb (a INT)" + assert event.query == "CREATE TABLE test_latin1_\xd6\xc6\xdb (a INT)" @pytest.mark.mariadb From bd7a930ef3b9c4b6fb4aa17d08461ac778cdcb12 Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Tue, 10 Oct 2023 01:13:07 +0900 Subject: [PATCH 10/20] refactor: changed default setting to 5.7 to mysql 8.0 --- pymysqlreplication/tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymysqlreplication/tests/conftest.py b/pymysqlreplication/tests/conftest.py index 8e1b55b7..153bfa56 100644 --- a/pymysqlreplication/tests/conftest.py +++ b/pymysqlreplication/tests/conftest.py @@ -2,7 +2,7 @@ def pytest_addoption(parser): - parser.addoption("--db", action="store", default="mysql-5") + parser.addoption("--db", action="store", default="mysql-8") @pytest.fixture From ed782941b18800cb61d975c5754faa68c9a85927 Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Tue, 10 Oct 2023 01:14:07 +0900 Subject: [PATCH 11/20] refactor: removed python2.0 compatibility --- pymysqlreplication/tests/test_data_type.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/pymysqlreplication/tests/test_data_type.py b/pymysqlreplication/tests/test_data_type.py index 15cb5166..9c91dbad 100644 --- a/pymysqlreplication/tests/test_data_type.py +++ b/pymysqlreplication/tests/test_data_type.py @@ -1,5 +1,4 @@ import copy -import platform import json from pymysqlreplication import BinLogStreamReader import unittest @@ -666,10 +665,7 @@ def test_encoding_latin1(self): db["charset"] = "latin1" self.connect_conn_control(db) - if platform.python_version_tuple()[0] == "2": - string = unichr(233) - else: - string = "\u00e9" + string = "\u00e9" create_query = ( "CREATE TABLE test (test CHAR(12)) CHARACTER SET latin1 COLLATE latin1_bin;" @@ -680,10 +676,7 @@ def test_encoding_latin1(self): self.assertEqual(event.rows[0]["values"]["test"], string) def test_encoding_utf8(self): - if platform.python_version_tuple()[0] == "2": - string = unichr(0x20AC) - else: - string = "\u20ac" + string = "\u20ac" create_query = ( "CREATE TABLE test (test CHAR(12)) CHARACTER SET utf8 COLLATE utf8_bin;" From 4cb5ea114964adcba9909204ab50863eadb2538b Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Tue, 10 Oct 2023 14:28:42 +0900 Subject: [PATCH 12/20] stash --- pymysqlreplication/tests/test_basic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pymysqlreplication/tests/test_basic.py b/pymysqlreplication/tests/test_basic.py index cdd9b814..2da38763 100644 --- a/pymysqlreplication/tests/test_basic.py +++ b/pymysqlreplication/tests/test_basic.py @@ -1459,10 +1459,12 @@ def test_query_event_latin1(self): self.execute("CREATE TABLE test_latin1_ÖÆÛ (a INT)") self.execute("COMMIT") assert "ÖÆÛ".encode("latin-1") == b"\xd6\xc6\xdb" + print("result", "ÖÆÛ".encode("latin-1")) event = self.stream.fetchone() + print("event type: ", event.event_type) assert event.query.startswith("CREATE TABLE test") - assert event.query == "CREATE TABLE test_latin1_\xd6\xc6\xdb (a INT)" + assert event.query == r"CREATE TABLE test_latin1_\xd6\xc6\xdb (a INT)" @pytest.mark.mariadb From 111e2e40df670c2ca5a121f9138121a5d64d6ede Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Thu, 12 Oct 2023 12:50:45 +0900 Subject: [PATCH 13/20] remove : removed all dependency and left test_ignore_decode_errors --- pymysqlreplication/tests/test_basic.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pymysqlreplication/tests/test_basic.py b/pymysqlreplication/tests/test_basic.py index 2da38763..cc38f835 100644 --- a/pymysqlreplication/tests/test_basic.py +++ b/pymysqlreplication/tests/test_basic.py @@ -1459,10 +1459,9 @@ def test_query_event_latin1(self): self.execute("CREATE TABLE test_latin1_ÖÆÛ (a INT)") self.execute("COMMIT") assert "ÖÆÛ".encode("latin-1") == b"\xd6\xc6\xdb" - print("result", "ÖÆÛ".encode("latin-1")) event = self.stream.fetchone() - print("event type: ", event.event_type) + assert event.query.startswith("CREATE TABLE test") assert event.query == r"CREATE TABLE test_latin1_\xd6\xc6\xdb (a INT)" From 29cb7693bb441b25652e7a93320255fb3b45687b Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Thu, 12 Oct 2023 13:48:29 +0900 Subject: [PATCH 14/20] chore : fixed docker-compse.yml --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9ee13f1d..bb07d7aa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,13 +25,13 @@ services: <<: *mysql image: percona:8.0 ports: - - "3309:3306" + - "3306:3306" mariadb-10.6: <<: *mariadb image: mariadb:10.6 ports: - - "3308:3306" + - "3307:3306" volumes: - type: bind source: ./.mariadb From 19bd2a8f58f6e1edfc654523da780af93f83d0cb Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Thu, 12 Oct 2023 13:51:44 +0900 Subject: [PATCH 15/20] chore : fixed docker-compse.yml --- docker-compose.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index bb07d7aa..102ff631 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,17 +21,29 @@ x-mariadb: &mariadb --binlog-format=row services: + percona-5.7: + <<: *mysql + image: percona:5.7 + ports: + - "3306:3306" + + percona-5.7-ctl: + <<: *mysql + image: percona:5.7 + ports: + - "3307:3306" + percona-8.0: <<: *mysql image: percona:8.0 ports: - - "3306:3306" + - "3309:3306" mariadb-10.6: <<: *mariadb image: mariadb:10.6 ports: - - "3307:3306" + - "3308:3306" volumes: - type: bind source: ./.mariadb From 946d3f6c1e4f4c1430fc061d4a7934f53237aac6 Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Thu, 12 Oct 2023 14:18:32 +0900 Subject: [PATCH 16/20] chore : added ctl on docker-compose.yml --- docker-compose.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 102ff631..6076644b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,15 +21,9 @@ x-mariadb: &mariadb --binlog-format=row services: - percona-5.7: + percona-8.0-ctl: <<: *mysql - image: percona:5.7 - ports: - - "3306:3306" - - percona-5.7-ctl: - <<: *mysql - image: percona:5.7 + image: percona:8.0 ports: - "3307:3306" From 33dff945f18868bcc6ded833222d6a6f90c298ff Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Thu, 12 Oct 2023 14:20:29 +0900 Subject: [PATCH 17/20] chore : added ctl on docker-compose.yml --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6076644b..be548897 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,7 +31,7 @@ services: <<: *mysql image: percona:8.0 ports: - - "3309:3306" + - "3306:3306" mariadb-10.6: <<: *mariadb From 057cffaa5b1bdb67095630280f9275ba6338d508 Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Thu, 12 Oct 2023 14:22:34 +0900 Subject: [PATCH 18/20] chore : fixed config.json --- pymysqlreplication/tests/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymysqlreplication/tests/config.json b/pymysqlreplication/tests/config.json index d4c46229..a891cc6e 100644 --- a/pymysqlreplication/tests/config.json +++ b/pymysqlreplication/tests/config.json @@ -12,7 +12,7 @@ "host": "localhost", "user": "root", "passwd": "", - "port": 3309, + "port": 3306, "use_unicode": true, "charset": "utf8", "db": "pymysqlreplication_test" From d3b3048b0016e905296328a2847e1724e5dd2cc2 Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Thu, 12 Oct 2023 14:24:54 +0900 Subject: [PATCH 19/20] chore : added ctl in config.json --- pymysqlreplication/tests/config.json | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pymysqlreplication/tests/config.json b/pymysqlreplication/tests/config.json index a891cc6e..db18c31c 100644 --- a/pymysqlreplication/tests/config.json +++ b/pymysqlreplication/tests/config.json @@ -1,18 +1,27 @@ { - "mariadb-10": { + "mysql-8": { "host": "localhost", "user": "root", "passwd": "", - "port": 3308, + "port": 3306, "use_unicode": true, "charset": "utf8", "db": "pymysqlreplication_test" }, - "mysql-8": { + "mysql-8-ctl": { "host": "localhost", "user": "root", "passwd": "", - "port": 3306, + "port": 3307, + "use_unicode": true, + "charset": "utf8", + "db": "pymysqlreplication_test" + }, + "mariadb-10": { + "host": "localhost", + "user": "root", + "passwd": "", + "port": 3308, "use_unicode": true, "charset": "utf8", "db": "pymysqlreplication_test" From 8a78daa835af9a93ae1ac787fce2c71a1e8b4fe3 Mon Sep 17 00:00:00 2001 From: mirageoasis Date: Thu, 12 Oct 2023 14:40:59 +0900 Subject: [PATCH 20/20] chore : fixed order of services in docker-compse.yml --- docker-compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index be548897..3cb48a0a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,17 +21,17 @@ x-mariadb: &mariadb --binlog-format=row services: - percona-8.0-ctl: + percona-8.0: <<: *mysql image: percona:8.0 ports: - - "3307:3306" + - "3306:3306" - percona-8.0: + percona-8.0-ctl: <<: *mysql image: percona:8.0 ports: - - "3306:3306" + - "3307:3306" mariadb-10.6: <<: *mariadb