Skip to content

Commit 97216ba

Browse files
authored
FIX: improve postgres upgrade reliability (#989)
On some systems the /shared/postgres_data directory might be a mount point, so in order to avoid failure in this scenario, move the postgres data files directly instead of manipulating the data directory. see https://meta.discourse.org/t/infinite-loop-during-postgres-upgrade/91767/8?u=lavamind
1 parent d6f5aa4 commit 97216ba

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

templates/postgres.15.template.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ run:
132132
exit 1
133133
fi
134134
135-
mv /shared/postgres_data /shared/postgres_data_old
136-
mv /shared/postgres_data_new /shared/postgres_data
135+
mkdir /shared/postgres_data_old
136+
mv /shared/postgres_data/* /shared/postgres_data_old
137+
mv /shared/postgres_data_new/* /shared/postgres_data
138+
rmdir /shared/postgres_data_new
137139
138140
echo -------------------------------------------------------------------------------------
139141
echo UPGRADE OF POSTGRES COMPLETE

templates/postgres.template.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,10 @@ run:
139139
exit 1
140140
fi
141141
142-
mv /shared/postgres_data /shared/postgres_data_old
143-
mv /shared/postgres_data_new /shared/postgres_data
142+
mkdir /shared/postgres_data_old
143+
mv /shared/postgres_data/* /shared/postgres_data_old
144+
mv /shared/postgres_data_new/* /shared/postgres_data
145+
rmdir /shared/postgres_data_new
144146
145147
echo -------------------------------------------------------------------------------------
146148
echo UPGRADE OF POSTGRES COMPLETE

0 commit comments

Comments
 (0)