- Notifications
You must be signed in to change notification settings - Fork5
Commit4240e42
committed
Try to acquire relation locks in RangeVarGetRelid.
In the previous coding, we would look up a relation in RangeVarGetRelid,lock the resulting OID, and then AcceptInvalidationMessages(). Whilethis was sufficient to ensure that we noticed any changes to therelation definition before building the relcache entry, it didn'thandle the possibility that the name we looked up no longer referencedthe same OID. This was particularly problematic in the case where atable had been dropped and recreated: we'd latch on to the entry forthe old relation and fail later on. Now, we acquire the relation lockinside RangeVarGetRelid, and retry the name lookup if we notice thatinvalidation messages have been processed meanwhile. Many operationsthat would previously have failed with an error in the presence ofconcurrent DDL will now succeed.There is a good deal of work remaining to be done here: many callersof RangeVarGetRelid still pass NoLock for one reason or another. Inaddition, nothing in this patch guards against the possibility thatthe meaning of an unqualified name might change due to the creationof a relation in a schema earlier in the user's search path than theone where it was previously found. Furthermore, there's nothing atall here to guard against similar race conditions for non-relations.For all that, it's a start.Noah Misch and Robert Haas1 parent9d522cb commit4240e42
File tree
26 files changed
+337
-195
lines changed- src
- backend
- access/heap
- catalog
- commands
- parser
- rewrite
- storage
- ipc
- lmgr
- tcop
- utils/adt
- include
- catalog
- commands
- rewrite
- storage
- pl/plpgsql/src
26 files changed
+337
-195
lines changedLines changed: 6 additions & 36 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
975 | 975 |
| |
976 | 976 |
| |
977 | 977 |
| |
978 |
| - | |
979 |
| - | |
980 |
| - | |
981 |
| - | |
982 |
| - | |
983 |
| - | |
984 |
| - | |
985 |
| - | |
986 |
| - | |
987 |
| - | |
988 |
| - | |
989 |
| - | |
990 |
| - | |
991 |
| - | |
992 |
| - | |
993 |
| - | |
994 |
| - | |
| 978 | + | |
| 979 | + | |
995 | 980 |
| |
996 | 981 |
| |
997 |
| - | |
| 982 | + | |
998 | 983 |
| |
999 | 984 |
| |
1000 | 985 |
| |
| |||
1012 | 997 |
| |
1013 | 998 |
| |
1014 | 999 |
| |
1015 |
| - | |
1016 |
| - | |
1017 |
| - | |
1018 |
| - | |
1019 |
| - | |
1020 |
| - | |
1021 |
| - | |
1022 |
| - | |
1023 |
| - | |
1024 |
| - | |
1025 |
| - | |
1026 |
| - | |
1027 |
| - | |
1028 |
| - | |
1029 |
| - | |
1030 |
| - | |
1031 |
| - | |
| 1000 | + | |
| 1001 | + | |
1032 | 1002 |
| |
1033 | 1003 |
| |
1034 | 1004 |
| |
1035 | 1005 |
| |
1036 | 1006 |
| |
1037 | 1007 |
| |
1038 |
| - | |
| 1008 | + | |
1039 | 1009 |
| |
1040 | 1010 |
| |
1041 | 1011 |
| |
|
Lines changed: 6 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
583 | 583 |
| |
584 | 584 |
| |
585 | 585 |
| |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
586 | 591 |
| |
587 | 592 |
| |
588 | 593 |
| |
| |||
601 | 606 |
| |
602 | 607 |
| |
603 | 608 |
| |
604 |
| - | |
| 609 | + | |
605 | 610 |
| |
606 | 611 |
| |
607 | 612 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2942 | 2942 |
| |
2943 | 2943 |
| |
2944 | 2944 |
| |
2945 |
| - | |
| 2945 | + | |
| 2946 | + | |
2946 | 2947 |
| |
2947 | 2948 |
| |
2948 | 2949 |
| |
|
Lines changed: 120 additions & 29 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
44 | 44 |
| |
45 | 45 |
| |
46 | 46 |
| |
| 47 | + | |
| 48 | + | |
47 | 49 |
| |
48 | 50 |
| |
49 | 51 |
| |
| |||
215 | 217 |
| |
216 | 218 |
| |
217 | 219 |
| |
218 |
| - | |
| 220 | + | |
219 | 221 |
| |
| 222 | + | |
| 223 | + | |
220 | 224 |
| |
221 | 225 |
| |
222 |
| - | |
| 226 | + | |
| 227 | + | |
223 | 228 |
| |
| 229 | + | |
224 | 230 |
| |
225 | 231 |
| |
| 232 | + | |
| 233 | + | |
226 | 234 |
| |
227 | 235 |
| |
228 | 236 |
| |
| |||
238 | 246 |
| |
239 | 247 |
| |
240 | 248 |
| |
241 |
| - | |
242 |
| - | |
243 |
| - | |
244 |
| - | |
245 |
| - | |
246 |
| - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
247 | 263 |
| |
248 |
| - | |
| 264 | + | |
249 | 265 |
| |
250 |
| - | |
251 |
| - | |
252 |
| - | |
253 |
| - | |
254 |
| - | |
255 |
| - | |
256 |
| - | |
257 |
| - | |
258 |
| - | |
259 |
| - | |
260 |
| - | |
261 |
| - | |
262 |
| - | |
263 |
| - | |
264 |
| - | |
265 |
| - | |
266 |
| - | |
267 |
| - | |
268 |
| - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
269 | 360 |
| |
270 | 361 |
| |
271 |
| - | |
| 362 | + | |
272 | 363 |
| |
273 | 364 |
| |
274 | 365 |
| |
|
Lines changed: 6 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
108 | 108 |
| |
109 | 109 |
| |
110 | 110 |
| |
111 |
| - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
112 | 117 |
| |
113 | 118 |
| |
114 | 119 |
| |
|
Lines changed: 10 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1531 | 1531 |
| |
1532 | 1532 |
| |
1533 | 1533 |
| |
1534 |
| - | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
1535 | 1541 |
| |
1536 |
| - | |
| 1542 | + | |
1537 | 1543 |
| |
1538 | 1544 |
| |
1539 | 1545 |
| |
| |||
1562 | 1568 |
| |
1563 | 1569 |
| |
1564 | 1570 |
| |
1565 |
| - | |
| 1571 | + | |
| 1572 | + | |
1566 | 1573 |
| |
1567 | 1574 |
| |
1568 | 1575 |
| |
|
0 commit comments
Comments
(0)