|
76 | 76 | #define PARALLEL_KEY_REINDEX_STATE UINT64CONST(0xFFFFFFFFFFFF000C) |
77 | 77 | #define PARALLEL_KEY_RELMAPPER_STATE UINT64CONST(0xFFFFFFFFFFFF000D) |
78 | 78 | #define PARALLEL_KEY_UNCOMMITTEDENUMS UINT64CONST(0xFFFFFFFFFFFF000E) |
| 79 | +#define PARALLEL_KEY_CLIENTCONNINFO UINT64CONST(0xFFFFFFFFFFFF000F) |
79 | 80 |
|
80 | 81 | /* Fixed-size parallel state. */ |
81 | 82 | typedef struct FixedParallelState |
@@ -212,6 +213,7 @@ InitializeParallelDSM(ParallelContext *pcxt) |
212 | 213 | Size reindexlen = 0; |
213 | 214 | Size relmapperlen = 0; |
214 | 215 | Size uncommittedenumslen = 0; |
| 216 | + Size clientconninfolen = 0; |
215 | 217 | Size segsize = 0; |
216 | 218 | int i; |
217 | 219 | FixedParallelState *fps; |
@@ -272,8 +274,10 @@ InitializeParallelDSM(ParallelContext *pcxt) |
272 | 274 | shm_toc_estimate_chunk(&pcxt->estimator, relmapperlen); |
273 | 275 | uncommittedenumslen = EstimateUncommittedEnumsSpace(); |
274 | 276 | shm_toc_estimate_chunk(&pcxt->estimator, uncommittedenumslen); |
| 277 | + clientconninfolen = EstimateClientConnectionInfoSpace(); |
| 278 | + shm_toc_estimate_chunk(&pcxt->estimator, clientconninfolen); |
275 | 279 | /* If you add more chunks here, you probably need to add keys. */ |
276 | | - shm_toc_estimate_keys(&pcxt->estimator, 11); |
| 280 | + shm_toc_estimate_keys(&pcxt->estimator, 12); |
277 | 281 |
|
278 | 282 | /* Estimate space need for error queues. */ |
279 | 283 | StaticAssertStmt(BUFFERALIGN(PARALLEL_ERROR_QUEUE_SIZE) == |
@@ -352,6 +356,7 @@ InitializeParallelDSM(ParallelContext *pcxt) |
352 | 356 | char *session_dsm_handle_space; |
353 | 357 | char *entrypointstate; |
354 | 358 | char *uncommittedenumsspace; |
| 359 | + char *clientconninfospace; |
355 | 360 | Size lnamelen; |
356 | 361 |
|
357 | 362 | /* Serialize shared libraries we have loaded. */ |
@@ -422,6 +427,12 @@ InitializeParallelDSM(ParallelContext *pcxt) |
422 | 427 | shm_toc_insert(pcxt->toc, PARALLEL_KEY_UNCOMMITTEDENUMS, |
423 | 428 | uncommittedenumsspace); |
424 | 429 |
|
| 430 | + /* Serialize our ClientConnectionInfo. */ |
| 431 | + clientconninfospace = shm_toc_allocate(pcxt->toc, clientconninfolen); |
| 432 | + SerializeClientConnectionInfo(clientconninfolen, clientconninfospace); |
| 433 | + shm_toc_insert(pcxt->toc, PARALLEL_KEY_CLIENTCONNINFO, |
| 434 | + clientconninfospace); |
| 435 | + |
425 | 436 | /* Allocate space for worker information. */ |
426 | 437 | pcxt->worker = palloc0(sizeof(ParallelWorkerInfo) * pcxt->nworkers); |
427 | 438 |
|
@@ -1270,6 +1281,7 @@ ParallelWorkerMain(Datum main_arg) |
1270 | 1281 | char *reindexspace; |
1271 | 1282 | char *relmapperspace; |
1272 | 1283 | char *uncommittedenumsspace; |
| 1284 | + char *clientconninfospace; |
1273 | 1285 | StringInfoData msgbuf; |
1274 | 1286 | char *session_dsm_handle_space; |
1275 | 1287 | Snapshot tsnapshot; |
@@ -1479,6 +1491,11 @@ ParallelWorkerMain(Datum main_arg) |
1479 | 1491 | false); |
1480 | 1492 | RestoreUncommittedEnums(uncommittedenumsspace); |
1481 | 1493 |
|
| 1494 | + /* Restore the ClientConnectionInfo. */ |
| 1495 | + clientconninfospace = shm_toc_lookup(toc, PARALLEL_KEY_CLIENTCONNINFO, |
| 1496 | + false); |
| 1497 | + RestoreClientConnectionInfo(clientconninfospace); |
| 1498 | + |
1482 | 1499 | /* Attach to the leader's serializable transaction, if SERIALIZABLE. */ |
1483 | 1500 | AttachSerializableXact(fps->serializable_xact_handle); |
1484 | 1501 |
|
|
0 commit comments