mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +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) 1996-2010, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* 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,
|
ereport(LOG,
|
||||||
(errmsg("database system was shut down at %s",
|
(errmsg("database system was shut down at %s",
|
||||||
str_time(ControlFile->time))));
|
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)
|
else if (ControlFile->state == DB_SHUTDOWNING)
|
||||||
ereport(LOG,
|
ereport(LOG,
|
||||||
(errmsg("database system shutdown was interrupted; last known up at %s",
|
(errmsg("database system shutdown was interrupted; last known up at %s",
|
||||||
@ -7548,6 +7552,14 @@ CreateRestartPoint(int flags)
|
|||||||
lastCheckPoint.redo.xlogid, lastCheckPoint.redo.xrecoff)));
|
lastCheckPoint.redo.xlogid, lastCheckPoint.redo.xrecoff)));
|
||||||
|
|
||||||
UpdateMinRecoveryPoint(InvalidXLogRecPtr, true);
|
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);
|
LWLockRelease(CheckpointLock);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -7585,6 +7597,8 @@ CreateRestartPoint(int flags)
|
|||||||
ControlFile->checkPoint = lastCheckPointRecPtr;
|
ControlFile->checkPoint = lastCheckPointRecPtr;
|
||||||
ControlFile->checkPointCopy = lastCheckPoint;
|
ControlFile->checkPointCopy = lastCheckPoint;
|
||||||
ControlFile->time = (pg_time_t) time(NULL);
|
ControlFile->time = (pg_time_t) time(NULL);
|
||||||
|
if (flags & CHECKPOINT_IS_SHUTDOWN)
|
||||||
|
ControlFile->state = DB_SHUTDOWNED_IN_RECOVERY;
|
||||||
UpdateControlFile();
|
UpdateControlFile();
|
||||||
}
|
}
|
||||||
LWLockRelease(ControlFileLock);
|
LWLockRelease(ControlFileLock);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
|
* copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
|
||||||
* licence: BSD
|
* 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");
|
return _("starting up");
|
||||||
case DB_SHUTDOWNED:
|
case DB_SHUTDOWNED:
|
||||||
return _("shut down");
|
return _("shut down");
|
||||||
|
case DB_SHUTDOWNED_IN_RECOVERY:
|
||||||
|
return _("shut down in recovery");
|
||||||
case DB_SHUTDOWNING:
|
case DB_SHUTDOWNING:
|
||||||
return _("shutting down");
|
return _("shutting down");
|
||||||
case DB_IN_CRASH_RECOVERY:
|
case DB_IN_CRASH_RECOVERY:
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* 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_STARTUP = 0,
|
||||||
DB_SHUTDOWNED,
|
DB_SHUTDOWNED,
|
||||||
|
DB_SHUTDOWNED_IN_RECOVERY,
|
||||||
DB_SHUTDOWNING,
|
DB_SHUTDOWNING,
|
||||||
DB_IN_CRASH_RECOVERY,
|
DB_IN_CRASH_RECOVERY,
|
||||||
DB_IN_ARCHIVE_RECOVERY,
|
DB_IN_ARCHIVE_RECOVERY,
|
||||||
|
Reference in New Issue
Block a user