- Notifications
You must be signed in to change notification settings - Fork5
Commit2834855
committed
Fix BRIN to use SnapshotAny during summarization
For correctness of summarization results, it is critical that thesnapshot used during the summarization scan is able to see all tuplesthat are live to all transactions -- including tuples inserted ordeleted by in-progress transactions. Otherwise, it would be possiblefor a transaction to insert a tuple, then idle for a long time while aconcurrent transaction executes summarization of the range: this wouldresult in the inserted value not being considered in the summary.Previously we were trying to use a MVCC snapshot in conjunction withadding a "placeholder" tuple in the index: the snapshot would see allcommitted tuples, and the placeholder tuple would catch insertions byany new inserters. The hole is that prior insertions by transactionsthat are still in progress by the time the MVCC snapshot was taken wereignored.Kevin Grittner reported this as a bogus error message during vacuum withdefault transaction isolation mode set to repeatable read (because theerror report mentioned a function name not being invoked during), butthe problem is larger than that.To fix, tweak IndexBuildHeapRangeScan to have a new mode that behavesthe way we need using SnapshotAny visibility rules. This changesimplifies the BRIN code a bit, mainly by removing large comments thatwere mistaken. Instead, rely on the SnapshotAny semantics to providewhat it needs. (The business about a placeholder tuple needs to remain:that covers the case that a transaction inserts a a tuple in a page thatsummarization already scanned.)Discussion:https://www.postgresql.org/message-id/20150731175700.GX2441@postgresql.orgIn passing, remove a couple of unused declarations from brin.h andreword a comment to be proper English. This part submitted by KevinGrittner.Backpatch to 9.5, where BRIN was introduced.1 parent6af9ee4 commit2834855
File tree
7 files changed
+129
-35
lines changed- src
- backend
- access/brin
- catalog
- include
- access
- catalog
- test/isolation
- expected
- specs
7 files changed
+129
-35
lines changedLines changed: 9 additions & 32 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
696 | 696 |
| |
697 | 697 |
| |
698 | 698 |
| |
699 |
| - | |
| 699 | + | |
700 | 700 |
| |
701 | 701 |
| |
702 | 702 |
| |
| |||
951 | 951 |
| |
952 | 952 |
| |
953 | 953 |
| |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
954 | 958 |
| |
955 | 959 |
| |
956 |
| - | |
| 960 | + | |
957 | 961 |
| |
958 | 962 |
| |
959 | 963 |
| |
| |||
1058 | 1062 |
| |
1059 | 1063 |
| |
1060 | 1064 |
| |
1061 |
| - | |
1062 |
| - | |
1063 |
| - | |
1064 |
| - | |
1065 |
| - | |
1066 |
| - | |
1067 |
| - | |
1068 |
| - | |
1069 |
| - | |
1070 |
| - | |
1071 |
| - | |
1072 |
| - | |
1073 |
| - | |
1074 |
| - | |
1075 |
| - | |
1076 |
| - | |
1077 |
| - | |
1078 |
| - | |
1079 |
| - | |
1080 |
| - | |
1081 |
| - | |
1082 |
| - | |
1083 |
| - | |
1084 |
| - | |
1085 |
| - | |
1086 |
| - | |
1087 |
| - | |
1088 |
| - | |
1089 |
| - | |
1090 |
| - | |
1091 | 1065 |
| |
1092 | 1066 |
| |
1093 | 1067 |
| |
| |||
1111 | 1085 |
| |
1112 | 1086 |
| |
1113 | 1087 |
| |
| 1088 | + | |
1114 | 1089 |
| |
| 1090 | + | |
| 1091 | + | |
1115 | 1092 |
| |
1116 | 1093 |
| |
1117 | 1094 |
| |
|
Lines changed: 35 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2161 | 2161 |
| |
2162 | 2162 |
| |
2163 | 2163 |
| |
| 2164 | + | |
2164 | 2165 |
| |
2165 | 2166 |
| |
2166 | 2167 |
| |
| |||
2170 | 2171 |
| |
2171 | 2172 |
| |
2172 | 2173 |
| |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
2173 | 2178 |
| |
2174 | 2179 |
| |
2175 | 2180 |
| |
2176 | 2181 |
| |
2177 | 2182 |
| |
2178 | 2183 |
| |
| 2184 | + | |
2179 | 2185 |
| |
2180 | 2186 |
| |
2181 | 2187 |
| |
| |||
2209 | 2215 |
| |
2210 | 2216 |
| |
2211 | 2217 |
| |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
2212 | 2224 |
| |
2213 | 2225 |
| |
2214 | 2226 |
| |
| |||
2236 | 2248 |
| |
2237 | 2249 |
| |
2238 | 2250 |
| |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
2239 | 2254 |
| |
2240 | 2255 |
| |
2241 | 2256 |
| |
| |||
2363 | 2378 |
| |
2364 | 2379 |
| |
2365 | 2380 |
| |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
2366 | 2392 |
| |
2367 | 2393 |
| |
2368 | 2394 |
| |
| |||
2409 | 2435 |
| |
2410 | 2436 |
| |
2411 | 2437 |
| |
2412 |
| - | |
| 2438 | + | |
| 2439 | + | |
2413 | 2440 |
| |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
2414 | 2448 |
| |
2415 | 2449 |
| |
2416 | 2450 |
| |
|
Lines changed: 0 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
22 | 22 |
| |
23 | 23 |
| |
24 | 24 |
| |
25 |
| - | |
26 | 25 |
| |
27 | 26 |
| |
28 | 27 |
| |
29 | 28 |
| |
30 | 29 |
| |
31 | 30 |
| |
32 | 31 |
| |
33 |
| - | |
34 | 32 |
| |
35 | 33 |
| |
36 | 34 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
105 | 105 |
| |
106 | 106 |
| |
107 | 107 |
| |
| 108 | + | |
108 | 109 |
| |
109 | 110 |
| |
110 | 111 |
| |
|
Lines changed: 39 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + |
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
| 39 | + | |
39 | 40 |
| |
40 | 41 |
| |
41 | 42 |
| |
|
Lines changed: 44 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + |
0 commit comments
Comments
(0)