redo log mics fixes
os_file_flush_data_func(): fix builds on POSIX OSs where fdatasync() is not avaiable log_t::files::flush_data_only(): rename from fdatasync() log_t::files::fsync(): removed and replaced with flush_data_only(). It will flush everything we need for using redo log files.
This commit is contained in:
parent
b19760b843
commit
34dafb7e3a
@ -18614,7 +18614,7 @@ checkpoint_now_set(THD*, st_mysql_sys_var*, void*, const void* save)
|
||||
? log_sys.append_on_checkpoint->size() : 0)
|
||||
< log_sys.lsn) {
|
||||
log_make_checkpoint();
|
||||
log_sys.log.fdatasync();
|
||||
log_sys.log.flush_data_only();
|
||||
}
|
||||
|
||||
dberr_t err = fil_write_flushed_lsn(log_sys.lsn);
|
||||
|
@ -553,10 +553,8 @@ struct log_t{
|
||||
@param[in] total_offset offset in log files treated as a single file
|
||||
@param[in] buf buffer from which to write */
|
||||
void write(size_t total_offset, span<byte> buf);
|
||||
/** flushes OS page cache for all log files */
|
||||
void fsync();
|
||||
/** flushes OS page cache (excluding metadata!) for all log files */
|
||||
void fdatasync();
|
||||
void flush_data_only();
|
||||
/** closes all log files */
|
||||
void close_files();
|
||||
|
||||
|
@ -641,24 +641,7 @@ void log_t::files::write(size_t total_offset, span<byte> buf)
|
||||
}
|
||||
}
|
||||
|
||||
void log_t::files::fsync()
|
||||
{
|
||||
ut_ad(files.size() == file_names.size());
|
||||
|
||||
log_sys.pending_flushes.fetch_add(1, std::memory_order_acquire);
|
||||
for (auto it= files.begin(), end= files.end(); it != end; ++it)
|
||||
{
|
||||
if (!os_file_flush(*it))
|
||||
{
|
||||
const auto idx= std::distance(files.begin(), it);
|
||||
ib::fatal() << "os_file_flush(" << file_names[idx] << ") failed";
|
||||
}
|
||||
}
|
||||
log_sys.pending_flushes.fetch_sub(1, std::memory_order_release);
|
||||
log_sys.flushes.fetch_add(1, std::memory_order_release);
|
||||
}
|
||||
|
||||
void log_t::files::fdatasync()
|
||||
void log_t::files::flush_data_only()
|
||||
{
|
||||
ut_ad(files.size() == file_names.size());
|
||||
|
||||
@ -880,7 +863,7 @@ log_write_flush_to_disk_low()
|
||||
calling os_event_set()! */
|
||||
ut_a(log_sys.n_pending_flushes == 1); /* No other threads here */
|
||||
|
||||
log_sys.log.fdatasync();
|
||||
log_sys.log.flush_data_only();
|
||||
|
||||
log_mutex_enter();
|
||||
log_sys.flushed_to_disk_lsn = log_sys.current_flush_lsn;
|
||||
@ -1307,7 +1290,7 @@ void log_write_checkpoint_info(lsn_t end_lsn)
|
||||
: LOG_CHECKPOINT_1,
|
||||
{buf, OS_FILE_LOG_BLOCK_SIZE});
|
||||
|
||||
log_sys.log.fdatasync();
|
||||
log_sys.log.flush_data_only();
|
||||
|
||||
log_mutex_enter();
|
||||
|
||||
@ -1785,7 +1768,7 @@ wait_suspend_loop:
|
||||
|
||||
/* Ensure that all buffered changes are written to the
|
||||
redo log before fil_close_all_files(). */
|
||||
log_sys.log.fdatasync();
|
||||
log_sys.log.flush_data_only();
|
||||
} else {
|
||||
lsn = srv_start_lsn;
|
||||
}
|
||||
|
@ -4626,7 +4626,7 @@ os_normalize_path(
|
||||
}
|
||||
|
||||
bool os_file_flush_data_func(os_file_t file) {
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) || !defined(HAVE_FDATASYNC) || HAVE_DECL_FDATASYNC == 0
|
||||
return os_file_flush_func(file);
|
||||
#else
|
||||
bool success= fdatasync(file) != -1;
|
||||
|
@ -421,7 +421,7 @@ MY_ATTRIBUTE((warn_unused_result, nonnull))
|
||||
static dberr_t create_log_files_rename(char *logfilename, size_t dirnamelen,
|
||||
lsn_t lsn, std::string &logfile0)
|
||||
{
|
||||
log_sys.log.fsync();
|
||||
log_sys.log.flush_data_only();
|
||||
|
||||
ut_ad(!srv_log_files_created);
|
||||
ut_d(srv_log_files_created= true);
|
||||
@ -1132,7 +1132,7 @@ srv_prepare_to_delete_redo_log_files(
|
||||
|
||||
log_write_up_to(flushed_lsn, true);
|
||||
|
||||
log_sys.log.fsync();
|
||||
log_sys.log.flush_data_only();
|
||||
|
||||
ut_ad(flushed_lsn == log_get_lsn());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user