From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Ed Loehr <eloehr(at)austin(dot)rr(dot)com> |
Cc: | pghackers <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | Re: [HACKERS] Re: ERROR: out of free buffers: time to abort ! |
Date: | 2000-01-08 22:57:15 |
Message-ID: | 9208.947372235@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Ed Loehr <eloehr(at)austin(dot)rr(dot)com> writes:
> Tom Lane wrote:
>> Yes, a postmaster restart would clean up the buffer reference counts.
>> I think there were also some less drastic code paths that would clean
>> them up --- you might try something as simple as deliberately inducing
>> an SQL error now and then, so that error cleanup runs.
> What *kind* of SQL error would trigger the cleanup?
Actually, on looking at the code it doesn't seem that error recovery
will fix things --- nothing short of a postmaster restart will do it.
Instead of hacking up your application code to work around this problem,
why don't you try applying the following patch to the 6.5.3 sources.
You may get some "Buffer Leak" notice messages, but it ought to work
better than it does now. (I think --- this is off-the-cuff and not
tested ... but the complete changes that I put into current sources are
much too large to risk back-patching.)
Keep us posted.
regards, tom lane
*** src/backend/storage/buffer/bufmgr.c~ Sat Jan 8 17:44:58 2000
--- src/backend/storage/buffer/bufmgr.c Sat Jan 8 17:49:15 2000
***************
*** 1202,1213 ****
for (i = 1; i <= NBuffers; i++)
{
CommitInfoNeedsSave[i - 1] = 0;
if (BufferIsValid(i))
{
while (PrivateRefCount[i - 1] > 0)
ReleaseBuffer(i);
}
- LastRefCount[i - 1] = 0;
}
ResetLocalBufferPool();
--- 1202,1218 ----
for (i = 1; i <= NBuffers; i++)
{
CommitInfoNeedsSave[i - 1] = 0;
+ /*
+ * quick hack: any refcount still being held in LastRefCount
+ * needs to be released.
+ */
+ PrivateRefCount[i - 1] += LastRefCount[i - 1];
+ LastRefCount[i - 1] = 0;
if (BufferIsValid(i))
{
while (PrivateRefCount[i - 1] > 0)
ReleaseBuffer(i);
}
}
ResetLocalBufferPool();
***************
*** 1228,1233 ****
--- 1233,1244 ----
for (i = 1; i <= NBuffers; i++)
{
+ /*
+ * quick hack: any refcount still being held in LastRefCount
+ * needs to be released.
+ */
+ PrivateRefCount[i - 1] += LastRefCount[i - 1];
+ LastRefCount[i - 1] = 0;
if (BufferIsValid(i))
{
BufferDesc *buf = &(BufferDescriptors[i - 1]);
From | Date | Subject | |
---|---|---|---|
Next Message | HydroMan | 2000-01-08 23:35:49 | Postgresql Perl Problem |
Previous Message | The Hermit Hacker | 2000-01-08 22:38:16 | Re: [HACKERS] LIBPQ patches ... |