@ -201,7 +201,7 @@ DBImpl::DBImpl(const DBOptions& options, const std::string& dbname)
shutting_down_ ( false ) ,
shutting_down_ ( false ) ,
bg_cv_ ( & mutex_ ) ,
bg_cv_ ( & mutex_ ) ,
logfile_number_ ( 0 ) ,
logfile_number_ ( 0 ) ,
log_dir_un synced_ ( tru e) ,
log_dir_synced_ ( fals e) ,
log_empty_ ( true ) ,
log_empty_ ( true ) ,
default_cf_handle_ ( nullptr ) ,
default_cf_handle_ ( nullptr ) ,
total_log_size_ ( 0 ) ,
total_log_size_ ( 0 ) ,
@ -3101,13 +3101,13 @@ Status DBImpl::Write(const WriteOptions& write_options, WriteBatch* my_batch) {
} else {
} else {
status = log_ - > file ( ) - > Sync ( ) ;
status = log_ - > file ( ) - > Sync ( ) ;
}
}
if ( status . ok ( ) & & log_dir_un synced_ ) {
if ( status . ok ( ) & & ! log_dir_synced_ ) {
// We only sync WAL directory the first time WAL syncing is
// We only sync WAL directory the first time WAL syncing is
// requested, so that in case users never turn on WAL sync,
// requested, so that in case users never turn on WAL sync,
// we can avoid the disk I/O in the write code path.
// we can avoid the disk I/O in the write code path.
status = directories_ . GetWalDir ( ) - > Fsync ( ) ;
status = directories_ . GetWalDir ( ) - > Fsync ( ) ;
}
}
log_dir_un synced_ = fals e;
log_dir_synced_ = tru e;
}
}
}
}
if ( status . ok ( ) ) {
if ( status . ok ( ) ) {
@ -3250,7 +3250,7 @@ Status DBImpl::SetNewMemtableAndNewLogFile(ColumnFamilyData* cfd,
lfile - > SetPreallocationBlockSize (
lfile - > SetPreallocationBlockSize (
1.1 * mutable_cf_options . write_buffer_size ) ;
1.1 * mutable_cf_options . write_buffer_size ) ;
new_log = new log : : Writer ( std : : move ( lfile ) ) ;
new_log = new log : : Writer ( std : : move ( lfile ) ) ;
log_dir_un synced_ = tru e;
log_dir_synced_ = fals e;
}
}
}
}