Re: 64-bit API for large objects

From: Jeremy Drake <pgsql(at)jdrake(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Mark Dilger <pgsql(at)markdilger(dot)com>
Subject: Re: 64-bit API for large objects
Date: 2005-09-23 18:07:30
Message-ID: Pine.LNX.4.63.0509231040590.5158@garibaldi.apptechsys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This patch implements the ability for large objects to be larger than 2GB.
I believe the limit to now be about 2TB, based on the fact that the large
object page size is 2048 bytes, and the page number is still 32 bits.

There are a few things about this patch which probably require tweaking or
at least a closer inspection from the list.

1) The lo_*64 functions are added to the catalog/pg_proc.h (spacing exact
location atm) with OID set to 0, all other entries in this file have OIDs
explicitly defined.

2) The lo_*64, in order to be convenient from the client end, have
functions added to libpq as the existing lo_* functions. The client side
of libpq did not previously know anything about int64 or how to
send/receive them. I added an include of postgres-fe.h (which according
to the comment in that file looks like it should go there) so int64 would
be defined, also implemented functions (code mostly stolen from the server
libpq format functions for same) to convert them to/from network byte
order. I did this in a somewhat inconsistent way between the get and put,
as I did not want to change the existing api at all, and existing code as
little as possible.

3) The 32 bit box I tested this on was a PII 300MHz laptop. Not exactly
the fastest. The "test" consisted entirely of making sure it compiled.
Perhaps someone with a fast IA32 box and spare cycles can test it? Also,
so far the only platforms I have tried to compile this on have been:

* Linux 2.6 (gentoo), AMD64, gcc-3.4.4
* Solaris 8, SPARCv9, gcc-3.4.2
* Linux 2.6 (debian unstable), i686, gcc-3.4.x (laptop, don't remember
exact version).

Would probably be a good idea to verify this on other platforms as well,
or at least other compilers.

Hopefully I did not break anything too badly with this. All of the
regression tests still pass after the patch, and I made a version of the
tests/examples/testlo which uses 64bit (in the patch) which works also. I
grepped in the regression tests, and I could not find any usage of large
objects in them, which I found to be rather odd, which is why I used
testlo and my new testlo64 to test them instead.

On Tue, 20 Sep 2005, Jonah H. Harris wrote:

> Cool. We look forward to it.
>
> On 9/19/05, Mark Dilger <pgsql(at)markdilger(dot)com> wrote:
> >
> > Jonah H. Harris wrote:
> > > Mark,
> > >
> > > If you don't mind contributing the changes, we'd be glad to take a look
> > > at them. Thanks.
> > >
> > > -Jonah
> > >
> >
> > Ok, we will post it back soon. We have tested it on two different 64-bit
> > architectures (Sparc and AMD) and are now testing on pentium before
> > posting up
> > to the list.
> >
> > mark
> >
>
>
>
> --
> Respectfully,
>
> Jonah H. Harris, Database Internals Architect
> EnterpriseDB Corporation
> http://www.enterprisedb.com/
>

--
Mere nonexistence is a feeble excuse for declaring a thing unseeable. You
*can* see dragons. You just have to look in the right direction.
-- John Hasler

Attachment Content-Type Size
postgres-8.0.3-64bit-lo.patch text/plain 22.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-09-23 18:15:40 Re: [PERFORM] Releasing memory during External sorting?
Previous Message Tom Lane 2005-09-23 17:58:21 Re: [GENERAL] 8.1 observation