Skip to content
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

feat(wale-clone): Added data dir permission change (0700) during cloning #920

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

Conversation

thedatabaseme
Copy link
Contributor

@thedatabaseme thedatabaseme commented Sep 12, 2023

In the launch.sh script, the permissions of PGROOT and PGDATA directories are already set. In situations where you clone an instance from a source with wrong permissions (e.g. 0775) on the PGDATA directory, the clone will fail during recovery, since the permissions will be set wrong.

The error will be something like this:

data directory "/home/postgres/pgdata/pgroot/data" has invalid permissions
DETAIL:  Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).

A reason why the permissions are updated by Kubernetes itself can be, if there is a kubelet restart on a worker node. This will lead to a permission change to allow full access to whatever fsGroup is specified. This is done recursively on the root folder. So the result will be 0770 permissions. See here for more details. The same happens also during kubelet restarts.

This PR includes setting the permissions to 0700 of the PGDATA directory after the backup-fetch has been done. The actual instance recovery will therefore not fail.

I hope you find this helpful.

Kind regards
Philip

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.

None yet

1 participant