1. chagne all fsync to fdatasync

This commit is contained in:
listar 2021-11-10 17:23:46 +08:00
parent 07798b61ac
commit ad945d333b
6 changed files with 6 additions and 6 deletions

View File

@ -542,7 +542,7 @@ public:
file_path,
std::to_string(bytes_written));
if (::fsync(file.fd) < 0)
if (::fdatasync(file.fd) < 0)
throwFromErrnoWithPath("Cannot fsync " + file_path, file_path, ErrorCodes::CANNOT_FSYNC);
current_block_index += buffer_size_in_blocks;

View File

@ -35,7 +35,7 @@ LocalDirectorySyncGuard::~LocalDirectorySyncGuard()
if (fcntl(fd, F_FULLFSYNC, 0))
throwFromErrno("Cannot fcntl(F_FULLFSYNC)", ErrorCodes::CANNOT_FSYNC);
#endif
if (-1 == ::fsync(fd))
if (-1 == ::fdatasync(fd))
throw Exception("Cannot fsync", ErrorCodes::CANNOT_FSYNC);
if (-1 == ::close(fd))

View File

@ -114,7 +114,7 @@ void WriteBufferFromFileDescriptor::sync()
next();
/// Request OS to sync data with storage medium.
int res = fsync(fd);
int res = ::fdatasync(fd);
if (-1 == res)
throwFromErrnoWithPath("Cannot fsync " + getFileName(), getFileName(), ErrorCodes::CANNOT_FSYNC);
}

View File

@ -691,7 +691,7 @@ struct StorageDistributedDirectoryMonitor::Batch
: parent(parent_)
, file_index_to_path(file_index_to_path_)
, split_batch_on_failure(parent.split_batch_on_failure)
, fsync(parent.storage.getDistributedSettingsRef().fsync_after_insert)
, fdatasync(parent.storage.getDistributedSettingsRef().fsync_after_insert)
, dir_fsync(parent.dir_fsync)
{}

View File

@ -156,7 +156,7 @@ int mainImpl(int argc, char ** argv)
pool.scheduleOrThrowOnError([=]{ thread(fd, mode, min_offset, max_offset, block_size, count); });
pool.wait();
fsync(fd);
fdatasync(fd);
watch.stop();

View File

@ -136,7 +136,7 @@ int mainImpl(int argc, char ** argv)
for (size_t i = 0; i < descriptors; ++i)
{
if (fsync(fds[i]))
if (fdatasync(fds[i]))
throwFromErrno("Cannot fsync", ErrorCodes::CANNOT_FSYNC);
}