forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc2e228d
committed
Fix RelationCacheInitializePhase2 (Phase3, in HEAD) to cope with the
possibility of shared-inval messages causing a relcache flush while it triesto fill in missing data in preloaded relcache entries. There are actuallytwo distinct failure modes here:1. The flush could delete the next-to-be-processed cache entry, causingthe subsequent hash_seq_search calls to go off into the weeds. This isthe problem reported by Michael Brown, and I believe it also accountsfor bug #5074. The simplest fix is to restart the hashtable scan afterwe've read any new data from the catalogs. It appears that pre-8.4branches have not suffered from this failure, because by chance there wereno other catalogs sharing the same hash chains with the catalogs thatRelationCacheInitializePhase2 had work to do for. However that's obviouslypretty fragile, and it seems possible that derivative versions withadditional system catalogs might be vulnerable, so I'm back-patching thispart of the fix anyway.2. The flush could delete the *current* cache entry, in which case thepointer to the newly-loaded data would end up being stored into analready-deleted Relation struct. As long as it was still deleted, the onlyconsequence would be some leaked space in CacheMemoryContext. But it seemspossible that the Relation struct could already have been recycled, inwhich case this represents a hard-to-reproduce clobber of cached datastructures, with unforeseeable consequences. The fix here is to pin theentry while we work on it.In passing, also change RelationCacheInitializePhase2 to Assert thatformrdesc() set up the relation's cached TupleDesc (rd_att) with thecorrect type OID and hasoids values. This is more appropriate thansilently updating the values, because the original tupdesc might alreadyhave been copied into the catcache. However this part of the patch isnot in HEAD because it fails due to some questionable recent changes informrdesc :-(. That will be cleaned up in a subsequent patch.1 parentd39a84a commitc2e228d
1 file changed
+54
-7
lines changedLines changed: 54 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
144 | 144 |
| |
145 | 145 |
| |
146 | 146 |
| |
147 |
| - | |
148 |
| - | |
| 147 | + | |
149 | 148 |
| |
150 | 149 |
| |
151 | 150 |
| |
| |||
154 | 153 |
| |
155 | 154 |
| |
156 | 155 |
| |
157 |
| - | |
| 156 | + | |
| 157 | + | |
158 | 158 |
| |
159 | 159 |
| |
160 | 160 |
| |
| |||
1412 | 1412 |
| |
1413 | 1413 |
| |
1414 | 1414 |
| |
1415 |
| - | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
1416 | 1418 |
| |
1417 | 1419 |
| |
1418 | 1420 |
| |
| |||
2687 | 2689 |
| |
2688 | 2690 |
| |
2689 | 2691 |
| |
| 2692 | + | |
| 2693 | + | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
| 2698 | + | |
| 2699 | + | |
2690 | 2700 |
| |
2691 | 2701 |
| |
2692 | 2702 |
| |
2693 | 2703 |
| |
2694 | 2704 |
| |
2695 | 2705 |
| |
| 2706 | + | |
| 2707 | + | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
2696 | 2712 |
| |
2697 | 2713 |
| |
2698 | 2714 |
| |
2699 | 2715 |
| |
2700 |
| - | |
| 2716 | + | |
2701 | 2717 |
| |
2702 | 2718 |
| |
2703 | 2719 |
| |
| |||
2714 | 2730 |
| |
2715 | 2731 |
| |
2716 | 2732 |
| |
2717 |
| - | |
2718 | 2733 |
| |
2719 | 2734 |
| |
2720 | 2735 |
| |
| |||
2730 | 2745 |
| |
2731 | 2746 |
| |
2732 | 2747 |
| |
| 2748 | + | |
| 2749 | + | |
| 2750 | + | |
| 2751 | + | |
| 2752 | + | |
| 2753 | + | |
| 2754 | + | |
2733 | 2755 |
| |
2734 | 2756 |
| |
2735 | 2757 |
| |
2736 | 2758 |
| |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
2737 | 2764 |
| |
2738 | 2765 |
| |
| 2766 | + | |
2739 | 2767 |
| |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
2740 | 2772 |
| |
| 2773 | + | |
2741 | 2774 |
| |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
2742 | 2789 |
| |
2743 | 2790 |
| |
2744 | 2791 |
| |
|
0 commit comments
Comments
(0)