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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: ERROR: invalid memory alloc request size <a_big_number_here>


  • From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
  • To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
  • Cc: Matteo Beccati <php(at)beccati(dot)com>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, pgsql-hackers(at)postgresql(dot)org
  • Subject: Re: ERROR: invalid memory alloc request size <a_big_number_here>
  • Date: Thu, 27 Oct 2005 12:08:47 -0400
  • Message-id: <19645(dot)1130429327(at)sss(dot)pgh(dot)pa(dot)us>

Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> Tom Lane wrote:
>> I don't see any easy way to fix this except by introducing a lot more
>> locking than is there now --- ie, holding the MultiXactGenLock until the
>> new mxact's starting offset has been written to disk.  Any better ideas?

> Well, it isn't a very good solution because it requires us to retain the
> MultiXactGenLock past a XLogInsert and some I/O on SLRU pages.

Yeah :-(.  If MultiXactGenLock wasn't a bottleneck before, it will soon
become one.

> I confess being attracted to Martijn's idea of looping until the correct
> answer is obtained.  I don't think it's even too difficult to implement.
> But I wonder if there's some hidden pitfall.

I've been looking at that and I think it can work.  The key point is
that GetNewMultiXactId() does guarantee that space has been allocated
for the new mxact's offset before it releases the lock (else we'd risk
trying to read a nonexistent slru page when we fetch the offset in
GetMultiXactIdMembers).  And we are careful to zero out newly allocated
space.  So it should be safe to assume that the offset will be zero if
it hasn't been initialized yet.  So we could loop if we see zero.

We'd have to make sure zero is never the *correct* value of the offset,
but that just means wasting one word, which seems no problem.

			regards, tom lane



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group