Restore previous ordering of BUFFER_FLUSH_START probe. I had wanted to
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 13 Mar 2009 17:46:21 +0000 (17:46 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 13 Mar 2009 17:46:21 +0000 (17:46 +0000)
make it include the time for the possible smgropen() call, but that
results in a null pointer dereference :-(.

An alternative solution would be to fetch the buffer tag instead of
looking at *reln, but I'll just put it back as it was for the moment.

BTW, this indicates that DTrace probes evaluate their arguments even
when nominally inactive.  What was that about "zero cost", again?

src/backend/storage/buffer/bufmgr.c

index b9c030b7aa4999093e5bdab4f8831951e01a0ae1..92e0b7f25d437730fe4b9ec7ab43c6ed885dd0ba 100644 (file)
@@ -1861,14 +1861,14 @@ FlushBuffer(volatile BufferDesc *buf, SMgrRelation reln)
        errcontext.previous = error_context_stack;
        error_context_stack = &errcontext;
 
-       TRACE_POSTGRESQL_BUFFER_FLUSH_START(reln->smgr_rnode.spcNode,
-                                                                               reln->smgr_rnode.dbNode,
-                                                                               reln->smgr_rnode.relNode);
-
        /* Find smgr relation for buffer */
        if (reln == NULL)
                reln = smgropen(buf->tag.rnode);
 
+       TRACE_POSTGRESQL_BUFFER_FLUSH_START(reln->smgr_rnode.spcNode,
+                                                                               reln->smgr_rnode.dbNode,
+                                                                               reln->smgr_rnode.relNode);
+
        /*
         * Force XLOG flush up to buffer's LSN.  This implements the basic WAL
         * rule that log updates must hit disk before any of the data-file changes