Re: Print pg_lsn as a number?

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Print pg_lsn as a number?
Дата
Msg-id 20180613001821.GC3138@paquier.xyz
обсуждение исходный текст
Ответ на Re: Print pg_lsn as a number?  (Andres Freund <andres@anarazel.de>)
Ответы Re: Print pg_lsn as a number?
Список pgsql-general
On Tue, Jun 12, 2018 at 10:39:43AM -0700, Andres Freund wrote:
> On 2018-06-12 09:31:49 -0700, Scott Stroupe wrote:
>> According to the documentation[1], pg_lsn is a 64-bit integer that's
>> printed as two hex numbers separated by a slash, e.g. 68/1225BB70. Is
>> there a way to get the 64-bit integer in a common numeric
>> representation instead of the peculiar hex-slash-hex representation?
>
> What do you want to do with the LSN?

While fixing the slot advance stuff, I would have liked to get an
automatic test able to reproduce the crash where the slot is first
advanced at a page boundary, and then again moved forward.  However it
happens that it is not that easy to do so, so I would be rather
supportive to at least the following operations:
pg_lsn + numeric = pg_lsn.
pg_lsn % numeric = numeric.

We map pg_wal_lsn_diff result to a numeric, so that could make sense to
use numeric as well here, which is not the greatest choice by the way as
that's an int64 internally, but that's more portable for any
(unlikely-to-happen) future changes.

Using the segment size value in pg_settings, you could also advance the
LSN worth a full segment for example...
--
Michael

Вложения

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

Предыдущее
От: Jerry Sievers
Дата:
Сообщение: Re: pg_upgrade 10.2
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Print pg_lsn as a number?