-
Notifications
You must be signed in to change notification settings - Fork 742
Keep temp reloid for columnar cases #8309
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
Conversation
5f5da94 to
15ecb4b
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.
Currently evaluating this solution.
@manaldush UPDATE: after taking advice from my colleague @colm-mchugh as well, we decided this approach is better compared to #8303 for two reasons:
- it avoids an extra scan of
pg_classfor temp tables. - It doesn't revert behavior that PG identified as broken, like #8303 does.
We also need comments for ColumnarRelationId and RelationPrecomputeOid_compat. Thanks for the PR.
| #define RelationPhysicalIdentifierBackend_compat(a) (a->smgr_rnode.node) | ||
| typedef RelFileNode RelFileLocator; | ||
| typedef Oid RelFileNumber; | ||
| #define RelidByRelfilenumber(a, b) RelidByRelfilenode(a, b) |
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.
Should keep this as it's needed for PG15 support.
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.
fixed
src/include/pg_version_compat.h
Outdated
|
|
||
| #define RelationPhysicalIdentifier_compat(a) ((a)->rd_locator) | ||
| #define RelationTablespace_compat(a) (a.spcOid) | ||
| #define RelationPrecomputeOid_compat(a) (RelationUsesLocalBuffers(a) ? RelationGetRelid( \ |
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 should be defined in columnar.h because all PG versions need it (we use pg_version_compat.h file for functions that need compatibility changes between different PG versions)
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.
Fixed and renamed according with #8309 (comment)
| TupleDesc tupleDescriptor; | ||
| FmgrInfo **comparisonFunctionArray; | ||
| RelFileLocator relfilelocator; | ||
| Oid temp_relid; /* We can't rely on RelidByRelfilenumber for temp tables anymore.*/ |
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.
| Oid temp_relid; /* We can't rely on RelidByRelfilenumber for temp tables anymore.*/ | |
| Oid temp_relid; /* We can't rely on RelidByRelfilenumber for temp tables since PG18 */ |
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 see change in RelidByRelfilenumber in all version since PG13(be aware till PG16 RelidByRelfilenumber = RelidByRelfilenumber), so fixed with since PG13. If you have some doubts about this change, please notify me, I will fix it
src/include/pg_version_compat.h
Outdated
|
|
||
| #define RelationPhysicalIdentifier_compat(a) ((a)->rd_locator) | ||
| #define RelationTablespace_compat(a) (a.spcOid) | ||
| #define RelationPrecomputeOid_compat(a) (RelationUsesLocalBuffers(a) ? RelationGetRelid( \ |
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.
| #define RelationPrecomputeOid_compat(a) (RelationUsesLocalBuffers(a) ? RelationGetRelid( \ | |
| #define RelationPrecomputeOid(a) (RelationUsesLocalBuffers(a) ? RelationGetRelid( \ |
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.
Fixed and moved to columnar.h according to #8309 (comment)
15ecb4b to
5565920
Compare
Codecov Report❌ Patch coverage is ❌ Your project check has failed because the head coverage (62.18%) is below the target coverage (87.50%). You can increase the head coverage or adjust the target coverage.
Additional details and impacted files@@ Coverage Diff @@
## m3hm3t/pg18_beta_confs #8309 +/- ##
===========================================================
- Coverage 88.96% 62.18% -26.78%
===========================================================
Files 287 287
Lines 63134 62956 -178
Branches 7941 7895 -46
===========================================================
- Hits 56165 39148 -17017
- Misses 4660 20826 +16166
- Partials 2309 2982 +673 🚀 New features to boost your workflow:
|
| * to get correct relid value. | ||
| * | ||
| * Now it is basically used for temp rels, because since PGXX RelidByRelfilenumber | ||
| * Now it is basically used for temp rels, because since PG13 RelidByRelfilenumber |
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.
Might be a bit misleading since it was a backport to PG13. Lets say sth like "since PG18 (it was backpatched through PG13)"
Same comment for columnar.h file
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.
fixed
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.
Also citusdata:m3hm3t/pg18_beta_confs has been force pushed so could you update the PR accordingly?
EDIT: @manaldush in fact we use citusdata:m3hm3t/pg18_beta_confs for sanity checks only, and we merge directly to main branch, so it would be great if you can update the base branch to citusdata:main and include ONLY your commits.
After PG vanilla commit ab874faaa1f, RelidByRelfilenumber logic was changed, now for temp objects its return O oid. For such cases we can use alternative approach with keeping temp relations oids directly.
Fix PR comments.
Fix PR comments.
Fix PR comments.
28af426 to
cbf097f
Compare
done, now branch m3hm3t/pg18_beta_confs_8235 branched from main. |
naisila
left a comment
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.
LGTM, thanks
Backporting citusdata#8235 PG18 and PG latest minors ignore temporary relations in `RelidByRelfilenumber` (`RelidByRelfilenode` in PG15) Relevant PG commit: postgres/postgres@86831952 Here we are keeping temp reloids instead of getting it with RelidByRelfilenumber, for example, in some cases, we can directly get reloid from relations, in other cases we keep it in some structures. Note: there is still an outstanding issue with columnar temp tables in concurrent sessions, that will be fixed in PR citusdata#8252
Backporting citusdata#8235 PG18 and PG latest minors ignore temporary relations in `RelidByRelfilenumber` (`RelidByRelfilenode` in PG15) Relevant PG commit: postgres/postgres@86831952 Here we are keeping temp reloids instead of getting it with RelidByRelfilenumber, for example, in some cases, we can directly get reloid from relations, in other cases we keep it in some structures. Note: there is still an outstanding issue with columnar temp tables in concurrent sessions, that will be fixed in PR citusdata#8252 (cherry picked from commit daa69be)
Backporting citusdata#8235 PG18 and PG latest minors ignore temporary relations in `RelidByRelfilenumber` (`RelidByRelfilenode` in PG15) Relevant PG commit: postgres/postgres@86831952 Here we are keeping temp reloids instead of getting it with RelidByRelfilenumber, for example, in some cases, we can directly get reloid from relations, in other cases we keep it in some structures. Note: there is still an outstanding issue with columnar temp tables in concurrent sessions, that will be fixed in PR citusdata#8252 (cherry picked from commit daa69be)
Backporting citusdata#8235 PG18 and PG latest minors ignore temporary relations in `RelidByRelfilenumber` (`RelidByRelfilenode` in PG15) Relevant PG commit: postgres/postgres@86831952 Here we are keeping temp reloids instead of getting it with RelidByRelfilenumber, for example, in some cases, we can directly get reloid from relations, in other cases we keep it in some structures. Note: there is still an outstanding issue with columnar temp tables in concurrent sessions, that will be fixed in PR citusdata#8252 (cherry picked from commit daa69be)
Fixes #8235
PG18 and PG latest minors ignore temporary relations in
RelidByRelfilenumber(RelidByRelfilenodein PG15)Relevant PG commit:
postgres/postgres@86831952
Here we are keeping temp reloids instead of getting it with RelidByRelfilenumber, for example, in some cases, we can directly get reloid from relations, in other cases we keep it in some structures.
Note: there is still an outstanding issue with columnar temp tables in concurrent sessions, that will be fixed in PR #8252
Alternative PR to #8303
Comparing with #8303, this approach avoids copy-paste of PG vanilla codebase