Skip to content

Conversation

@onurctirtir
Copy link
Member

DESCRIPTION: Fixes (pg_dump/pg_upgrade) dependency loop warnings caused by pg_depend entries inserted by citus_columnar

Fixes #5510.

In the past, having columnar tables in the cluster was causing pg
upgrades to fail when attempting to access columnar metadata. This is
because, pg_dump doesn't see objects that we use for columnar-am related
booking as the dependencies of the tables using columnar-am.
To fix that; in #5456, we inserted some "normal dependency" edges (from
those objects to columnar-am) into pg_depend.

This helped us ensuring the existency of a class of metadata objects
--such as columnar.storageid_seq-- and helped fixing #5437.

However, the normal-dependency edges that we added for indexes on
columnar metadata tables --such columnar.stripe_pkey-- didn't help at
all because they were indeed causing dependency loops (#5510) and
pg_dump was not able to take those dependency edges into the account.

For this reason, this commit deletes those dependency edges so that
pg_dump stops complaining about them. Note that it's not critical to
delete those edges from pg_depend since they're not breaking pg upgrades
but were triggering some warning messages. And given that backporting
a sql change into older versions is hard a lot, we skip backporting
this.

2 | 0 | 1 | table_with_orphaned_shards_102011 | 0 | 0
(2 rows)

-- TODO: Looks like citus_columnar doesn't get auto-updated when updating Citus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, but at least open an issue for this

@onurctirtir onurctirtir force-pushed the fix/columnar-dependency-loop branch from 149318d to bac5409 Compare January 18, 2023 13:06
@codecov
Copy link

codecov bot commented Jan 18, 2023

Codecov Report

Merging #6628 (9550ebd) into main (f68fc9e) will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #6628      +/-   ##
==========================================
+ Coverage   93.15%   93.16%   +0.01%     
==========================================
  Files         259      259              
  Lines       55962    55960       -2     
==========================================
+ Hits        52130    52137       +7     
+ Misses       3832     3823       -9     

@onurctirtir onurctirtir force-pushed the fix/columnar-dependency-loop branch from bac5409 to 79bd16b Compare January 19, 2023 15:22
@onurctirtir onurctirtir changed the title Fix pg_dump dependency loop warnings caused by pg_depend entries inserted in #5456 Remove pg_depend entries from columnar metadata indexes to columnar-am (inserted in #5456) Feb 1, 2023
@onurctirtir onurctirtir force-pushed the fix/columnar-dependency-loop branch from 47a2130 to 4611fed Compare February 1, 2023 08:06
@onurctirtir onurctirtir force-pushed the fix/columnar-dependency-loop branch from 4611fed to 31c78e3 Compare March 14, 2023 07:11
@onurctirtir onurctirtir requested a review from JelteF March 14, 2023 07:16
@@ -0,0 +1,43 @@
CREATE OR REPLACE FUNCTION columnar_internal.columnar_ensure_am_depends_catalog()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when do we call this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

via citus_finish_pg_upgrade()

Copy link
Contributor

@marcocitus marcocitus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to have some kind of pg_dump test to confirm we fixed the original issue?

@onurctirtir onurctirtir force-pushed the fix/columnar-dependency-loop branch from 642f61c to c282ec8 Compare March 14, 2023 12:01
@onurctirtir
Copy link
Member Author

Is it possible to have some kind of pg_dump test to confirm we fixed the original issue?

I see that we have some pg_dump tests for columnar in pg_dump.sql but apparently they don't report warnings etc., so not sure if there is way to do that.

@onurctirtir onurctirtir force-pushed the fix/columnar-dependency-loop branch 5 times, most recently from 26b101e to e7aff54 Compare March 14, 2023 13:19
When run_test.py is run for an upgrade_.*_after.sql then, then
automatically run the corresponding uprade_.*_before.sql file first.
This is because all those upgrade_.*_after.sql files depend on the
objects created in upgrade_.*_before.sql files by definition.
This commit hides port numbers in upgrade_columnar_after because the
port numbers assigned to nodes in upgrade schedule differ from the ones
that flaky test detector assigns.
…le times

So that flaky test detector can run upgrade_columnar_before.sql multiple
times.
In the past, having columnar tables in the cluster was causing pg
upgrades to fail when attempting to access columnar metadata. This is
because, pg_dump doesn't see objects that we use for columnar-am related
booking as the dependencies of the tables using columnar-am.
To fix that; in #5456, we inserted some "normal dependency" edges (from
those objects to columnar-am) into pg_depend.

This helped us ensuring the existency of a class of metadata objects
--such as columnar.storageid_seq-- and helped fixing #5437.

However, the normal-dependency edges that we added for indexes on
columnar metadata tables --such columnar.stripe_pkey-- didn't help at
all because they were indeed causing dependency loops (#5510) and
pg_dump was not able to take those dependency edges into the account.

For this reason, this commit deletes those dependency edges so that
pg_dump stops complaining about them. Note that it's not critical to
delete those edges from pg_depend since they're not breaking pg upgrades
but were triggering some warning messages. And given that backporting
a sql change into older versions is hard a lot, we skip backporting
this.
@onurctirtir onurctirtir force-pushed the fix/columnar-dependency-loop branch from e7aff54 to 9550ebd Compare March 14, 2023 14:13
@onurctirtir onurctirtir merged commit a0a4194 into main Mar 14, 2023
@onurctirtir onurctirtir deleted the fix/columnar-dependency-loop branch March 14, 2023 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pg_dump gives columnar AM dependency loop warnings

3 participants