@@ -130,7 +130,7 @@ bool *wal_consistency_checking = NULL;
130130bool wal_init_zero = true;
131131bool wal_recycle = true;
132132bool log_checkpoints = true;
133- int sync_method = DEFAULT_SYNC_METHOD ;
133+ int wal_sync_method = DEFAULT_WAL_SYNC_METHOD ;
134134int wal_level = WAL_LEVEL_REPLICA ;
135135int CommitDelay = 0 ;/* precommit delay in microseconds */
136136int CommitSiblings = 5 ;/* # concurrent xacts needed to sleep */
@@ -171,17 +171,17 @@ static bool check_wal_consistency_checking_deferred = false;
171171/*
172172 * GUC support
173173 */
174- const struct config_enum_entry sync_method_options []= {
175- {"fsync" ,SYNC_METHOD_FSYNC , false},
174+ const struct config_enum_entry wal_sync_method_options []= {
175+ {"fsync" ,WAL_SYNC_METHOD_FSYNC , false},
176176#ifdef HAVE_FSYNC_WRITETHROUGH
177- {"fsync_writethrough" ,SYNC_METHOD_FSYNC_WRITETHROUGH , false},
177+ {"fsync_writethrough" ,WAL_SYNC_METHOD_FSYNC_WRITETHROUGH , false},
178178#endif
179- {"fdatasync" ,SYNC_METHOD_FDATASYNC , false},
179+ {"fdatasync" ,WAL_SYNC_METHOD_FDATASYNC , false},
180180#ifdef O_SYNC
181- {"open_sync" ,SYNC_METHOD_OPEN , false},
181+ {"open_sync" ,WAL_SYNC_METHOD_OPEN , false},
182182#endif
183183#ifdef O_DSYNC
184- {"open_datasync" ,SYNC_METHOD_OPEN_DSYNC , false},
184+ {"open_datasync" ,WAL_SYNC_METHOD_OPEN_DSYNC , false},
185185#endif
186186{NULL ,0 , false}
187187};
@@ -2343,8 +2343,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible)
23432343 * have no open file or the wrong one. However, we do not need to
23442344 * fsync more than one file.
23452345 */
2346- if (sync_method != SYNC_METHOD_OPEN &&
2347- sync_method != SYNC_METHOD_OPEN_DSYNC )
2346+ if (wal_sync_method != WAL_SYNC_METHOD_OPEN &&
2347+ wal_sync_method != WAL_SYNC_METHOD_OPEN_DSYNC )
23482348{
23492349if (openLogFile >=0 &&
23502350!XLByteInPrevSeg (LogwrtResult .Write ,openLogSegNo ,
@@ -2974,7 +2974,7 @@ XLogFileInitInternal(XLogSegNo logsegno, TimeLineID logtli,
29742974 */
29752975* added = false;
29762976fd = BasicOpenFile (path ,O_RDWR |PG_BINARY |O_CLOEXEC |
2977- get_sync_bit (sync_method ));
2977+ get_sync_bit (wal_sync_method ));
29782978if (fd < 0 )
29792979{
29802980if (errno != ENOENT )
@@ -3139,7 +3139,7 @@ XLogFileInit(XLogSegNo logsegno, TimeLineID logtli)
31393139
31403140/* Now open original target segment (might not be file I just made) */
31413141fd = BasicOpenFile (path ,O_RDWR |PG_BINARY |O_CLOEXEC |
3142- get_sync_bit (sync_method ));
3142+ get_sync_bit (wal_sync_method ));
31433143if (fd < 0 )
31443144ereport (ERROR ,
31453145(errcode_for_file_access (),
@@ -3371,7 +3371,7 @@ XLogFileOpen(XLogSegNo segno, TimeLineID tli)
33713371XLogFilePath (path ,tli ,segno ,wal_segment_size );
33723372
33733373fd = BasicOpenFile (path ,O_RDWR |PG_BINARY |O_CLOEXEC |
3374- get_sync_bit (sync_method ));
3374+ get_sync_bit (wal_sync_method ));
33753375if (fd < 0 )
33763376ereport (PANIC ,
33773377(errcode_for_file_access (),
@@ -8137,16 +8137,16 @@ get_sync_bit(int method)
81378137 * not included in the enum option array, and therefore will never
81388138 * be seen here.
81398139 */
8140- case SYNC_METHOD_FSYNC :
8141- case SYNC_METHOD_FSYNC_WRITETHROUGH :
8142- case SYNC_METHOD_FDATASYNC :
8140+ case WAL_SYNC_METHOD_FSYNC :
8141+ case WAL_SYNC_METHOD_FSYNC_WRITETHROUGH :
8142+ case WAL_SYNC_METHOD_FDATASYNC :
81438143return o_direct_flag ;
81448144#ifdef O_SYNC
8145- case SYNC_METHOD_OPEN :
8145+ case WAL_SYNC_METHOD_OPEN :
81468146return O_SYNC |o_direct_flag ;
81478147#endif
81488148#ifdef O_DSYNC
8149- case SYNC_METHOD_OPEN_DSYNC :
8149+ case WAL_SYNC_METHOD_OPEN_DSYNC :
81508150return O_DSYNC |o_direct_flag ;
81518151#endif
81528152default :
@@ -8160,9 +8160,9 @@ get_sync_bit(int method)
81608160 * GUC support
81618161 */
81628162void
8163- assign_xlog_sync_method (int new_sync_method ,void * extra )
8163+ assign_wal_sync_method (int new_wal_sync_method ,void * extra )
81648164{
8165- if (sync_method != new_sync_method )
8165+ if (wal_sync_method != new_wal_sync_method )
81668166{
81678167/*
81688168 * To ensure that no blocks escape unsynced, force an fsync on the
@@ -8188,7 +8188,7 @@ assign_xlog_sync_method(int new_sync_method, void *extra)
81888188}
81898189
81908190pgstat_report_wait_end ();
8191- if (get_sync_bit (sync_method )!= get_sync_bit (new_sync_method ))
8191+ if (get_sync_bit (wal_sync_method )!= get_sync_bit (new_wal_sync_method ))
81928192XLogFileClose ();
81938193}
81948194}
@@ -8214,8 +8214,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli)
82148214 * file.
82158215 */
82168216if (!enableFsync ||
8217- sync_method == SYNC_METHOD_OPEN ||
8218- sync_method == SYNC_METHOD_OPEN_DSYNC )
8217+ wal_sync_method == WAL_SYNC_METHOD_OPEN ||
8218+ wal_sync_method == WAL_SYNC_METHOD_OPEN_DSYNC )
82198219return ;
82208220
82218221/* Measure I/O timing to sync the WAL file */
@@ -8225,29 +8225,29 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli)
82258225INSTR_TIME_SET_ZERO (start );
82268226
82278227pgstat_report_wait_start (WAIT_EVENT_WAL_SYNC );
8228- switch (sync_method )
8228+ switch (wal_sync_method )
82298229{
8230- case SYNC_METHOD_FSYNC :
8230+ case WAL_SYNC_METHOD_FSYNC :
82318231if (pg_fsync_no_writethrough (fd )!= 0 )
82328232msg = _ ("could not fsync file \"%s\": %m" );
82338233break ;
82348234#ifdef HAVE_FSYNC_WRITETHROUGH
8235- case SYNC_METHOD_FSYNC_WRITETHROUGH :
8235+ case WAL_SYNC_METHOD_FSYNC_WRITETHROUGH :
82368236if (pg_fsync_writethrough (fd )!= 0 )
82378237msg = _ ("could not fsync write-through file \"%s\": %m" );
82388238break ;
82398239#endif
8240- case SYNC_METHOD_FDATASYNC :
8240+ case WAL_SYNC_METHOD_FDATASYNC :
82418241if (pg_fdatasync (fd )!= 0 )
82428242msg = _ ("could not fdatasync file \"%s\": %m" );
82438243break ;
8244- case SYNC_METHOD_OPEN :
8245- case SYNC_METHOD_OPEN_DSYNC :
8244+ case WAL_SYNC_METHOD_OPEN :
8245+ case WAL_SYNC_METHOD_OPEN_DSYNC :
82468246/* not reachable */
82478247Assert (false);
82488248break ;
82498249default :
8250- elog (PANIC ,"unrecognized wal_sync_method: %d" ,sync_method );
8250+ elog (PANIC ,"unrecognized wal_sync_method: %d" ,wal_sync_method );
82518251break ;
82528252}
82538253