|
37 | 37 | #include "utils/guc.h"
|
38 | 38 | #include "utils/inval.h"
|
39 | 39 | #include "utils/memutils.h"
|
40 |
| -#include "utils/resowner.h" |
41 | 40 | #include "utils/snapmgr.h"
|
42 | 41 | #include "utils/typcache.h"
|
43 | 42 |
|
@@ -1220,16 +1219,19 @@ ParallelWorkerMain(Datum main_arg)
|
1220 | 1219 | Assert(ParallelWorkerNumber == -1);
|
1221 | 1220 | memcpy(&ParallelWorkerNumber, MyBgworkerEntry->bgw_extra, sizeof(int));
|
1222 | 1221 |
|
1223 |
| - /* Set up a memory context and resource owner. */ |
1224 |
| - Assert(CurrentResourceOwner == NULL); |
1225 |
| - CurrentResourceOwner = ResourceOwnerCreate(NULL, "parallel toplevel"); |
| 1222 | + /* Set up a memory context to work in, just for cleanliness. */ |
1226 | 1223 | CurrentMemoryContext = AllocSetContextCreate(TopMemoryContext,
|
1227 | 1224 | "Parallel worker",
|
1228 | 1225 | ALLOCSET_DEFAULT_SIZES);
|
1229 | 1226 |
|
1230 | 1227 | /*
|
1231 |
| - * Now that we have a resource owner, we can attach to the dynamic shared |
1232 |
| - * memory segment and read the table of contents. |
| 1228 | + * Attach to the dynamic shared memory segment for the parallel query, and |
| 1229 | + * find its table of contents. |
| 1230 | + * |
| 1231 | + * Note: at this point, we have not created any ResourceOwner in this |
| 1232 | + * process. This will result in our DSM mapping surviving until process |
| 1233 | + * exit, which is fine. If there were a ResourceOwner, it would acquire |
| 1234 | + * ownership of the mapping, but we have no need for that. |
1233 | 1235 | */
|
1234 | 1236 | seg = dsm_attach(DatumGetUInt32(main_arg));
|
1235 | 1237 | if (seg == NULL)
|
@@ -1393,7 +1395,7 @@ ParallelWorkerMain(Datum main_arg)
|
1393 | 1395 | /* Must exit parallel mode to pop active snapshot. */
|
1394 | 1396 | ExitParallelMode();
|
1395 | 1397 |
|
1396 |
| - /* Must pop active snapshot so resowner.c doesn't complain. */ |
| 1398 | + /* Must pop active snapshot so snapmgr.c doesn't complain. */ |
1397 | 1399 | PopActiveSnapshot();
|
1398 | 1400 |
|
1399 | 1401 | /* Shut down the parallel-worker transaction. */
|
|
0 commit comments