From: "Amit Kapila" <amit.kapila16@gmail.com>
> 1. Assume a tablespace tbs already exists.
> 2. Create table t1(c1 int) tablespace tbs;
> 3. drop table t1;
> 4. Drop tablespace tbs;
> 5. Do immediate shutdown (pg_ctl stop -mi);
> 6. During recovery it will create a table in directory (in function
> TablespaceCreateDbspace) which needs to be removed by
> destroy_tablespace_directories().
>
> I am neither aware of, nor could think of such a case for
> create_tablespace_directories(). Do you have any such case in mind
> which I might be missing?
A bit contrived example is:
1. After the directory is created by TablespaceCreateDbspace(), recovery is
stopped (e.g. due to power outage). The directory remains.
2. Restart the server, redoing CREATE TABLESPACE during recovery, which
executes create_tablespace_directories().
> By saying above, I don't mean that your current patch has any
> problem; even if there is no such scenario, I think your code is
> right as stat/isdir check seems to be okay to identify junction
> points and it avoids ifdef WIN32 check (which I personally think
> is bit annoying and we should try to avoid such code unless it
> is must or provides any significant advantage).
I think so, too.
Regards
MauMau