提交 145eb5d6 编写于 作者: J Jacob Champion 提交者: Xin Zhang

Remove dead/unreferenced db state code (#4225)

The DB_IN_STANDBY_NEW_TLI_SET state doesn't really seem to do anything
anymore, as of commit 813b817cc. Remove it entirely to get rid of an
assertion during standby tests. Also remove multipass function
declarations; they're gone.
上级 6494b02c
......@@ -6514,13 +6514,6 @@ StartupXLOG(void)
errhint("If this has occurred more than once something unexpected is happening"
" after standby has been promoted"),
errSendAlert(true)));
else if (ControlFile->state == DB_IN_STANDBY_NEW_TLI_SET)
ereport(LOG,
(errmsg("database system was interrupted post new TLI was setup on standby promotion at %s",
str_time(ControlFile->checkPointCopy.time)),
errhint("If this has occurred more than once something unexpected is happening"
" after standby has been promoted and new TLI has been set"),
errSendAlert(true)));
else if (ControlFile->state == DB_IN_PRODUCTION)
ereport(LOG,
(errmsg("database system was interrupted; last known up at %s",
......@@ -6563,8 +6556,7 @@ StartupXLOG(void)
if (StandbyModeRequested)
{
Assert(ControlFile->state != DB_IN_CRASH_RECOVERY
&& ControlFile->state != DB_IN_STANDBY_NEW_TLI_SET);
Assert(ControlFile->state != DB_IN_CRASH_RECOVERY);
/*
* If the standby was promoted (last time) and recovery.conf
......@@ -6837,8 +6829,7 @@ StartupXLOG(void)
(errmsg("database system was not properly shut down; "
"automatic recovery in progress")));
if (ControlFile->state != DB_IN_STANDBY_PROMOTED
&& ControlFile->state != DB_IN_STANDBY_NEW_TLI_SET)
if (ControlFile->state != DB_IN_STANDBY_PROMOTED)
ControlFile->state = DB_IN_CRASH_RECOVERY;
}
......@@ -7436,27 +7427,11 @@ StartupXLOG(void)
true);
#endif
/*
* If this system was a standby which was promoted (or whose catalog is not
* yet updated after promote), we delay going into actual production till Pass4.
* Pass4 updates the catalog to comply with the standby promotion changes.
*/
LWLockAcquire(ControlFileLock, LW_EXCLUSIVE);
if (ControlFile->state == DB_IN_STANDBY_PROMOTED
|| ControlFile->state == DB_IN_STANDBY_NEW_TLI_SET)
{
ControlFile->state = DB_IN_STANDBY_NEW_TLI_SET;
ControlFile->time = (pg_time_t) time(NULL);
UpdateControlFile();
ereport(LOG, (errmsg("database system is almost ready")));
}
else
{
ControlFile->state = DB_IN_PRODUCTION;
ControlFile->time = (pg_time_t) time(NULL);
UpdateControlFile();
ereport(LOG, (errmsg("database system is ready")));
}
ControlFile->state = DB_IN_PRODUCTION;
ControlFile->time = (pg_time_t) time(NULL);
UpdateControlFile();
ereport(LOG, (errmsg("database system is ready")));
LWLockRelease(ControlFileLock);
{
......@@ -8318,8 +8293,7 @@ CreateCheckPoint(int flags)
*
* Refer to Startup_InProduction() for more details
*/
if (ControlFile->state != DB_IN_STANDBY_PROMOTED
&& ControlFile->state != DB_IN_STANDBY_NEW_TLI_SET)
if (ControlFile->state != DB_IN_STANDBY_PROMOTED)
{
LWLockAcquire(ControlFileLock, LW_EXCLUSIVE);
ControlFile->state = DB_SHUTDOWNING;
......@@ -8675,8 +8649,7 @@ CreateCheckPoint(int flags)
* Ugly fix to dis-allow changing pg_control state
* for standby promotion continuity
*/
if (ControlFile->state != DB_IN_STANDBY_PROMOTED
&& ControlFile->state != DB_IN_STANDBY_NEW_TLI_SET)
if (ControlFile->state != DB_IN_STANDBY_PROMOTED)
ControlFile->state = DB_SHUTDOWNED;
}
......
......@@ -59,8 +59,6 @@ dbState(DBState state)
return _("in standby mode");
case DB_IN_STANDBY_PROMOTED:
return _("in standby mode (promoted)");
case DB_IN_STANDBY_NEW_TLI_SET:
return _("in standby mode (new tli set)");
case DB_IN_PRODUCTION:
return _("in production");
}
......
......@@ -254,9 +254,6 @@ extern void BootStrapXLOG(void);
extern void StartupXLOG(void);
extern bool XLogStartupMultipleRecoveryPassesNeeded(void);
extern bool XLogStartupIntegrityCheckNeeded(void);
extern void StartupXLOG_Pass2(void);
extern void StartupXLOG_Pass3(void);
extern void StartupXLOG_Pass4(void);
extern void ShutdownXLOG(int code, Datum arg);
extern void InitXLOGAccess(void);
extern void CreateCheckPoint(int flags);
......
......@@ -70,7 +70,6 @@ typedef enum DBState
DB_IN_ARCHIVE_RECOVERY,
DB_IN_STANDBY_MODE,
DB_IN_STANDBY_PROMOTED,
DB_IN_STANDBY_NEW_TLI_SET,
DB_IN_PRODUCTION
} DBState;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册