-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Support running server with autocommit #1065
Conversation
After the fix
|
Doh, sorry, this one got lost -- I worry that this "leaks" to users since their scripts get run in this environment too, so I think I'd prefer if we change our one or two scripts to instead enable autocommit (since IIRC there's a trivial one-line way to do so for a single session). It might also be worth trying to make sure we minimize the number of queries we actually make, but maybe we've already done that. 🙈 |
@tianon sadly no you can't use that one liner in a session (or I didn't get it working after trying many ways). I tested the change and posted the result and it respected the flag that was passed. |
Wow, that's bizarre -- I've confirmed, every way I can find or think of to That's wild, and seems unintentional? Effectively this means it must be impossible to set autocommit to off by default, but turn it back on for a single session, which isn't a limitation that's documented anywhere I can find. 🤔 |
To clarify though, my concern is not that the final runtime environment is correct (that much is clear from your change), but that the intermediate environment in which the user-supplied initdb scripts get invoked is also disabling autocommit by default (because I think that's part of the "user intent" expressed by passing this flag by default globally). |
Now I'm questioning my testing methodology entirely though, because even deleting the |
@tianon glad it's not just me! I spent a while trying to get it work that way |
Hahahahahahahahahahaha: mysql/mysql-server@7dbf4f8 / https://bugs.mysql.com/bug.php?id=110535 Turns out this was a bug in |
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 8cb17c4..e635e07 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -214,7 +214,8 @@ docker_create_db_directories() {
# initializes the database directory
docker_init_database_dir() {
mysql_note "Initializing database files"
- "$@" --initialize-insecure --default-time-zone=SYSTEM
+ "$@" --initialize-insecure --default-time-zone=SYSTEM --autocommit=1
+ # explicitly enable autocommit to combat https://bugs.mysql.com/bug.php?id=110535 (TODO remove this when 8.0 is EOL; see https://github.com/mysql/mysql-server/commit/7dbf4f80ed15f3c925cfb2b834142f23a2de719a)
mysql_note "Database files initialized"
}
@@ -292,6 +293,9 @@ docker_setup_db() {
# tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is just now being set
docker_process_sql --dont-use-mysql-root-password --database=mysql <<-EOSQL
+ -- enable autocommit explicitly (in case it was disabled globally)
+ SET autocommit = 1;
+
-- What's done in this file shouldn't be replicated
-- or products like mysql-fabric won't work
SET @@SESSION.SQL_LOG_BIN=0; |
Forces initiation queries to run in autocommit then use the provided mode Fixed docker-library#816
Done! |
Changes: - docker-library/mysql@1a70331: Merge pull request docker-library/mysql#1065 from LaurentGoderre/fix-816 - docker-library/mysql@319db56: Support running server with autocommit
I thought we might've missed the other Lines 266 to 269 in 1a70331
Lines 311 to 324 in 1a70331
|
Forces initiation queries to run in autocommit then use the provided mode
Fixed #816