WAL buffers fills before the transaction commits

怎甘沉沦 提交于 2021-01-28 19:11:42

问题


I have been going around the crash recovery mechanism in Postgresql and this hit me. In WAL logging, At the transaction START, based on the queries, WAL Buffers are filled with XLOG records. At transaction COMMIT, the WAL buffer gets flushed. Now, Assume that i start a transaction with series of inserts. When the existing WAL segments gets filled, it creates new ones. But what happens, when i do bulk insert or copy heavy data or something (say 4-5GB), and the WAL Buffer(1-2GB) gets filled before the transaction commits? In this case, what happens to the WAL?


回答1:


When the WAL buffers are full, they are flushed to disk. There is nothing that says that WAL buffers can only be flushed when a transaction commits. What is important is that all WAL records pertaining to a transaction are flushed before a transaction is reported as committed (assuming synchronous commit). But the reverse is not true: A WAL record can be flushed before a transaction is committed.



来源:https://stackoverflow.com/questions/39879754/wal-buffers-fills-before-the-transaction-commits

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!