zalando / postgres-operator

Postgres operator creates and manages PostgreSQL clusters running in Kubernetes
https://postgres-operator.readthedocs.io/
MIT License
4.36k stars 981 forks source link

Issues on major upgrade from Postgres 13 to Postgres 14 #1912

Open phlegx opened 2 years ago

phlegx commented 2 years ago

Please, answer some short questions which should help us to understand your problem / question better?

Hi there,

I try to upgrade my Postgres clusters (All single instances for now) from Postgres version 13 to 14 with the following command:

python3 /scripts/inplace_upgrade.py 1

However the upgrade fails with the following message:

If pg_upgrade fails after this point, you must re-initdb the new cluster before continuing.

Performing Upgrade
------------------
Analyzing all rows in the new cluster                       ok
Freezing all rows in the new cluster                        ok
Deleting files from new pg_xact                             ok
Copying old pg_xact to new server                           ok
Setting oldest XID for new cluster                          ok
Setting next transaction ID and epoch for new cluster       ok
Deleting files from new pg_multixact/offsets                ok
Copying old pg_multixact/offsets to new server              ok
Deleting files from new pg_multixact/members                ok
Copying old pg_multixact/members to new server              ok
Setting next multixact ID and offset for new cluster        ok
Resetting WAL archives                                      ok
Setting frozenxid and minmxid counters in new cluster       ok
Restoring global objects in the new cluster                 ok
Restoring database schemas in the new cluster
  postgres                                                  
*failure*

Consult the last few lines of "pg_upgrade_dump_13385.log" for
the probable cause of the failure.
Failure, exiting

*failure*

Consult the last few lines of "pg_upgrade_dump_9151023.log" for
the probable cause of the failure.
Failure, exiting

child process exited abnormally: status 256
Failure, exiting
2022-05-30 18:05:09,617 inplace_upgrade ERROR: Failed to upgrade cluster from 13 to 14
2022-05-30 18:05:09,619 inplace_upgrade INFO: Disabling maintenance mode
2022-05-30 18:05:10,650 inplace_upgrade INFO: Maintenance mode disabled

Seems to be caused by this error:

pg_restore: creating INDEX "public.index_account_profiles_on_account_id"
pg_restore: creating INDEX "public.index_account_profiles_on_discarded_at"
pg_restore: creating INDEX "public.index_account_profiles_on_f_unaccent_firstname_gin_trgm_ops"
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 4581; 1259 17967 INDEX index_account_profiles_on_f_unaccent_firstname_gin_trgm_ops postgres
pg_restore: error: could not execute query: ERROR:  text search dictionary "unaccent" does not exist
LINE 2:   SELECT immutable_unaccent(regdictionary 'unaccent', $1)
                                                  ^
QUERY:  
  SELECT immutable_unaccent(regdictionary 'unaccent', $1)

CONTEXT:  SQL function "f_unaccent" during inlining
Command was: 
-- For binary upgrade, must preserve pg_class oids
SELECT pg_catalog.binary_upgrade_set_next_index_pg_class_oid('17967'::pg_catalog.oid);

CREATE INDEX "index_account_profiles_on_f_unaccent_firstname_gin_trgm_ops" ON "public"."account_profiles" USING "gin" ("public"."f_unaccent"(("firstname")::"text") "public"."gin_trgm_o
ps");

Does anyone know why this happens and what is causing it? Can this somehow be fixed?

thanks in advance Martin

CyberDem0n commented 2 years ago

https://www.postgresql.org/message-id/flat/CAPs%2BM8LCex6d%3DDeneofdsoJVijaG59m9V0ggbb3pOH7hZO4%2BcQ%40mail.gmail.com -- looks very similar