Re: crash-recovery replay of CREATE TABLESPACE is broken in HEAD
Bruce Momjian <bruce@momjian.us>
From: Bruce Momjian <bruce@momjian.us>
To: Bruce Momjian <bruce@momjian.us>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>, pgsql-hackers@postgresql.org
Date: 2010-07-20T18:21:47Z
Lists: pgsql-hackers
Attachments
- /rtmp/diff (text/x-diff) patch
Bruce Momjian wrote:
> Bruce Momjian wrote:
> > > The attached patch does as suggested. I added the recovery code to the
> > > create tablespace function so I didn't have to duplicate all the code
> > > that computes the path names.
> > >
> > > Attached.
> >
> > Uh, another question. Looking at the createdb recovery, I see:
> >
> > /*
> > * Our theory for replaying a CREATE is to forcibly drop the target
> > * subdirectory if present, then re-copy the source data. This may be
> > * more work than needed, but it is simple to implement.
> > */
> > if (stat(dst_path, &st) == 0 && S_ISDIR(st.st_mode))
> > {
> > if (!rmtree(dst_path, true))
> > ereport(WARNING,
> > (errmsg("some useless files may be left behind in old database directory \"%s\"",
> > dst_path)));
> > }
> >
> > Should I be using rmtree() on the mkdir target?
> >
> > Also, the original tablespace recovery code did not drop the symlink
> > first. I assume that was not a bug only because we don't support moving
> > tablespaces:
>
> For consistency with CREATE DATABASE recovery and for reliablity, I
> coded the rmtree() call instead. Patch attached.
Attached patch applied to HEAD and 9.0. 9.0 open item moved to
completed.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ None of us is going to be here forever. +