mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Reduce unnecessary PANIC to ERROR, improve a couple of comments.
This commit is contained in:
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2008, 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.309 2008/05/14 14:02:57 mha Exp $
|
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.310 2008/05/16 19:15:05 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -67,6 +67,7 @@ bool XLogArchiveMode = false;
|
|||||||
char *XLogArchiveCommand = NULL;
|
char *XLogArchiveCommand = NULL;
|
||||||
bool fullPageWrites = true;
|
bool fullPageWrites = true;
|
||||||
bool log_checkpoints = false;
|
bool log_checkpoints = false;
|
||||||
|
int sync_method = DEFAULT_SYNC_METHOD;
|
||||||
|
|
||||||
#ifdef WAL_DEBUG
|
#ifdef WAL_DEBUG
|
||||||
bool XLOG_DEBUG = false;
|
bool XLOG_DEBUG = false;
|
||||||
@ -88,8 +89,6 @@ bool XLOG_DEBUG = false;
|
|||||||
/*
|
/*
|
||||||
* GUC support
|
* GUC support
|
||||||
*/
|
*/
|
||||||
int sync_method = DEFAULT_SYNC_METHOD;
|
|
||||||
|
|
||||||
const struct config_enum_entry sync_method_options[] = {
|
const struct config_enum_entry sync_method_options[] = {
|
||||||
{"fsync", SYNC_METHOD_FSYNC},
|
{"fsync", SYNC_METHOD_FSYNC},
|
||||||
#ifdef HAVE_FSYNC_WRITETHROUGH
|
#ifdef HAVE_FSYNC_WRITETHROUGH
|
||||||
@ -1613,7 +1612,8 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible, bool xlog_switch)
|
|||||||
* have no open file or the wrong one. However, we do not need to
|
* have no open file or the wrong one. However, we do not need to
|
||||||
* fsync more than one file.
|
* fsync more than one file.
|
||||||
*/
|
*/
|
||||||
if (sync_method != SYNC_METHOD_OPEN && sync_method != SYNC_METHOD_OPEN_DSYNC)
|
if (sync_method != SYNC_METHOD_OPEN &&
|
||||||
|
sync_method != SYNC_METHOD_OPEN_DSYNC)
|
||||||
{
|
{
|
||||||
if (openLogFile >= 0 &&
|
if (openLogFile >= 0 &&
|
||||||
!XLByteInPrevSeg(LogwrtResult.Write, openLogId, openLogSeg))
|
!XLByteInPrevSeg(LogwrtResult.Write, openLogId, openLogSeg))
|
||||||
@ -6340,10 +6340,10 @@ get_sync_bit(int method)
|
|||||||
switch (method)
|
switch (method)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Values for these sync options are defined even if they are not
|
* enum values for all sync options are defined even if they are not
|
||||||
* supported on the current platform. They are not included in
|
* supported on the current platform. But if not, they are not
|
||||||
* the enum option array, and therefor will never be set if the
|
* included in the enum option array, and therefore will never be seen
|
||||||
* platform doesn't support it.
|
* here.
|
||||||
*/
|
*/
|
||||||
case SYNC_METHOD_FSYNC:
|
case SYNC_METHOD_FSYNC:
|
||||||
case SYNC_METHOD_FSYNC_WRITETHROUGH:
|
case SYNC_METHOD_FSYNC_WRITETHROUGH:
|
||||||
@ -6358,12 +6358,8 @@ get_sync_bit(int method)
|
|||||||
return OPEN_DATASYNC_FLAG;
|
return OPEN_DATASYNC_FLAG;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
/*
|
/* can't happen (unless we are out of sync with option array) */
|
||||||
* This "can never happen", since the available values in
|
elog(ERROR, "unrecognized wal_sync_method: %d", method);
|
||||||
* new_sync_method are controlled by the available enum
|
|
||||||
* options.
|
|
||||||
*/
|
|
||||||
elog(PANIC, "unrecognized wal_sync_method: %d", method);
|
|
||||||
return 0; /* silence warning */
|
return 0; /* silence warning */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user