-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Inconsistent MySQL settings in preview environments and staging/production #4169
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
Comments
Many thanks @mads-hartmann for the co-op on debugging this! Another symptom / way to reproduce this problem is to try the
Here is my current understanding of the differences between
|
Nice find @mads-hartmann ! It definitely makes sense to:
|
As I bumped into this today I tried to fix it. The journey:
|
Bug description
The MySQL
explicit_defaults_for_timestamp
system variable (docs) is enabled in our preview environments but not staging (and probably not in production, haven't checked)Having this variable enabled will cause things to break if we ever try to do an insert or update statement where we explicitly insert a NULL value. If the setting is disabled it will use the DEFAULT value of the column even if you insert NULL.
This currently breaks inserts from typescript into the d_b_prebuilt_workspace table as we use the
MAP_ISO_STRING_TO_TIMESTAMP_DROP
transformer which returns undefined no matter the value, and it appears this gets translated to an insert/update statement with an explicit NULL.To fix this we should make sure we have the same setting for
explicit_defaults_for_timestamp
in all environments.This is related to #4122
Steps to reproduce
You can check the current value of the setting by connecting to MySQL and run the following query:
This returns 1, but in staging it returns 0.
Some of our DB tests current fail in the preview environments because of this. If you start a preview environment off main and run the following commands you should get failing tests.
kubectl port-forward statefulset/mysql 23306:3306
cd components/gitpod-db
andyarn db-test
Expected behavior
No response
Example repository
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: