Skip to content

Commit 6e1c851

Browse files
authored
Added support for mysql 8.4 and higher (#74)
1 parent 84a6920 commit 6e1c851

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

docker-compose-tests.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ services:
1919
- ./tests_override.xml:/bitnami/clickhouse/etc/conf.d/override.xml:ro
2020

2121
mysql_db:
22-
image: mysql/mysql-server:8.0.32
22+
image: mysql:8.4.3
2323
environment:
24-
- MYSQL_DATABASE=admin
25-
- MYSQL_ROOT_HOST=%
26-
- MYSQL_ROOT_PASSWORD=admin
27-
networks:
28-
default:
24+
MYSQL_DATABASE: admin
25+
MYSQL_ROOT_HOST: "%"
26+
MYSQL_ROOT_PASSWORD: admin
2927
ports:
30-
- 9306:3306
28+
- "9306:3306"
3129
volumes:
32-
- ./test_mysql.cnf:/etc/my.cnf:ro
30+
- ./test_mysql.cnf:/etc/mysql/my.cnf:ro
31+
networks:
32+
- default
3333

3434
mariadb_db:
3535
image: mariadb:11.5.2

mysql_ch_replicator/pymysqlreplication/binlogstream.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,11 @@ def __connect_to_stream(self):
397397
# valid, if not, get the current position from master
398398
if self.log_file is None or self.log_pos is None:
399399
cur = self._stream_connection.cursor()
400-
cur.execute("SHOW MASTER STATUS")
400+
try:
401+
cur.execute("SHOW MASTER STATUS")
402+
except:
403+
cur = self._stream_connection.cursor()
404+
cur.execute("SHOW BINARY LOG STATUS")
401405
master_status = cur.fetchone()
402406
if master_status is None:
403407
raise BinLogNotEnabled()

mysql_ch_replicator/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def restart_dead_processes(self):
100100
def restart_replication_if_required(self):
101101
if not self.need_restart_replication:
102102
return
103-
logger.info('\n\n\n ====== restarting replication =====')
103+
logger.info('restarting replication')
104104
for db_name, runner in self.runners.items():
105105
logger.info(f'stopping runner {db_name}')
106106
runner.stop()

test_mysql.cnf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ user = mysql
1515
# Custom settings
1616
collation-server = utf8mb4_0900_ai_ci
1717
character-set-server = utf8mb4
18-
default_authentication_plugin = mysql_native_password
18+
#default_authentication_plugin = mysql_native_password
1919
init-connect = 'SET NAMES utf8mb4'
20-
skip-host-cache
20+
#skip-host-cache
2121
skip-name-resolve
2222
information_schema_stats_expiry = 0
2323

@@ -27,3 +27,4 @@ enforce_gtid_consistency = 1
2727
binlog_expire_logs_seconds = 864000
2828
max_binlog_size = 500M
2929
binlog_format = ROW #Very important if you want to receive write, update and delete row events
30+
log-bin = mysql-bin

0 commit comments

Comments
 (0)