Skip site navigation (1) Skip section navigation (2)

Re: BufFileWrite across MAX_PHYSICAL_FILESIZE boundary

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kurt Harriman" <kharriman(at)greenplum(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: BufFileWrite across MAX_PHYSICAL_FILESIZE boundary
Date: 2007-06-01 23:46:48
Message-ID: 27252.1180741608@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
I wrote:
> "Kurt Harriman" <kharriman(at)greenplum(dot)com> writes:
>> Just noticed buffile.c:292 doesn't look quite right where
>> BufFileDumpBuffer calls FileWrite:
>> bytestowrite = FileWrite(thisfile, file->buffer, bytestowrite);
>> It looks as though it would write the same data each time the
>> loop is iterated.  Would this be better?
>> bytestowrite = FileWrite(thisfile, file->buffer + wpos, bytestowrite);

> Yeah, I think you're right.

FYI, I was able to exercise the bug by changing RELSEG_SIZE to 2 within
buffile.c and then running this script in the regression database:

set work_mem = '64kB';
begin;
declare c scroll cursor for select * from tenk1 a join tenk1 b using(two);
fetch 1 from c;
fetch 100 from c;
fetch backward 10 from c;
fetch 100 from c;
fetch backward 10 from c;
fetch 100 from c;
fetch backward 100 from c;
commit;

It doesn't crash with the fix applied.  Thanks for spotting it.

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Jon ColversonDate: 2007-06-02 00:07:44
Subject: Re: Attempt to re-archive existing WAL logs afterrestoringfrom backup
Previous:From: Jim NasbyDate: 2007-06-01 23:42:24
Subject: Re: Ye olde drop-the-database-you-just-left problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group