[PATCH] XLogReadRecord returns pointer to currently read page

Поиск
Список
Период
Сортировка
От Andrey Lepikhov
Тема [PATCH] XLogReadRecord returns pointer to currently read page
Дата
Msg-id c2ea54dd-a1d3-80eb-ddbf-7e6f258e615e@postgrespro.ru
обсуждение исходный текст
Ответы Re: [PATCH] XLogReadRecord returns pointer to currently read page
Re: [PATCH] XLogReadRecord returns pointer to currently read page
Список pgsql-hackers
Hi, hackers!

I propose the patch for fix one small code defect.
The XLogReadRecord() function reads the pages of a WAL segment that 
contain a WAL-record. Then it creates a readRecordBuf buffer in private 
memory of a backend and copy record from the pages to the readRecordBuf 
buffer. Pointer 'record' is set to the beginning of the readRecordBuf 
buffer.

But if the WAL-record is fully placed on one page, the XLogReadRecord() 
function forgets to bind the "record" pointer with the beginning of the 
readRecordBuf buffer. In this case, XLogReadRecord() returns a pointer 
to an internal xlog page. This patch fixes the defect.

Previously, in all cases of using WAL this was not a problem. However if 
you plan to perform some decoding operations before returning the WAL 
record to the caller (this is my case), this can lead to bugs that are 
difficult to catch.


-- 
Andrey Lepikhov
Postgres Professional
https://postgrespro.com
The Russian Postgres Company

Вложения

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

Предыдущее
От: Tatsuro Yamada
Дата:
Сообщение: Re: Fix help option of contrib/oid2name
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [PATCH] XLogReadRecord returns pointer to currently read page