Tom Lane <[EMAIL PROTECTED]> wrote:

> ITAGAKI Takahiro <[EMAIL PROTECTED]> writes:
> > Here is a trivial fix of locking issue in pgstattuple().
> 
> Hmm, is this really a bug, and if so how far back does it go?
> I'm thinking that having a pin on the buffer should be enough to
> call PageGetHeapFreeSpace.

Hmm... we might use pd_upper and pd_lower at different times,
but the error is ok for pgstattuple purpose.
(It might be dangerous for tuple insertion, though.)
Inconsistent usage of locks is confusable -- remove them, please.

Index: contrib/pgstattuple/pgstattuple.c
===================================================================
--- contrib/pgstattuple/pgstattuple.c   (HEAD)
+++ contrib/pgstattuple/pgstattuple.c   (working copy)
@@ -289,9 +289,7 @@
                while (block <= tupblock)
                {
                        buffer = ReadBuffer(rel, block);
-                       LockBuffer(buffer, BUFFER_LOCK_SHARE);
                        stat.free_space += PageGetHeapFreeSpace((Page) 
BufferGetPage(buffer));
-                       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
                        ReleaseBuffer(buffer);
                        block++;
                }

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center



---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to