mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-02 02:34:19 +00:00
Fix for 823431: pt-query-advisor hangs on big queries
This was caused by a regex backtracking itself to a halt. The solution was to add a positive lookahead that searches for the floating but mandatory substrings that the regex needs; if those exist, then eventually it will match, but if they don't, it'll fail quickly.
This commit is contained in:
@@ -371,6 +371,7 @@ sub parse_insert {
|
||||
|
||||
# Parse INTO clause. Literal "INTO" is optional.
|
||||
if ( my @into = ($query =~ m/
|
||||
(?=VALUE|SE(?:T|LECT)) # Avoid a backtracking explosion
|
||||
(?:INTO\s+)? # INTO, optional
|
||||
(.+?)\s+ # table ref
|
||||
(\([^\)]+\)\s+)? # column list, optional
|
||||
|
Reference in New Issue
Block a user