From 319db566ac7fef45c22f3df15ee5e194a7c43259 Mon Sep 17 00:00:00 2001 From: Laurent Goderre Date: Thu, 30 May 2024 16:18:01 -0400 Subject: [PATCH] Support running server with autocommit Forces initiation queries to run in autocommit then use the provided mode Fixed #816 --- 8.0/docker-entrypoint.sh | 6 +++++- 8.4/docker-entrypoint.sh | 6 +++++- docker-entrypoint.sh | 6 +++++- innovation/docker-entrypoint.sh | 6 +++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 8cb17c4b1..e635e0762 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/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; diff --git a/8.4/docker-entrypoint.sh b/8.4/docker-entrypoint.sh index 8cb17c4b1..e635e0762 100755 --- a/8.4/docker-entrypoint.sh +++ b/8.4/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; diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 8cb17c4b1..e635e0762 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; diff --git a/innovation/docker-entrypoint.sh b/innovation/docker-entrypoint.sh index 8cb17c4b1..e635e0762 100755 --- a/innovation/docker-entrypoint.sh +++ b/innovation/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;