Skip to content

pg_upgrade 14 -> 15 fails when using columnar 11.1 in child table #6570

@amalek215

Description

@amalek215

When a child table in a partitioned table is using citus_columnar then an upgrade from PSQL 14 to 15 fails

PostgreSQL 14.5 and 15.1
citus/citus_columnar 11.1-1
RHEL 7.9

Steps to reproduce:

$ mkdir test_citus_pg_14_15_upgrade
$ /usr/pgsql-14/bin/initdb -D test_citus_pg_14_15_upgrade/data14
$ /usr/pgsql-15/bin/initdb -D test_citus_pg_14_15_upgrade/data15
$ echo  "shared_preload_libraries = 'citus'" >> test_citus_pg_14_15_upgrade/data15/postgresql.conf
$ echo  "shared_preload_libraries = 'citus'" >> test_citus_pg_14_15_upgrade/data14/postgresql.conf
$ /usr/pgsql-14/bin/pg_ctl -D test_citus_pg_14_15_upgrade/data14 start
$ psql -c "CREATE EXTENSION citus_columnar ; CREATE TABLE foo (d DATE NOT NULL) PARTITION BY RANGE (d); CREATE TABLE foo3 PARTITION OF foo FOR VALUES FROM ('2009-02-01') TO ('2009-03-01') USING COLUMNAR; "
$ pg_ctl -D test_citus_pg_14_15_upgrade/data14 stop
$ /usr/pgsql-15/bin/pg_upgrade --link --old-datadir="/var/lib/pgsql/test_citus_pg_14_15_upgrade/data14" --new-datadir="/var/lib/pgsql/test_citus_pg_14_15_upgrade/data15" --old-bindir="/usr/pgsql-14/bin" --new-bindir="/usr/pgsql-15/bin"

Output from upgrade command:

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for system-defined composite types in user tables  ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Creating dump of global objects                             ok
Creating dump of database schemas
                                                            ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok
Checking for new cluster tablespace directories             ok

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 "/var/lib/pgsql/test_citus_pg_14_15_upgrade/data15/pg_upgrade_output.d/20221221T093126.357/log/pg_upgrade_dump_14486.log" for
the probable cause of the failure.
Failure, exiting
$ egrep -B3 -A3 '(warning)|(ERROR)' /var/lib/pgsql/test_citus_pg_14_15_upgrade/data15/pg_upgrade_output.d/20221221T094039.598/log/pg_upgrade_dump_14486.log
command: "/usr/pgsql-15/bin/pg_dump" --host /var/lib/pgsql --port 50432 --username postgres --schema-only --quote-all-identifiers --binary-upgrade --format=custom  --file="/var/lib/pgsql/test_citus_pg_14_15_upgrade/data15/pg_upgrade_output.d/20221221T094039.598/dump/pg_upgrade_dump_14486.custom" 'dbname=postgres' >> "/var/lib/pgsql/test_citus_pg_14_15_upgrade/data15/pg_upgrade_output.d/20221221T094039.598/log/pg_upgrade_dump_14486.log" 2>&1
pg_dump: warning: could not resolve dependency loop among these items:
pg_dump: warning: could not resolve dependency loop among these items:
pg_dump: warning: could not resolve dependency loop among these items:
pg_dump: warning: could not resolve dependency loop among these items:
pg_dump: warning: could not resolve dependency loop among these items:
pg_dump: warning: could not resolve dependency loop among these items:


command: "/usr/pgsql-15/bin/pg_restore" --host /var/lib/pgsql --port 50432 --username postgres --clean --create --exit-on-error --verbose --dbname template1 "/var/lib/pgsql/test_citus_pg_14_15_upgrade/data15/pg_upgrade_output.d/20221221T094039.598/dump/pg_upgrade_dump_14486.custom" >> "/var/lib/pgsql/test_citus_pg_14_15_upgrade/data15/pg_upgrade_output.d/20221221T094039.598/log/pg_upgrade_dump_14486.log" 2>&1
--
pg_restore: creating TABLE ATTACH "public.foo3"
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 3950; 0 0 TABLE ATTACH foo3 postgres
pg_restore: error: could not execute query: ERROR:  could not open relation with OID 0
Command was: ALTER TABLE ONLY "public"."foo" ATTACH PARTITION "public"."foo3" FOR VALUES FROM ('2009-02-01') TO ('2009-03-01');

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions