mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
On clean shutdown during recovery, don't warn about possible corruption.
Fujii Masao. Review by Heikki Linnakangas and myself.
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.415 2010/06/02 09:28:44 heikki Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.416 2010/06/03 03:19:59 rhaas Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -5661,6 +5661,10 @@ StartupXLOG(void)
|
||||
ereport(LOG,
|
||||
(errmsg("database system was shut down at %s",
|
||||
str_time(ControlFile->time))));
|
||||
else if (ControlFile->state == DB_SHUTDOWNED_IN_RECOVERY)
|
||||
ereport(LOG,
|
||||
(errmsg("database system was shut down in recovery at %s",
|
||||
str_time(ControlFile->time))));
|
||||
else if (ControlFile->state == DB_SHUTDOWNING)
|
||||
ereport(LOG,
|
||||
(errmsg("database system shutdown was interrupted; last known up at %s",
|
||||
@ -7548,6 +7552,14 @@ CreateRestartPoint(int flags)
|
||||
lastCheckPoint.redo.xlogid, lastCheckPoint.redo.xrecoff)));
|
||||
|
||||
UpdateMinRecoveryPoint(InvalidXLogRecPtr, true);
|
||||
if (flags & CHECKPOINT_IS_SHUTDOWN)
|
||||
{
|
||||
LWLockAcquire(ControlFileLock, LW_EXCLUSIVE);
|
||||
ControlFile->state = DB_SHUTDOWNED_IN_RECOVERY;
|
||||
ControlFile->time = (pg_time_t) time(NULL);
|
||||
UpdateControlFile();
|
||||
LWLockRelease(ControlFileLock);
|
||||
}
|
||||
LWLockRelease(CheckpointLock);
|
||||
return false;
|
||||
}
|
||||
@ -7585,6 +7597,8 @@ CreateRestartPoint(int flags)
|
||||
ControlFile->checkPoint = lastCheckPointRecPtr;
|
||||
ControlFile->checkPointCopy = lastCheckPoint;
|
||||
ControlFile->time = (pg_time_t) time(NULL);
|
||||
if (flags & CHECKPOINT_IS_SHUTDOWN)
|
||||
ControlFile->state = DB_SHUTDOWNED_IN_RECOVERY;
|
||||
UpdateControlFile();
|
||||
}
|
||||
LWLockRelease(ControlFileLock);
|
||||
|
@ -6,7 +6,7 @@
|
||||
* copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
|
||||
* licence: BSD
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.49 2010/04/28 19:38:49 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.50 2010/06/03 03:20:00 rhaas Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -57,6 +57,8 @@ dbState(DBState state)
|
||||
return _("starting up");
|
||||
case DB_SHUTDOWNED:
|
||||
return _("shut down");
|
||||
case DB_SHUTDOWNED_IN_RECOVERY:
|
||||
return _("shut down in recovery");
|
||||
case DB_SHUTDOWNING:
|
||||
return _("shutting down");
|
||||
case DB_IN_CRASH_RECOVERY:
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/catalog/pg_control.h,v 1.54 2010/04/28 16:10:43 heikki Exp $
|
||||
* $PostgreSQL: pgsql/src/include/catalog/pg_control.h,v 1.55 2010/06/03 03:20:00 rhaas Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -65,6 +65,7 @@ typedef enum DBState
|
||||
{
|
||||
DB_STARTUP = 0,
|
||||
DB_SHUTDOWNED,
|
||||
DB_SHUTDOWNED_IN_RECOVERY,
|
||||
DB_SHUTDOWNING,
|
||||
DB_IN_CRASH_RECOVERY,
|
||||
DB_IN_ARCHIVE_RECOVERY,
|
||||
|
Reference in New Issue
Block a user