Re: Remove Deprecated Exclusive Backup Mode

Поиск
Список
Период
Сортировка
От David Steele
Тема Re: Remove Deprecated Exclusive Backup Mode
Дата
Msg-id dafc6375-232f-46de-5919-1a5ee8818e09@pgmasters.net
обсуждение исходный текст
Ответ на Re: Remove Deprecated Exclusive Backup Mode  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: Remove Deprecated Exclusive Backup Mode
Список pgsql-hackers
On 7/1/20 4:39 PM, Magnus Hagander wrote:
> On Wed, Jul 1, 2020 at 10:28 PM David Steele <david@pgmasters.net 
>     Here's a thought. What if we just stored the oldest starting LSN and a
>     count of how many backups have been requested. When the backup ends it
>     checks that backup count is > 0 and starting LSN is <= its starting
>     LSN.
>     If not, it throws an error. When backups go to 0 FPWs are turned off if
>     they were off before the first backup.
> 
> I guess the weak spot of that one is if some script does stop without 
> doing start first, it will break somebody else's backup. (And yes, I've 
> seen scripts make this mistake many times -- it equally breaks the 
> exclusive backups in the current system...)

Well, they'd have to pass in a backup_label with a start LSN >= the min 
LSN or they would just get an error and not decrement the backup count.

The real issue would be if they called pg_stop_backup twice. We might be 
able to stop that with a rolling max stop lsn to keep anyone from 
calling pg_stop_backup() twice.

But yeah, it would be possible to kill somebody else's session with some 
finagling. Still, worse case would be an error'd backup rather than a 
corrupt one.

But really, that's only if FPWs are turned off. We can also do some 
extra validation if the session is left open, which for most software is 
the norm now.

> And don't we need the combination of the start/stop location for the 
> history file?

You mean the .backup file for the WAL? All that needs is the 
backup_label and the stop LSN that's determined in pg_stop_backup(). Am 
I missing something?

Regards,
-- 
-David
david@pgmasters.net



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: SQL-standard function body
Следующее
От: Joe Conway
Дата:
Сообщение: Re: pg_read_file() with virtual files returns empty string