Skip to content

Commit 558444e

Browse files
'slave_uuid' was deprecated from MySQL 8.0.22 (julien-duponchelle#429)
Since the SHOW SLAVE HOSTS statement was deprecated from MySQL 8.0.22[1], the MySQL variable slave_uuid is also be deprecated. To ensure version compatibility, both the replica_uuid and slave_uuid variables will be set to the MySQL Server. This approach aligns with what was done in go-mysql[2]. Co-authored-by: davinc71998 <[email protected]>
1 parent db86df4 commit 558444e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: pymysqlreplication/binlogstream.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ def __init__(self, connection_settings, server_id,
168168
skip_to_timestamp: Ignore all events until reaching specified
169169
timestamp.
170170
report_slave: Report slave in SHOW SLAVE HOSTS.
171-
slave_uuid: Report slave_uuid in SHOW SLAVE HOSTS.
171+
slave_uuid: Report slave_uuid or replica_uuid in SHOW SLAVE HOSTS(MySQL 8.0.21-) or
172+
SHOW REPLICAS(MySQL 8.0.22+) depends on your MySQL version.
172173
fail_on_table_metadata_unavailable: Should raise exception if we
173174
can't get table information on
174175
row_events
@@ -306,7 +307,7 @@ def __connect_to_stream(self):
306307

307308
if self.slave_uuid:
308309
cur = self._stream_connection.cursor()
309-
cur.execute("set @slave_uuid= '%s'" % self.slave_uuid)
310+
cur.execute("SET @slave_uuid = %s, @replica_uuid = %s", (self.slave_uuid, self.slave_uuid))
310311
cur.close()
311312

312313
if self.slave_heartbeat:

0 commit comments

Comments
 (0)