aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/postgresql/APKBUILD4
-rw-r--r--main/postgresql/postgresql.confd39
-rw-r--r--main/postgresql/postgresql.initd40
3 files changed, 50 insertions, 33 deletions
diff --git a/main/postgresql/APKBUILD b/main/postgresql/APKBUILD
index da93392889f..a278d0197be 100644
--- a/main/postgresql/APKBUILD
+++ b/main/postgresql/APKBUILD
@@ -268,8 +268,8 @@ sha512sums="b7bd378db1dcb74ebcd5fffba03b82d8117d182029e4caca48eef62d8bcdbeef2c2e
c4179fcd8b71791cdc41ea7b622cf82e9bd42ac1de66999234b98a83c0c508c79c492a9301274fe859c06a3f1a8b17b53ab97541ab76801a985f8f0b9b8716e7 disable-broken-tests.patch
14703da0a9441ae1bbad9fe124c4c267526975a22080c5f3e8c3a323164b743158ee10fcff31f18131a64e765c89125410652b317da46e92e962f251079f5a9a disable-test-collate.icu.utf8.patch
2bd10c4911a50432a00d47bf423c2bb120bacd01a04b41430aa427ae15eafeb3f61e386893211fd147bc7972e4e7f9075ec9e0cd18d50caac14ab0eddb707ef7 czech-snowball-stemmer.patch
-19c24a1632e2738befd28857fe74ada3e753362fc042160cefcefb6efb4adbe55637a9e4bcc101b0732a6a846c4ccb1971d05b054c746a9fae06346c3d6f6fed postgresql.initd
-6d96c8d4644e267599b3c395efc9cd0a8cf013631c85078107fc98845d862ac333279d82314c8ce9923253855c6d738fa0c1d2ea584aa13e9b12e6e9ebda745f postgresql.confd
+59cab18e20a656251b0d951642025e0b8623384dbb3113997efb2abd552ddbb467e78ea2325ae9c748110d3e95d9ae08e6073cbd03d8e705d9174ac8783feeeb postgresql.initd
+50034cd4ed040dfcae8b015ddfba9a9210787d170125451e75ceaadc9f8364a1c93ba6ddeb205a6deb21f96c7634066919d26686c3af514bf0693a97d6b0dbd0 postgresql.confd
f5a1cba051e7d846c2d16703514601cb25729ed96b677c9bd0c199d64552120a8b14b238af01917fdb87106681e12dee6fff7447558155ba273e4f96be5e2892 pg-restore.initd
c14a5684e914abb3b0ee71bbf15eed71a9264deacaa404a6e3af6bfc330d93e7598624d0ed11a94263106cc660f7f54c8ff57e759033cf606a795f69ff6c1c7c pg-restore.confd
5c9bfd9e295dcf678298bf0aa974347a7c311d6e7c2aa76a6920fcb751d01fd1ab77abbec11f3c672f927ad9deaa88e04e370c0b5cd1b60087554c474b748731 pltcl_create_tables.sql"
diff --git a/main/postgresql/postgresql.confd b/main/postgresql/postgresql.confd
index 188cdd9626b..8fe0b935b92 100644
--- a/main/postgresql/postgresql.confd
+++ b/main/postgresql/postgresql.confd
@@ -1,3 +1,8 @@
+# Configuration for /etc/init.d/postgresql
+#
+# For more information about shutdown modes see
+# https://www.postgresql.org/docs/13/server-shutdown.html.
+
# Which port and socket to bind PostgreSQL.
# This may be overriden in postgresql.conf.
#port="5432"
@@ -5,22 +10,24 @@
# How long to wait for server to start in seconds.
#start_timeout=10
-# Number of seconds to wait for clients to disconnect from the server before
-# shutting down. Set to zero to disable this timeout.
-#nice_timeout=5
-
-# Timeout in seconds for rude quit - forecfully disconnect clients from server
-# and shut down. This is performed after nice_timeout exceeded. Terminated
-# client connections have their open transactions rolled back.
-# Set "rude_quit=no" to disable.
-#rude_quit="yes"
-#rude_timeout=10
-
-# Timeout in seconds for force quit - if the server still fails to shutdown,
-# you can force it to quit and a recover-run will execute on the next startup.
-# Set "force_quit=yes" to enable.
-#force_quit="no"
-#force_timeout=6
+# Timeout in seconds for Smart Shutdown (SIGTERM) - disallow new connections
+# and wait for clients to disconnect from the server before shutting down.
+# Set to 0 to skip Smart Shutdown phase when executing 'stop' command.
+#stop_smart_timeout=5
+
+# Timeout in seconds for Fast Shutdown (SIGINT) - forcefully disconnect clients
+# from server, abort their transactions and shut down. This is performed after
+# $stop_smart_timeout has exceeded (or skipped) when executing 'stop' command.
+# Set to 0 to skip Fast Shutdown phase.
+#stop_fast_timeout=10
+
+# Timeout in seconds for Immediate Shutdown (SIGQUIT) - terminate client
+# connections and quit without doing normal database shutdown processing.
+# This will lead to recovery (by replaying the WAL log) upon next start-up.
+# This is performed after both $stop_smart_timeout and $stop_fast_timeout has
+# exceeded (or skipped) when executing 'stop' command. Set to non-zero value
+# to enable Immediate Shutdown.
+#stop_force_timeout=0
# Extra options to run postmaster with, e.g.:
# -N is the maximal number of client connections
diff --git a/main/postgresql/postgresql.initd b/main/postgresql/postgresql.initd
index f3d5353c183..3720cfdfacb 100644
--- a/main/postgresql/postgresql.initd
+++ b/main/postgresql/postgresql.initd
@@ -18,11 +18,10 @@ description_setup="Initialize a new PostgreSQL cluster"
: ${auto_setup:="yes"}
: ${start_timeout:=10}
-: ${nice_timeout:=5}
-: ${rude_quit:="yes"}
-: ${rude_timeout:=10}
-: ${force_quit:="no"}
-: ${force_timeout:=6}
+# nice_timeout, rude_timeout and force_timeout are for backward compatibility.
+: ${stop_smart_timeout:=${nice_timeout:-5}}
+: ${stop_fast_timeout:=${rude_timeout:-10}}
+: ${stop_force_timeout:=${force_timeout:-0}}
: ${data_dir:="/var/lib/postgresql/@VERSION@/data"}
: ${conf_dir:=$data_dir}
@@ -52,6 +51,16 @@ depend() {
}
start_pre() {
+ check_deprecated_var nice_timeout stop_smart_timeout
+ check_deprecated_var rude_timeout stop_fast_timeout
+ check_deprecated_var rude_quit stop_fast_timeout
+ check_deprecated_var force_timeout stop_force_timeout
+ check_deprecated_var force_quit stop_force_timeout
+
+ # For backward compatibility only.
+ [ "$rude_quit" = no ] && [ "stop_fast_timeout" -eq 10 ] && stop_fast_timeout=0
+ [ "$force_quit" = yes ] && [ "$stop_force_timeout" -eq 0 ] && stop_force_timeout=2
+
if [ ! -d "$data_dir/base" ]; then
if yesno "$auto_setup"; then
setup || return 1
@@ -114,17 +123,18 @@ start() {
}
stop() {
- local retry="SIGTERM/$nice_timeout"
-
- yesno "$rude_quit" \
- && retry="$retry/SIGINT/$rude_timeout" \
- || rude_timeout=0
+ local retry=''
- yesno "$force_quit" \
- && retry="$retry/SIGQUIT/$force_timeout" \
- || force_timeout=0
+ [ "$stop_smart_timeout" -eq 0 ] \
+ || retry="SIGTERM/$stop_smart_timeout"
+ [ "$stop_fast_timeout" -eq 0 ] \
+ || retry="${retry:+$retry/}SIGINT/$stop_fast_timeout"
+ [ "$stop_force_timeout" -eq 0 ] \
+ || retry="${retry:+$retry/}SIGQUIT/$stop_force_timeout"
+ [ "$retry" ] \
+ || retry='SIGINT/5'
- local seconds=$(( $nice_timeout + $rude_timeout + $force_timeout ))
+ local seconds=$(( $stop_smart_timeout + $stop_fast_timeout + $stop_force_timeout ))
ebegin "Stopping $name (this can take up to $seconds seconds)"
@@ -285,7 +295,7 @@ check_deprecated_var() {
local new_name="$2"
if [ -n "$(getval "$old_name")" ]; then
- ewarn "Variable '$old_name' has been removed, please use '$new_name' instead."
+ ewarn "Variable '$old_name' is deprecated, please use '$new_name' instead."
fi
}