]> granicus.if.org Git - postgresql/commitdiff
Add isExtend to the parameters of the buffer_read_start and buffer_read_done
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 22 Mar 2009 22:39:05 +0000 (22:39 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 22 Mar 2009 22:39:05 +0000 (22:39 +0000)
DTrace probes, so that ordinary reads can be distinguished from relation
extension operations.  Move buffer_read_start probe to before the
smgrnblocks() call that's needed in the isExtend case, since really that step
should be charged as part of the time needed for the extension operation.
(This makes it slightly harder to match the read_start with the associated
read_done, since now you can't match them on blockNumber, but it should still
be possible since isExtend operations on the same relation can never be
interleaved.)  Per recent discussion.

In passing, add the page identity (forkNum/blockNum) to the parameters of the
buffer_flush_start/buffer_flush_done probes, which were unaccountably lacking
the info.

src/backend/storage/buffer/bufmgr.c
src/backend/utils/probes.d

index 59e61decc01161a6145b670011c8414c239affe1..eac98734286e7ba1f8930a7d2f3f2a0b50e09085 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.247 2009/03/13 17:46:21 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.248 2009/03/22 22:39:05 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -256,15 +256,16 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum,
 
        isExtend = (blockNum == P_NEW);
 
-       /* Substitute proper block number if caller asked for P_NEW */
-       if (isExtend)
-               blockNum = smgrnblocks(smgr, forkNum);
-
        TRACE_POSTGRESQL_BUFFER_READ_START(forkNum, blockNum,
                                                                           smgr->smgr_rnode.spcNode,
                                                                           smgr->smgr_rnode.dbNode,
                                                                           smgr->smgr_rnode.relNode,
-                                                                          isLocalBuf);
+                                                                          isLocalBuf,
+                                                                          isExtend);
+
+       /* Substitute proper block number if caller asked for P_NEW */
+       if (isExtend)
+               blockNum = smgrnblocks(smgr, forkNum);
 
        if (isLocalBuf)
        {
@@ -318,6 +319,7 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum,
                                                                                          smgr->smgr_rnode.dbNode,
                                                                                          smgr->smgr_rnode.relNode,
                                                                                          isLocalBuf,
+                                                                                         isExtend,
                                                                                          found);
 
                        return BufferDescriptorGetBuffer(bufHdr);
@@ -447,6 +449,7 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum,
                                                                          smgr->smgr_rnode.dbNode,
                                                                          smgr->smgr_rnode.relNode,
                                                                          isLocalBuf,
+                                                                         isExtend,
                                                                          found);
 
        return BufferDescriptorGetBuffer(bufHdr);
@@ -1865,7 +1868,9 @@ FlushBuffer(volatile BufferDesc *buf, SMgrRelation reln)
        if (reln == NULL)
                reln = smgropen(buf->tag.rnode);
 
-       TRACE_POSTGRESQL_BUFFER_FLUSH_START(reln->smgr_rnode.spcNode,
+       TRACE_POSTGRESQL_BUFFER_FLUSH_START(buf->tag.forkNum,
+                                                                               buf->tag.blockNum,
+                                                                               reln->smgr_rnode.spcNode,
                                                                                reln->smgr_rnode.dbNode,
                                                                                reln->smgr_rnode.relNode);
 
@@ -1902,7 +1907,9 @@ FlushBuffer(volatile BufferDesc *buf, SMgrRelation reln)
         */
        TerminateBufferIO(buf, true, 0);
 
-       TRACE_POSTGRESQL_BUFFER_FLUSH_DONE(reln->smgr_rnode.spcNode,
+       TRACE_POSTGRESQL_BUFFER_FLUSH_DONE(buf->tag.forkNum,
+                                                                          buf->tag.blockNum,
+                                                                          reln->smgr_rnode.spcNode,
                                                                           reln->smgr_rnode.dbNode,
                                                                           reln->smgr_rnode.relNode);
 
index 18d1b56f5da329582713c19eb16873f824e7e1c4..65e0b6fe660313f63b7f37def90ce574ce3dc1a7 100644 (file)
@@ -3,7 +3,7 @@
  *
  *     Copyright (c) 2006-2009, PostgreSQL Global Development Group
  *
- *     $PostgreSQL: pgsql/src/backend/utils/probes.d,v 1.7 2009/03/11 23:19:25 tgl Exp $
+ *     $PostgreSQL: pgsql/src/backend/utils/probes.d,v 1.8 2009/03/22 22:39:05 tgl Exp $
  * ----------
  */
 
@@ -54,10 +54,10 @@ provider postgresql {
        probe sort__start(int, bool, int, int, bool);
        probe sort__done(bool, long);
 
-       probe buffer__read__start(ForkNumber, BlockNumber, Oid, Oid, Oid, bool);
-       probe buffer__read__done(ForkNumber, BlockNumber, Oid, Oid, Oid, bool, bool);
-       probe buffer__flush__start(Oid, Oid, Oid);
-       probe buffer__flush__done(Oid, Oid, Oid);
+       probe buffer__read__start(ForkNumber, BlockNumber, Oid, Oid, Oid, bool, bool);
+       probe buffer__read__done(ForkNumber, BlockNumber, Oid, Oid, Oid, bool, bool, bool);
+       probe buffer__flush__start(ForkNumber, BlockNumber, Oid, Oid, Oid);
+       probe buffer__flush__done(ForkNumber, BlockNumber, Oid, Oid, Oid);
 
        probe buffer__hit(bool);
        probe buffer__miss(bool);