-
Notifications
You must be signed in to change notification settings - Fork 62
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
Adding regex check for handling failure in parsing dump files with specific syntax #279
Adding regex check for handling failure in parsing dump files with specific syntax #279
Conversation
@@ -110,6 +114,10 @@ func readAndParseChunk(conv *internal.Conv, r *internal.Reader) ([]byte, []ast.S | |||
n += copy(s[n:], l[i]) | |||
} | |||
chunk := string(s) | |||
matchStatus := regexExp.Match([]byte(chunk)) | |||
if matchStatus { |
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.
log that this is being skipped
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.
added log
@@ -94,6 +94,10 @@ func processMySQLDump(conv *internal.Conv, r *internal.Reader) error { | |||
// files containing tens or hundreds of GB of data. | |||
func readAndParseChunk(conv *internal.Conv, r *internal.Reader) ([]byte, []ast.StmtNode, error) { | |||
var l [][]byte | |||
|
|||
// Regex for ignoring strings of the form /*!50717 SELECT COUNT(*) INTO @rocksdb_has_p_s_session_variables FROM INFORMATION_SCHEMA.TABLES */; | |||
// These system generated SQL statements are currently not supported by parser and return error. |
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.
add reference to the bug in the comment
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.
added bug reference
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.
this check will slow down the parsing, but let's make optimizing the parsing an independent activity
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.
LGTM
This regex check filters out the system generated code of the format :
/!50717 SELECT COUNT() INTO @rocksdb_has_p_s_session_variables FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'performance_schema' AND TABLE_NAME = 'session_variables' */;
Such code format fails in parsing, we have added this regex as a workaround and will remove once pingcap provides a permanent fix for this : pingcap/parser#1370