O_SYNC 每个write调用会自动将文件数据和元数据刷新到磁盘上,Synchronized I/O file integrity completion
O_DSYNC Synchronized I/O data integrity completion
O_RSYNC
fsync()
fdatasync() 可能会减少磁盘I/O操作的次数
sync()
PostgreSQL 同步磁盘文件参数sync_method
.conf文件里配置:
#fsync = on # flush data to disk for crash safety
# (turning this off can cause
# unrecoverable data corruption)
#synchronous_commit = on # synchronization level;
# off, local, remote_write, remote_apply, or on
#wal_sync_method = fsync # the default is the first option
# supported by the operating system:
# open_datasync
# fdatasync (default on Linux)
# fsync
# fsync_writethrough
# open_sync