forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitcfc43ae
committed
Fix marking of indisvalid for partitioned indexes at creation
The logic that introduced partitioned indexes missed a few things wheninvalidating a partitioned index when these are created, still the codeis written to handle recursions:1) If created from scratch because a mapping index could not be found,the new index created could be itself invalid, if for example it was apartitioned index with one of its leaves invalid.2) A CCI was missing when indisvalid is set for a parent index, leadingto inconsistent trees when recursing across more than one level for apartitioned index creation if an invalidation of the parent wasrequired.This could lead to the creation of a partition index tree where some ofthe partitioned indexes are marked as invalid, but some of the parentsare marked valid, which is not something that should happen (asvalidatePartitionedIndex() defines, indisvalid is switched to true for apartitioned index iff all its partitions are themselves valid).This patch makes sure that indisvalid is set to false on a partitionedindex if at least one of its partition is invalid. The flag is set totrue if *all* its partitions are valid.The regression test added in this commit abuses of a failed concurrentindex creation, marked as invalid, that maps with an index created onits partitioned table afterwards.Reported-by: Alexander LakhinReviewed-by: Alexander LakhinDiscussion:https://postgr.es/m/14987634-43c0-0cb3-e075-94d423607e08@gmail.comBackpatch-through: 111 parentc951e90 commitcfc43ae
File tree
3 files changed
+85
-7
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+85
-7
lines changedLines changed: 24 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1416 | 1416 |
| |
1417 | 1417 |
| |
1418 | 1418 |
| |
| 1419 | + | |
1419 | 1420 |
| |
1420 | 1421 |
| |
1421 | 1422 |
| |
| |||
1469 | 1470 |
| |
1470 | 1471 |
| |
1471 | 1472 |
| |
1472 |
| - | |
1473 |
| - | |
1474 |
| - | |
1475 |
| - | |
1476 |
| - | |
1477 |
| - | |
1478 |
| - | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
1479 | 1482 |
| |
1480 | 1483 |
| |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
1481 | 1492 |
| |
1482 | 1493 |
| |
1483 | 1494 |
| |
| |||
1507 | 1518 |
| |
1508 | 1519 |
| |
1509 | 1520 |
| |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
1510 | 1527 |
| |
1511 | 1528 |
| |
1512 | 1529 |
| |
|
Lines changed: 35 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1451 | 1451 |
| |
1452 | 1452 |
| |
1453 | 1453 |
| |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + |
Lines changed: 26 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
782 | 782 |
| |
783 | 783 |
| |
784 | 784 |
| |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + |
0 commit comments
Comments
(0)