forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit727bc6a

Richard Guo
Fix freeing a child join's SpecialJoinInfo
In try_partitionwise_join, we try to break down the join between twopartitioned relations into joins between matching partitions. Toachieve this, we iterate through each pair of partitions from the twojoining relations and create child join relations for them. To reducememory accumulation during each iteration, one step we take is freeingthe SpecialJoinInfos created for the child joins.A child join's SpecialJoinInfo is a copy of the parent join'sSpecialJoinInfo, with some members being translated copies of theircounterparts in the parent. However, when freeing the bitmapsetmembers in a child join's SpecialJoinInfo, we failed to check whetherthey were translated copies. As a result, we inadvertently freed themembers that were still in use by the parent SpecialJoinInfo, leadingto crashes when those freed members were accessed.To fix, check if each member of the child join's SpecialJoinInfo is atranslated copy and free it only if that's the case. This requirespassing the parent join's SpecialJoinInfo as a parameter tofree_child_join_sjinfo.Back-patch to v17 where this bug crept in.Bug: #18806Reported-by: 孟令彬 <m_lingbin@126.com>Diagnosed-by: Tender Wang <tndrwang@gmail.com>Author: Richard Guo <guofenglinux@gmail.com>Reviewed-by: Amit Langote <amitlangote09@gmail.com>Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>Discussion:https://postgr.es/m/18806-d70b0c9fdf63dcbf@postgresql.orgBackpatch-through: 171 parenta68a759 commit727bc6a
File tree
3 files changed
+64
-9
lines changed- src
- backend/optimizer/path
- test/regress
- expected
- sql
3 files changed
+64
-9
lines changedLines changed: 25 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
45 | 45 |
| |
46 | 46 |
| |
47 | 47 |
| |
48 |
| - | |
| 48 | + | |
| 49 | + | |
49 | 50 |
| |
50 | 51 |
| |
51 | 52 |
| |
| |||
1677 | 1678 |
| |
1678 | 1679 |
| |
1679 | 1680 |
| |
1680 |
| - | |
| 1681 | + | |
1681 | 1682 |
| |
1682 | 1683 |
| |
1683 | 1684 |
| |
| |||
1744 | 1745 |
| |
1745 | 1746 |
| |
1746 | 1747 |
| |
1747 |
| - | |
| 1748 | + | |
| 1749 | + | |
1748 | 1750 |
| |
1749 | 1751 |
| |
1750 | 1752 |
| |
1751 | 1753 |
| |
1752 | 1754 |
| |
1753 |
| - | |
| 1755 | + | |
1754 | 1756 |
| |
1755 |
| - | |
1756 |
| - | |
1757 |
| - | |
1758 |
| - | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
1759 | 1775 |
| |
1760 | 1776 |
| |
1761 | 1777 |
| |
1762 | 1778 |
| |
1763 | 1779 |
| |
1764 | 1780 |
| |
1765 | 1781 |
| |
1766 |
| - | |
| 1782 | + | |
1767 | 1783 |
| |
1768 | 1784 |
| |
1769 | 1785 |
| |
|
Lines changed: 35 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
674 | 674 |
| |
675 | 675 |
| |
676 | 676 |
| |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
677 | 712 |
| |
678 | 713 |
| |
679 | 714 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
138 | 138 |
| |
139 | 139 |
| |
140 | 140 |
| |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
141 | 145 |
| |
142 | 146 |
| |
143 | 147 |
| |
|
0 commit comments
Comments
(0)