Re: [HACKERS] Problems with >2GB tables on Linux 2.0

From: Peter T Mount <peter(at)retep(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Problems with >2GB tables on Linux 2.0
Date: 1999-02-07 19:42:52
Message-ID: Pine.LNX.4.04.9902071920280.6820-100000@maidast.retep.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 7 Feb 1999, Tom Lane wrote:

> Peter T Mount <peter(at)retep(dot)org(dot)uk> writes:
> > As expected, the splitting of the file works fine. So the code isn't
> > broken. What I think is happening is that the code extends the table, then
> > tests to see if it's at the 2Gig limit, and when it is, creates the next
> > file for that table.
>
> > However, I think the OS has problems with a file exactly 2Gb in size.
>
> Oh! I didn't realize that we were trying to extend the file to
> *exactly* 2Gb. Indeed that's a very dangerous thing to do: the file
> size in bytes will be 0x80000000, which will appear to be negative when
> viewed as a signed 32-bit integer; unless your OS is very careful about
> signed vs. unsigned arithmetic, it will break.
>
> For that matter it's not impossible that our own code contains similar
> problems, if it does much calculating with byte offsets into the file.
> (The pushups that darrenk had to do in order to calculate RELSEG_SIZE
> in the first place should have suggested to him that running right at
> the overflow limit was not such a hot idea...)
>
> I'd suggest setting the limit a good deal less than 2Gb to avoid any
> risk of arithmetic overflow. Maybe 200000 8K blocks, instead of 262144.

That might be an idea.

I've just re-synced by copy of the cvs source, so I'll set it there, and
we'll know by the morning if it's worked or not.

> And change the comment while you're at it, not just the code ;-)

Will do :-)

Peter

--
Peter T Mount peter(at)retep(dot)org(dot)uk
Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
Java PDF Generator: http://www.retep.org.uk/pdf

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-02-07 20:08:42 Re: [HACKERS] One I've never seen before:
Previous Message Jan Wieck 1999-02-07 19:41:10 Re: [HACKERS] trouble with rules