On Tue, Jul 23, 2019 at 02:54:20PM +0800, Ning Yu wrote:
> MakePGDirectory() is also called in TablespaceCreateDbspace(), EEXIST is
> considered as non-error for parent directories, however as it considers
> EEXIST as a failure for the last level of the path so the logic is
> still correct,
So the complains here are about two things:
- In some code paths calling mkdir, we don't care about the fact that
EEXIST can happen for something else than a folder. This could be a
problem if we have conflicts in the backend related to the naming of
the files/folders created. I find a bit surprising to not perform
the sanity checks in MakePGDirectory() in your patch. What of all the
existing callers of this routine?
- pg_mkdir_p is pretty bad at detecting problems with concurrent
creation of parent directories, leading to random failures where these
should not happen.
I may be missing something, but your patch does not actually fix
problem 2, no? Trying to do an initdb with a set of N folders using
the same parent folders not created still results in random failures.
--
Michael