77 * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
88 * Portions Copyright (c) 1994, Regents of the University of California
99 *
10- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.309 2008/05/14 14:02:57 mha Exp $
10+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.310 2008/05/16 19:15:05 tgl Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -67,6 +67,7 @@ boolXLogArchiveMode = false;
6767char * XLogArchiveCommand = NULL ;
6868bool fullPageWrites = true;
6969bool log_checkpoints = false;
70+ int sync_method = DEFAULT_SYNC_METHOD ;
7071
7172#ifdef WAL_DEBUG
7273bool XLOG_DEBUG = false;
@@ -88,8 +89,6 @@ boolXLOG_DEBUG = false;
8889/*
8990 * GUC support
9091 */
91- int sync_method = DEFAULT_SYNC_METHOD ;
92-
9392const struct config_enum_entry sync_method_options []= {
9493{"fsync" ,SYNC_METHOD_FSYNC },
9594#ifdef HAVE_FSYNC_WRITETHROUGH
@@ -1613,7 +1612,8 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible, bool xlog_switch)
16131612 * have no open file or the wrong one.However, we do not need to
16141613 * fsync more than one file.
16151614 */
1616- if (sync_method != SYNC_METHOD_OPEN && sync_method != SYNC_METHOD_OPEN_DSYNC )
1615+ if (sync_method != SYNC_METHOD_OPEN &&
1616+ sync_method != SYNC_METHOD_OPEN_DSYNC )
16171617{
16181618if (openLogFile >=0 &&
16191619!XLByteInPrevSeg (LogwrtResult .Write ,openLogId ,openLogSeg ))
@@ -6340,10 +6340,10 @@ get_sync_bit(int method)
63406340switch (method )
63416341{
63426342/*
6343- *Values forthese sync options are defined even if they are not
6344- * supported on the current platform.They are not included in
6345- * the enum option array, andtherefor will never beset if the
6346- *platform doesn't support it .
6343+ *enum values forall sync options are defined even if they are not
6344+ * supported on the current platform. But if not, they are not
6345+ *included in the enum option array, andtherefore will never beseen
6346+ *here .
63476347 */
63486348case SYNC_METHOD_FSYNC :
63496349case SYNC_METHOD_FSYNC_WRITETHROUGH :
@@ -6358,12 +6358,8 @@ get_sync_bit(int method)
63586358return OPEN_DATASYNC_FLAG ;
63596359#endif
63606360default :
6361- /*
6362- * This "can never happen", since the available values in
6363- * new_sync_method are controlled by the available enum
6364- * options.
6365- */
6366- elog (PANIC ,"unrecognized wal_sync_method: %d" ,method );
6361+ /* can't happen (unless we are out of sync with option array) */
6362+ elog (ERROR ,"unrecognized wal_sync_method: %d" ,method );
63676363return 0 ;/* silence warning */
63686364}
63696365}
@@ -6392,7 +6388,7 @@ assign_xlog_sync_method(int new_sync_method, bool doit, GucSource source)
63926388(errcode_for_file_access (),
63936389errmsg ("could not fsync log file %u, segment %u: %m" ,
63946390openLogId ,openLogSeg )));
6395- if (get_sync_bit (sync_method )!= get_sync_bit (new_sync_method ))
6391+ if (get_sync_bit (sync_method )!= get_sync_bit (new_sync_method ))
63966392XLogFileClose ();
63976393}
63986394}