forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc4afdca
committed
Fix two serious bugs introduced into hash indexes by the 8.4 patch that made
hash indexes keep entries sorted by hash value. First, the original plans forconcurrency assumed that insertions would happen only at the end of a page,which is no longer true; this could cause scans to transiently fail to findindex entries in the presence of concurrent insertions. We can compensateby teaching scans to re-find their position after re-acquiring read locks.Second, neither the bucket split nor the bucket compaction logic had beenfixed to preserve hashvalue ordering, so application of either of thoseprocesses could lead to permanent corruption of an index, in the sensethat searches might fail to find entries that are present.This patch fixes the split and compaction logic to preserve hashvalueordering, but it cannot do anything about pre-existing corruption. We willneed to recommend reindexing all hash indexes in the 8.4.2 release notes.To buy back the performance loss hereby induced in split and compaction,fix them to use PageIndexMultiDelete instead of retail PageIndexDeleteoperations. We might later want to do something with qsort'ing thepage contents rather than doing a binary search for each insertion,but that seemed more invasive than I cared to risk in a back-patch.Per bug #5157 from Jeff Janes and subsequent investigation.1 parentef59fa0 commitc4afdca
File tree
6 files changed
+250
-190
lines changed- src
- backend/access/hash
- include/access
6 files changed
+250
-190
lines changedLines changed: 35 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
| 1 | + | |
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 |
| - | |
7 |
| - | |
8 |
| - | |
9 |
| - | |
10 |
| - | |
11 |
| - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
12 | 13 |
| |
13 | 14 |
| |
14 | 15 |
| |
| |||
32 | 33 |
| |
33 | 34 |
| |
34 | 35 |
| |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
35 | 44 |
| |
36 | 45 |
| |
37 | 46 |
| |
| |||
205 | 214 |
| |
206 | 215 |
| |
207 | 216 |
| |
208 |
| - | |
209 |
| - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
210 | 229 |
| |
211 | 230 |
| |
212 | 231 |
| |
| |||
220 | 239 |
| |
221 | 240 |
| |
222 | 241 |
| |
223 |
| - | |
| 242 | + | |
224 | 243 |
| |
225 | 244 |
| |
226 | 245 |
| |
227 | 246 |
| |
228 | 247 |
| |
229 | 248 |
| |
230 | 249 |
| |
231 |
| - | |
232 |
| - | |
233 |
| - | |
234 |
| - | |
235 |
| - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
236 | 256 |
| |
237 | 257 |
| |
238 | 258 |
| |
|
Lines changed: 49 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
206 | 206 |
| |
207 | 207 |
| |
208 | 208 |
| |
| 209 | + | |
209 | 210 |
| |
210 | 211 |
| |
| 212 | + | |
211 | 213 |
| |
212 | 214 |
| |
213 | 215 |
| |
| |||
225 | 227 |
| |
226 | 228 |
| |
227 | 229 |
| |
228 |
| - | |
| 230 | + | |
| 231 | + | |
229 | 232 |
| |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
230 | 262 |
| |
231 | 263 |
| |
232 | 264 |
| |
| |||
235 | 267 |
| |
236 | 268 |
| |
237 | 269 |
| |
238 |
| - | |
239 |
| - | |
240 | 270 |
| |
241 | 271 |
| |
242 | 272 |
| |
243 | 273 |
| |
244 | 274 |
| |
245 | 275 |
| |
246 | 276 |
| |
247 |
| - | |
| 277 | + | |
248 | 278 |
| |
249 | 279 |
| |
250 | 280 |
| |
| |||
262 | 292 |
| |
263 | 293 |
| |
264 | 294 |
| |
265 |
| - | |
| 295 | + | |
266 | 296 |
| |
267 | 297 |
| |
268 | 298 |
| |
| |||
517 | 547 |
| |
518 | 548 |
| |
519 | 549 |
| |
520 |
| - | |
| 550 | + | |
| 551 | + | |
521 | 552 |
| |
522 | 553 |
| |
523 | 554 |
| |
| |||
529 | 560 |
| |
530 | 561 |
| |
531 | 562 |
| |
532 |
| - | |
533 | 563 |
| |
534 |
| - | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
535 | 567 |
| |
536 | 568 |
| |
537 | 569 |
| |
| |||
541 | 573 |
| |
542 | 574 |
| |
543 | 575 |
| |
544 |
| - | |
545 |
| - | |
546 |
| - | |
547 |
| - | |
548 |
| - | |
549 |
| - | |
550 |
| - | |
| 576 | + | |
| 577 | + | |
551 | 578 |
| |
552 | 579 |
| |
553 | 580 |
| |
554 |
| - | |
555 |
| - | |
556 |
| - | |
557 | 581 |
| |
558 |
| - | |
559 | 582 |
| |
560 | 583 |
| |
561 | 584 |
| |
562 |
| - | |
| 585 | + | |
563 | 586 |
| |
564 | 587 |
| |
565 | 588 |
| |
566 |
| - | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
567 | 592 |
| |
| 593 | + | |
| 594 | + | |
568 | 595 |
| |
569 | 596 |
| |
570 | 597 |
| |
|
Lines changed: 10 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
23 |
| - | |
24 |
| - | |
25 |
| - | |
26 |
| - | |
27 | 23 |
| |
28 | 24 |
| |
29 | 25 |
| |
| |||
180 | 176 |
| |
181 | 177 |
| |
182 | 178 |
| |
183 |
| - | |
184 |
| - | |
185 |
| - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
186 | 186 |
| |
187 |
| - | |
188 |
| - | |
189 |
| - | |
190 |
| - | |
191 |
| - | |
| 187 | + | |
| 188 | + | |
192 | 189 |
| |
193 | 190 |
| |
194 | 191 |
| |
|
0 commit comments
Comments
(0)