- Notifications
You must be signed in to change notification settings - Fork28
Commit242dfcb
committed
Avoid killing btree items that are already dead
_bt_killitems marks btree items dead when a scan leaves the page wherethey live, but it does so with only share lock (to improve concurrency).This was historicall okay, since killing a dead item has noconsequences. However, with the advent of data checksums andwal_log_hints, this action incurs a WAL full-page-image record of thepage. Multiple concurrent processes would write the same page severaltimes, leading to WAL bloat. The probability of this happening can bereduced by only killing items if they're not already dead, so change thecode to do that.The problem could eliminated completely by having _bt_killitems upgradeto exclusive lock upon seeing a killable item, but that would reduceconcurrency so it's considered a cure worse than the disease.Backpatch all the way back to 9.5, since wal_log_hints was introduced in9.4.Author: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>Discussion:https://postgr.es/m/CA+fd4k6PeRj2CkzapWNrERkja5G0-6D-YQiKfbukJV+qZGFZ_Q@mail.gmail.com1 parent5da1493 commit242dfcb
1 file changed
+9
-1
lines changedLines changed: 9 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1854 | 1854 |
| |
1855 | 1855 |
| |
1856 | 1856 |
| |
1857 |
| - | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
1858 | 1866 |
| |
1859 | 1867 |
| |
1860 | 1868 |
| |
|
0 commit comments
Comments
(0)