forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4e32f8c
committed
Fix hash_search to avoid corruption of the hash table on out-of-memory.
An out-of-memory error during expand_table() on a palloc-based hash tablewould leave a partially-initialized entry in the table. This would not beharmful for transient hash tables, since they'd get thrown away anyway attransaction abort. But for long-lived hash tables, such as the relcachehash, this would effectively corrupt the table, leading to crash or othermisbehavior later.To fix, rearrange the order of operations so that table enlargement isattempted before we insert a new entry, rather than after adding itto the hash table.Problem discovered by Hitoshi Harada, though this is a bit differentfrom his proposed patch.1 parent0d68950 commit4e32f8c
1 file changed
+30
-16
lines changedLines changed: 30 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
24 | 29 |
| |
25 | 30 |
| |
26 | 31 |
| |
| |||
820 | 825 |
| |
821 | 826 |
| |
822 | 827 |
| |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
823 | 849 |
| |
824 | 850 |
| |
825 | 851 |
| |
| |||
940 | 966 |
| |
941 | 967 |
| |
942 | 968 |
| |
943 |
| - | |
944 |
| - | |
945 | 969 |
| |
946 |
| - | |
947 |
| - | |
948 |
| - | |
949 |
| - | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
950 | 974 |
| |
951 |
| - | |
952 |
| - | |
953 |
| - | |
954 |
| - | |
955 |
| - | |
956 |
| - | |
957 |
| - | |
958 |
| - | |
959 |
| - | |
960 |
| - | |
961 | 975 |
| |
962 | 976 |
| |
963 | 977 |
| |
|
0 commit comments
Comments
(0)