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/02 19:14:33 momjian Exp $
44+ * $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.47 2009/04/02 20: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{
374373 SlruShared 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 */
378376 for (;;)
379377 {
@@ -401,7 +399,6 @@ SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok,
401399 }
402400 /* Otherwise, it's ready to use */
403401 SlruRecentlyUsed (shared , slotno );
404- TRACE_POSTGRESQL_SLRU_READPAGE_DONE (slotno );
405402 return slotno ;
406403 }
407404
@@ -449,7 +446,6 @@ SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok,
449446 SlruReportIOError (ctl , pageno , xid );
450447
451448 SlruRecentlyUsed (shared , slotno );
452- TRACE_POSTGRESQL_SLRU_READPAGE_DONE (slotno );
453449 return slotno ;
454450 }
455451}
@@ -474,8 +470,6 @@ SimpleLruReadPage_ReadOnly(SlruCtl ctl, int pageno, TransactionId xid)
474470 SlruShared shared = ctl -> shared ;
475471 int 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 */
480474 LWLockAcquire (shared -> ControlLock , LW_SHARED );
481475
@@ -517,8 +511,6 @@ SimpleLruWritePage(SlruCtl ctl, int slotno, SlruFlush fdata)
517511 int pageno = shared -> page_number [slotno ];
518512 bool 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 */
523515 while (shared -> page_status [slotno ] == SLRU_PAGE_WRITE_IN_PROGRESS &&
524516 shared -> page_number [slotno ] == pageno )
@@ -533,10 +525,7 @@ SimpleLruWritePage(SlruCtl ctl, int slotno, SlruFlush fdata)
533525 if (!shared -> page_dirty [slotno ] ||
534526 shared -> page_status [slotno ] != SLRU_PAGE_VALID ||
535527 shared -> page_number [slotno ] != pageno )
536- {
537- TRACE_POSTGRESQL_SLRU_WRITEPAGE_DONE ();
538528 return ;
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 */
581570 if (!ok )
582571 SlruReportIOError (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
607594 SlruFileName (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 {
623608 slru_errcause = SLRU_OPEN_FAILED ;
624609 slru_errno = errno ;
625- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
626610 return false;
627611 }
628612
629613 ereport (LOG ,
630614 (errmsg ("file \"%s\" doesn't exist, reading as zeroes" ,
631615 path )));
632616 MemSet (shared -> page_buffer [slotno ], 0 , BLCKSZ );
633- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (true, -1 , -1 );
634617 return true;
635618 }
636619
@@ -639,7 +622,6 @@ SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno)
639622 slru_errcause = SLRU_SEEK_FAILED ;
640623 slru_errno = errno ;
641624 close (fd );
642- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
643625 return false;
644626 }
645627
@@ -649,20 +631,16 @@ SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno)
649631 slru_errcause = SLRU_READ_FAILED ;
650632 slru_errno = errno ;
651633 close (fd );
652- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
653634 return false;
654635 }
655636
656637 if (close (fd ))
657638 {
658639 slru_errcause = SLRU_CLOSE_FAILED ;
659640 slru_errno = errno ;
660- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
661641 return false;
662642 }
663643
664- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (true, -1 , -1 );
665-
666644 return true;
667645}
668646
@@ -690,8 +668,6 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
690668 char path [MAXPGPATH ];
691669 int 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 {
778754 slru_errcause = SLRU_OPEN_FAILED ;
779755 slru_errno = errno ;
780- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
781756 return false;
782757 }
783758
@@ -806,7 +781,6 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
806781 slru_errno = errno ;
807782 if (!fdata )
808783 close (fd );
809- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
810784 return false;
811785 }
812786
@@ -820,7 +794,6 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
820794 slru_errno = errno ;
821795 if (!fdata )
822796 close (fd );
823- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
824797 return false;
825798 }
826799
@@ -835,20 +808,17 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
835808 slru_errcause = SLRU_FSYNC_FAILED ;
836809 slru_errno = errno ;
837810 close (fd );
838- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
839811 return false;
840812 }
841813
842814 if (close (fd ))
843815 {
844816 slru_errcause = SLRU_CLOSE_FAILED ;
845817 slru_errno = errno ;
846- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
847818 return false;
848819 }
849820 }
850821
851- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (true, -1 , -1 );
852822 return true;
853823}
854824
0 commit comments