Skip to content
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

[bitnami/postgresql] Introduces environment variable POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION to change the global default transaction isolation level #47819

Merged
merged 2 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ postgresql_env_vars=(
POSTGRESQL_WAL_LEVEL
POSTGRESQL_DEFAULT_TOAST_COMPRESSION
POSTGRESQL_PASSWORD_ENCRYPTION
POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION
POSTGRESQL_AUTOCTL_CONF_DIR
POSTGRESQL_AUTOCTL_MODE
POSTGRESQL_AUTOCTL_MONITOR_HOST
Expand Down Expand Up @@ -327,6 +328,7 @@ export POSTGRESQL_POSTGRES_CONNECTION_LIMIT="${POSTGRESQL_POSTGRES_CONNECTION_LI
export POSTGRESQL_WAL_LEVEL="${POSTGRESQL_WAL_LEVEL:-replica}"
export POSTGRESQL_DEFAULT_TOAST_COMPRESSION="${POSTGRESQL_DEFAULT_TOAST_COMPRESSION:-}"
export POSTGRESQL_PASSWORD_ENCRYPTION="${POSTGRESQL_PASSWORD_ENCRYPTION:-}"
export POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION="${POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION:-}"

# pgAutoFailover settings
export POSTGRESQL_AUTOCTL_VOLUME_DIR="${POSTGRESQL_VOLUME_DIR}/pgautoctl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if [[ -n "${POSTGRESQL_EXTRA_FLAGS:-}" ]]; then
flags+=("${extra_flags[@]}")
fi

if [[ -n "${POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION:-}" ]]; then
flags+=("-c" "default_transaction_isolation=$POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION")
fi

flags+=("$@")

cmd=$(command -v postgres)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ postgresql_env_vars=(
POSTGRESQL_WAL_LEVEL
POSTGRESQL_DEFAULT_TOAST_COMPRESSION
POSTGRESQL_PASSWORD_ENCRYPTION
POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION
POSTGRESQL_AUTOCTL_CONF_DIR
POSTGRESQL_AUTOCTL_MODE
POSTGRESQL_AUTOCTL_MONITOR_HOST
Expand Down Expand Up @@ -327,6 +328,7 @@ export POSTGRESQL_POSTGRES_CONNECTION_LIMIT="${POSTGRESQL_POSTGRES_CONNECTION_LI
export POSTGRESQL_WAL_LEVEL="${POSTGRESQL_WAL_LEVEL:-replica}"
export POSTGRESQL_DEFAULT_TOAST_COMPRESSION="${POSTGRESQL_DEFAULT_TOAST_COMPRESSION:-}"
export POSTGRESQL_PASSWORD_ENCRYPTION="${POSTGRESQL_PASSWORD_ENCRYPTION:-}"
export POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION="${POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION:-}"

# pgAutoFailover settings
export POSTGRESQL_AUTOCTL_VOLUME_DIR="${POSTGRESQL_VOLUME_DIR}/pgautoctl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if [[ -n "${POSTGRESQL_EXTRA_FLAGS:-}" ]]; then
flags+=("${extra_flags[@]}")
fi

if [[ -n "${POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION:-}" ]]; then
flags+=("-c" "default_transaction_isolation=$POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION")
fi

flags+=("$@")

cmd=$(command -v postgres)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ postgresql_env_vars=(
POSTGRESQL_WAL_LEVEL
POSTGRESQL_DEFAULT_TOAST_COMPRESSION
POSTGRESQL_PASSWORD_ENCRYPTION
POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION
POSTGRESQL_AUTOCTL_CONF_DIR
POSTGRESQL_AUTOCTL_MODE
POSTGRESQL_AUTOCTL_MONITOR_HOST
Expand Down Expand Up @@ -327,6 +328,7 @@ export POSTGRESQL_POSTGRES_CONNECTION_LIMIT="${POSTGRESQL_POSTGRES_CONNECTION_LI
export POSTGRESQL_WAL_LEVEL="${POSTGRESQL_WAL_LEVEL:-replica}"
export POSTGRESQL_DEFAULT_TOAST_COMPRESSION="${POSTGRESQL_DEFAULT_TOAST_COMPRESSION:-}"
export POSTGRESQL_PASSWORD_ENCRYPTION="${POSTGRESQL_PASSWORD_ENCRYPTION:-}"
export POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION="${POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION:-}"

# pgAutoFailover settings
export POSTGRESQL_AUTOCTL_VOLUME_DIR="${POSTGRESQL_VOLUME_DIR}/pgautoctl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if [[ -n "${POSTGRESQL_EXTRA_FLAGS:-}" ]]; then
flags+=("${extra_flags[@]}")
fi

if [[ -n "${POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION:-}" ]]; then
flags+=("-c" "default_transaction_isolation=$POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION")
fi

flags+=("$@")

cmd=$(command -v postgres)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ postgresql_env_vars=(
POSTGRESQL_WAL_LEVEL
POSTGRESQL_DEFAULT_TOAST_COMPRESSION
POSTGRESQL_PASSWORD_ENCRYPTION
POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION
POSTGRESQL_AUTOCTL_CONF_DIR
POSTGRESQL_AUTOCTL_MODE
POSTGRESQL_AUTOCTL_MONITOR_HOST
Expand Down Expand Up @@ -327,6 +328,7 @@ export POSTGRESQL_POSTGRES_CONNECTION_LIMIT="${POSTGRESQL_POSTGRES_CONNECTION_LI
export POSTGRESQL_WAL_LEVEL="${POSTGRESQL_WAL_LEVEL:-replica}"
export POSTGRESQL_DEFAULT_TOAST_COMPRESSION="${POSTGRESQL_DEFAULT_TOAST_COMPRESSION:-}"
export POSTGRESQL_PASSWORD_ENCRYPTION="${POSTGRESQL_PASSWORD_ENCRYPTION:-}"
export POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION="${POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION:-}"

# pgAutoFailover settings
export POSTGRESQL_AUTOCTL_VOLUME_DIR="${POSTGRESQL_VOLUME_DIR}/pgautoctl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if [[ -n "${POSTGRESQL_EXTRA_FLAGS:-}" ]]; then
flags+=("${extra_flags[@]}")
fi

if [[ -n "${POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION:-}" ]]; then
flags+=("-c" "default_transaction_isolation=$POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION")
fi

flags+=("$@")

cmd=$(command -v postgres)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ postgresql_env_vars=(
POSTGRESQL_WAL_LEVEL
POSTGRESQL_DEFAULT_TOAST_COMPRESSION
POSTGRESQL_PASSWORD_ENCRYPTION
POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION
POSTGRESQL_AUTOCTL_CONF_DIR
POSTGRESQL_AUTOCTL_MODE
POSTGRESQL_AUTOCTL_MONITOR_HOST
Expand Down Expand Up @@ -327,6 +328,7 @@ export POSTGRESQL_POSTGRES_CONNECTION_LIMIT="${POSTGRESQL_POSTGRES_CONNECTION_LI
export POSTGRESQL_WAL_LEVEL="${POSTGRESQL_WAL_LEVEL:-replica}"
export POSTGRESQL_DEFAULT_TOAST_COMPRESSION="${POSTGRESQL_DEFAULT_TOAST_COMPRESSION:-}"
export POSTGRESQL_PASSWORD_ENCRYPTION="${POSTGRESQL_PASSWORD_ENCRYPTION:-}"
export POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION="${POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION:-}"

# pgAutoFailover settings
export POSTGRESQL_AUTOCTL_VOLUME_DIR="${POSTGRESQL_VOLUME_DIR}/pgautoctl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if [[ -n "${POSTGRESQL_EXTRA_FLAGS:-}" ]]; then
flags+=("${extra_flags[@]}")
fi

if [[ -n "${POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION:-}" ]]; then
flags+=("-c" "default_transaction_isolation=$POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION")
fi

flags+=("$@")

cmd=$(command -v postgres)
Expand Down
8 changes: 8 additions & 0 deletions bitnami/postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@ Passing extra command-line flags to the postgresql service command is possible t

* `POSTGRESQL_EXTRA_FLAGS`: Flags to be appended to the `postgres` startup command. No defaults

#### Adjusting the default transaction isolation level

The default transaction isolation level in postgresql is `read committed`, the global default transaction isolation level can be changed using the environment variable `POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION`.

Possible values are: `read uncommitted`, `read committed`, `repeatable read` or `serializable`. For more details consult the documentation for `default_transaction_isolation` in <https://www.postgresql.org/docs/current/runtime-config-client.html>

*Note: Setting `default_transaction_isolation` via `POSTGRESQL_EXTRA_FLAGS` is currently only possible for transaction levels without white spaces in its name.*

### Initializing a new instance

When the container is executed for the first time, it will execute the files with extensions `.sh`, `.sql` and `.sql.gz` located at `/docker-entrypoint-initdb.d`.
Expand Down
Loading