postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

Issues on major upgrade from Postgres 13 to Postgres 14

Open phlegx opened this issue 3 years ago • 1 comments

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

  • Which image of the operator are you using? registry.opensource.zalan.do/acid/postgres-operator:v1.8.0
  • Where do you run it - cloud or metal? Kubernetes or OpenShift? [Kubernetes Bare Metal, Rancher k3s]
  • Are you running Postgres Operator in production? [yes, but this issue now happens in staging since we update staging first]
  • Type of issue? [Bug report OR question]

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

phlegx avatar May 31 '22 18:05 phlegx

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

CyberDem0n avatar Jun 01 '22 05:06 CyberDem0n