@@ -89,6 +89,45 @@ def _dump(self):
89
89
def __repr__ (self ):
90
90
return '<GtidEvent "%s">' % self .gtid
91
91
92
+ class MariadbGtidListEvent (BinLogEvent ):
93
+ """
94
+ GTID List event
95
+ https://mariadb.com/kb/en/gtid_list_event/
96
+
97
+ Attributes:
98
+ gtid_length: Number of GTIDs
99
+ gtid_list: list of 'MariadbGtidObejct'
100
+
101
+ 'MariadbGtidObejct' Attributes:
102
+ domain_id: Replication Domain ID
103
+ server_id: Server_ID
104
+ gtid_seq_no: GTID sequence
105
+ gtid: 'domain_id'+ 'server_id' + 'gtid_seq_no'
106
+ """
107
+ def __init__ (self , from_packet , event_size , table_map , ctl_connection , ** kwargs ):
108
+
109
+ super (MariadbGtidListEvent , self ).__init__ (from_packet , event_size , table_map , ctl_connection , ** kwargs )
110
+
111
+ class MariadbGtidObejct (BinLogEvent ):
112
+ """
113
+ Information class of elements in GTID list
114
+ """
115
+ def __init__ (self , from_packet , event_size , table_map , ctl_connection , ** kwargs ):
116
+ super (MariadbGtidObejct , self ).__init__ (from_packet , event_size , table_map , ctl_connection , ** kwargs )
117
+ self .domain_id = self .packet .read_uint32 ()
118
+ self .server_id = self .packet .server_id
119
+ self .gtid_seq_no = self .packet .read_uint64 ()
120
+ self .gtid = "%d-%d-%d" % (self .domain_id , self .server_id , self .gtid_seq_no )
121
+
122
+
123
+ self .gtid_length = self .packet .read_uint32 ()
124
+ self .gtid_list = [MariadbGtidObejct (from_packet , event_size , table_map , ctl_connection , ** kwargs ) for i in range (self .gtid_length )]
125
+
126
+
127
+ def _dump (self ):
128
+ super (MariadbGtidListEvent , self )._dump ()
129
+ print ("GTID length:" ,self .gtid_length )
130
+ print ("GTID list: " + "," .join (list (map (lambda x : x .gtid ,self .gtid_list ))))
92
131
93
132
class MariadbGtidEvent (BinLogEvent ):
94
133
"""
0 commit comments