python-mysql-replication icon indicating copy to clipboard operation
python-mysql-replication copied to clipboard

max_allowed_packet issue when using ## for binlogEvent in stream

Open BlackWatchuser opened this issue 6 years ago • 1 comments

error message like below:

log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master

the stack is:

  for binlog_event in stream:
  File "/usr/lib/python2.7/dist-packages/pymysqlreplication/binlogstream.py", line 408, in fetchone
    pkt = self._stream_connection._read_packet()
  File "/usr/local/lib/python2.7/site-packages/PyMySQL-0.7.11-py2.7.egg/pymysql/connections.py", line 1014, in _read_packet
    packet.check_error()
  File "/usr/local/lib/python2.7/site-packages/PyMySQL-0.7.11-py2.7.egg/pymysql/connections.py", line 393, in check_error
    err.raise_mysql_exception(self._data)
  File "/usr/local/lib/python2.7/site-packages/PyMySQL-0.7.11-py2.7.egg/pymysql/err.py", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
InternalError: (1236, u"log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master;

I checked master's max_allowed_packet setting, and i found it was setting to 1GB, so i adding the setting on my code, here's the detail:

conn_setting = {'host': HOST, 'port': 3306, 'user': USER, 'passwd': PASSWORD, 'charset': 'utf8', 'max_allowed_packet':1*1024*1024*1024}
        binlog2sql = Binlog2sql(connection_settings=conn_setting, start_file=FILE, start_pos=POS,
                                end_file="", end_pos="", start_time="",
                                stop_time="", only_schemas="", only_tables="",
                                no_pk=False, flashback=False, stop_never=False,
                                back_interval=1.0, only_dml=False, sql_type=['INSERT', 'UPDATE', 'DELETE'])

but it seems like having no effect. please check this out.

BlackWatchuser avatar Aug 28 '19 12:08 BlackWatchuser

@BlackWatchuser Could you please provide a scenario to reproduce this exception?

dongwook-chan avatar Mar 09 '22 13:03 dongwook-chan