-
Notifications
You must be signed in to change notification settings - Fork 671
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 compatibility: Fix Test Failure in local_table_join #7732
base: naisila/pg17_support
Are you sure you want to change the base?
Conversation
(cherry picked from commit ae3ed7d)
(cherry picked from commit 76f60a7)
(cherry picked from commit df9c7b4)
In PG17, the outer loop in acquire_sample_rows() changed from while (BlockSampler_HasMore(&bs)) to while (table_scan_analyze_next_block(scan, stream)) Relevant PG commit: 041b96802efa33d2bc9456f2ad946976b92b5ae1 postgres/postgres@041b968 It is expected that the scan_analyze_next_block function will check if there are any blocks left. So we add that check in columnar_scan_analyze_next_block (cherry picked from commit 7eb0ad5)
PG 17 added support for DEFAULT in ALTER TABLE .. SET ACCESS METHOD Relevant PG commit: d61a6cad6418f643a5773352038d0dfe5d3535b8 postgres/postgres@d61a6ca In that case, name in AlterTableCmd would be null. Add a null check here to avoid crash. (cherry picked from commit 71b9974)
…tests Fix pg15 pg16 multi_mx_create_table multi_schema_support Relevant PG commit: postgres/postgres@f696c0c f696c0cd5f299f1b51e214efc55a22a782cc175d (cherry picked from commit 17a2ed0)
Relevant PG commit: f69319f2f1fb16eda4b535bcccec90dff3a6795e postgres/postgres@f69319f (cherry picked from commit 6c12b10)
This PR addresses a regression test failure in the multi-mx feature of Citus with the new PostgreSQL 17 version. The regression was identified during the execution of multi-node tests, specifically targeting compatibility issues introduced with PostgreSQL 17. --------- Co-authored-by: Mehmet YILMAZ <[email protected]> (cherry picked from commit 70cf729)
This reverts commit e4040dd. Reverting for now as this commit is fixing more than one thing at once at multi_extension.out file Its a harmless revert for testing purposes
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## naisila/pg17_support #7732 +/- ##
========================================================
- Coverage 89.61% 89.61% -0.01%
========================================================
Files 274 274
Lines 59689 59689
Branches 7446 7446
========================================================
- Hits 53490 53488 -2
Misses 4069 4069
- Partials 2130 2132 +2 |
@@ -1438,7 +1442,7 @@ set citus.local_table_join_policy to 'prefer-distributed'; | |||
SELECT COUNT(*) FROM distributed_table d1 JOIN postgres_table using(key) | |||
WHERE d1.key IN (SELECT key FROM distributed_table WHERE d1.key = key and key = 5); | |||
DEBUG: Wrapping relation "distributed_table" "d1" to a subquery | |||
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join.distributed_table d1 WHERE true | |||
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join.distributed_table d1 WHERE (key OPERATOR(pg_catalog.=) 5) |
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 just two lines with the same change (key OPERATOR(pg_catalog.=) 5)
How about a normalized line, we can change the table names such that the normalization rule detects the line easily.
e.g.
postgres_table_key5_filtering
distributed_table_key5_filtering
Just an idea, could be better. But I am reluctant of merging a new file with 1659 new lines just for 2 lines change in the test output. What do you think?
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.
Applied the solution
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.
Thanks, these changes make sense. Based on your solution, I think we can leverage renaming the table even further by using a table alias, this will make changes even more minimal. What I mean by this:
In order to include everything with one normalize line, and avoid creating a new table, we can make use of aliases. For example, table_diff_filtering
alias. We can include this alias in local_dist_join_mixed
line difference as well. And we can change the output to WHERE true
(in local_table_join, WHERE true
is in PG16; in local_dist_join_mixed, WHERE true
is in PG17, but we don't need to document this part)
I did a sketch commit and it seems to work. https://github.com/citusdata/citus/tree/naisila/try_filtering_diff
Could you please update this PR accordingly?
(PS: We had used this table alias trick in PG16 support as well, I believe it deserves to be added to the documentation.)
update update . update
12b095e
to
7ba57a6
Compare
46dc966
to
6d036b0
Compare
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.
Hey Mehmet, after your remarks and @onurctirtir's ones, I re-checked this test. You are right that the filter change is not trivial.
However, the filter is not necessary to what the test is about: the test is about correlated sublinks not being yet supported. If we remove "key = 5" from the query, we still have a correlated sublink. So, we can remove "key = 5" from the queries and the result will be the same, and this will get rid of the test difference between versions.
On the other hand, we can add the test with "key = 5" to pg17.sql
to see the improvement of Postgres applied in Citus.
All makes sense to me, let's do both. |
e108bb8
to
c396ce6
Compare
PostgreSQL 17 seems to have introduced improvements in how correlated subqueries are handled during plan generation. Instead of generating a trivial subplan with WHERE true, it now applies more specific filtering (WHERE (key = 5)), which makes the execution plan more efficient.
postgres/postgres@b262ad44