Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pymysqlreplication/binlogstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def __init__(self, connection_settings, server_id, resume_stream=False,
ignored_events=None, auto_position=None,
only_tables=None, only_schemas=None,
freeze_schema=False, skip_to_timestamp=None,
report_slave=None):
report_slave=None, slave_uuid=None):
"""
Attributes:
resume_stream: Start for event from position or the latest event of
Expand All @@ -144,6 +144,7 @@ def __init__(self, connection_settings, server_id, resume_stream=False,
freeze_schema: If true do not support ALTER TABLE. It's faster.
skip_to_timestamp: Ignore all events until reaching specified timestamp.
report_slave: Report slave in SHOW SLAVE HOSTS.
slave_uuid: Report slave_uuid in SHOW SLAVE HOSTS.
"""
self.__connection_settings = connection_settings
self.__connection_settings["charset"] = "utf8"
Expand Down Expand Up @@ -176,6 +177,7 @@ def __init__(self, connection_settings, server_id, resume_stream=False,

if report_slave:
self.report_slave = ReportSlave(report_slave)
self.slave_uuid = slave_uuid

def close(self):
if self.__connected_stream:
Expand Down Expand Up @@ -241,6 +243,11 @@ def __connect_to_stream(self):
cur.execute("set @master_binlog_checksum= @@global.binlog_checksum")
cur.close()

if self.slave_uuid:
cur = self._stream_connection.cursor()
cur.execute("set @slave_uuid= '%s'" % self.slave_uuid)
cur.close()

self._register_slave()

if not self.auto_position:
Expand Down