- Notifications
You must be signed in to change notification settings - Fork5
Commitcae1c78
committed
Improve the situation for parallel query versus temp relations.
Transmit the leader's temp-namespace state to workers. This is importantbecause without it, the workers do not really have the same search pathas the leader. For example, there is no good reason (and no extant codeeither) to prevent a worker from executing a temp function that theleader created previously; but as things stood it would fail to find thetemp function, and then either fail or execute the wrong function entirely.We still prohibit a worker from creating a temp namespace on its own.In effect, a worker can only see the session's temp namespace if the leaderhad created it before starting the worker, which seems like the rightsemantics.Also, transmit the leader's BackendId to workers, and arrange for workersto use that when determining the physical file path of a temp relationbelonging to their session. While the original intent was to prevent suchaccesses entirely, there were a number of holes in that, notably in placeslike dbsize.c which assume they can safely access temp rels of othersessions anyway. We might as well get this right, as a small down paymenton someday allowing workers to access the leader's temp tables. (Withthis change, directly using "MyBackendId" as a relation or buffer backendID is deprecated; you should use BackendIdForTempRelations() instead.I left a couple of such uses alone though, as they're not going to bereachable in parallel workers until we do something about localbuf.c.)Move the thou-shalt-not-access-thy-leader's-temp-tables prohibition downinto localbuf.c, which is where it actually matters, instead of having itin relation_open(). This amounts to recognizing that access to temptables' catalog entries is perfectly safe in a worker, it's only the datain local buffers that is problematic.Having done all that, we can get rid of the test in has_parallel_hazard()that says that use of a temp table's rowtype is unsafe in parallel workers.That test was unduly expensive, and if we really did need such aprohibition, that was not even close to being a bulletproof guard for it.(For example, any user-defined function executed in a parallel workermight have attempted such access.)1 parent2410a25 commitcae1c78
File tree
12 files changed
+92
-72
lines changed- src
- backend
- access
- heap
- transam
- catalog
- optimizer/util
- storage/buffer
- utils
- adt
- cache
- init
- include
- catalog
- storage
12 files changed
+92
-72
lines changedLines changed: 0 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1131 | 1131 |
| |
1132 | 1132 |
| |
1133 | 1133 |
| |
1134 |
| - | |
1135 |
| - | |
1136 |
| - | |
1137 |
| - | |
1138 |
| - | |
1139 | 1134 |
| |
1140 |
| - | |
1141 | 1135 |
| |
1142 | 1136 |
| |
1143 | 1137 |
| |
| |||
1183 | 1177 |
| |
1184 | 1178 |
| |
1185 | 1179 |
| |
1186 |
| - | |
1187 |
| - | |
1188 |
| - | |
1189 |
| - | |
1190 |
| - | |
1191 | 1180 |
| |
1192 |
| - | |
1193 | 1181 |
| |
1194 | 1182 |
| |
1195 | 1183 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
| 20 | + | |
20 | 21 |
| |
21 | 22 |
| |
22 | 23 |
| |
| |||
67 | 68 |
| |
68 | 69 |
| |
69 | 70 |
| |
| 71 | + | |
| 72 | + | |
70 | 73 |
| |
71 | 74 |
| |
72 | 75 |
| |
| |||
288 | 291 |
| |
289 | 292 |
| |
290 | 293 |
| |
| 294 | + | |
| 295 | + | |
291 | 296 |
| |
292 | 297 |
| |
293 | 298 |
| |
| |||
1019 | 1024 |
| |
1020 | 1025 |
| |
1021 | 1026 |
| |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
1022 | 1034 |
| |
1023 | 1035 |
| |
1024 | 1036 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
390 | 390 |
| |
391 | 391 |
| |
392 | 392 |
| |
393 |
| - | |
| 393 | + | |
394 | 394 |
| |
395 | 395 |
| |
396 | 396 |
| |
|
Lines changed: 45 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3073 | 3073 |
| |
3074 | 3074 |
| |
3075 | 3075 |
| |
| 3076 | + | |
| 3077 | + | |
| 3078 | + | |
| 3079 | + | |
| 3080 | + | |
| 3081 | + | |
| 3082 | + | |
| 3083 | + | |
| 3084 | + | |
| 3085 | + | |
| 3086 | + | |
| 3087 | + | |
| 3088 | + | |
| 3089 | + | |
| 3090 | + | |
| 3091 | + | |
| 3092 | + | |
| 3093 | + | |
| 3094 | + | |
| 3095 | + | |
| 3096 | + | |
| 3097 | + | |
| 3098 | + | |
| 3099 | + | |
| 3100 | + | |
| 3101 | + | |
| 3102 | + | |
| 3103 | + | |
| 3104 | + | |
| 3105 | + | |
| 3106 | + | |
| 3107 | + | |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
| 3111 | + | |
| 3112 | + | |
| 3113 | + | |
| 3114 | + | |
| 3115 | + | |
| 3116 | + | |
| 3117 | + | |
| 3118 | + | |
| 3119 | + | |
| 3120 | + | |
3076 | 3121 |
| |
3077 | 3122 |
| |
3078 | 3123 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
85 | 85 |
| |
86 | 86 |
| |
87 | 87 |
| |
88 |
| - | |
| 88 | + | |
89 | 89 |
| |
90 | 90 |
| |
91 | 91 |
| |
|
Lines changed: 0 additions & 55 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
115 | 115 |
| |
116 | 116 |
| |
117 | 117 |
| |
118 |
| - | |
119 | 118 |
| |
120 | 119 |
| |
121 | 120 |
| |
| |||
1409 | 1408 |
| |
1410 | 1409 |
| |
1411 | 1410 |
| |
1412 |
| - | |
1413 |
| - | |
1414 |
| - | |
1415 |
| - | |
1416 |
| - | |
1417 |
| - | |
1418 |
| - | |
1419 |
| - | |
1420 |
| - | |
1421 |
| - | |
1422 |
| - | |
1423 |
| - | |
1424 |
| - | |
1425 |
| - | |
1426 |
| - | |
1427 |
| - | |
1428 |
| - | |
1429 |
| - | |
1430 |
| - | |
1431 |
| - | |
1432 |
| - | |
1433 |
| - | |
1434 |
| - | |
1435 |
| - | |
1436 |
| - | |
1437 |
| - | |
1438 |
| - | |
1439 |
| - | |
1440 |
| - | |
1441 |
| - | |
1442 |
| - | |
1443 |
| - | |
1444 |
| - | |
1445 |
| - | |
1446 |
| - | |
1447 |
| - | |
1448 |
| - | |
1449 |
| - | |
1450 |
| - | |
1451 |
| - | |
1452 |
| - | |
1453 |
| - | |
1454 |
| - | |
1455 | 1411 |
| |
1456 | 1412 |
| |
1457 | 1413 |
| |
| |||
1558 | 1514 |
| |
1559 | 1515 |
| |
1560 | 1516 |
| |
1561 |
| - | |
1562 |
| - | |
1563 |
| - | |
1564 |
| - | |
1565 |
| - | |
1566 |
| - | |
1567 |
| - | |
1568 |
| - | |
1569 |
| - | |
1570 |
| - | |
1571 |
| - | |
1572 | 1517 |
| |
1573 | 1518 |
| |
1574 | 1519 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
| 18 | + | |
18 | 19 |
| |
19 | 20 |
| |
20 | 21 |
| |
| |||
412 | 413 |
| |
413 | 414 |
| |
414 | 415 |
| |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
415 | 429 |
| |
416 | 430 |
| |
417 | 431 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1004 | 1004 |
| |
1005 | 1005 |
| |
1006 | 1006 |
| |
1007 |
| - | |
| 1007 | + | |
1008 | 1008 |
| |
1009 | 1009 |
| |
1010 | 1010 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
993 | 993 |
| |
994 | 994 |
| |
995 | 995 |
| |
996 |
| - | |
| 996 | + | |
997 | 997 |
| |
998 | 998 |
| |
999 | 999 |
| |
| |||
2970 | 2970 |
| |
2971 | 2971 |
| |
2972 | 2972 |
| |
2973 |
| - | |
| 2973 | + | |
2974 | 2974 |
| |
2975 | 2975 |
| |
2976 | 2976 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
71 | 71 |
| |
72 | 72 |
| |
73 | 73 |
| |
| 74 | + | |
| 75 | + | |
74 | 76 |
| |
75 | 77 |
| |
76 | 78 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
125 | 125 |
| |
126 | 126 |
| |
127 | 127 |
| |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
128 | 132 |
| |
129 | 133 |
| |
130 | 134 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
27 | 37 |
|
0 commit comments
Comments
(0)