redmine
redmine copied to clipboard
Set transaction isolation level in config/database.yml
If you use MySQL and MariaDB with Redmine 5.1.1 or later, you need to set the transaction isolation level in config/database.yml.
For MySQL version 5.7.20 or older and MariaDB, the setting is tx_isolation instead of transaction_isolation.
https://www.redmine.org/projects/redmine/wiki/MySQL_configuration
So, It might be a good idea to edit docker-entrypoint.sh so that the transaction isolation level can be set in /config/database.yml.
The following is a temporary improvement in my environment. Since I am using MariaDB, only "tx_isolation" is considered, but it should be possible to switch to "transaction_isolation".
diff --git a/5.1/bookworm/docker-entrypoint.sh b/5.1/bookworm/docker-entrypoint.sh
index ff3f94b..3390268 100755
--- a/5.1/bookworm/docker-entrypoint.sh
+++ b/5.1/bookworm/docker-entrypoint.sh
@@ -75,6 +75,7 @@ if [ -n "$isLikelyRedmine" ]; then
file_env 'REDMINE_DB_PASSWORD' "${MYSQL_ENV_MYSQL_PASSWORD:-${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}"
file_env 'REDMINE_DB_DATABASE' "${MYSQL_ENV_MYSQL_DATABASE:-${MYSQL_ENV_MYSQL_USER:-redmine}}"
file_env 'REDMINE_DB_ENCODING' ''
+ file_env 'REDMINE_DB_TX_ISOLATION' 'READ-COMMITTED'
elif [ "$REDMINE_DB_POSTGRES" ]; then
adapter='postgresql'
host="$REDMINE_DB_POSTGRES"
@@ -129,6 +130,10 @@ if [ -n "$isLikelyRedmine" ]; then
[ -n "$val" ] || continue
echo " $var: \"$val\"" >> config/database.yml
done
+ if [ "$REDMINE_DB_TX_ISOLATION" ]; then
+ echo " variables:" >> config/database.yml
+ echo " tx_isolation: \"$REDMINE_DB_TX_ISOLATION\"" >> config/database.yml
+ fi
fi
# install additional gems for Gemfile.local and plugins
I agree that correct setting of transaction isolation should be presented out of the box and asked earlier. See more in the #303 and related comment.
Thanks for your advice.
I am building my own environment on AWS and using RDS.
I don't configure the DB in docker-compose.yml, so it would be easier if I could configure it in the redmine container.
If this issue is not supported, I would like to change my RDS configuration or continue with my current solution.