From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
---|---|
To: | a(dot)lepikhov(at)postgrespro(dot)ru, PostgreSQL-Dev <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [PATCH] XLogReadRecord returns pointer to currently read page |
Date: | 2018-10-21 21:06:02 |
Message-ID: | 25cc0d31-a5c7-2b7d-e66e-f5cc9f2d4985@iki.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 17/08/2018 06:47, Andrey Lepikhov wrote:
> 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.
Hmm. I agree it looks weird the way it is. But I wonder, why do we even
copy the record to readRecordBuf, if it fits on the WAL page? Returning
a pointer to the xlog page buffer seems OK in that case. What if we
remove the memcpy(), instead?
- Heikki
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Korotkov | 2018-10-21 21:18:15 | Re: Pluggable Storage - Andres's take |
Previous Message | Tom Lane | 2018-10-21 20:24:16 | Re: remove deprecated @@@ operator ? |