mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
1. chagne all fsync to fdatasync
This commit is contained in:
parent
07798b61ac
commit
ad945d333b
@ -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;
|
||||
|
@ -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))
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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)
|
||||
{}
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user