-
Notifications
You must be signed in to change notification settings - Fork 670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move pg_dist_object to pg_catalog #5765
Conversation
150f1c8
to
563ee98
Compare
563ee98
to
959934c
Compare
-- TODO: This test should be moved to a valid downgrade testing suite where the downgrade is done, both on the schema and the binaries. Later changes in Citus made a C vs Schema discrepancy error here | ||
-- BEGIN; | ||
-- SET citus.enable_metadata_sync TO on; | ||
-- SELECT master_add_node('localhost', :master_port, groupId=>0); | ||
-- CREATE TABLE citus_local_table (a int); | ||
-- SELECT create_citus_local_table('citus_local_table'); | ||
-- RESET citus.enable_metadata_sync; | ||
-- | ||
-- -- downgrade from 9.5-1 to 9.4-1 should fail as we have a citus local table | ||
-- ALTER EXTENSION citus UPDATE TO '9.4-1'; | ||
-- ROLLBACK; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test runs into schema vs binary incompatibility.
Have disabled it for now, would be great to have more robust downgrade tests where binary and schema actually do conform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks good and straight-forward
-- downgrade from 9.5-1 to 9.4-1 should fail as we have a citus local table | ||
ALTER EXTENSION citus UPDATE TO '9.4-1'; | ||
ROLLBACK; | ||
-- TODO: This test should be moved to a valid downgrade testing suite where the downgrade is done, both on the schema and the binaries. Later changes in Citus made a C vs Schema discrepancy error here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably also quite well-covered by the regression tests of previous releases and no longer that relevant.
Citus 11 moved `pg_dist_object` to `pg_catalog`. When doing a downgrade, for a brief period of time, Citus 10.2 expects to have this table in `citus` schema, but fails. This can potentially cause failures in downgrade. We now search for the relation in the `citus` schema and if that fails, we search in the `pg_catalog` schema. Related: #5765
DESCRIPTION: Move pg_dist_object to pg_catalog
Historically
pg_dist_object
had been created in thecitus
schema as an experiment to understand if we could move our catalog tables to a branded schema. We quickly realised that this interfered with the UX on our managed services and other environments, where users connected via a user with the name ofcitus
.By default postgres put the username on the search_path. To be able to read the catalog in the
citus
schema we would need to grant access permissions to the schema. This caused newly created objects like tables etc, to default to this schema for creation. This failed due to the write permissions to that schema.With this change we move the
pg_dist_object
catalog table to thepg_catalog
schema, where our other schema's are also located. This makes the catalog table visible and readable by any user, like our other catalog tables, for debugging purposes.Note: due to the change of schema, we had to disable 1 test that was running into a discrepancy between the schema and binary. Secondly, we needed to make the lookup functions for the
pg_dist_object
relation and their indexes less strict on the fallback of the naming due to an other test that, due to an unfortunate cache invalidation, needed to lookup the relation again. This makes that we won't default to only resolving frompg_catalog
outside of upgrades.