Re: [HACKERS] Re: ERROR: out of free buffers: time to abort !

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Re: ERROR: out of free buffers: time to abort !
Дата
Msg-id 9208.947372235@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Re: ERROR: out of free buffers: time to abort !  (Ed Loehr <eloehr@austin.rr.com>)
Список pgsql-hackers
Ed Loehr <eloehr@austin.rr.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]);
 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: Re: [HACKERS] LIBPQ patches ...
Следующее
От: Alfred Perlstein
Дата:
Сообщение: Re: [HACKERS] LIBPQ patches ...