[patch] Fix pg_checksums to allow checking of offline base backupdirectories

Поиск
Список
Период
Сортировка
От Michael Banck
Тема [patch] Fix pg_checksums to allow checking of offline base backupdirectories
Дата
Msg-id 78c199841acb84a47b55fd2dd6ee9619ab8a09c2.camel@credativ.de
обсуждение исходный текст
Ответы Re: [patch] Fix pg_checksums to allow checking of offline basebackup directories
Список pgsql-hackers
Hi,

Right now, pg_checksums cannot check a base backup directory taken by
pg_basebackup:

initdb -k data > /dev/null
pg_ctl -D data -l logfile start > /dev/null
pg_basebackup -D data_backup
pg_checksums -D data_backup 
pg_checksums: error: cluster must be shut down

So users need to start and then stop postgres on the base backup
directory in order to run pg_checksums on it. This is due to this check
in pg_checksums.c:

        if (ControlFile->state != DB_SHUTDOWNED &&
                ControlFile->state != DB_SHUTDOWNED_IN_RECOVERY)
        {
                pg_log_error("cluster must be shut down");

I think we can allow checking of base backups if we make sure
backup_label exists in the data directory or am I missing something?
I think we need to have similar checks about pages changed during base
backup, so this patch ignores checksum failures between the checkpoint
LSN and (as a reasonable upper bound) the last LSN of the last existing
transaction log file. If no xlog files exist (the --wal-method=none
case), the last LSN of the checkpoint WAL segment is taken.


Michael

-- 
Michael Banck
Projektleiter / Senior Berater
Tel.: +49 2166 9901-171
Fax:  +49 2166 9901-100
Email: michael.banck@credativ.de

credativ GmbH, HRB Mönchengladbach 12080
USt-ID-Nummer: DE204566209
Trompeterallee 108, 41189 Mönchengladbach
Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer

Unser Umgang mit personenbezogenen Daten unterliegt
folgenden Bestimmungen: https://www.credativ.de/datenschutz

Вложения

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

Предыдущее
От: davinder singh
Дата:
Сообщение: PG compilation error with Visual Studio 2015/2017/2019
Следующее
От: David Rowley
Дата:
Сообщение: Re: Make MemoryContextMemAllocated() more precise