]> granicus.if.org Git - postgresql/commitdiff
Tune BufferGetLSNAtomic() when checksums !enabled
authorSimon Riggs <simon@2ndQuadrant.com>
Sun, 7 Apr 2013 21:37:39 +0000 (22:37 +0100)
committerSimon Riggs <simon@2ndQuadrant.com>
Sun, 7 Apr 2013 21:37:39 +0000 (22:37 +0100)
From performance analysis by Heikki Linnakangas

src/backend/storage/buffer/bufmgr.c

index 1cd0ac806a7b086989a71e21029c7d3314832725..c2ef53f4617ec466d60e1d4033745de33021ebb3 100644 (file)
@@ -2079,8 +2079,10 @@ BufferGetLSNAtomic(Buffer buffer)
        char                            *page = BufferGetPage(buffer);
        XLogRecPtr                       lsn;
 
-       /* Local buffers don't need a lock. */
-       if (BufferIsLocal(buffer))
+       /*
+        * If we don't need locking for correctness, fastpath out.
+        */
+       if (!DataChecksumsEnabled() || BufferIsLocal(buffer))
                return PageGetLSN(page);
 
        /* Make sure we've got a real buffer, and that we hold a pin on it. */