Browse files

Partial fix for dropped columns blowing up replication when replaying…

… binlog with past events

Mitigates following errror:
  File "/usr/local/lib/python2.7/dist-packages/pymysqlreplication/", line 262, in fetchone
  File "/usr/local/lib/python2.7/dist-packages/pymysqlreplication/", line 98, in __init__
    freeze_schema = freeze_schema)
  File "/usr/local/lib/python2.7/dist-packages/pymysqlreplication/", line 550, in __init__
    column_schema = self.column_schemas[i]
IndexError: list index out of range

This is just a superficial patch. It does not address deeper issue at hand, which is that pymysqlreplication
has no good way of handling RowEvents containing columns which have been dropped prior to pymsqlreplication
start. The problem is always relying on current version of information_schema even though dealing with events
that might be several versions in the past.
  • Loading branch information...
vartec committed Jun 17, 2015
1 parent 647ccee commit 4c48538168f4cd3239563393a29b542cc6ffcf4b
Showing with 14 additions and 1 deletion.
  1. +14 −1 pymysqlreplication/
@@ -547,7 +547,20 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
for i in range(0, len(column_types)):
column_type = column_types[i]
column_schema = self.column_schemas[i]
column_schema = self.column_schemas[i]
except IndexError:
# this a dirty hack to prevent row evens containing columns which have been dropped prior
# to pymysqlreplication start, but replayed from binlog from blowing up the service.
# TODO: this does not address the issue if the column other than the last one is dropped
column_schema = {
'COLUMN_NAME': '__dropped_col_{i}__'.format(i=i),
'COLUMN_TYPE': 'BLOB', # we don't know what it is, so let's not do anything with it.
col = Column(byte2int(column_type), column_schema, from_packet)

0 comments on commit 4c48538

Please sign in to comment.