-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Improve resiliency of ETLv2 manage tables #807
Conversation
8813ad0
to
9914452
Compare
9914452
to
3b19005
Compare
// Normalize property values to lowercase to match MySQL behavior | ||
if ( in_array($property, array('time', 'event')) ) { | ||
$value = strtoupper($value); | ||
} elseif ( 'body' == $property && 0 !== stripos($value, "BEGIN") ) { |
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.
Quick question, is the 'body' == $property ...
portion of this elseif
needed? It looks like, based on the switch
statement above that it will always be 'body'
at this point.
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.
facepalm fall through w/ the other case
s. It won't always be body
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.
It could be table
, which is case sensitive.
Description
When comparing table definitions generated from ETL configuration files to those stored in the MySQL information_schema, MySQL normalizes several items such as column and index names to lowercase. In the case where these values were capitalized in the ETL configuration files, this would cause an endless and unnecessary loop of
ALTER TABLE
statements to be executed during each ETL execution.As per https://dev.mysql.com/doc/refman/5.5/en/identifier-case-sensitivity.html
To aid in identifying items that have changed, logging and error checking was improved. If a table element definition and the current state of the database was found to differ the exact reason in the configuration is logged:
NOTE: Since variables/macros can be used to create dynamic column names and column names are normalized to lowercase as stored in the MySQL information schema, it was necessary to make the variable names themselves case-insensitive (e.g., ${MYVAR} and ${myvar} are treated as the same variable). Note that since variable substitution occurs after the
DbModel
has been built, the value of those variables must also be lowercase to mitigate an needlessALTER TABLE
statements.Motivation and Context
Stop continual
ALTER TABLE
statements when they are not truly necessary.Tests performed
Added tests.
Types of changes
Checklist: