- Notifications
You must be signed in to change notification settings - Fork5
Commit2065dd2
committed
Prevent very-low-probability PANIC during PREPARE TRANSACTION.
The code in PostPrepare_Locks supposed that it could reassign locks tothe prepared transaction's dummy PGPROC by deleting the PROCLOCK tableentries and immediately creating new ones. This was safe when that codewas written, but since we invented partitioning of the shared lock table,it's not safe --- another process could steal away the PROCLOCK entry inthe short interval when it's on the freelist. Then, if we were otherwiseout of shared memory, PostPrepare_Locks would have to PANIC, since it'stoo late to back out of the PREPARE at that point.Fix by inventing a dynahash.c function to atomically update a hashtableentry's key. (This might possibly have other uses in future.)This is an ancient bug that in principle we ought to back-patch, but theodds of someone hitting it in the field seem really tiny, because (a) therisk window is small, and (b) nobody runs servers with maxed-out locktables for long, because they'll be getting non-PANIC out-of-memory errorsanyway. So fixing it in HEAD seems sufficient, at least until the newcode has gotten some testing.1 parent9d2cd99 commit2065dd2
File tree
3 files changed
+169
-48
lines changed- src
- backend
- storage/lmgr
- utils/hash
- include/utils
3 files changed
+169
-48
lines changedLines changed: 23 additions & 48 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3028 | 3028 |
| |
3029 | 3029 |
| |
3030 | 3030 |
| |
3031 |
| - | |
3032 | 3031 |
| |
3033 | 3032 |
| |
3034 | 3033 |
| |
| |||
3114 | 3113 |
| |
3115 | 3114 |
| |
3116 | 3115 |
| |
3117 |
| - | |
3118 |
| - | |
3119 | 3116 |
| |
3120 |
| - | |
| 3117 | + | |
3121 | 3118 |
| |
3122 | 3119 |
| |
3123 | 3120 |
| |
| |||
3145 | 3142 |
| |
3146 | 3143 |
| |
3147 | 3144 |
| |
3148 |
| - | |
3149 |
| - | |
3150 | 3145 |
| |
3151 | 3146 |
| |
3152 | 3147 |
| |
3153 |
| - | |
3154 |
| - | |
3155 |
| - | |
3156 |
| - | |
3157 |
| - | |
3158 |
| - | |
| 3148 | + | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
| 3156 | + | |
3159 | 3157 |
| |
3160 |
| - | |
3161 | 3158 |
| |
3162 |
| - | |
3163 |
| - | |
3164 |
| - | |
3165 |
| - | |
3166 | 3159 |
| |
3167 | 3160 |
| |
3168 |
| - | |
| 3161 | + | |
3169 | 3162 |
| |
3170 | 3163 |
| |
3171 | 3164 |
| |
3172 | 3165 |
| |
3173 |
| - | |
3174 |
| - | |
3175 |
| - | |
3176 |
| - | |
3177 |
| - | |
3178 |
| - | |
3179 |
| - | |
3180 |
| - | |
3181 |
| - | |
3182 | 3166 |
| |
3183 |
| - | |
| 3167 | + | |
| 3168 | + | |
| 3169 | + | |
3184 | 3170 |
| |
3185 |
| - | |
3186 |
| - | |
3187 |
| - | |
3188 |
| - | |
3189 |
| - | |
3190 |
| - | |
3191 |
| - | |
3192 |
| - | |
3193 |
| - | |
3194 |
| - | |
3195 |
| - | |
3196 |
| - | |
3197 |
| - | |
3198 |
| - | |
3199 |
| - | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
| 3174 | + | |
3200 | 3175 |
| |
3201 |
| - | |
3202 |
| - | |
3203 |
| - | |
3204 |
| - | |
3205 |
| - | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
3206 | 3181 |
| |
3207 | 3182 |
| |
3208 | 3183 |
| |
|
Lines changed: 144 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
183 | 183 |
| |
184 | 184 |
| |
185 | 185 |
| |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
186 | 192 |
| |
187 | 193 |
| |
188 | 194 |
| |
| |||
987 | 993 |
| |
988 | 994 |
| |
989 | 995 |
| |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
990 | 1134 |
| |
991 | 1135 |
| |
992 | 1136 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
128 | 128 |
| |
129 | 129 |
| |
130 | 130 |
| |
| 131 | + | |
| 132 | + | |
131 | 133 |
| |
132 | 134 |
| |
133 | 135 |
| |
|
0 commit comments
Comments
(0)