Skip to content

PG-1504 Make partitions inherit encryption status #253

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

Open
wants to merge 2 commits into
base: TDE_REL_17_STABLE
Choose a base branch
from

Conversation

AndersAstrand
Copy link
Collaborator

Since the access method isn't included in the statement we'll have to look it up on the parent in the same way DefineRelation() does.

@codecov-commenter
Copy link

codecov-commenter commented Apr 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.44%. Comparing base (b7d52ab) to head (6a2d44f).
Report is 5 commits behind head on TDE_REL_17_STABLE.

❌ Your project status has failed because the head coverage (78.44%) is below the target coverage (90.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@                  Coverage Diff                  @@
##           TDE_REL_17_STABLE     #253      +/-   ##
=====================================================
+ Coverage              78.34%   78.44%   +0.10%     
=====================================================
  Files                     22       22              
  Lines                   2484     2496      +12     
  Branches                 391      394       +3     
=====================================================
+ Hits                    1946     1958      +12     
  Misses                   462      462              
  Partials                  76       76              
Components Coverage Δ
access 79.35% <ø> (ø)
catalog 86.23% <ø> (ø)
common 92.50% <ø> (ø)
encryption 71.90% <ø> (ø)
keyring 72.07% <ø> (ø)
src 55.55% <100.00%> (+1.76%) ⬆️
smgr 98.01% <ø> (ø)
transam ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@jeltz jeltz left a comment

Choose a reason for hiding this comment

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

I think it has a bug, but even if not I think the tests should also involve the GUC.

@dutow
Copy link
Collaborator

dutow commented Apr 23, 2025

I'm not 100% sure how to handle enforce_encryption with this.
Currently by looking at the code, if it is set, we can't create new partitions for not encrypted tables.
Which probably makes sense, but on the other hand we do allow to do other modifications of non encrypted tables, like creating new indexes.

At least the testcase could include this behavior.

@AndersAstrand AndersAstrand force-pushed the tde/table-inherit-access-method branch from bcb9f9a to f1beaf2 Compare April 24, 2025 09:40
@AndersAstrand
Copy link
Collaborator Author

I'm not 100% sure how to handle enforce_encryption with this. Currently by looking at the code, if it is set, we can't create new partitions for not encrypted tables. Which probably makes sense, but on the other hand we do allow to do other modifications of non encrypted tables, like creating new indexes.

At least the testcase could include this behavior.

Agreed! I included the current behavior in the test, we can change it later if we would want to allow creation of unencrypted partitions even if the GUC is set.

Copy link
Collaborator

@jeltz jeltz left a comment

Choose a reason for hiding this comment

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

I think there is one case with the default GUC which is still not properly handled but I could be wrong.

@AndersAstrand AndersAstrand force-pushed the tde/table-inherit-access-method branch from f1beaf2 to 1041d55 Compare April 25, 2025 16:11
@AndersAstrand
Copy link
Collaborator Author

I think there is one case with the default GUC which is still not properly handled but I could be wrong.

Should be fixed now!

Since the access method isn't included in the statement we'll have to
look it up on the parent in the same way DefineRelation() does.
@AndersAstrand AndersAstrand force-pushed the tde/table-inherit-access-method branch from 1041d55 to 134bf2e Compare April 25, 2025 16:23
parentOid = RangeVarGetRelid(linitial(stmt->inhRelations),
AccessExclusiveLock,
false);
parentAmOid = get_rel_relam(parentOid);
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could accomplish the same with relation_open_rv() but I am not sure which is cleaner.

AccessExclusiveLock,
false);
parentAmOid = get_rel_relam(parentOid);
foundAccessMethod = (bool) parentAmOid;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think PostgreSQL style for this is foundAccessMethod = parentAmOid != InvalidOid.

Copy link
Collaborator Author

@AndersAstrand AndersAstrand Apr 26, 2025

Choose a reason for hiding this comment

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

Yes! That's better. I didn't know about InvalidOid so i felt this was just as good as randomly comparing to 0

Pushed a fixup and also added a noop to the if just below to make it slightly clearer what's going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants