@@ -130,7 +130,7 @@ bool *wal_consistency_checking = NULL;
130
130
bool wal_init_zero = true;
131
131
bool wal_recycle = true;
132
132
bool log_checkpoints = true;
133
- int sync_method = DEFAULT_SYNC_METHOD ;
133
+ int wal_sync_method = DEFAULT_WAL_SYNC_METHOD ;
134
134
int wal_level = WAL_LEVEL_REPLICA ;
135
135
int CommitDelay = 0 ; /* precommit delay in microseconds */
136
136
int CommitSiblings = 5 ; /* # concurrent xacts needed to sleep */
@@ -171,17 +171,17 @@ static bool check_wal_consistency_checking_deferred = false;
171
171
/*
172
172
* GUC support
173
173
*/
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},
176
176
#ifdef HAVE_FSYNC_WRITETHROUGH
177
- {"fsync_writethrough" , SYNC_METHOD_FSYNC_WRITETHROUGH , false},
177
+ {"fsync_writethrough" , WAL_SYNC_METHOD_FSYNC_WRITETHROUGH , false},
178
178
#endif
179
- {"fdatasync" , SYNC_METHOD_FDATASYNC , false},
179
+ {"fdatasync" , WAL_SYNC_METHOD_FDATASYNC , false},
180
180
#ifdef O_SYNC
181
- {"open_sync" , SYNC_METHOD_OPEN , false},
181
+ {"open_sync" , WAL_SYNC_METHOD_OPEN , false},
182
182
#endif
183
183
#ifdef O_DSYNC
184
- {"open_datasync" , SYNC_METHOD_OPEN_DSYNC , false},
184
+ {"open_datasync" , WAL_SYNC_METHOD_OPEN_DSYNC , false},
185
185
#endif
186
186
{NULL , 0 , false}
187
187
};
@@ -2343,8 +2343,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible)
2343
2343
* have no open file or the wrong one. However, we do not need to
2344
2344
* fsync more than one file.
2345
2345
*/
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 )
2348
2348
{
2349
2349
if (openLogFile >= 0 &&
2350
2350
!XLByteInPrevSeg (LogwrtResult .Write , openLogSegNo ,
@@ -2974,7 +2974,7 @@ XLogFileInitInternal(XLogSegNo logsegno, TimeLineID logtli,
2974
2974
*/
2975
2975
* added = false;
2976
2976
fd = BasicOpenFile (path , O_RDWR | PG_BINARY | O_CLOEXEC |
2977
- get_sync_bit (sync_method ));
2977
+ get_sync_bit (wal_sync_method ));
2978
2978
if (fd < 0 )
2979
2979
{
2980
2980
if (errno != ENOENT )
@@ -3139,7 +3139,7 @@ XLogFileInit(XLogSegNo logsegno, TimeLineID logtli)
3139
3139
3140
3140
/* Now open original target segment (might not be file I just made) */
3141
3141
fd = BasicOpenFile (path , O_RDWR | PG_BINARY | O_CLOEXEC |
3142
- get_sync_bit (sync_method ));
3142
+ get_sync_bit (wal_sync_method ));
3143
3143
if (fd < 0 )
3144
3144
ereport (ERROR ,
3145
3145
(errcode_for_file_access (),
@@ -3371,7 +3371,7 @@ XLogFileOpen(XLogSegNo segno, TimeLineID tli)
3371
3371
XLogFilePath (path , tli , segno , wal_segment_size );
3372
3372
3373
3373
fd = BasicOpenFile (path , O_RDWR | PG_BINARY | O_CLOEXEC |
3374
- get_sync_bit (sync_method ));
3374
+ get_sync_bit (wal_sync_method ));
3375
3375
if (fd < 0 )
3376
3376
ereport (PANIC ,
3377
3377
(errcode_for_file_access (),
@@ -8137,16 +8137,16 @@ get_sync_bit(int method)
8137
8137
* not included in the enum option array, and therefore will never
8138
8138
* be seen here.
8139
8139
*/
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 :
8143
8143
return o_direct_flag ;
8144
8144
#ifdef O_SYNC
8145
- case SYNC_METHOD_OPEN :
8145
+ case WAL_SYNC_METHOD_OPEN :
8146
8146
return O_SYNC | o_direct_flag ;
8147
8147
#endif
8148
8148
#ifdef O_DSYNC
8149
- case SYNC_METHOD_OPEN_DSYNC :
8149
+ case WAL_SYNC_METHOD_OPEN_DSYNC :
8150
8150
return O_DSYNC | o_direct_flag ;
8151
8151
#endif
8152
8152
default :
@@ -8160,9 +8160,9 @@ get_sync_bit(int method)
8160
8160
* GUC support
8161
8161
*/
8162
8162
void
8163
- assign_xlog_sync_method (int new_sync_method , void * extra )
8163
+ assign_wal_sync_method (int new_wal_sync_method , void * extra )
8164
8164
{
8165
- if (sync_method != new_sync_method )
8165
+ if (wal_sync_method != new_wal_sync_method )
8166
8166
{
8167
8167
/*
8168
8168
* 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)
8188
8188
}
8189
8189
8190
8190
pgstat_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 ))
8192
8192
XLogFileClose ();
8193
8193
}
8194
8194
}
@@ -8214,8 +8214,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli)
8214
8214
* file.
8215
8215
*/
8216
8216
if (!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 )
8219
8219
return ;
8220
8220
8221
8221
/* Measure I/O timing to sync the WAL file */
@@ -8225,29 +8225,29 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli)
8225
8225
INSTR_TIME_SET_ZERO (start );
8226
8226
8227
8227
pgstat_report_wait_start (WAIT_EVENT_WAL_SYNC );
8228
- switch (sync_method )
8228
+ switch (wal_sync_method )
8229
8229
{
8230
- case SYNC_METHOD_FSYNC :
8230
+ case WAL_SYNC_METHOD_FSYNC :
8231
8231
if (pg_fsync_no_writethrough (fd ) != 0 )
8232
8232
msg = _ ("could not fsync file \"%s\": %m" );
8233
8233
break ;
8234
8234
#ifdef HAVE_FSYNC_WRITETHROUGH
8235
- case SYNC_METHOD_FSYNC_WRITETHROUGH :
8235
+ case WAL_SYNC_METHOD_FSYNC_WRITETHROUGH :
8236
8236
if (pg_fsync_writethrough (fd ) != 0 )
8237
8237
msg = _ ("could not fsync write-through file \"%s\": %m" );
8238
8238
break ;
8239
8239
#endif
8240
- case SYNC_METHOD_FDATASYNC :
8240
+ case WAL_SYNC_METHOD_FDATASYNC :
8241
8241
if (pg_fdatasync (fd ) != 0 )
8242
8242
msg = _ ("could not fdatasync file \"%s\": %m" );
8243
8243
break ;
8244
- case SYNC_METHOD_OPEN :
8245
- case SYNC_METHOD_OPEN_DSYNC :
8244
+ case WAL_SYNC_METHOD_OPEN :
8245
+ case WAL_SYNC_METHOD_OPEN_DSYNC :
8246
8246
/* not reachable */
8247
8247
Assert (false);
8248
8248
break ;
8249
8249
default :
8250
- elog (PANIC , "unrecognized wal_sync_method: %d" , sync_method );
8250
+ elog (PANIC , "unrecognized wal_sync_method: %d" , wal_sync_method );
8251
8251
break ;
8252
8252
}
8253
8253
0 commit comments