PostgreSQL 對 fsync() 的行為傷腦筋...
FOSDEM 2019
上的演講,討論PostgreSQL
在確保ACID
特性中的Durability
時遇到fsync()
的行為跟預想的不一樣 (主要是當fsync()
失敗的行為):「PostgreSQL vs. fsync
」。
在「PostgreSQL vs. fsync. How is it possible that PostgreSQL used fsync incorrectly for 20 years, and what we'll do about it. 」這邊的 Q&A 形式的訪談有快速描述了短期的計畫與長期的想法:
The short-term solution is ensuring that we detect fsync errors reliably at least on sufficiently recent kernels (since 4.13). On older kernels we can’t do much better, unfortunately. The long-term solution is still being discussed in the community, but it’s hard to say how we could keep relying on buffered I/O in the future. So we may end up with direct I/O, but that’s a pretty significant change and is likely going to be a multi-year project.
在MySQL
這邊則是以O_DIRECT
為主的世界,受到的影響就小很多了...