4141 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
4242 * Portions Copyright (c) 1994, Regents of the University of California
4343 *
44- * $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.46 2009/04/0219:14:33 momjian Exp $
44+ * $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.47 2009/04/0220:59:10 momjian Exp $
4545 *
4646 *-------------------------------------------------------------------------
4747 */
5757#include "storage/fd.h"
5858#include "storage/shmem.h"
5959#include "miscadmin.h"
60- #include "pg_trace.h"
6160
6261
6362/*
@@ -373,7 +372,6 @@ SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok,
373372{
374373SlruShared shared = ctl -> shared ;
375374
376- TRACE_POSTGRESQL_SLRU_READPAGE_START ((uintptr_t )ctl ,pageno ,write_ok ,xid );
377375/* Outer loop handles restart if we must wait for someone else's I/O */
378376for (;;)
379377{
@@ -401,7 +399,6 @@ SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok,
401399}
402400/* Otherwise, it's ready to use */
403401SlruRecentlyUsed (shared ,slotno );
404- TRACE_POSTGRESQL_SLRU_READPAGE_DONE (slotno );
405402return slotno ;
406403}
407404
@@ -449,7 +446,6 @@ SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok,
449446SlruReportIOError (ctl ,pageno ,xid );
450447
451448SlruRecentlyUsed (shared ,slotno );
452- TRACE_POSTGRESQL_SLRU_READPAGE_DONE (slotno );
453449return slotno ;
454450}
455451}
@@ -474,8 +470,6 @@ SimpleLruReadPage_ReadOnly(SlruCtl ctl, int pageno, TransactionId xid)
474470SlruShared shared = ctl -> shared ;
475471int slotno ;
476472
477- TRACE_POSTGRESQL_SLRU_READPAGE_READONLY ((uintptr_t )ctl ,pageno ,xid );
478-
479473/* Try to find the page while holding only shared lock */
480474LWLockAcquire (shared -> ControlLock ,LW_SHARED );
481475
@@ -517,8 +511,6 @@ SimpleLruWritePage(SlruCtl ctl, int slotno, SlruFlush fdata)
517511int pageno = shared -> page_number [slotno ];
518512bool ok ;
519513
520- TRACE_POSTGRESQL_SLRU_WRITEPAGE_START ((uintptr_t )ctl ,pageno ,slotno );
521-
522514/* If a write is in progress, wait for it to finish */
523515while (shared -> page_status [slotno ]== SLRU_PAGE_WRITE_IN_PROGRESS &&
524516shared -> page_number [slotno ]== pageno )
@@ -533,10 +525,7 @@ SimpleLruWritePage(SlruCtl ctl, int slotno, SlruFlush fdata)
533525if (!shared -> page_dirty [slotno ]||
534526shared -> page_status [slotno ]!= SLRU_PAGE_VALID ||
535527shared -> page_number [slotno ]!= pageno )
536- {
537- TRACE_POSTGRESQL_SLRU_WRITEPAGE_DONE ();
538528return ;
539- }
540529
541530/*
542531 * Mark the slot write-busy, and clear the dirtybit. After this point, a
@@ -580,8 +569,6 @@ SimpleLruWritePage(SlruCtl ctl, int slotno, SlruFlush fdata)
580569/* Now it's okay to ereport if we failed */
581570if (!ok )
582571SlruReportIOError (ctl ,pageno ,InvalidTransactionId );
583-
584- TRACE_POSTGRESQL_SLRU_WRITEPAGE_DONE ();
585572}
586573
587574/*
@@ -606,8 +593,6 @@ SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno)
606593
607594SlruFileName (ctl ,path ,segno );
608595
609- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_START ((uintptr_t )ctl ,path ,pageno ,slotno );
610-
611596/*
612597 * In a crash-and-restart situation, it's possible for us to receive
613598 * commands to set the commit status of transactions whose bits are in
@@ -622,15 +607,13 @@ SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno)
622607{
623608slru_errcause = SLRU_OPEN_FAILED ;
624609slru_errno = errno ;
625- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (false,slru_errcause ,slru_errno );
626610return false;
627611}
628612
629613ereport (LOG ,
630614(errmsg ("file \"%s\" doesn't exist, reading as zeroes" ,
631615path )));
632616MemSet (shared -> page_buffer [slotno ],0 ,BLCKSZ );
633- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (true,-1 ,-1 );
634617return true;
635618}
636619
@@ -639,7 +622,6 @@ SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno)
639622slru_errcause = SLRU_SEEK_FAILED ;
640623slru_errno = errno ;
641624close (fd );
642- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (false,slru_errcause ,slru_errno );
643625return false;
644626}
645627
@@ -649,20 +631,16 @@ SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno)
649631slru_errcause = SLRU_READ_FAILED ;
650632slru_errno = errno ;
651633close (fd );
652- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (false,slru_errcause ,slru_errno );
653634return false;
654635}
655636
656637if (close (fd ))
657638{
658639slru_errcause = SLRU_CLOSE_FAILED ;
659640slru_errno = errno ;
660- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (false,slru_errcause ,slru_errno );
661641return false;
662642}
663643
664- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (true,-1 ,-1 );
665-
666644return true;
667645}
668646
@@ -690,8 +668,6 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
690668char path [MAXPGPATH ];
691669int fd = -1 ;
692670
693- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_START ((uintptr_t )ctl ,pageno ,slotno );
694-
695671/*
696672 * Honor the write-WAL-before-data rule, if appropriate, so that we do not
697673 * write out data before associated WAL records. This is the same action
@@ -777,7 +753,6 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
777753{
778754slru_errcause = SLRU_OPEN_FAILED ;
779755slru_errno = errno ;
780- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (false,slru_errcause ,slru_errno );
781756return false;
782757}
783758
@@ -806,7 +781,6 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
806781slru_errno = errno ;
807782if (!fdata )
808783close (fd );
809- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (false,slru_errcause ,slru_errno );
810784return false;
811785}
812786
@@ -820,7 +794,6 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
820794slru_errno = errno ;
821795if (!fdata )
822796close (fd );
823- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (false,slru_errcause ,slru_errno );
824797return false;
825798}
826799
@@ -835,20 +808,17 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
835808slru_errcause = SLRU_FSYNC_FAILED ;
836809slru_errno = errno ;
837810close (fd );
838- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (false,slru_errcause ,slru_errno );
839811return false;
840812}
841813
842814if (close (fd ))
843815{
844816slru_errcause = SLRU_CLOSE_FAILED ;
845817slru_errno = errno ;
846- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (false,slru_errcause ,slru_errno );
847818return false;
848819}
849820}
850821
851- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (true,-1 ,-1 );
852822return true;
853823}
854824