diff --git a/roles/matrix-postgres/tasks/upgrade_postgres.yml b/roles/matrix-postgres/tasks/upgrade_postgres.yml index bf98d938a..61666eb3d 100644 --- a/roles/matrix-postgres/tasks/upgrade_postgres.yml +++ b/roles/matrix-postgres/tasks/upgrade_postgres.yml @@ -87,9 +87,10 @@ --entrypoint=/bin/sh --mount type=bind,src={{ postgres_dump_dir }},dst=/out {{ matrix_postgres_detected_version_corresponding_docker_image }} - -c "pg_dumpall -h matrix-postgres - {{ '| gzip -c ' if postgres_dump_name.endswith('.gz') else '' }} - > /out/{{ postgres_dump_name }}" + -c "pg_dumpall -h matrix-postgres --format=directory -j 8 -f /out/postgres" + +# {{ '| gzip -c ' if postgres_dump_name.endswith('.gz') else '' }} +# > /out/{{ postgres_dump_name }}" - name: Ensure matrix-postgres is stopped service: @@ -133,11 +134,13 @@ --entrypoint=/bin/sh --mount type=bind,src={{ postgres_dump_dir }},dst=/in,ro {{ matrix_postgres_docker_image_latest }} - -c "cat /in/{{ postgres_dump_name }} | - {{ 'gunzip |' if postgres_dump_name.endswith('.gz') else '' }} - grep -vE '{{ matrix_postgres_import_roles_ignore_regex }}' | - grep -vE '{{ matrix_postgres_import_databases_ignore_regex }}' | - psql -v ON_ERROR_STOP=1 -h matrix-postgres" + -c "pg_restore -j 10 -h matrix-postgres" + +# -c "cat /in/{{ postgres_dump_name }} | +# {{ 'gunzip |' if postgres_dump_name.endswith('.gz') else '' }} +# grep -vE '{{ matrix_postgres_import_roles_ignore_regex }}' | +# grep -vE '{{ matrix_postgres_import_databases_ignore_regex }}' | +# psql -v ON_ERROR_STOP=1 -h matrix-postgres" # This is a hack. # See: https://ansibledaily.com/print-to-standard-output-without-escaping/