Skip to content

Commit 122e100

Browse files
committed
DLPX-67396 [Backport of Issue DLPX-67394 to 6.0.0.0] Increase postgres service timeout during migration
1 parent 010bc27 commit 122e100

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

files/common/var/lib/delphix-platform/os-migration

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ MIGRATE_CONFIG_SCRIPT="/opt/delphix/migration/migrate_config.py"
1919
MIGRATE_CONFIG_LOG="/var/delphix/migration/log"
2020
PG_REINDEX=/var/delphix/server/db/force-reindex
2121
MGMT_SERVICE_OVERRIDE="/run/systemd/system/delphix-mgmt.service.d/override.conf"
22+
POSTGRES_SERVICE_OVERRIDE="/run/systemd/system/delphix-postgres@default.service.d/override.conf"
2223

2324
# shellcheck disable=SC1091
2425
. /opt/delphix/server/bin/upgrade/dx_upg_stress_options --source
@@ -187,9 +188,28 @@ function perform_migration() {
187188
chown postgres "$PG_REINDEX" || die "Failed to chown $PG_REINDEX"
188189

189190
#
190-
# Prevent the mgmt service from restarting on failure for the duration
191-
# of migration as this makes debugging and migration stress testing
192-
# harder.
191+
# Since re-indexing can take a long time, we increase the timeout
192+
# for the postgres service. We also prevent the service from restarting
193+
# on failure since if re-indexing takes unusually long and still times
194+
# out, we do not want to keep re-trying and timing out again. Those
195+
# settings are temporary and are reverted when migration completes.
196+
#
197+
mkdir -p "$(dirname "$POSTGRES_SERVICE_OVERRIDE")" ||
198+
die "Failed to create dir $(dirname "$POSTGRES_SERVICE_OVERRIDE")"
199+
cat <<-EOF >"$POSTGRES_SERVICE_OVERRIDE" ||
200+
#
201+
# Set temporarily by delphix-migration service.
202+
#
203+
[Service]
204+
Restart=no
205+
TimeoutSec=3600
206+
EOF
207+
die "Failed to create delphix-postgres.service override file."
208+
209+
#
210+
# Similarly, prevent the mgmt service from restarting on failure for
211+
# the duration of migration as this makes debugging and migration
212+
# stress testing harder.
193213
#
194214
mkdir -p "$(dirname "$MGMT_SERVICE_OVERRIDE")" ||
195215
die "Failed to create dir $(dirname "$MGMT_SERVICE_OVERRIDE")"
@@ -201,6 +221,10 @@ function perform_migration() {
201221
Restart=no
202222
EOF
203223
die "Failed to create delphix-mgmt.service override file."
224+
225+
#
226+
# Notify systemd of the new service override files.
227+
#
204228
systemctl daemon-reload || die "daemon-reload failed"
205229

206230
rm "$PERFORM_MIGRATION" || die "Failed to remove $PERFORM_MIGRATION"

0 commit comments

Comments
 (0)