diff options
Diffstat (limited to 'src/backend/postmaster/pgstat.c')
-rw-r--r-- | src/backend/postmaster/pgstat.c | 103 |
1 files changed, 1 insertions, 102 deletions
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index ba335fd3429..e94f5f55c78 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -38,7 +38,6 @@ #include "access/transam.h" #include "access/twophase_rmgr.h" #include "access/xact.h" -#include "access/xlogprefetch.h" #include "catalog/partition.h" #include "catalog/pg_database.h" #include "catalog/pg_proc.h" @@ -280,7 +279,6 @@ static PgStat_GlobalStats globalStats; static PgStat_WalStats walStats; static PgStat_SLRUStats slruStats[SLRU_NUM_ELEMENTS]; static HTAB *replSlotStatHash = NULL; -static PgStat_RecoveryPrefetchStats recoveryPrefetchStats; /* * List of OIDs of databases we need to write out. If an entry is InvalidOid, @@ -352,7 +350,6 @@ static void pgstat_recv_archiver(PgStat_MsgArchiver *msg, int len); static void pgstat_recv_bgwriter(PgStat_MsgBgWriter *msg, int len); static void pgstat_recv_wal(PgStat_MsgWal *msg, int len); static void pgstat_recv_slru(PgStat_MsgSLRU *msg, int len); -static void pgstat_recv_recoveryprefetch(PgStat_MsgRecoveryPrefetch *msg, int len); static void pgstat_recv_funcstat(PgStat_MsgFuncstat *msg, int len); static void pgstat_recv_funcpurge(PgStat_MsgFuncpurge *msg, int len); static void pgstat_recv_recoveryconflict(PgStat_MsgRecoveryConflict *msg, int len); @@ -1446,20 +1443,11 @@ pgstat_reset_shared_counters(const char *target) msg.m_resettarget = RESET_BGWRITER; else if (strcmp(target, "wal") == 0) msg.m_resettarget = RESET_WAL; - else if (strcmp(target, "prefetch_recovery") == 0) - { - /* - * We can't ask the stats collector to do this for us as it is not - * attached to shared memory. - */ - XLogPrefetchRequestResetStats(); - return; - } else ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("unrecognized reset target: \"%s\"", target), - errhint("Target must be \"archiver\", \"bgwriter\", \"wal\" or \"prefetch_recovery\"."))); + errhint("Target must be \"archiver\", \"bgwriter\" or \"wal\"."))); pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_RESETSHAREDCOUNTER); pgstat_send(&msg, sizeof(msg)); @@ -2898,22 +2886,6 @@ pgstat_fetch_replslot(NameData slotname) } /* - * --------- - * pgstat_fetch_recoveryprefetch() - - * - * Support function for restoring the counters managed by xlogprefetch.c. - * --------- - */ -PgStat_RecoveryPrefetchStats * -pgstat_fetch_recoveryprefetch(void) -{ - backend_read_statsfile(); - - return &recoveryPrefetchStats; -} - - -/* * Shut down a single backend's statistics reporting at process exit. * * Flush any remaining statistics counts out to the collector. @@ -3189,23 +3161,6 @@ pgstat_send_slru(void) /* ---------- - * pgstat_send_recoveryprefetch() - - * - * Send recovery prefetch statistics to the collector - * ---------- - */ -void -pgstat_send_recoveryprefetch(PgStat_RecoveryPrefetchStats *stats) -{ - PgStat_MsgRecoveryPrefetch msg; - - pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_RECOVERYPREFETCH); - msg.m_stats = *stats; - pgstat_send(&msg, sizeof(msg)); -} - - -/* ---------- * PgstatCollectorMain() - * * Start up the statistics collector process. This is the body of the @@ -3422,10 +3377,6 @@ PgstatCollectorMain(int argc, char *argv[]) pgstat_recv_slru(&msg.msg_slru, len); break; - case PGSTAT_MTYPE_RECOVERYPREFETCH: - pgstat_recv_recoveryprefetch(&msg.msg_recoveryprefetch, len); - break; - case PGSTAT_MTYPE_FUNCSTAT: pgstat_recv_funcstat(&msg.msg_funcstat, len); break; @@ -3719,13 +3670,6 @@ pgstat_write_statsfiles(bool permanent, bool allDbs) (void) rc; /* we'll check for error with ferror */ /* - * Write recovery prefetch stats struct - */ - rc = fwrite(&recoveryPrefetchStats, sizeof(recoveryPrefetchStats), 1, - fpout); - (void) rc; /* we'll check for error with ferror */ - - /* * Walk through the database table. */ hash_seq_init(&hstat, pgStatDBHash); @@ -4000,7 +3944,6 @@ pgstat_read_statsfiles(Oid onlydb, bool permanent, bool deep) memset(&archiverStats, 0, sizeof(archiverStats)); memset(&walStats, 0, sizeof(walStats)); memset(&slruStats, 0, sizeof(slruStats)); - memset(&recoveryPrefetchStats, 0, sizeof(recoveryPrefetchStats)); /* * Set the current timestamp (will be kept only in case we can't load an @@ -4101,18 +4044,6 @@ pgstat_read_statsfiles(Oid onlydb, bool permanent, bool deep) } /* - * Read recoveryPrefetchStats struct - */ - if (fread(&recoveryPrefetchStats, 1, sizeof(recoveryPrefetchStats), - fpin) != sizeof(recoveryPrefetchStats)) - { - ereport(pgStatRunningInCollector ? LOG : WARNING, - (errmsg("corrupted statistics file \"%s\"", statfile))); - memset(&recoveryPrefetchStats, 0, sizeof(recoveryPrefetchStats)); - goto done; - } - - /* * We found an existing collector stats file. Read it and put all the * hashtable entries into place. */ @@ -4452,7 +4383,6 @@ pgstat_read_db_statsfile_timestamp(Oid databaseid, bool permanent, PgStat_WalStats myWalStats; PgStat_SLRUStats mySLRUStats[SLRU_NUM_ELEMENTS]; PgStat_StatReplSlotEntry myReplSlotStats; - PgStat_RecoveryPrefetchStats myRecoveryPrefetchStats; FILE *fpin; int32 format_id; const char *statfile = permanent ? PGSTAT_STAT_PERMANENT_FILENAME : pgstat_stat_filename; @@ -4529,18 +4459,6 @@ pgstat_read_db_statsfile_timestamp(Oid databaseid, bool permanent, return false; } - /* - * Read recovery prefetch stats struct - */ - if (fread(&myRecoveryPrefetchStats, 1, sizeof(myRecoveryPrefetchStats), - fpin) != sizeof(myRecoveryPrefetchStats)) - { - ereport(pgStatRunningInCollector ? LOG : WARNING, - (errmsg("corrupted statistics file \"%s\"", statfile))); - FreeFile(fpin); - return false; - } - /* By default, we're going to return the timestamp of the global file. */ *ts = myGlobalStats.stats_timestamp; @@ -4724,13 +4642,6 @@ backend_read_statsfile(void) if (ok && file_ts >= min_ts) break; - /* - * If we're in crash recovery, the collector may not even be running, - * so work with what we have. - */ - if (InRecovery) - break; - /* Not there or too old, so kick the collector and wait a bit */ if ((count % PGSTAT_INQ_LOOP_COUNT) == 0) pgstat_send_inquiry(cur_ts, min_ts, inquiry_db); @@ -5471,18 +5382,6 @@ pgstat_recv_slru(PgStat_MsgSLRU *msg, int len) } /* ---------- - * pgstat_recv_recoveryprefetch() - - * - * Process a recovery prefetch message. - * ---------- - */ -static void -pgstat_recv_recoveryprefetch(PgStat_MsgRecoveryPrefetch *msg, int len) -{ - recoveryPrefetchStats = msg->m_stats; -} - -/* ---------- * pgstat_recv_recoveryconflict() - * * Process a RECOVERYCONFLICT message. |