| From: | "Seung Hyun Jeong" <jeongs(at)cs(dot)man(dot)ac(dot)uk> |
|---|---|
| To: | <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | about BufferPoolBlowaway() |
| Date: | 2002-03-14 11:59:48 |
| Message-ID: | 000501c1cb4f$bdf0bbd0$15c65882@cs.man.ac.uk |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi, all.
I am experimenting on performance evaluation for some queries based on
PostgreSQL.
To give fair conditions to each queries, I try to clear buffer of PostgreSQL
before running each queries.
I think the following function in .../backend/storage/buffer/bufmgr.c seems
to be designed
for such a purpose.
But the function seems to have a logical error in my opinion.
void BufferPoolBlowaway()
{
1: int i;
2: BufferSync();
3: for (i = 1; i <= NBuffers; i++)
4: {
5: if (BufferIsValid(i))
6: {
7: while (BufferIsValid(i)) ReleaseBuffer(i);
8: }
9: BufTableDelete(&BufferDescriptors[i - 1]);
}
}
The line 7 causes an infinite loop, I think.
So, what I did instead is the following:
void BufferPoolBlowaway()
{
1: BufferDesc *bufHdr;
2: int i;
3: BufferSync();
4: for (i = 1; i <= NBuffers; i++)
5: {
6: if (BufferIsValid(i))
7: {
8: bufHdr = &BufferDescriptors[i - 1];
9: while (bufHdr->refcount > 0) ReleaseBuffer(i);
10: }
11: BufTableDelete(&BufferDescriptors[i - 1]);
12: }
}
Line 1, 8, and 9 are added instead of the original to release buffers.
It works without any infinite loop, but I am not quite sure that my
modification is reasonable.
Can anybody advise me about the modification?
In addition, I wonder that the disk read/write operations via buffer manager
in PostgreSQL
are free from linux system buffer cache.
If not, does anyone know how to flush and initialize the linux system buffer
cache?
Cheers.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Turbo Fredriksson | 2002-03-14 13:00:32 | 'Following' the Primary key |
| Previous Message | Jean-Paul ARGUDO | 2002-03-14 09:23:11 | Re: Pre-preparing / parsing SQL statements |