forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4228817
committed
Fix index deletion latestRemovedXid bug.
The logic for determining the latest removed XID for the purposes ofgenerating recovery conflicts in REDO routines was subtly broken. Itfailed to follow links from HOT chains, and so failed to consider allrelevant heap tuple headers in some cases.To fix, expand the loop that deals with LP_REDIRECT line pointers toalso deal with HOT chains. The new version of the loop is loosely basedon a similar loop from heap_prune_chain().The impact of this bug is probably quite limited, since the horizon codenecessarily deals with heap tuples that are pointed to by LP_DEAD-setindex tuples. The process of setting LP_DEAD index tuples (e.g. withinthe kill_prior_tuple mechanism) is highly correlated with opportunisticpruning of pointed-to heap tuples. Plus the question of generating arecovery conflict usually comes up some time after index tuple LP_DEADbits were initially set, unlike heap pruning, where a latestRemovedXidis generated at the point of the pruning operation (heap pruning has nodeferred "would-be page split" style processing that produces conflictslazily).Only backpatch to Postgres 12, the first version where this logic runsduring original execution (following commit558a916). The indexlatestRemovedXid mechanism has had the same bug since it first appearedover 10 years ago (in commita760893), but backpatching to allsupported versions now seems like a bad idea on balance. Running thenew improved code during recovery seems risky, especially given the lackof complaints from the field.Author: Peter Geoghegan <pg@bowt.ie>Discussion:https://postgr.es/m/CAH2-Wz=Eib393+HHcERK_9MtgNS7Ew1HY=RDC_g6GL46zM5C6Q@mail.gmail.comBackpatch: 12-1 parent319f4d5 commit4228817
2 files changed
+79
-55
lines changedLines changed: 70 additions & 48 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6997 | 6997 |
| |
6998 | 6998 |
| |
6999 | 6999 |
| |
| 7000 | + | |
7000 | 7001 |
| |
7001 |
| - | |
| 7002 | + | |
7002 | 7003 |
| |
7003 |
| - | |
| 7004 | + | |
| 7005 | + | |
| 7006 | + | |
7004 | 7007 |
| |
7005 | 7008 |
| |
7006 | 7009 |
| |
| |||
7040 | 7043 |
| |
7041 | 7044 |
| |
7042 | 7045 |
| |
7043 |
| - | |
7044 |
| - | |
7045 | 7046 |
| |
7046 | 7047 |
| |
7047 | 7048 |
| |
7048 |
| - | |
7049 |
| - | |
| 7049 | + | |
7050 | 7050 |
| |
7051 | 7051 |
| |
7052 | 7052 |
| |
7053 | 7053 |
| |
7054 | 7054 |
| |
7055 |
| - | |
7056 |
| - | |
| 7055 | + | |
| 7056 | + | |
7057 | 7057 |
| |
7058 | 7058 |
| |
7059 | 7059 |
| |
| |||
7062 | 7062 |
| |
7063 | 7063 |
| |
7064 | 7064 |
| |
7065 |
| - | |
| 7065 | + | |
7066 | 7066 |
| |
7067 |
| - | |
| 7067 | + | |
7068 | 7068 |
| |
7069 | 7069 |
| |
7070 | 7070 |
| |
| |||
7075 | 7075 |
| |
7076 | 7076 |
| |
7077 | 7077 |
| |
7078 |
| - | |
| 7078 | + | |
| 7079 | + | |
7079 | 7080 |
| |
7080 | 7081 |
| |
7081 | 7082 |
| |
7082 | 7083 |
| |
7083 |
| - | |
7084 |
| - | |
7085 |
| - | |
7086 | 7084 |
| |
7087 |
| - | |
| 7085 | + | |
| 7086 | + | |
| 7087 | + | |
7088 | 7088 |
| |
7089 |
| - | |
| 7089 | + | |
| 7090 | + | |
| 7091 | + | |
7090 | 7092 |
| |
7091 |
| - | |
7092 |
| - | |
7093 |
| - | |
| 7093 | + | |
| 7094 | + | |
7094 | 7095 |
| |
7095 |
| - | |
7096 |
| - | |
7097 |
| - | |
7098 |
| - | |
7099 |
| - | |
7100 |
| - | |
7101 |
| - | |
7102 |
| - | |
7103 |
| - | |
| 7096 | + | |
| 7097 | + | |
| 7098 | + | |
| 7099 | + | |
| 7100 | + | |
| 7101 | + | |
7104 | 7102 |
| |
7105 |
| - | |
| 7103 | + | |
| 7104 | + | |
| 7105 | + | |
| 7106 | + | |
| 7107 | + | |
| 7108 | + | |
7106 | 7109 |
| |
7107 |
| - | |
7108 |
| - | |
7109 |
| - | |
7110 |
| - | |
7111 | 7110 |
| |
7112 |
| - | |
7113 |
| - | |
7114 |
| - | |
7115 |
| - | |
| 7111 | + | |
| 7112 | + | |
| 7113 | + | |
| 7114 | + | |
| 7115 | + | |
| 7116 | + | |
| 7117 | + | |
| 7118 | + | |
| 7119 | + | |
| 7120 | + | |
| 7121 | + | |
7116 | 7122 |
| |
7117 |
| - | |
7118 |
| - | |
7119 |
| - | |
| 7123 | + | |
| 7124 | + | |
| 7125 | + | |
| 7126 | + | |
| 7127 | + | |
| 7128 | + | |
| 7129 | + | |
| 7130 | + | |
| 7131 | + | |
| 7132 | + | |
| 7133 | + | |
7120 | 7134 |
| |
| 7135 | + | |
| 7136 | + | |
| 7137 | + | |
| 7138 | + | |
| 7139 | + | |
| 7140 | + | |
| 7141 | + | |
| 7142 | + | |
| 7143 | + | |
| 7144 | + | |
| 7145 | + | |
| 7146 | + | |
| 7147 | + | |
| 7148 | + | |
| 7149 | + | |
| 7150 | + | |
7121 | 7151 |
| |
7122 | 7152 |
| |
7123 | 7153 |
| |
| |||
7126 | 7156 |
| |
7127 | 7157 |
| |
7128 | 7158 |
| |
7129 |
| - | |
7130 |
| - | |
7131 |
| - | |
7132 |
| - | |
7133 |
| - | |
7134 |
| - | |
7135 |
| - | |
7136 |
| - | |
7137 | 7159 |
| |
7138 | 7160 |
| |
7139 | 7161 |
| |
|
Lines changed: 9 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
305 | 305 |
| |
306 | 306 |
| |
307 | 307 |
| |
308 |
| - | |
309 |
| - | |
310 |
| - | |
311 |
| - | |
312 |
| - | |
313 |
| - | |
314 |
| - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
315 | 317 |
| |
316 | 318 |
| |
317 | 319 |
| |
|
0 commit comments
Comments
(0)