forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1d84751
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 parent5663844 commit1d84751
1 file changed
+13
-3
lines changedLines changed: 13 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1789 | 1789 |
| |
1790 | 1790 |
| |
1791 | 1791 |
| |
1792 |
| - | |
1793 |
| - | |
1794 |
| - | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
1795 | 1805 |
| |
1796 | 1806 |
| |
1797 | 1807 |
| |
|
0 commit comments
Comments
(0)