Skip to content

Commit e475a18

Browse files
author
Lior Sion
committed
change names of events to V2 from default
according to this post http://dev.mysql.com/doc/internals/en/row-based-replication.html#rows-event events are marked as version 0,1,2 (current) - the code had _V1 and no version at all - I think it would b easier and morefuture compatible to use V2 since it seems V3 is unavoidable.
1 parent 0fe6a6d commit e475a18

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

pymysqlreplication/constants/BINLOG.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
HEARTBEAT_LOG_EVENT = 0x1b
2929
IGNORABLE_LOG_EVENT= 0x1c
3030
ROWS_QUERY_LOG_EVENT= 0x1d
31-
WRITE_ROWS_EVENT = 0x1e
32-
UPDATE_ROWS_EVENT = 0x1f
33-
DELETE_ROWS_EVENT = 0x20
31+
WRITE_ROWS_EVENT_V2 = 0x1e
32+
UPDATE_ROWS_EVENT_V2 = 0x1f
33+
DELETE_ROWS_EVENT_V2 = 0x20
3434
GTID_LOG_EVENT= 0x21
3535
ANONYMOUS_GTID_LOG_EVENT= 0x22
3636
PREVIOUS_GTIDS_LOG_EVENT= 0x23

pymysqlreplication/packet.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ class BinLogPacketWrapper(object):
2828
UPDATE_ROWS_EVENT_V1: UpdateRowsEvent,
2929
WRITE_ROWS_EVENT_V1: WriteRowsEvent,
3030
DELETE_ROWS_EVENT_V1: DeleteRowsEvent,
31-
UPDATE_ROWS_EVENT: UpdateRowsEvent,
32-
WRITE_ROWS_EVENT: WriteRowsEvent,
33-
DELETE_ROWS_EVENT: DeleteRowsEvent,
31+
UPDATE_ROWS_EVENT_V2: UpdateRowsEvent,
32+
WRITE_ROWS_EVENT_V2: WriteRowsEvent,
33+
DELETE_ROWS_EVENT_V2: DeleteRowsEvent,
3434
TABLE_MAP_EVENT: TableMapEvent,
3535
ROTATE_EVENT: RotateEvent,
3636
FORMAT_DESCRIPTION_EVENT: FormatDescriptionEvent,

pymysqlreplication/row_event.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection):
1818
self.flags = struct.unpack('<H', self.packet.read(2))[0]
1919

2020
#Event V2
21-
if self.event_type == BINLOG.WRITE_ROWS_EVENT or \
22-
self.event_type == BINLOG.DELETE_ROWS_EVENT or \
23-
self.event_type == BINLOG.UPDATE_ROWS_EVENT:
21+
if self.event_type == BINLOG.WRITE_ROWS_EVENT_V2 or \
22+
self.event_type == BINLOG.DELETE_ROWS_EVENT_V2 or \
23+
self.event_type == BINLOG.UPDATE_ROWS_EVENT_V2:
2424
self.extra_data_length = struct.unpack('<H', self.packet.read(2))[0]
2525
self.extra_data = self.packet.read(self.extra_data_length / 8)
2626

pymysqlreplication/tests/test_basic.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_write_row_event(self):
9292

9393
event = self.stream.fetchone()
9494
if self.isMySQL56AndMore():
95-
self.assertEqual(event.event_type, WRITE_ROWS_EVENT)
95+
self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V2)
9696
else:
9797
self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V1)
9898
self.assertIsInstance(event, WriteRowsEvent)
@@ -127,7 +127,7 @@ def test_delete_row_event(self):
127127

128128
event = self.stream.fetchone()
129129
if self.isMySQL56AndMore():
130-
self.assertEqual(event.event_type, DELETE_ROWS_EVENT)
130+
self.assertEqual(event.event_type, DELETE_ROWS_EVENT_V2)
131131
else:
132132
self.assertEqual(event.event_type, DELETE_ROWS_EVENT_V1)
133133
self.assertIsInstance(event, DeleteRowsEvent)
@@ -159,7 +159,7 @@ def test_update_row_event(self):
159159

160160
event = self.stream.fetchone()
161161
if self.isMySQL56AndMore():
162-
self.assertEqual(event.event_type, UPDATE_ROWS_EVENT)
162+
self.assertEqual(event.event_type, UPDATE_ROWS_EVENT_V2)
163163
else:
164164
self.assertEqual(event.event_type, UPDATE_ROWS_EVENT_V1)
165165
self.assertIsInstance(event, UpdateRowsEvent)
@@ -192,7 +192,7 @@ def test_insert_multiple_row_event(self):
192192

193193
event = self.stream.fetchone()
194194
if self.isMySQL56AndMore():
195-
self.assertEqual(event.event_type, WRITE_ROWS_EVENT)
195+
self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V2)
196196
else:
197197
self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V1)
198198
self.assertIsInstance(event, WriteRowsEvent)
@@ -230,7 +230,7 @@ def test_update_multiple_row_event(self):
230230

231231
event = self.stream.fetchone()
232232
if self.isMySQL56AndMore():
233-
self.assertEqual(event.event_type, UPDATE_ROWS_EVENT)
233+
self.assertEqual(event.event_type, UPDATE_ROWS_EVENT_V2)
234234
else:
235235
self.assertEqual(event.event_type, UPDATE_ROWS_EVENT_V1)
236236
self.assertIsInstance(event, UpdateRowsEvent)
@@ -272,7 +272,7 @@ def test_delete_multiple_row_event(self):
272272

273273
event = self.stream.fetchone()
274274
if self.isMySQL56AndMore():
275-
self.assertEqual(event.event_type, DELETE_ROWS_EVENT)
275+
self.assertEqual(event.event_type, DELETE_ROWS_EVENT_V2)
276276
else:
277277
self.assertEqual(event.event_type, DELETE_ROWS_EVENT_V1)
278278
self.assertIsInstance(event, DeleteRowsEvent)

pymysqlreplication/tests/test_data_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def create_and_insert_value(self, create_query, insert_query):
3232

3333
event = self.stream.fetchone()
3434
if self.isMySQL56AndMore():
35-
self.assertEqual(event.event_type, WRITE_ROWS_EVENT)
35+
self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V2)
3636
else:
3737
self.assertEqual(event.event_type, WRITE_ROWS_EVENT_V1)
3838
self.assertIsInstance(event, WriteRowsEvent)

0 commit comments

Comments
 (0)