forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc01eb61
committed
Apply stopgap fix for bug #15672.
Fix DefineIndex so that it doesn't attempt to pass down a to-be-reusedindex relfilenode to a child index creation, and fix TryReuseIndexto not think that reuse is sensible for a partitioned index.In v11, this fixes a problem where ALTER TABLE on a partitioned tablecould assign the same relfilenode to several different child indexes,causing very nasty catalog corruption --- in fact, attempting to DROPthe partitioned table then leads not only to a database crash, but toinability to restart because the same crash will recur during WAL replay.Either of these two changes would be enough to prevent the failure, butsince neither action could possibly be sane, let's put in both changesfor future-proofing.In HEAD, no such bug manifests, but that's just an accidental consequenceof having changed the pg_class representation of partitioned indexes tohave relfilenode = 0. Both of these changes still seem like smartfuture-proofing.This is only a stop-gap because the code for ALTER TABLE on a partitionedtable with a no-op type change still leaves a great deal to be desired.As the added regression tests show, it gets things wrong for comments onchild indexes/constraints, and it is regenerating child indexes it doesn'thave to. However, fixing those problems will take more work which may notget back-patched into v11. We need a fix for the corruption problem now.Per bug #15672 from Jianing Yang.Patch by me, regression test cases based on work by Amit Langote,who also did a lot of the investigative work.Discussion:https://postgr.es/m/15672-b9fa7db32698269f@postgresql.org1 parent7fcdb5e commitc01eb61
File tree
4 files changed
+166
-3
lines changed- src
- backend/commands
- test/regress
- expected
- sql
4 files changed
+166
-3
lines changedLines changed: 12 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1150 | 1150 |
| |
1151 | 1151 |
| |
1152 | 1152 |
| |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
1153 | 1165 |
| |
1154 | 1166 |
| |
1155 | 1167 |
| |
| |||
1181 | 1193 |
| |
1182 | 1194 |
| |
1183 | 1195 |
| |
1184 |
| - | |
1185 |
| - | |
1186 | 1196 |
| |
1187 | 1197 |
| |
1188 | 1198 |
| |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
11452 | 11452 |
| |
11453 | 11453 |
| |
11454 | 11454 |
| |
11455 |
| - | |
| 11455 | + | |
| 11456 | + | |
| 11457 | + | |
11456 | 11458 |
| |
11457 | 11459 |
| |
11458 | 11460 |
| |
|
Lines changed: 88 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1990 | 1990 |
| |
1991 | 1991 |
| |
1992 | 1992 |
| |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
1993 | 2081 |
| |
1994 | 2082 |
| |
1995 | 2083 |
| |
|
Lines changed: 63 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1353 | 1353 |
| |
1354 | 1354 |
| |
1355 | 1355 |
| |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
1356 | 1419 |
| |
1357 | 1420 |
| |
1358 | 1421 |
| |
|
0 commit comments
Comments
(0)