Skip to content

Commit 3330891

Browse files
authored
chore: fix race conditions when running a pg upgrade (#629)
1 parent cdefeeb commit 3330891

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

ansible/files/admin_api_scripts/pg_upgrade_initiate.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,6 @@ function initiate_upgrade {
174174
chown -R postgres:postgres /tmp/pg_upgrade/
175175
cd /tmp/pg_upgrade/
176176

177-
echo "running" > /tmp/pg-upgrade-status
178-
179177
# Fixing erros generated by previous dpkg executions (package upgrades et co)
180178
echo "2. Fixing potential errors generated by dpkg"
181179
DEBIAN_FRONTEND=noninteractive dpkg --configure -a --force-confold || true # handle errors generated by dpkg
@@ -195,7 +193,14 @@ function initiate_upgrade {
195193

196194
mkdir -p "$MOUNT_POINT"
197195
echo "5. Mounting block device"
196+
197+
sleep 5
198+
e2fsck -pf "$BLOCK_DEVICE"
199+
200+
sleep 1
198201
mount "$BLOCK_DEVICE" "$MOUNT_POINT"
202+
203+
sleep 1
199204
resize2fs "$BLOCK_DEVICE"
200205
fi
201206

@@ -270,6 +275,7 @@ EOF
270275

271276
trap cleanup ERR
272277

278+
echo "running" > /tmp/pg-upgrade-status
273279
if [ "$IS_DRY_RUN" = true ]; then
274280
initiate_upgrade
275281
else

common.vars.pkr.hcl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
postgres-version = "15.1.0.73"
1+
postgres-version = "15.1.0.74"

0 commit comments

Comments
 (0)