Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle changes in tablemap ids #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

YousefED
Copy link

It is possible that a tableMap event is passed from the MySQL protocol, that changes the id of a table. e.g.:

Current tablemap:
112: tableA
113: tableB

It's possible to get a tableMap event "113: tableA". Currently zongji doesn't handle this, because it sees we already have "113". With my proposed change, we check for changes in tableName or number of columns.

To fix the root cause, I'm wondering why we need to do a _fetchTableInfo anyway. What information do we retrieve in _fetchTableInfo that's not already included in the tableMap message?

If we don't need to do the _fetchTableInfo, we don't need to pause the connection, and we can just always use the latest tableMap event, as recommended by the replication protocol. Let me know if you have more info about this

@nevill
Copy link
Owner

nevill commented Nov 28, 2019

Good point. The reason is simple, I didn't know how Table_Map_Event is working at the time the code was born. It was simple to retrieve the table meta info by direct querying rather than parsing the packet.

@YousefED
Copy link
Author

YousefED commented Dec 1, 2019

Thanks. I'm not an expert on the MySQL binlog protocol, but it seems like the charset information is not available there; correct? That might be the (unfortunate) reason this query is necessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants