File tree 3 files changed +28
-2
lines changed 3 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -15,3 +15,11 @@ services:
15
15
ports :
16
16
- 3307:3307
17
17
command : mysqld --log-bin=mysql-bin.log --server-id 1 --binlog-format=row --gtid_mode=on --enforce-gtid-consistency=on --log_slave_updates -P 3307
18
+
19
+ percona-5.7-binlog-rows-query-events :
20
+ image : percona:5.7
21
+ environment :
22
+ MYSQL_ALLOW_EMPTY_PASSWORD : true
23
+ ports :
24
+ - 3308:3308
25
+ command : mysqld --log-bin=mysql-bin.log --server-id 1 --binlog-format=row --binlog-rows-query-log-events=on --gtid_mode=on --enforce-gtid-consistency=on --log_slave_updates -P 3308
Original file line number Diff line number Diff line change @@ -18,15 +18,15 @@ class PyMySQLReplicationTestCase(base):
18
18
def ignoredEvents (self ):
19
19
return []
20
20
21
- def setUp (self ):
21
+ def setUp (self , port = 3306 ):
22
22
23
23
db = os .environ .get ('DB' )
24
24
# default
25
25
self .database = {
26
26
"host" : "localhost" ,
27
27
"user" : "root" ,
28
28
"passwd" : "" ,
29
- "port" : 3306 ,
29
+ "port" : port ,
30
30
"use_unicode" : True ,
31
31
"charset" : "utf8" ,
32
32
"db" : "pymysqlreplication_test"
Original file line number Diff line number Diff line change @@ -1003,6 +1003,24 @@ def test_parsing(self):
1003
1003
gtid = Gtid ("57b70f4e-20d3-11e5-a393-4a63946f7eac::1" )
1004
1004
1005
1005
1006
+ class TestRowsQueryLogEvents (base .PyMySQLReplicationTestCase ):
1007
+ def setUp (self ):
1008
+ super (TestRowsQueryLogEvents , self ).setUp (port = 3308 )
1009
+
1010
+ def test_rows_query_log_event (self ):
1011
+ self .stream .close ()
1012
+ self .stream = BinLogStreamReader (
1013
+ self .database ,
1014
+ server_id = 1024 ,
1015
+ only_events = [RowsQueryLogEvent ],
1016
+ )
1017
+ self .execute ("CREATE TABLE IF NOT EXISTS test (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255))" )
1018
+ self .execute ("INSERT INTO test (name) VALUES ('Soul Lee')" )
1019
+ self .execute ("COMMIT" )
1020
+ event = self .stream .fetchone ()
1021
+ self .assertIsInstance (event , RowsQueryLogEvent )
1022
+
1023
+
1006
1024
if __name__ == "__main__" :
1007
1025
import unittest
1008
1026
unittest .main ()
You can’t perform that action at this time.
0 commit comments