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

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: basebackups during ALTER DATABASE ... SET TABLESPACE ... not safe?
Date: 2015-01-30 20:36:42
Message-ID: 20150130203642.GB13118@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-01-27 20:16:43 +0100, Andres Freund wrote:
> Here's an alternative approach. I think it generally is superior and
> going in the right direction, but I'm not sure it's backpatchable.
>
> It basically consists out of:
> 1) Make GetLockConflicts() actually work.

already commited as being a independent problem.

> 2) Allow the startup process to actually acquire locks other than
> AccessExclusiveLocks. There already is code acquiring other locks,
> but it's currently broken because they're acquired in blocking mode
> which isn't actually supported in the startup mode. Using this
> infrastructure we can actually fix a couple small races around
> database creation/drop.
> 3) Allow session locks during recovery to be heavier than
> RowExclusiveLock - since relation/object session locks aren't ever
> taken out by the user (without a plain lock first) that's safe.

merged and submitted independently.

> 5) Make walsender actually react to recovery conflict interrupts

submitted here. (0003)

> 4) Perform streaming base backups from within a transaction command, to
> provide error handling.
> 6) Prevent access to the template database of a CREATE DATABASE during
> WAL replay.
> 7) Add an interlock to prevent base backups and movedb() to run
> concurrently. What we actually came here for.

combined, submitted here. (0004)

I think this actually doesn't look that bad.

Greetings,

Andres Freund

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

Attachment Content-Type Size
0001-Allow-recovery-lock-infrastructure-to-not-only-hold-.patch text/x-patch 12.9 KB
0002-Fix-startup-process-crash-and-race-during-CREATE-DRO.patch text/x-patch 6.8 KB
0003-Allow-walsender-to-be-cancelled-by-recovery-conflict.patch text/x-patch 1.8 KB
0004-Don-t-allow-changing-a-database-s-tablespace-during-.patch text/x-patch 11.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2015-01-30 21:08:03 Re: Buildfarm broken for 9.3 and up
Previous Message Andres Freund 2015-01-30 20:34:29 Re: Hot Standby WAL reply uses heavyweight session locks, but doesn't have enough infrastructure set up