Re: basebackups during ALTER DATABASE ... SET TABLESPACE ... not safe?

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: basebackups during ALTER DATABASE ... SET TABLESPACE ... not safe?
Date: 2015-01-27 02:03:10
Message-ID: 20150127020310.GG4655@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-01-26 22:03:03 +0100, Andres Freund wrote:
> Attached is a patch trying to this. Doesn't look too bad and lead me to
> discover missing recovery conflicts during a AD ST.
>
> But: It doesn't actually work on standbys, because lock.c prevents any
> stronger lock than RowExclusive from being acquired. And we need need a
> lock that can conflict with WAL replay of DBASE_CREATE, to handle base
> backups that are executed on the primary. Those obviously can't detect
> whether any standby is currently doing a base backup...
>
> I currently don't have a good idea how to mangle lock.c to allow
> this. I've played with doing it like in the second patch, but that
> doesn't actually work because of some asserts around ProcSleep - leading
> to locks on database objects not working in the startup process (despite
> already being used).
>
> The easiest thing would be to just use a lwlock instead of a heavyweight
> lock - but those aren't canceleable...

As Stephen noticed on irc I forgot to attach those. Caused by the
generic HS issue mentioned in 20150126212458(dot)GA29457(at)awork2(dot)anarazel(dot)de(dot)

Attached now.

As mentioned above, this isn't really isn't ready (e.g. it'll Assert() on a
standby due to the HS issue).

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
0001-Prevent-ALTER-DATABASE-SET-TABLESPACE-from-running-c.patch text/x-patch 7.7 KB
2.patch text/x-patch 6.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-01-27 02:08:25 Re: Misaligned BufferDescriptors causing major performance problems on AMD
Previous Message Andres Freund 2015-01-27 01:04:07 Re: Misaligned BufferDescriptors causing major performance problems on AMD