@@ -38,9 +38,9 @@ typedef struct TwoPhasePgStatRecord
3838 PgStat_Counter inserted_pre_truncdrop ;
3939 PgStat_Counter updated_pre_truncdrop ;
4040 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? */
4444} TwoPhasePgStatRecord ;
4545
4646
@@ -310,7 +310,7 @@ pgstat_report_analyze(Relation rel,
310310 deadtuples -= trans -> tuples_updated + trans -> tuples_deleted ;
311311 }
312312 /* 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 ;
314314 /* Since ANALYZE's counts are estimates, we could have underflowed */
315315 livetuples = Max (livetuples , 0 );
316316 deadtuples = Max (deadtuples , 0 );
@@ -385,13 +385,13 @@ pgstat_count_heap_update(Relation rel, bool hot, bool newpage)
385385 pgstat_info -> trans -> tuples_updated ++ ;
386386
387387 /*
388- * t_tuples_hot_updated and t_tuples_newpage_updated counters are
388+ * tuples_hot_updated and tuples_newpage_updated counters are
389389 * nontransactional, so just advance them
390390 */
391391 if (hot )
392- pgstat_info -> t_counts . t_tuples_hot_updated ++ ;
392+ pgstat_info -> counts . tuples_hot_updated ++ ;
393393 else if (newpage )
394- pgstat_info -> t_counts . t_tuples_newpage_updated ++ ;
394+ pgstat_info -> counts . tuples_newpage_updated ++ ;
395395 }
396396}
397397
@@ -432,7 +432,7 @@ pgstat_count_truncate(Relation rel)
432432 * update dead-tuples count
433433 *
434434 * 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
436436 * rather than increasing, and the change goes straight into the per-table
437437 * counter, not into transactional state.
438438 */
@@ -443,7 +443,7 @@ pgstat_update_heap_dead_tuples(Relation rel, int delta)
443443 {
444444 PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
445445
446- pgstat_info -> t_counts . t_delta_dead_tuples -= delta ;
446+ pgstat_info -> counts . delta_dead_tuples -= delta ;
447447 }
448448}
449449
@@ -519,33 +519,33 @@ AtEOXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit)
519519 if (!isCommit )
520520 restore_truncdrop_counters (trans );
521521 /* 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 ;
525525 if (isCommit )
526526 {
527- tabstat -> t_counts . t_truncdropped = trans -> truncdropped ;
527+ tabstat -> counts . truncdropped = trans -> truncdropped ;
528528 if (trans -> truncdropped )
529529 {
530530 /* 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 ;
533533 }
534534 /* insert adds a live tuple, delete removes one */
535- tabstat -> t_counts . t_delta_live_tuples +=
535+ tabstat -> counts . delta_live_tuples +=
536536 trans -> tuples_inserted - trans -> tuples_deleted ;
537537 /* update and delete each create a dead tuple */
538- tabstat -> t_counts . t_delta_dead_tuples +=
538+ tabstat -> counts . delta_dead_tuples +=
539539 trans -> tuples_updated + trans -> tuples_deleted ;
540540 /* insert, update, delete each count as one change event */
541- tabstat -> t_counts . t_changed_tuples +=
541+ tabstat -> counts . changed_tuples +=
542542 trans -> tuples_inserted + trans -> tuples_updated +
543543 trans -> tuples_deleted ;
544544 }
545545 else
546546 {
547547 /* inserted tuples are dead, deleted tuples are unaffected */
548- tabstat -> t_counts . t_delta_dead_tuples +=
548+ tabstat -> counts . delta_dead_tuples +=
549549 trans -> tuples_inserted + trans -> tuples_updated ;
550550 /* an aborted xact generates no changed_tuple events */
551551 }
@@ -625,11 +625,11 @@ AtEOSubXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit, in
625625 /* first restore values obliterated by truncate/drop */
626626 restore_truncdrop_counters (trans );
627627 /* 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 ;
631631 /* inserted tuples are dead, deleted tuples are unaffected */
632- tabstat -> t_counts . t_delta_dead_tuples +=
632+ tabstat -> counts . delta_dead_tuples +=
633633 trans -> tuples_inserted + trans -> tuples_updated ;
634634 tabstat -> trans = trans -> upper ;
635635 pfree (trans );
@@ -662,9 +662,9 @@ AtPrepare_PgStat_Relations(PgStat_SubXactStatus *xact_state)
662662 record .inserted_pre_truncdrop = trans -> inserted_pre_truncdrop ;
663663 record .updated_pre_truncdrop = trans -> updated_pre_truncdrop ;
664664 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 ;
668668
669669 RegisterTwoPhaseRecord (TWOPHASE_RM_PGSTAT_ID , 0 ,
670670 & record , sizeof (TwoPhasePgStatRecord ));
@@ -706,24 +706,24 @@ pgstat_twophase_postcommit(TransactionId xid, uint16 info,
706706 PgStat_TableStatus * pgstat_info ;
707707
708708 /* 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 );
710710
711711 /* 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 )
717717 {
718718 /* 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 ;
721721 }
722- pgstat_info -> t_counts . t_delta_live_tuples +=
722+ pgstat_info -> counts . delta_live_tuples +=
723723 rec -> tuples_inserted - rec -> tuples_deleted ;
724- pgstat_info -> t_counts . t_delta_dead_tuples +=
724+ pgstat_info -> counts . delta_dead_tuples +=
725725 rec -> tuples_updated + rec -> tuples_deleted ;
726- pgstat_info -> t_counts . t_changed_tuples +=
726+ pgstat_info -> counts . changed_tuples +=
727727 rec -> tuples_inserted + rec -> tuples_updated +
728728 rec -> tuples_deleted ;
729729}
@@ -742,19 +742,19 @@ pgstat_twophase_postabort(TransactionId xid, uint16 info,
742742 PgStat_TableStatus * pgstat_info ;
743743
744744 /* 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 );
746746
747747 /* Same math as in AtEOXact_PgStat, abort case */
748- if (rec -> t_truncdropped )
748+ if (rec -> truncdropped )
749749 {
750750 rec -> tuples_inserted = rec -> inserted_pre_truncdrop ;
751751 rec -> tuples_updated = rec -> updated_pre_truncdrop ;
752752 rec -> tuples_deleted = rec -> deleted_pre_truncdrop ;
753753 }
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 +=
758758 rec -> tuples_inserted + rec -> tuples_updated ;
759759}
760760
@@ -785,7 +785,7 @@ pgstat_relation_flush_cb(PgStat_EntryRef *entry_ref, bool nowait)
785785 * Ignore entries that didn't accumulate any actual counts, such as
786786 * indexes that were opened by the planner but not used.
787787 */
788- if (memcmp (& lstats -> t_counts , & all_zeroes ,
788+ if (memcmp (& lstats -> counts , & all_zeroes ,
789789 sizeof (PgStat_TableCounts )) == 0 )
790790 {
791791 return true;
@@ -797,38 +797,38 @@ pgstat_relation_flush_cb(PgStat_EntryRef *entry_ref, bool nowait)
797797 /* add the values to the shared entry. */
798798 tabentry = & shtabstats -> stats ;
799799
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 )
802802 {
803803 TimestampTz t = GetCurrentTransactionStopTimestamp ();
804804
805805 if (t > tabentry -> lastscan )
806806 tabentry -> lastscan = t ;
807807 }
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 ;
815815
816816 /*
817817 * If table was truncated/dropped, first reset the live/dead counters.
818818 */
819- if (lstats -> t_counts . t_truncdropped )
819+ if (lstats -> counts . truncdropped )
820820 {
821821 tabentry -> live_tuples = 0 ;
822822 tabentry -> dead_tuples = 0 ;
823823 tabentry -> ins_since_vacuum = 0 ;
824824 }
825825
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 ;
832832
833833 /* Clamp live_tuples in case of negative delta_live_tuples */
834834 tabentry -> live_tuples = Max (tabentry -> live_tuples , 0 );
@@ -839,13 +839,13 @@ pgstat_relation_flush_cb(PgStat_EntryRef *entry_ref, bool nowait)
839839
840840 /* The entry was successfully flushed, add the same to database stats */
841841 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 ;
849849
850850 return true;
851851}
@@ -873,8 +873,8 @@ pgstat_prep_relation_pending(Oid rel_id, bool isshared)
873873 isshared ? InvalidOid : MyDatabaseId ,
874874 rel_id , NULL );
875875 pending = entry_ref -> pending ;
876- pending -> t_id = rel_id ;
877- pending -> t_shared = isshared ;
876+ pending -> id = rel_id ;
877+ pending -> shared = isshared ;
878878
879879 return pending ;
880880}
0 commit comments