@@ -38,9 +38,9 @@ typedef struct TwoPhasePgStatRecord
38
38
PgStat_Counter inserted_pre_truncdrop ;
39
39
PgStat_Counter updated_pre_truncdrop ;
40
40
PgStat_Counter deleted_pre_truncdrop ;
41
- Oid t_id ; /* table's OID */
42
- bool t_shared ; /* is it a shared catalog? */
43
- bool t_truncdropped ; /* was the relation truncated/dropped? */
41
+ Oid id ; /* table's OID */
42
+ bool shared ; /* is it a shared catalog? */
43
+ bool truncdropped ; /* was the relation truncated/dropped? */
44
44
} TwoPhasePgStatRecord ;
45
45
46
46
@@ -310,7 +310,7 @@ pgstat_report_analyze(Relation rel,
310
310
deadtuples -= trans -> tuples_updated + trans -> tuples_deleted ;
311
311
}
312
312
/* count stuff inserted by already-aborted subxacts, too */
313
- deadtuples -= rel -> pgstat_info -> t_counts . t_delta_dead_tuples ;
313
+ deadtuples -= rel -> pgstat_info -> counts . delta_dead_tuples ;
314
314
/* Since ANALYZE's counts are estimates, we could have underflowed */
315
315
livetuples = Max (livetuples , 0 );
316
316
deadtuples = Max (deadtuples , 0 );
@@ -385,13 +385,13 @@ pgstat_count_heap_update(Relation rel, bool hot, bool newpage)
385
385
pgstat_info -> trans -> tuples_updated ++ ;
386
386
387
387
/*
388
- * t_tuples_hot_updated and t_tuples_newpage_updated counters are
388
+ * tuples_hot_updated and tuples_newpage_updated counters are
389
389
* nontransactional, so just advance them
390
390
*/
391
391
if (hot )
392
- pgstat_info -> t_counts . t_tuples_hot_updated ++ ;
392
+ pgstat_info -> counts . tuples_hot_updated ++ ;
393
393
else if (newpage )
394
- pgstat_info -> t_counts . t_tuples_newpage_updated ++ ;
394
+ pgstat_info -> counts . tuples_newpage_updated ++ ;
395
395
}
396
396
}
397
397
@@ -432,7 +432,7 @@ pgstat_count_truncate(Relation rel)
432
432
* update dead-tuples count
433
433
*
434
434
* The semantics of this are that we are reporting the nontransactional
435
- * recovery of "delta" dead tuples; so t_delta_dead_tuples decreases
435
+ * recovery of "delta" dead tuples; so delta_dead_tuples decreases
436
436
* rather than increasing, and the change goes straight into the per-table
437
437
* counter, not into transactional state.
438
438
*/
@@ -443,7 +443,7 @@ pgstat_update_heap_dead_tuples(Relation rel, int delta)
443
443
{
444
444
PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
445
445
446
- pgstat_info -> t_counts . t_delta_dead_tuples -= delta ;
446
+ pgstat_info -> counts . delta_dead_tuples -= delta ;
447
447
}
448
448
}
449
449
@@ -519,33 +519,33 @@ AtEOXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit)
519
519
if (!isCommit )
520
520
restore_truncdrop_counters (trans );
521
521
/* count attempted actions regardless of commit/abort */
522
- tabstat -> t_counts . t_tuples_inserted += trans -> tuples_inserted ;
523
- tabstat -> t_counts . t_tuples_updated += trans -> tuples_updated ;
524
- tabstat -> t_counts . t_tuples_deleted += trans -> tuples_deleted ;
522
+ tabstat -> counts . tuples_inserted += trans -> tuples_inserted ;
523
+ tabstat -> counts . tuples_updated += trans -> tuples_updated ;
524
+ tabstat -> counts . tuples_deleted += trans -> tuples_deleted ;
525
525
if (isCommit )
526
526
{
527
- tabstat -> t_counts . t_truncdropped = trans -> truncdropped ;
527
+ tabstat -> counts . truncdropped = trans -> truncdropped ;
528
528
if (trans -> truncdropped )
529
529
{
530
530
/* forget live/dead stats seen by backend thus far */
531
- tabstat -> t_counts . t_delta_live_tuples = 0 ;
532
- tabstat -> t_counts . t_delta_dead_tuples = 0 ;
531
+ tabstat -> counts . delta_live_tuples = 0 ;
532
+ tabstat -> counts . delta_dead_tuples = 0 ;
533
533
}
534
534
/* insert adds a live tuple, delete removes one */
535
- tabstat -> t_counts . t_delta_live_tuples +=
535
+ tabstat -> counts . delta_live_tuples +=
536
536
trans -> tuples_inserted - trans -> tuples_deleted ;
537
537
/* update and delete each create a dead tuple */
538
- tabstat -> t_counts . t_delta_dead_tuples +=
538
+ tabstat -> counts . delta_dead_tuples +=
539
539
trans -> tuples_updated + trans -> tuples_deleted ;
540
540
/* insert, update, delete each count as one change event */
541
- tabstat -> t_counts . t_changed_tuples +=
541
+ tabstat -> counts . changed_tuples +=
542
542
trans -> tuples_inserted + trans -> tuples_updated +
543
543
trans -> tuples_deleted ;
544
544
}
545
545
else
546
546
{
547
547
/* inserted tuples are dead, deleted tuples are unaffected */
548
- tabstat -> t_counts . t_delta_dead_tuples +=
548
+ tabstat -> counts . delta_dead_tuples +=
549
549
trans -> tuples_inserted + trans -> tuples_updated ;
550
550
/* an aborted xact generates no changed_tuple events */
551
551
}
@@ -625,11 +625,11 @@ AtEOSubXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit, in
625
625
/* first restore values obliterated by truncate/drop */
626
626
restore_truncdrop_counters (trans );
627
627
/* count attempted actions regardless of commit/abort */
628
- tabstat -> t_counts . t_tuples_inserted += trans -> tuples_inserted ;
629
- tabstat -> t_counts . t_tuples_updated += trans -> tuples_updated ;
630
- tabstat -> t_counts . t_tuples_deleted += trans -> tuples_deleted ;
628
+ tabstat -> counts . tuples_inserted += trans -> tuples_inserted ;
629
+ tabstat -> counts . tuples_updated += trans -> tuples_updated ;
630
+ tabstat -> counts . tuples_deleted += trans -> tuples_deleted ;
631
631
/* inserted tuples are dead, deleted tuples are unaffected */
632
- tabstat -> t_counts . t_delta_dead_tuples +=
632
+ tabstat -> counts . delta_dead_tuples +=
633
633
trans -> tuples_inserted + trans -> tuples_updated ;
634
634
tabstat -> trans = trans -> upper ;
635
635
pfree (trans );
@@ -662,9 +662,9 @@ AtPrepare_PgStat_Relations(PgStat_SubXactStatus *xact_state)
662
662
record .inserted_pre_truncdrop = trans -> inserted_pre_truncdrop ;
663
663
record .updated_pre_truncdrop = trans -> updated_pre_truncdrop ;
664
664
record .deleted_pre_truncdrop = trans -> deleted_pre_truncdrop ;
665
- record .t_id = tabstat -> t_id ;
666
- record .t_shared = tabstat -> t_shared ;
667
- record .t_truncdropped = trans -> truncdropped ;
665
+ record .id = tabstat -> id ;
666
+ record .shared = tabstat -> shared ;
667
+ record .truncdropped = trans -> truncdropped ;
668
668
669
669
RegisterTwoPhaseRecord (TWOPHASE_RM_PGSTAT_ID , 0 ,
670
670
& record , sizeof (TwoPhasePgStatRecord ));
@@ -706,24 +706,24 @@ pgstat_twophase_postcommit(TransactionId xid, uint16 info,
706
706
PgStat_TableStatus * pgstat_info ;
707
707
708
708
/* Find or create a tabstat entry for the rel */
709
- pgstat_info = pgstat_prep_relation_pending (rec -> t_id , rec -> t_shared );
709
+ pgstat_info = pgstat_prep_relation_pending (rec -> id , rec -> shared );
710
710
711
711
/* Same math as in AtEOXact_PgStat, commit case */
712
- pgstat_info -> t_counts . t_tuples_inserted += rec -> tuples_inserted ;
713
- pgstat_info -> t_counts . t_tuples_updated += rec -> tuples_updated ;
714
- pgstat_info -> t_counts . t_tuples_deleted += rec -> tuples_deleted ;
715
- pgstat_info -> t_counts . t_truncdropped = rec -> t_truncdropped ;
716
- if (rec -> t_truncdropped )
712
+ pgstat_info -> counts . tuples_inserted += rec -> tuples_inserted ;
713
+ pgstat_info -> counts . tuples_updated += rec -> tuples_updated ;
714
+ pgstat_info -> counts . tuples_deleted += rec -> tuples_deleted ;
715
+ pgstat_info -> counts . truncdropped = rec -> truncdropped ;
716
+ if (rec -> truncdropped )
717
717
{
718
718
/* forget live/dead stats seen by backend thus far */
719
- pgstat_info -> t_counts . t_delta_live_tuples = 0 ;
720
- pgstat_info -> t_counts . t_delta_dead_tuples = 0 ;
719
+ pgstat_info -> counts . delta_live_tuples = 0 ;
720
+ pgstat_info -> counts . delta_dead_tuples = 0 ;
721
721
}
722
- pgstat_info -> t_counts . t_delta_live_tuples +=
722
+ pgstat_info -> counts . delta_live_tuples +=
723
723
rec -> tuples_inserted - rec -> tuples_deleted ;
724
- pgstat_info -> t_counts . t_delta_dead_tuples +=
724
+ pgstat_info -> counts . delta_dead_tuples +=
725
725
rec -> tuples_updated + rec -> tuples_deleted ;
726
- pgstat_info -> t_counts . t_changed_tuples +=
726
+ pgstat_info -> counts . changed_tuples +=
727
727
rec -> tuples_inserted + rec -> tuples_updated +
728
728
rec -> tuples_deleted ;
729
729
}
@@ -742,19 +742,19 @@ pgstat_twophase_postabort(TransactionId xid, uint16 info,
742
742
PgStat_TableStatus * pgstat_info ;
743
743
744
744
/* Find or create a tabstat entry for the rel */
745
- pgstat_info = pgstat_prep_relation_pending (rec -> t_id , rec -> t_shared );
745
+ pgstat_info = pgstat_prep_relation_pending (rec -> id , rec -> shared );
746
746
747
747
/* Same math as in AtEOXact_PgStat, abort case */
748
- if (rec -> t_truncdropped )
748
+ if (rec -> truncdropped )
749
749
{
750
750
rec -> tuples_inserted = rec -> inserted_pre_truncdrop ;
751
751
rec -> tuples_updated = rec -> updated_pre_truncdrop ;
752
752
rec -> tuples_deleted = rec -> deleted_pre_truncdrop ;
753
753
}
754
- pgstat_info -> t_counts . t_tuples_inserted += rec -> tuples_inserted ;
755
- pgstat_info -> t_counts . t_tuples_updated += rec -> tuples_updated ;
756
- pgstat_info -> t_counts . t_tuples_deleted += rec -> tuples_deleted ;
757
- pgstat_info -> t_counts . t_delta_dead_tuples +=
754
+ pgstat_info -> counts . tuples_inserted += rec -> tuples_inserted ;
755
+ pgstat_info -> counts . tuples_updated += rec -> tuples_updated ;
756
+ pgstat_info -> counts . tuples_deleted += rec -> tuples_deleted ;
757
+ pgstat_info -> counts . delta_dead_tuples +=
758
758
rec -> tuples_inserted + rec -> tuples_updated ;
759
759
}
760
760
@@ -785,7 +785,7 @@ pgstat_relation_flush_cb(PgStat_EntryRef *entry_ref, bool nowait)
785
785
* Ignore entries that didn't accumulate any actual counts, such as
786
786
* indexes that were opened by the planner but not used.
787
787
*/
788
- if (memcmp (& lstats -> t_counts , & all_zeroes ,
788
+ if (memcmp (& lstats -> counts , & all_zeroes ,
789
789
sizeof (PgStat_TableCounts )) == 0 )
790
790
{
791
791
return true;
@@ -797,38 +797,38 @@ pgstat_relation_flush_cb(PgStat_EntryRef *entry_ref, bool nowait)
797
797
/* add the values to the shared entry. */
798
798
tabentry = & shtabstats -> stats ;
799
799
800
- tabentry -> numscans += lstats -> t_counts . t_numscans ;
801
- if (lstats -> t_counts . t_numscans )
800
+ tabentry -> numscans += lstats -> counts . numscans ;
801
+ if (lstats -> counts . numscans )
802
802
{
803
803
TimestampTz t = GetCurrentTransactionStopTimestamp ();
804
804
805
805
if (t > tabentry -> lastscan )
806
806
tabentry -> lastscan = t ;
807
807
}
808
- tabentry -> tuples_returned += lstats -> t_counts . t_tuples_returned ;
809
- tabentry -> tuples_fetched += lstats -> t_counts . t_tuples_fetched ;
810
- tabentry -> tuples_inserted += lstats -> t_counts . t_tuples_inserted ;
811
- tabentry -> tuples_updated += lstats -> t_counts . t_tuples_updated ;
812
- tabentry -> tuples_deleted += lstats -> t_counts . t_tuples_deleted ;
813
- tabentry -> tuples_hot_updated += lstats -> t_counts . t_tuples_hot_updated ;
814
- tabentry -> tuples_newpage_updated += lstats -> t_counts . t_tuples_newpage_updated ;
808
+ tabentry -> tuples_returned += lstats -> counts . tuples_returned ;
809
+ tabentry -> tuples_fetched += lstats -> counts . tuples_fetched ;
810
+ tabentry -> tuples_inserted += lstats -> counts . tuples_inserted ;
811
+ tabentry -> tuples_updated += lstats -> counts . tuples_updated ;
812
+ tabentry -> tuples_deleted += lstats -> counts . tuples_deleted ;
813
+ tabentry -> tuples_hot_updated += lstats -> counts . tuples_hot_updated ;
814
+ tabentry -> tuples_newpage_updated += lstats -> counts . tuples_newpage_updated ;
815
815
816
816
/*
817
817
* If table was truncated/dropped, first reset the live/dead counters.
818
818
*/
819
- if (lstats -> t_counts . t_truncdropped )
819
+ if (lstats -> counts . truncdropped )
820
820
{
821
821
tabentry -> live_tuples = 0 ;
822
822
tabentry -> dead_tuples = 0 ;
823
823
tabentry -> ins_since_vacuum = 0 ;
824
824
}
825
825
826
- tabentry -> live_tuples += lstats -> t_counts . t_delta_live_tuples ;
827
- tabentry -> dead_tuples += lstats -> t_counts . t_delta_dead_tuples ;
828
- tabentry -> mod_since_analyze += lstats -> t_counts . t_changed_tuples ;
829
- tabentry -> ins_since_vacuum += lstats -> t_counts . t_tuples_inserted ;
830
- tabentry -> blocks_fetched += lstats -> t_counts . t_blocks_fetched ;
831
- tabentry -> blocks_hit += lstats -> t_counts . t_blocks_hit ;
826
+ tabentry -> live_tuples += lstats -> counts . delta_live_tuples ;
827
+ tabentry -> dead_tuples += lstats -> counts . delta_dead_tuples ;
828
+ tabentry -> mod_since_analyze += lstats -> counts . changed_tuples ;
829
+ tabentry -> ins_since_vacuum += lstats -> counts . tuples_inserted ;
830
+ tabentry -> blocks_fetched += lstats -> counts . blocks_fetched ;
831
+ tabentry -> blocks_hit += lstats -> counts . blocks_hit ;
832
832
833
833
/* Clamp live_tuples in case of negative delta_live_tuples */
834
834
tabentry -> live_tuples = Max (tabentry -> live_tuples , 0 );
@@ -839,13 +839,13 @@ pgstat_relation_flush_cb(PgStat_EntryRef *entry_ref, bool nowait)
839
839
840
840
/* The entry was successfully flushed, add the same to database stats */
841
841
dbentry = pgstat_prep_database_pending (dboid );
842
- dbentry -> tuples_returned += lstats -> t_counts . t_tuples_returned ;
843
- dbentry -> tuples_fetched += lstats -> t_counts . t_tuples_fetched ;
844
- dbentry -> tuples_inserted += lstats -> t_counts . t_tuples_inserted ;
845
- dbentry -> tuples_updated += lstats -> t_counts . t_tuples_updated ;
846
- dbentry -> tuples_deleted += lstats -> t_counts . t_tuples_deleted ;
847
- dbentry -> blocks_fetched += lstats -> t_counts . t_blocks_fetched ;
848
- dbentry -> blocks_hit += lstats -> t_counts . t_blocks_hit ;
842
+ dbentry -> tuples_returned += lstats -> counts . tuples_returned ;
843
+ dbentry -> tuples_fetched += lstats -> counts . tuples_fetched ;
844
+ dbentry -> tuples_inserted += lstats -> counts . tuples_inserted ;
845
+ dbentry -> tuples_updated += lstats -> counts . tuples_updated ;
846
+ dbentry -> tuples_deleted += lstats -> counts . tuples_deleted ;
847
+ dbentry -> blocks_fetched += lstats -> counts . blocks_fetched ;
848
+ dbentry -> blocks_hit += lstats -> counts . blocks_hit ;
849
849
850
850
return true;
851
851
}
@@ -873,8 +873,8 @@ pgstat_prep_relation_pending(Oid rel_id, bool isshared)
873
873
isshared ? InvalidOid : MyDatabaseId ,
874
874
rel_id , NULL );
875
875
pending = entry_ref -> pending ;
876
- pending -> t_id = rel_id ;
877
- pending -> t_shared = isshared ;
876
+ pending -> id = rel_id ;
877
+ pending -> shared = isshared ;
878
878
879
879
return pending ;
880
880
}
0 commit comments