-
Notifications
You must be signed in to change notification settings - Fork 27
[DPE-7584] Fix temp tablespace permissions #1137
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
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (64.57%) is below the target coverage (70.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## 16/edge #1137 +/- ##
========================================
Coverage 64.57% 64.57%
========================================
Files 17 17
Lines 4325 4325
Branches 667 667
========================================
Hits 2793 2793
Misses 1351 1351
Partials 181 181 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
| if temp_location is not None: | ||
| # Fix permissions on the temporary tablespace location when a reboot happens and tmpfs is being used. | ||
| user = pwd.getpwnam("_daemon_") | ||
| os.chown(temp_location, uid=user.pw_uid, gid=user.pw_gid) |
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 _change_owner() be moved to lib and used to avoid duplicates?
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 believe it's a good idea. I'd change it a bit and create a different Python file (and also move it to the single kernel library repo) to contain utilities related to the filesystem, and keep this library containing only things related to the database connection and interaction.
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 moved the _change_owner() function to the single kernel lib on canonical/postgresql-single-kernel-library#10.
| # Fix permissions on the temporary tablespace location when a reboot happens and tmpfs is being used. | ||
| user = pwd.getpwnam("_daemon_") | ||
| os.chown(temp_location, uid=user.pw_uid, gid=user.pw_gid) | ||
| os.chmod(temp_location, 0o700) |
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, it is 750 there
Are we consistent?
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.
Good catch. I'm checking and testing a consistent approach in all the places where the permissions are specific.
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'll need to change it to 700 everywhere, to be consistent. As we're always accessing the directories as the owner, there is no need to have permissions for the group to access them.
|
Superseeded by canonical/postgresql-single-kernel-library#10. |
Issue
When using
tmpfsfor thetempstorage, if we reboot the host machine, and later, after the charm starts again, it's not possible to create temporary objects, like temporary tables.The reason is that after the reboot, the storage is mounted with wrong ownership and permissions (owned by
rootinstead of_daemon_and with permissions set to755instead of700).Solution
Fix the permissions when the charm starts again.
I'll create a follow-up PR in the single kernel library repo to port those changes.
Checklist