diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-05-23 10:59:55 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-05-23 10:59:55 -0400 |
commit | 1d96c1b91a4b7da6288ee63671a234b557ff5ccf (patch) | |
tree | d87bb1d8dc0ae7f853e33fa38759ade52a8094df /src/backend/storage/file/fd.c | |
parent | b06d8e58b5ac257c2119312c47c4a0f233c5e0ca (diff) |
Fix incorrect ordering of operations in pg_resetwal and pg_rewind.
Commit c37b3d08c dropped its added GetDataDirectoryCreatePerm call into
the wrong place in pg_resetwal.c, namely after the chdir to DataDir.
That broke invocations using a relative path, as reported by Tushar Ahuja.
We could have left it where it was and changed the argument to be ".",
but that'd result in a rather confusing error message in event of a
failure, so re-ordering seems like a better solution.
Similarly reorder operations in pg_rewind.c. The issue there is that
it doesn't seem like a good idea to do any actual operations before the
not-root check (on Unix) or the restricted token acquisition (on Windows).
I don't know that this is an actual bug, but I'm definitely not convinced
that it isn't, either.
Assorted other code review for c37b3d08c and da9b580d8: fix some
misspelled or otherwise badly worded comments, put the #include for
<sys/stat.h> where it actually belongs, etc.
Discussion: https://postgr.es/m/aeb9c3a7-3c3f-a57f-1a18-c8d4fcdc2a1f@enterprisedb.com
Diffstat (limited to 'src/backend/storage/file/fd.c')
-rw-r--r-- | src/backend/storage/file/fd.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 441f18dcf56..8dd51f17674 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -3552,8 +3552,8 @@ fsync_parent_path(const char *fname, int elevel) /* * Create a PostgreSQL data sub-directory * - * The data directory itself, along with most other directories, are created at - * initdb-time, but we do have some occations where we create directories from + * The data directory itself, and most of its sub-directories, are created at + * initdb time, but we do have some occasions when we create directories in * the backend (CREATE TABLESPACE, for example). In those cases, we want to * make sure that those directories are created consistently. Today, that means * making sure that the created directory has the correct permissions, which is @@ -3562,8 +3562,8 @@ fsync_parent_path(const char *fname, int elevel) * Note that we also set the umask() based on what we understand the correct * permissions to be (see file_perm.c). * - * For permissions other than the default mkdir() can be used directly, but be - * sure to consider carefully such cases -- a directory with incorrect + * For permissions other than the default, mkdir() can be used directly, but + * be sure to consider carefully such cases -- a sub-directory with incorrect * permissions in a PostgreSQL data directory could cause backups and other * processes to fail. */ |