- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit387abe8
committed
Fix pruning of locked and updated tuples.
Previously it was possible that a tuple was not pruned during vacuum,even though its update xmax (i.e. the updating xid in a multixact withboth key share lockers and an updater) was below the cutoff horizon.As the freezing code assumed, rightly so, that that's not supposed tohappen, xmax would be preserved (as a member of a new multixact orxmax directly). That causes two problems: For one the tuple is belowthe xmin horizon, which can cause problems if the clog is truncated oronce there's an xid wraparound. The bigger problem is that that willbreak HOT chains, which in turn can lead two to breakages: First,failing index lookups, which in turn can e.g lead to constraints beingviolated. Second, future hot prunes / vacuums can end up makinginvisible tuples visible again. There's other harmful scenarios.Fix the problem by recognizing that tuples can be DEAD instead ofRECENTLY_DEAD, even if the multixactid has alive members, if theupdate_xid is below the xmin horizon. That's safe because newerversions of the tuple will contain the locking xids.A followup commit will harden the code somewhat against future similarbugs and already corrupted data.Author: Andres Freund, with changes by Alvaro HerreraReported-By: Daniel WoodAnalyzed-By: Andres Freund, Alvaro Herrera, Robert Haas, Peter Geoghegan, Daniel Wood, Yi Wen Wong, Michael PaquierReviewed-By: Alvaro Herrera, Robert Haas, Michael PaquierDiscussion:https://postgr.es/m/E5711E62-8FDF-4DCA-A888-C200BF6B5742@amazon.comhttps://postgr.es/m/20171102112019.33wb7g5wp4zpjelu@alap3.anarazel.deBackpatch: 9.3-1 parent152a569 commit387abe8
File tree
4 files changed
+80
-121
lines changed- src
- backend/utils/time
- test/isolation
- expected
- specs
4 files changed
+80
-121
lines changedLines changed: 24 additions & 33 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1434 | 1434 |
| |
1435 | 1435 |
| |
1436 | 1436 |
| |
1437 |
| - | |
1438 |
| - | |
1439 |
| - | |
1440 |
| - | |
1441 |
| - | |
1442 |
| - | |
1443 |
| - | |
1444 |
| - | |
| 1437 | + | |
1445 | 1438 |
| |
1446 |
| - | |
1447 |
| - | |
1448 |
| - | |
1449 |
| - | |
1450 |
| - | |
1451 |
| - | |
1452 |
| - | |
1453 |
| - | |
1454 |
| - | |
1455 |
| - | |
1456 |
| - | |
1457 |
| - | |
1458 |
| - | |
1459 |
| - | |
1460 |
| - | |
| 1439 | + | |
| 1440 | + | |
1461 | 1441 |
| |
1462 | 1442 |
| |
1463 | 1443 |
| |
1464 | 1444 |
| |
1465 |
| - | |
1466 |
| - | |
1467 |
| - | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
1468 | 1448 |
| |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
1469 | 1457 |
| |
1470 | 1458 |
| |
1471 |
| - | |
1472 |
| - | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
1473 | 1469 |
| |
1474 | 1470 |
| |
1475 |
| - | |
1476 |
| - | |
1477 |
| - | |
1478 |
| - | |
1479 |
| - | |
1480 | 1471 |
| |
1481 | 1472 |
| |
1482 | 1473 |
| |
|
Lines changed: 21 additions & 86 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
| 1 | + | |
2 | 2 |
| |
3 |
| - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 |
| |
5 |
| - | |
6 |
| - | |
7 | 8 |
| |
8 | 9 |
| |
9 | 10 |
| |
10 | 11 |
| |
11 |
| - | |
12 |
| - | |
13 |
| - | |
14 |
| - | |
15 |
| - | |
16 |
| - | |
| 12 | + | |
17 | 13 |
| |
18 | 14 |
| |
19 | 15 |
| |
20 |
| - | |
21 |
| - | |
22 |
| - | |
23 |
| - | |
24 | 16 |
| |
25 | 17 |
| |
26 |
| - | |
27 |
| - | |
28 |
| - | |
29 |
| - | |
30 | 18 |
| |
31 |
| - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
32 | 26 |
| |
33 |
| - | |
34 |
| - | |
35 |
| - | |
36 |
| - | |
| 27 | + | |
37 | 28 |
| |
38 |
| - | |
39 |
| - | |
40 |
| - | |
41 |
| - | |
42 |
| - | |
43 |
| - | |
44 |
| - | |
45 |
| - | |
46 |
| - | |
47 |
| - | |
48 |
| - | |
49 |
| - | |
50 |
| - | |
51 |
| - | |
52 |
| - | |
53 |
| - | |
54 |
| - | |
55 |
| - | |
56 |
| - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
57 | 34 |
| |
58 |
| - | |
59 |
| - | |
60 |
| - | |
61 |
| - | |
62 |
| - | |
63 |
| - | |
64 |
| - | |
65 |
| - | |
66 |
| - | |
67 |
| - | |
68 |
| - | |
69 |
| - | |
70 |
| - | |
71 |
| - | |
72 |
| - | |
73 |
| - | |
74 |
| - | |
75 |
| - | |
76 |
| - | |
77 |
| - | |
78 |
| - | |
79 |
| - | |
80 |
| - | |
81 |
| - | |
82 |
| - | |
83 |
| - | |
84 |
| - | |
85 |
| - | |
86 |
| - | |
87 |
| - | |
88 |
| - | |
89 |
| - | |
90 |
| - | |
91 |
| - | |
92 |
| - | |
93 |
| - | |
94 |
| - | |
95 |
| - | |
96 |
| - | |
97 |
| - | |
98 |
| - | |
99 |
| - | |
100 |
| - | |
101 |
| - | |
| 35 | + | |
| 36 | + |
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
| 33 | + | |
33 | 34 |
| |
34 | 35 |
|
Lines changed: 34 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
16 | 16 |
| |
17 | 17 |
| |
18 | 18 |
| |
19 |
| - | |
| 19 | + | |
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
23 | 32 |
| |
24 | 33 |
| |
25 |
| - | |
| 34 | + | |
26 | 35 |
| |
27 | 36 |
| |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + |
0 commit comments
Comments
(0)