Re: [bug fix] PostgreSQL fails to start on Windows if it crashes after tablespace creation - Mailing list pgsql-hackers

From MauMau
Subject Re: [bug fix] PostgreSQL fails to start on Windows if it crashes after tablespace creation
Date
Msg-id 48E2E45C0A7446D1AF4757B66B2D2D8B@maumau
Whole thread Raw
In response to Re: [bug fix] PostgreSQL fails to start on Windows if it crashes after tablespace creation  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: [bug fix] PostgreSQL fails to start on Windows if it crashes after tablespace creation
List pgsql-hackers
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




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Only first XLogRecData is visible to rm_desc with WAL_DEBUG
Next
From: Bruce Momjian
Date:
Subject: Re: Useless "Replica Identity: NOTHING" noise from psql \d