mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Fix crash restart bug introduced in 8356753c21.
The bug was caused by not re-reading the control file during crash recovery restarts, which lead to an attempt to pfree() shared memory contents. The fix is to re-read the control file, which seems good anyway. It's unclear as of this moment, whether we want to keep the refactoring introduced in the commit referenced above, or come up with an alternative approach. But fixing the bug in the mean time seems like a good idea regardless. A followup commit will introduce regression test coverage for crash restarts. Reported-By: Tom Lane Discussion: https://postgr.es/m/14134.1505572349@sss.pgh.pa.us
This commit is contained in:
@@ -951,7 +951,7 @@ PostmasterMain(int argc, char *argv[])
|
||||
CreateDataDirLockFile(true);
|
||||
|
||||
/* read control file (error checking and contains config) */
|
||||
LocalProcessControlFile();
|
||||
LocalProcessControlFile(false);
|
||||
|
||||
/*
|
||||
* Initialize SSL library, if specified.
|
||||
@@ -3829,6 +3829,10 @@ PostmasterStateMachine(void)
|
||||
ResetBackgroundWorkerCrashTimes();
|
||||
|
||||
shmem_exit(1);
|
||||
|
||||
/* re-read control file into local memory */
|
||||
LocalProcessControlFile(true);
|
||||
|
||||
reset_shared(PostPortNumber);
|
||||
|
||||
StartupPID = StartupDataBase();
|
||||
@@ -4808,8 +4812,11 @@ SubPostmasterMain(int argc, char *argv[])
|
||||
/* Read in remaining GUC variables */
|
||||
read_nondefault_variables();
|
||||
|
||||
/* (re-)read control file (contains config) */
|
||||
LocalProcessControlFile();
|
||||
/*
|
||||
* (re-)read control file, as it contains config. The postmaster will
|
||||
* already have read this, but this process doesn't know about that.
|
||||
*/
|
||||
LocalProcessControlFile(false);
|
||||
|
||||
/*
|
||||
* Reload any libraries that were preloaded by the postmaster. Since we
|
||||
|
||||
Reference in New Issue
Block a user