Infinite loop during postgres upgrade

נתקלתי בבעיה זו במהלך השדרוג האחרון מ-PotsgreSQL 13 ל-15.

בפריסה שלנו, ספריית /shared/postgres_data שלנו מותקנת על התקן אחסון NVMe מהיר יותר, ולכן המעבר נכשל עם הודעת השגיאה Device or resource busy.

תיקנו זאת על ידי תיקון תבנית הפוסטגרס באופן הבא:

diff --git a/templates/postgres.template.yml b/templates/postgres.template.yml
index c24bfe6..03813c4 100644
--- a/templates/postgres.template.yml
+++ b/templates/postgres.template.yml
@@ -139,8 +139,10 @@ run:
           fi

-         mv /shared/postgres_data /shared/postgres_data_old
-         mv /shared/postgres_data_new /shared/postgres_data
+         mkdir /shared/postgres_data_old
+         mv /shared/postgres_data/* /shared/postgres_data_old
+         mv /shared/postgres_data_new/* /shared/postgres_data
+         rmdir /shared/postgres_data_new

במקום לנסות לתפעל את הספרייה עצמה, פשוט העברנו את התוכן.
אנא שקלו לשלב שינוי זה כדי לשפר את האמינות של שדרוגי מסד נתונים.