Skip to content

Commit 3a3605f

Browse files
committed
MDEV-21382 fix compilation without perfschema plugin
1 parent 9cd6b23 commit 3a3605f

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

storage/innobase/include/os0file.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,9 @@ to original un-instrumented file I/O APIs */
11411141

11421142
# define os_file_flush(file) os_file_flush_func(file)
11431143

1144+
#define os_file_flush_data(file) \
1145+
pfs_os_file_flush_data_func(file, __FILE__, __LINE__)
1146+
11441147
# define os_file_rename(key, oldpath, newpath) \
11451148
os_file_rename_func(oldpath, newpath)
11461149

@@ -1220,6 +1223,14 @@ bool
12201223
os_file_flush_func(
12211224
os_file_t file);
12221225

1226+
/** NOTE! Use the corresponding macro os_file_flush_data(), not directly this
1227+
function!
1228+
Flushes only(!) data (excluding metadata) from OS page cache of a given file to
1229+
the disk.
1230+
@param[in] file handle to a file
1231+
@return true if success */
1232+
bool os_file_flush_data_func(os_file_t file);
1233+
12231234
/** Retrieves the last error number if an error occurs in a file io function.
12241235
The number should be retrieved before any other OS calls (because they may
12251236
overwrite the error number). If the number is not known to this program,

storage/innobase/os/os0file.cc

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4615,6 +4615,18 @@ os_normalize_path(
46154615
}
46164616
}
46174617

4618+
bool os_file_flush_data_func(os_file_t file) {
4619+
#ifdef _WIN32
4620+
return os_file_flush_func(file);
4621+
#else
4622+
bool success= fdatasync(file) != -1;
4623+
if (!success) {
4624+
ib::error() << "fdatasync() errno: " << errno;
4625+
}
4626+
return success;
4627+
#endif
4628+
}
4629+
46184630
bool pfs_os_file_flush_data_func(pfs_os_file_t file, const char *src_file,
46194631
uint src_line)
46204632
{
@@ -4624,14 +4636,8 @@ bool pfs_os_file_flush_data_func(pfs_os_file_t file, const char *src_file,
46244636
register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_SYNC, src_file,
46254637
src_line);
46264638

4627-
#ifdef _WIN32
4628-
bool result= os_file_flush_func(file);
4629-
#else
4630-
bool result= true;
4631-
if (fdatasync(file) == -1)
4632-
ib::error() << "fdatasync() errno: " << errno;
4633-
#endif
4639+
bool success= os_file_flush_data_func(file);
46344640

46354641
register_pfs_file_io_end(locker, 0);
4636-
return result;
4642+
return success;
46374643
}

0 commit comments

Comments
 (0)