-
Notifications
You must be signed in to change notification settings - Fork 117
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
fixed Cannot read property 'COLUMN_NAME' of undefined #21
Conversation
@DoubleSpout Thanks for your feedback. I can reproduce the bug too. But I cannot make it working even with your Fix, let me figure it out later ... |
@@ -182,8 +191,13 @@ ZongJi.prototype.start = function(options) { | |||
self.connection.pause(); | |||
self._fetchTableInfo(event, function() { | |||
// merge the column info with metadata | |||
event.updateColumnInfo(); | |||
self.emit('binlog', event); | |||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have a big Try ... catch block somewhere, to catch all the errors during parsing, not necessary here. Yeah, I'd like to have Try ... catch as few as possible. (even though, I'm not a Java Hater 😉 )
Not performing this operation causes invalid data structures that still crash Zongji later on. We need to figure out why the length of an array is zero, when we expect a non-zero length. It seems like we're parsing a tablemap wrong. If we bail from parsing it, we get the event following the tablemap and crash anyway. @nevill Is that what you think is going on as well? |
@nevill The SQL query in fetchTableInfo sometimes returns 0 rows which is the cause of this error. When I run the query by hand, it returns the expected number of rows. The query is a bit different in my fork since I added additional metadata. My query is also having the same issue. SELECT c.COLUMN_NAME, COLLATION_NAME, CHARACTER_SET_NAME, COLUMN_COMMENT, COLUMN_TYPE, IS_NULLABLE, t.CONSTRAINT_TYPE, k.ORDINAL_POSITION, k.CONSTRAINT_NAME FROM information_schema.columns c LEFT JOIN information_schema.KEY_COLUMN_USAGE k ON k.TABLE_NAME = c.TABLE_NAME AND k.TABLE_SCHEMA = c.TABLE_SCHEMA AND k.COLUMN_NAME = c.COLUMN_NAME LEFT JOIN information_schema.TABLE_CONSTRAINTS t ON t.TABLE_NAME = c.TABLE_NAME AND t.CONSTRAINT_SCHEMA = c.TABLE_SCHEMA AND t.CONSTRAINT_NAME = k.CONSTRAINT_NAME WHERE c.TABLE_SCHEMA = "<<schema>>" AND c.TABLE_NAME = "<<table>>" |
In this.ctrlConnection.query(sql, function(err, rows) {
if (err) {
// Errors should be emitted
self.emit('error', err);
return;
} We might as well throw/die here because if we don't call |
From the MySQL manual: |
I had the same issue using Mysql-Events package: Someone solved? |
Has there been a resolution yet? |
Hi All, to fix the problem for mysql 5.7 i added " order by c.ORDINAL_POSITION" to tableInfoQueryTemplate in index.js. |
Closing it because many things changed. |
@nevill: Awesome, I haven't been keeping up to date with the project. I'm sure my 12/17/15 comment has to do with the root cause, which technically isn't a bug in the software but an environmental issue. It might be worth adding a special error message or tips in the documentation. |
It seems that mysql lib is return a wrong |
Sorry for asking on a closed 4 year old thread. But this problem is occuring for me as well, seems like parseLengthCodedNumber -> Has the wrong length. The reason for it seems to be when i have a unique constraint in db. When i remove it, it works.... |
fix for another cause of: nevill#21 includes: : changes made to _fetchTableInfo method of ZongJi allowing fetch of both columns and hash indexes of table : added template for index query : added 2 functions fetching table info for readability
bug review: because i have modify the table name
fixed the bug~
I want to start from specify binlogfile and specify postion, so I have modified the
startAtEnd
Parameter, use it like this:if
startAtEnd
assignmentboolean
, it works as well as before.finally, thanks for your zongji module, I like it !