julien-duponchelle / julien-duponchelle/python-mysql-replication
AssertionError: Result length not requested length:
- Dominant language
- Python
- Stars
- 2.4k
- Forks
- 690
- PR merge metrics
- No merged PRs in 30d
Description
We are using pg_chameleon for replicating data from MySQL to PostgreSQL and pg_chameleon is using python-MySQL-replication internally. We are getting below error during replication. Is there any way to resolve it.
```
2018-09-13 15:12:49 MainProcess ERROR global_lib.py (558): Read process alive: False - Replay process alive: True [10/1912]
2018-09-13 15:12:49 MainProcess ERROR global_lib.py (559): Stack trace: Traceback (most recent call last):
File "/home/rahilr/venv/lib64/python3.6/site-packages/pg_chameleon/lib/global_lib.py", line 487, in read_replica
self.mysql_source.read_replica()
File "/home/rahilr/venv/lib64/python3.6/site-packages/pg_chameleon/lib/mysql_lib.py", line 1336, in read_replica
replica_data=self.__read_replica_stream(batch_data)
File "/home/rahilr/venv/lib64/python3.6/site-packages/pg_chameleon/lib/mysql_lib.py", line 1199, in __read_replica_stream
for row in binlogevent.rows:
File "/home/rahilr/venv/lib64/python3.6/site-packages/pymysqlreplication/row_event.py", line 443, in rows
self._fetch_rows()
File "/home/rahilr/venv/lib64/python3.6/site-packages/pymysqlreplication/row_event.py", line 438, in _fetch_rows
self.__rows.append(self._fetch_one_row())
File "/home/rahilr/venv/lib64/python3.6/site-packages/pymysqlreplication/row_event.py", line 529, in _fetch_one_row
row["after_values"] = self._read_column_data(self.columns_present_bitmap2)
File "/home/rahilr/venv/lib64/python3.6/site-packages/pymysqlreplication/row_event.py", line 138, in _read_column_data
values[name] = self.__read_string(1, column)
File "/home/rahilr/venv/lib64/python3.6/site-packages/pymysqlreplication/row_event.py", line 232, in __read_string
string = self.packet.read_length_coded_pascal_string(size)
File "/home/rahilr/venv/lib64/python3.6/site-packages/pymysqlreplication/packet.py", line 253, in read_length_coded_pascal_string
return self.read(length)
File "/home/rahilr/venv/lib64/python3.6/site-packages/pymysqlreplication/packet.py", line 153, in read
return self.packet.read(size)
File "/home/rahilr/venv/lib64/python3.6/site-packages/pymysql/protocol.py", line 78, in read
raise AssertionError(error)
AssertionError: Result length not requested length:
Expected=99. Actual=51. Position: 100. Data Length: 151
```
Contributor guide
Research direction
Start with pymysqlreplication/row_event.py and follow the traceback through __read_string and _read_column_data into pymysqlreplication/packet.py. Reproduce the replication failure with the reported length values, determine why the packet contains fewer bytes than requested, and verify that the affected binlog row can be read without the assertion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100