-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
fix(migration): Ensure key_value LargeBinary is encoded as a MEDIUMBLOB as opposed to BLOB for MySQL #20385
fix(migration): Ensure key_value LargeBinary is encoded as a MEDIUMBLOB as opposed to BLOB for MySQL #20385
Conversation
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
"""empty message |
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.
please describe the revision
@@ -0,0 +1,50 @@ | |||
# Licensed to the Apache Software Foundation (ASF) under one |
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.
Please name the migration file descriptively
Codecov Report
@@ Coverage Diff @@
## master #20385 +/- ##
=======================================
Coverage 66.68% 66.68%
=======================================
Files 1739 1739
Lines 65143 65143
Branches 6902 6902
=======================================
Hits 43443 43443
Misses 19947 19947
Partials 1753 1753
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
…OB as opposed to BLOB for MySQL
2aad4ec
to
89b890a
Compare
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, thanks for making this fix in opensource!
Highlighting this comment since it obviously got lost in the original PR. |
🤦 well we ran into it at least. I think it's probably best practice to not modify a merged migration unless there's a bug with it that can't be resolved in a future migration. And even then, maybe it's better to have another migration that undoes the bad one and then performs the same thing with the bug fix |
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.
Well this went totally sideways 6766938c6065
. Also, it's good to know for similar future issues that the migration apparently succeeds even if the existing_type
isn't accurate (when running migrations from scratch on the current codebase it'll be performing the migration on a column with length=2**31
).
"value", | ||
existing_nullable=False, | ||
existing_type=sa.LargeBinary(), | ||
type_=sa.LargeBinary(length=2**24 - 1), |
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.
To keep this in line with #19805, should we make it length=2**31
?
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.
@john-bodley @villebro Merging this to include it in v2.0. We can add more changes in a follow-up if necessary 😉 |
SUMMARY
At Airbnb we use MySQL for Superset's metadata database where the SQLAlchemy LargeBinary type—which is used for the
key_value.value
column—is encoded as aBLOB
which can handle up to 64 KiB of data. This isn't sufficient for storing large form-data blobs and thus this PR adds a migration which encodes the column as aMEDIUMBLOB
which can handle up to 16 MiB of data.The solution uses the suggestion here, note 16 MiB is equivalent to 2^24 - 1 bytes.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION