-
Notifications
You must be signed in to change notification settings - Fork 684
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
PG17 - Add Regression Test for Access Method Behavior on Partitioned Tables #7818
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## release-13.0 #7818 +/- ##
===============================================
Coverage ? 89.63%
===============================================
Files ? 274
Lines ? 59748
Branches ? 7452
===============================================
Hits ? 53556
Misses ? 4058
Partials ? 2134 |
src/test/regress/expected/pg17.out
Outdated
|
||
(1 row) | ||
|
||
-- Step 4: Verify that the table and partitions are created and distributed correctly |
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.
We have to verify step 4 in one of the worker nodes as well
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.
added
|
||
-- Step 5: Test ALTER TABLE ... SET ACCESS METHOD to a different method | ||
ALTER TABLE test_partitioned_alter SET ACCESS METHOD columnar; | ||
-- Step 6: Verify the change is applied to future partitions |
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.
similarly we have to verify step 5&6 in one of the worker nodes as well
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.
added
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.
I was trying to verify -- Step 5: Test ALTER TABLE ... SET ACCESS METHOD to a different method
in the worker nodes and I ran into a problem: the access method of the partitions is not updated! So, this PR needs code changes. The following output is from one of the worker nodes:
postgres=# \d+ test_partitioned_alter
Partitioned table "public.test_partitioned_alter"
...
Partitions: test_partition_1 FOR VALUES FROM (0) TO (100),
test_partition_2 FOR VALUES FROM (100) TO (200)
Access method: columnar
postgres=# \d+ test_partition_1
Table "public.test_partition_1"
...
Partition of: test_partitioned_alter FOR VALUES FROM (0) TO (100)
...
Access method: heap
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.
I just checked with the Postgres commit, and actually the existing partitions are not modified.
Specifying an AM for a partitioned table lets the value be used for all future partitions created under it, closely mirroring the behavior of the TABLESPACE option for partitioned
tables. Existing partitions are not modified.
Therefore, Citus is behaving correctly.
We need to modify the tests a little bit, I will leave some comments.
src/test/regress/sql/pg17.sql
Outdated
-- Step 4: Verify that the table and partitions are created and distributed correctly | ||
SELECT relname, relam | ||
FROM pg_class | ||
WHERE relname = 'test_partitioned_alter'; | ||
|
||
-- Check the partitions' access methods | ||
SELECT relname, relam | ||
FROM pg_class | ||
WHERE relname IN ('test_partition_1', 'test_partition_2') | ||
ORDER BY relname; |
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.
We should repeat these steps in one of the worker nodes as well.
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.
added
-- Step 6: Verify the change is applied to future partitions | ||
CREATE TABLE test_partition_3 PARTITION OF test_partitioned_alter | ||
FOR VALUES FROM (200) TO (300); | ||
|
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.
Between step 5 and step 6 we should add another step 4 (in the coordinator) to verify that the access method in the distributed parent changed, but it didn't change in the existing partitions.
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.
added
0709c77
to
97e4e1f
Compare
aaa940a
to
947cd4d
Compare
947cd4d
to
7d61038
Compare
update update fix whitespace update
7d61038
to
280456f
Compare
This PR adds a regression test to verify the behavior of access methods for partitioned and distributed tables, including: