question about zeroes in the wal file names

Поиск
Список
Период
Сортировка
От Luca Ferrari
Тема question about zeroes in the wal file names
Дата
Msg-id CAKoxK+67oS+PSygdmRHbn-GSjE_TY+t6Gzk6CRzcw-HVGswzOA@mail.gmail.com
обсуждение исходный текст
Ответы Re: question about zeroes in the wal file names  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Re: question about zeroes in the wal file names  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-general
I'm just curious to better understand the naming convention behind wal
files, because I've seen on a system of mine that the wals created
were:

000000050000020E000000FF
 000000050000020F00000000

while I was expecting 20E0x100. So I digged into the code and I've
seen, from the XLogFileName macro, that the last part is built as the
reminder of the number of segments per wal file:

#define XLogFileName(fname, tli, logSegNo, wal_segsz_bytes)    \
    snprintf(fname, MAXFNAMELEN, "%08X%08X%08X", tli,        \
             (uint32) ((logSegNo) / XLogSegmentsPerXLogId(wal_segsz_bytes)), \
             (uint32) ((logSegNo) % XLogSegmentsPerXLogId(wal_segsz_bytes)))


and with the default wal size of 16 MB that gives a remainder of 256
(FF + 1). Assuming I haven't missed anything, this means that there
are 6 zeroes that will never change in the last 8 chars of the wal
filename.  Is therefore this only done to handle PostgreSQL WAL sizes
of 4 GB each?

Thanks,
Luca



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

Предыдущее
От: Melvin Davidson
Дата:
Сообщение: Re: How to determine what is preventing deleting a rule
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Missing Trigger after pgdump install