41
41
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
42
42
* Portions Copyright (c) 1994, Regents of the University of California
43
43
*
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 $
45
45
*
46
46
*-------------------------------------------------------------------------
47
47
*/
57
57
#include "storage/fd.h"
58
58
#include "storage/shmem.h"
59
59
#include "miscadmin.h"
60
- #include "pg_trace.h"
61
60
62
61
63
62
/*
@@ -373,7 +372,6 @@ SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok,
373
372
{
374
373
SlruShared shared = ctl -> shared ;
375
374
376
- TRACE_POSTGRESQL_SLRU_READPAGE_START ((uintptr_t )ctl , pageno , write_ok , xid );
377
375
/* Outer loop handles restart if we must wait for someone else's I/O */
378
376
for (;;)
379
377
{
@@ -401,7 +399,6 @@ SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok,
401
399
}
402
400
/* Otherwise, it's ready to use */
403
401
SlruRecentlyUsed (shared , slotno );
404
- TRACE_POSTGRESQL_SLRU_READPAGE_DONE (slotno );
405
402
return slotno ;
406
403
}
407
404
@@ -449,7 +446,6 @@ SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok,
449
446
SlruReportIOError (ctl , pageno , xid );
450
447
451
448
SlruRecentlyUsed (shared , slotno );
452
- TRACE_POSTGRESQL_SLRU_READPAGE_DONE (slotno );
453
449
return slotno ;
454
450
}
455
451
}
@@ -474,8 +470,6 @@ SimpleLruReadPage_ReadOnly(SlruCtl ctl, int pageno, TransactionId xid)
474
470
SlruShared shared = ctl -> shared ;
475
471
int slotno ;
476
472
477
- TRACE_POSTGRESQL_SLRU_READPAGE_READONLY ((uintptr_t )ctl , pageno , xid );
478
-
479
473
/* Try to find the page while holding only shared lock */
480
474
LWLockAcquire (shared -> ControlLock , LW_SHARED );
481
475
@@ -517,8 +511,6 @@ SimpleLruWritePage(SlruCtl ctl, int slotno, SlruFlush fdata)
517
511
int pageno = shared -> page_number [slotno ];
518
512
bool ok ;
519
513
520
- TRACE_POSTGRESQL_SLRU_WRITEPAGE_START ((uintptr_t )ctl , pageno , slotno );
521
-
522
514
/* If a write is in progress, wait for it to finish */
523
515
while (shared -> page_status [slotno ] == SLRU_PAGE_WRITE_IN_PROGRESS &&
524
516
shared -> page_number [slotno ] == pageno )
@@ -533,10 +525,7 @@ SimpleLruWritePage(SlruCtl ctl, int slotno, SlruFlush fdata)
533
525
if (!shared -> page_dirty [slotno ] ||
534
526
shared -> page_status [slotno ] != SLRU_PAGE_VALID ||
535
527
shared -> page_number [slotno ] != pageno )
536
- {
537
- TRACE_POSTGRESQL_SLRU_WRITEPAGE_DONE ();
538
528
return ;
539
- }
540
529
541
530
/*
542
531
* Mark the slot write-busy, and clear the dirtybit. After this point, a
@@ -580,8 +569,6 @@ SimpleLruWritePage(SlruCtl ctl, int slotno, SlruFlush fdata)
580
569
/* Now it's okay to ereport if we failed */
581
570
if (!ok )
582
571
SlruReportIOError (ctl , pageno , InvalidTransactionId );
583
-
584
- TRACE_POSTGRESQL_SLRU_WRITEPAGE_DONE ();
585
572
}
586
573
587
574
/*
@@ -606,8 +593,6 @@ SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno)
606
593
607
594
SlruFileName (ctl , path , segno );
608
595
609
- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_START ((uintptr_t )ctl , path , pageno , slotno );
610
-
611
596
/*
612
597
* In a crash-and-restart situation, it's possible for us to receive
613
598
* commands to set the commit status of transactions whose bits are in
@@ -622,15 +607,13 @@ SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno)
622
607
{
623
608
slru_errcause = SLRU_OPEN_FAILED ;
624
609
slru_errno = errno ;
625
- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
626
610
return false;
627
611
}
628
612
629
613
ereport (LOG ,
630
614
(errmsg ("file \"%s\" doesn't exist, reading as zeroes" ,
631
615
path )));
632
616
MemSet (shared -> page_buffer [slotno ], 0 , BLCKSZ );
633
- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (true, -1 , -1 );
634
617
return true;
635
618
}
636
619
@@ -639,7 +622,6 @@ SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno)
639
622
slru_errcause = SLRU_SEEK_FAILED ;
640
623
slru_errno = errno ;
641
624
close (fd );
642
- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
643
625
return false;
644
626
}
645
627
@@ -649,20 +631,16 @@ SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno)
649
631
slru_errcause = SLRU_READ_FAILED ;
650
632
slru_errno = errno ;
651
633
close (fd );
652
- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
653
634
return false;
654
635
}
655
636
656
637
if (close (fd ))
657
638
{
658
639
slru_errcause = SLRU_CLOSE_FAILED ;
659
640
slru_errno = errno ;
660
- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
661
641
return false;
662
642
}
663
643
664
- TRACE_POSTGRESQL_SLRU_READPAGE_PHYSICAL_DONE (true, -1 , -1 );
665
-
666
644
return true;
667
645
}
668
646
@@ -690,8 +668,6 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
690
668
char path [MAXPGPATH ];
691
669
int fd = -1 ;
692
670
693
- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_START ((uintptr_t )ctl , pageno , slotno );
694
-
695
671
/*
696
672
* Honor the write-WAL-before-data rule, if appropriate, so that we do not
697
673
* 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)
777
753
{
778
754
slru_errcause = SLRU_OPEN_FAILED ;
779
755
slru_errno = errno ;
780
- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
781
756
return false;
782
757
}
783
758
@@ -806,7 +781,6 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
806
781
slru_errno = errno ;
807
782
if (!fdata )
808
783
close (fd );
809
- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
810
784
return false;
811
785
}
812
786
@@ -820,7 +794,6 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
820
794
slru_errno = errno ;
821
795
if (!fdata )
822
796
close (fd );
823
- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
824
797
return false;
825
798
}
826
799
@@ -835,20 +808,17 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
835
808
slru_errcause = SLRU_FSYNC_FAILED ;
836
809
slru_errno = errno ;
837
810
close (fd );
838
- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
839
811
return false;
840
812
}
841
813
842
814
if (close (fd ))
843
815
{
844
816
slru_errcause = SLRU_CLOSE_FAILED ;
845
817
slru_errno = errno ;
846
- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (false, slru_errcause , slru_errno );
847
818
return false;
848
819
}
849
820
}
850
821
851
- TRACE_POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_DONE (true, -1 , -1 );
852
822
return true;
853
823
}
854
824
0 commit comments