forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc3c35a7
committed
Prevent infinite insertion loops in spgdoinsert().
Formerly we just relied on operator classes that assert longValuesOKto eventually shorten the leaf value enough to fit on an index page.That fails since the introduction of INCLUDE-column support (commit09c1c6a), because the INCLUDE columns might alone take up morethan a page, meaning no amount of leaf-datum compaction will getthe job done. At least with spgtextproc.c, that leads to an infiniteloop, since spgtextproc.c won't throw an error for not being ableto shorten the leaf datum anymore.To fix without breaking cases that would otherwise work, add logicto spgdoinsert() to verify that the leaf tuple size is decreasingafter each "choose" step. Some opclasses might not decrease thesize on every single cycle, and in any case, alignment roundoffof the tuple size could obscure small gains. Therefore, allowup to 10 cycles without additional savings before throwing anerror. (Perhaps this number will need adjustment, but it seemsquite generous right now.)As long as we've developed this logic, let's back-patch it.The back branches don't have INCLUDE columns to worry about, butthis seems like a good defense against possible bugs in operatorclasses. We already know that an infinite loop here is prettyunpleasant, so having a defense seems to outweigh the risk ofbreaking things. (Note that spgtextproc.c is actually the onlyknown opclass with longValuesOK support, so that this is all mootfor known non-core opclasses anyway.)Per report from Dilip Kumar.Discussion:https://postgr.es/m/CAFiTN-uxP_soPhVG840tRMQTBmtA_f_Y8N51G7DKYYqDh7XN-A@mail.gmail.com1 parenteb7a6b9 commitc3c35a7
File tree
4 files changed
+88
-11
lines changed- doc/src/sgml
- src
- backend/access/spgist
- test/modules/spgist_name_ops
- expected
- sql
4 files changed
+88
-11
lines changedLines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
978 | 978 |
| |
979 | 979 |
| |
980 | 980 |
| |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
981 | 993 |
| |
982 | 994 |
| |
983 | 995 |
| |
|
Lines changed: 56 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
669 | 669 |
| |
670 | 670 |
| |
671 | 671 |
| |
672 |
| - | |
| 672 | + | |
| 673 | + | |
673 | 674 |
| |
674 | 675 |
| |
675 | 676 |
| |
| |||
1918 | 1919 |
| |
1919 | 1920 |
| |
1920 | 1921 |
| |
| 1922 | + | |
| 1923 | + | |
1921 | 1924 |
| |
1922 | 1925 |
| |
1923 | 1926 |
| |
| |||
1988 | 1991 |
| |
1989 | 1992 |
| |
1990 | 1993 |
| |
1991 |
| - | |
| 1994 | + | |
1992 | 1995 |
| |
1993 |
| - | |
| 1996 | + | |
| 1997 | + | |
1994 | 1998 |
| |
1995 | 1999 |
| |
1996 | 2000 |
| |
1997 | 2001 |
| |
1998 | 2002 |
| |
1999 | 2003 |
| |
2000 | 2004 |
| |
| 2005 | + | |
2001 | 2006 |
| |
2002 | 2007 |
| |
2003 | 2008 |
| |
| |||
2226 | 2231 |
| |
2227 | 2232 |
| |
2228 | 2233 |
| |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
2229 | 2282 |
| |
2230 | 2283 |
| |
2231 | 2284 |
| |
2232 | 2285 |
| |
2233 | 2286 |
| |
2234 |
| - | |
2235 |
| - | |
2236 |
| - | |
2237 |
| - | |
2238 |
| - | |
2239 |
| - | |
2240 |
| - | |
2241 |
| - | |
2242 | 2287 |
| |
2243 | 2288 |
| |
2244 | 2289 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
64 | 70 |
| |
65 | 71 |
| |
66 | 72 |
| |
| |||
100 | 106 |
| |
101 | 107 |
| |
102 | 108 |
| |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + |
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
30 | 36 |
| |
31 | 37 |
| |
32 | 38 |
| |
| |||
39 | 45 |
| |
40 | 46 |
| |
41 | 47 |
| |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + |
0 commit comments
Comments
(0)