Bucle infinito durante la actualización de postgres

Hi! Each time I launch /launcher rebuild app I get the following message (even if I launch it again) :

UPGRADE OF POSTGRES COMPLETE
Old 9.5 database is stored at /shared/postgres_data_old
To complete the upgrade, rebuild again using:
./launcher rebuild app

What information do you need to help me?

PS: The first time I ran it, the command stoped because I needed more space

Temporarily, I used the templates/postgres.9.5.template.yml template to avoid downtime. The app is running again, but I’d like to finish the update.

When I do a cleanup I get the following message : Old PostgreSQL backup data cluster detected taking up 1.2G detected. Would you like to remove it? (Y/n):

Sounds like a question for @tgxworld, but I am guessing that it failed due to lack of space but somehow didn’t catch that the upgrade had failed.

How much space do you have? And how big is your database?

1 me gusta

Can you provide me with the full log generated during the rebuild? Thank you!

3 Me gusta

He tenido el mismo problema durante varios meses y no puedo actualizar mi instalación.

Se queda en bucle y nunca tiene éxito. Uno de los problemas durante rebuild app es el siguiente:
mv: no se puede mover '/shared/postgres_data' a '/shared/postgres_data_old': Dispositivo o recurso ocupado

Al entrar en Docker, la versión de PostgreSQL que tengo es:

/usr/lib/postgresql/10/bin/postgres --version
postgres (PostgreSQL) 10.14 (Debian 10.14-1.pgdg100+1)

Estos son los errores que obtengo:

FAILED

--------------------

Pups::ExecError: /root/upgrade_postgres falló con el estado de retorno #<Process::Status: pid 47 exit 1>

Ubicación del fallo: /pups/lib/pups/exec_command.rb:112:in `spawn'

exec falló con los parámetros "/root/upgrade_postgres"

0c74c9de4d4315b63c0ef9055631f38c0cf4b3dd0be6500fd83ca0a5b13e0d9d

** FALLO AL INICIAR EL PROCESO ** por favor, haz scroll hacia arriba y busca mensajes de error anteriores; puede haber más de uno.

./discourse-doctor puede ayudar a diagnosticar el problema.

Parece que hay un problema en el script /pups/lib/pups/exec_command.rb al ejecutar spawn.

Sin embargo, puedo iniciar la aplicación:
./launcher start app

Estos son los archivos que tengo en /shared:

total 48
drwxr-xr-x 12 root      root     4096 Jan 12 13:12 .
drwxr-xr-x 57 root      root     4096 Dec 15 09:09 ..
drwxr-xr-x  3 discourse www-data 4096 Aug 20  2019 backups
drwxr-xr-x  4 root      root     4096 Aug 19  2019 log
drwxr-xr-x  2 postgres  postgres 4096 Aug 19  2019 postgres_backup
drwx------ 20 postgres  postgres 4096 Jan 12 13:14 postgres_data
drwx------ 19 postgres  postgres 4096 Jan 12 13:12 postgres_data_new
drwxrwxr-x  5 postgres  postgres 4096 Jan 12 13:14 postgres_run
drwxr-xr-x  2 redis     redis    4096 Jan 12 13:07 redis_data
drwxr-xr-x  4 root      root     4096 Aug 19  2019 state
drwxr-xr-x  4 discourse www-data 4096 Jan 12 13:14 tmp
drwxr-xr-x  4 discourse www-data 4096 Sep  8  2019 uploads

¿Qué puedo hacer?

¿Es tu directorio compartido algún tipo de montaje de red?

1 me gusta

¡No, pero finalmente lo he logrado!

Los dos comandos mv en templates/postgres.template.yml no se verifican para asegurar que funcionen correctamente. El script siempre dice UPGRADE OF POSTGRES COMPLETE, lo cual no es cierto cuando el movimiento falla.

Eliminé los comandos, moví los directorios manualmente después de entrar en el contenedor Docker, y el siguiente rebuild app está funcionando como antes. ¡Estoy muy feliz :smiley:!
Gracias.

3 Me gusta

Me encontré con este problema durante la última actualización de PostgreSQL de la versión 13 a la 15.

En nuestro despliegue, nuestro directorio /shared/postgres_data está montado en un dispositivo de almacenamiento NVMe más rápido, por lo que moverlo falló con un mensaje de error de Device or resource busy.

Solucionamos esto modificando la plantilla de postgres de la siguiente manera:

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

En lugar de intentar manipular el directorio en sí, simplemente movemos los contenidos.

Por favor, consideren integrar este cambio para mejorar la fiabilidad de las actualizaciones de la base de datos.

1 me gusta

Creo que esto podría estar relacionado: FIX: improve postgres upgrade reliability by jcharaoui · Pull Request #989 · discourse/discourse_docker · GitHub

2 Me gusta

El PR se ha fusionado :+1:

1 me gusta

Este tema se cerró automáticamente después de 6 días. Ya no se permiten nuevas respuestas.