forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit52ac6cd
committed
Prevent GIN deleted pages from being reclaimed too early
When GIN vacuum deletes a posting tree page, it assumes that no concurrentsearchers can access it, thanks to ginStepRight() locking two pages at once.However, since 9.4 searches can skip parts of posting trees descending from theroot. That leads to the risk that page is deleted and reclaimed beforeconcurrent search can access it.This commit prevents the risk of above by waiting for every transaction, whichmight wait to reference this page, to finish. Due to binary compatibilitywe can't change GinPageOpaqueData to store corresponding transaction id.Instead we reuse page header pd_prune_xid field, which is unused in index pages.Discussion:https://postgr.es/m/31a702a.14dd.166c1366ac1.Coremail.chjischj%40163.comAuthor: Andrey Borodin, Alexander KorotkovReviewed-by: Alexander KorotkovBackpatch-through: 9.41 parentc6ade7a commit52ac6cd
File tree
6 files changed
+22
-13
lines changed- src
- backend/access/gin
- include/access
6 files changed
+22
-13
lines changedLines changed: 4 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
304 | 304 |
| |
305 | 305 |
| |
306 | 306 |
| |
307 |
| - | |
308 |
| - | |
309 |
| - | |
310 |
| - | |
311 |
| - | |
312 |
| - | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
313 | 311 |
| |
314 | 312 |
| |
315 | 313 |
| |
|
Lines changed: 1 addition & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
309 | 309 |
| |
310 | 310 |
| |
311 | 311 |
| |
312 |
| - | |
313 |
| - | |
314 |
| - | |
315 |
| - | |
316 |
| - | |
317 |
| - | |
| 312 | + | |
318 | 313 |
| |
319 | 314 |
| |
320 | 315 |
| |
|
Lines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
157 | 157 |
| |
158 | 158 |
| |
159 | 159 |
| |
| 160 | + | |
| 161 | + | |
| 162 | + | |
160 | 163 |
| |
161 | 164 |
| |
162 | 165 |
| |
| |||
213 | 216 |
| |
214 | 217 |
| |
215 | 218 |
| |
| 219 | + | |
216 | 220 |
| |
217 | 221 |
| |
218 | 222 |
| |
| |||
732 | 736 |
| |
733 | 737 |
| |
734 | 738 |
| |
735 |
| - | |
| 739 | + | |
736 | 740 |
| |
737 | 741 |
| |
738 | 742 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
531 | 531 |
| |
532 | 532 |
| |
533 | 533 |
| |
| 534 | + | |
534 | 535 |
| |
535 | 536 |
| |
536 | 537 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
| 13 | + | |
13 | 14 |
| |
14 | 15 |
| |
15 | 16 |
| |
| |||
127 | 128 |
| |
128 | 129 |
| |
129 | 130 |
| |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
130 | 140 |
| |
131 | 141 |
| |
132 | 142 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
158 | 158 |
| |
159 | 159 |
| |
160 | 160 |
| |
| 161 | + | |
161 | 162 |
| |
162 | 163 |
| |
163 | 164 |
| |
|
0 commit comments
Comments
(0)