BUG in XLogRecordAssemble

Started by Zhang Zqalmost 11 years ago3 messageshackers
Jump to latest
#1Zhang Zq
zqzhangmail@163.com

hi,
I found the code in 'backend/access/transam/xloginsert.c' as that:
XLogRecordAssemble:
if (prev_regbuf && RelFileNodeEquals(regbuf->rnode, prev_regbuf->rnode))
{
samerel = true;
bkpb.fork_flags |= BKPBLOCK_SAME_REL;
prev_regbuf = regbuf;
}
else
samerel = false;

There is the only place that prev_regbuf is assigned, so prev_regbuf will never be assigned.
The patch will fix it, Thanks.
Zhang Zq

Attachments:

XLogRecordAssemble.patchapplication/octet-stream; name=XLogRecordAssemble.patchDownload+1-1
#2Michael Paquier
michael@paquier.xyz
In reply to: Zhang Zq (#1)
Re: BUG in XLogRecordAssemble

On Tue, May 5, 2015 at 1:04 AM, Zhang Zq <zqzhangmail@163.com> wrote:

There is the only place that prev_regbuf is assigned, so prev_regbuf will
never be assigned.
The patch will fix it, Thanks.

Indeed. I think you are right. We never set prev_regbuf with the current code.
--
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Zhang Zq (#1)
Re: BUG in XLogRecordAssemble

On 05/04/2015 07:04 PM, Zhang Zq wrote:

hi,
I found the code in 'backend/access/transam/xloginsert.c' as that:
XLogRecordAssemble:
if (prev_regbuf && RelFileNodeEquals(regbuf->rnode, prev_regbuf->rnode))
{
samerel = true;
bkpb.fork_flags |= BKPBLOCK_SAME_REL;
prev_regbuf = regbuf;
}
else
samerel = false;

There is the only place that prev_regbuf is assigned, so prev_regbuf will never be assigned.
The patch will fix it, Thanks.

Thanks, good catch! Committed.

- Heikki

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers