@@ -19,6 +19,7 @@ MIGRATE_CONFIG_SCRIPT="/opt/delphix/migration/migrate_config.py"
19
19
MIGRATE_CONFIG_LOG=" /var/delphix/migration/log"
20
20
PG_REINDEX=/var/delphix/server/db/force-reindex
21
21
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"
22
23
23
24
# shellcheck disable=SC1091
24
25
. /opt/delphix/server/bin/upgrade/dx_upg_stress_options --source
@@ -187,9 +188,28 @@ function perform_migration() {
187
188
chown postgres " $PG_REINDEX " || die " Failed to chown $PG_REINDEX "
188
189
189
190
#
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.
193
213
#
194
214
mkdir -p " $( dirname " $MGMT_SERVICE_OVERRIDE " ) " ||
195
215
die " Failed to create dir $( dirname " $MGMT_SERVICE_OVERRIDE " ) "
@@ -201,6 +221,10 @@ function perform_migration() {
201
221
Restart=no
202
222
EOF
203
223
die " Failed to create delphix-mgmt.service override file."
224
+
225
+ #
226
+ # Notify systemd of the new service override files.
227
+ #
204
228
systemctl daemon-reload || die " daemon-reload failed"
205
229
206
230
rm " $PERFORM_MIGRATION " || die " Failed to remove $PERFORM_MIGRATION "
0 commit comments