Corner case in xlog stuff: what happens exactly at a seg boundary?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Corner case in xlog stuff: what happens exactly at a seg boundary?
Дата
Msg-id 15952.1154827205@sss.pgh.pa.us
обсуждение исходный текст
Ответы Re: Corner case in xlog stuff: what happens exactly at a seg boundary?
Список pgsql-hackers
I'm noticing that if the current XLOG offset is exactly at a segment
boundary (ie, the last wal record just filled the segment) then the
various user-level functions return offsets that could be interpreted
as the start of the next segment, eg

regression=# select pg_switch_xlog();pg_switch_xlog 
----------------0/14000000
(1 row)

regression=# select pg_xlogfile_from_wal_location(pg_switch_xlog());pg_xlogfile_from_wal_location 
-------------------------------000000010000000000000014
(1 row)

regression=# 

Actually, the last segment file that needs to be archived in this
scenario is 0013; it's possible 0014 doesn't even exist yet.

Rather than expecting user-level scripts to get this corner case
right, I suggest that we ought to modify pg_stop_backup and friends
so that what they return is the last used byte address of WAL, not
the first unused byte address as now.  Then, blindly extracting
the filename will give the right answer about which file to archive,
even in the boundary case.

Comments?
        regards, tom lane


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

Предыдущее
От: Ron Mayer
Дата:
Сообщение: Re: 8.2 features status
Следующее
От: andrew@dunslane.net
Дата:
Сообщение: Re: 8.2 features status