*/
ValidateXLOGDirectoryStructure();
+ /*
+ * Clear out any old relcache cache files. This is *necessary* if we
+ * do any WAL replay, since that would probably result in the cache files
+ * being out of sync with database reality. In theory we could leave
+ * them in place if the database had been cleanly shut down, but it
+ * seems safest to just remove them always and let them be rebuilt
+ * during the first backend startup.
+ */
+ RelationCacheInitFileRemove();
+
/*
* Initialize on the assumption we want to recover to the same timeline
* that's active according to pg_control.
if (OidIsValid(dbid))
{
- char *dbname;
+ char dbname[NAMEDATALEN];
/*
* Report autovac startup to the stats collector. We deliberately do
* Note: if we have selected a just-deleted database (due to using
* stale stats info), we'll fail and exit here.
*/
- InitPostgres(NULL, dbid, NULL, &dbname);
+ InitPostgres(NULL, dbid, NULL, dbname);
SetProcessingMode(NormalProcessing);
set_ps_display(dbname, false);
ereport(DEBUG1,
* Called from InitPostgres. MyBackendId must be set,
* but we must not have started any transaction yet (since the
* exit hook must run after the last transaction exit).
+ * NOTE: MyDatabaseId isn't set yet; so the shutdown hook has to be careful.
* ----------
*/
void
{
volatile PgBackendStatus *beentry = MyBEEntry;
- pgstat_report_stat(true);
+ /