diff options
Diffstat (limited to 'src/backend/access/transam/parallel.c')
| -rw-r--r-- | src/backend/access/transam/parallel.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/backend/access/transam/parallel.c b/src/backend/access/transam/parallel.c index 3915750419..31b23a785b 100644 --- a/src/backend/access/transam/parallel.c +++ b/src/backend/access/transam/parallel.c @@ -807,6 +807,33 @@ HandleParallelMessage(ParallelContext *pcxt, int i, StringInfo msg) break; } + case 'L': /* Lock information */ + { + int i; + + Assert(msg->len > 1 && (msg->len % sizeof(LOCALLOCKTAG)) == 1); + + for (i = 1; i < msg->len; i += sizeof(LOCALLOCKTAG)) + { + LOCALLOCKTAG locallocktag; + + memcpy((char *) &locallocktag, &msg->data[i], sizeof(LOCALLOCKTAG)); + /* XXX. Now what? */ +#if 0 + ereport(NOTICE, + (errmsg("worker has lock %u/%u/%u/%u type %u method %u mode %u", + locallocktag.lock.locktag_field1, + locallocktag.lock.locktag_field2, + locallocktag.lock.locktag_field3, + locallocktag.lock.locktag_field4, + locallocktag.lock.locktag_type, + locallocktag.lock.locktag_lockmethodid, + locallocktag.mode))); +#endif + } + break; + } + case 'X': /* Terminate, indicating clean exit */ { pfree(pcxt->worker[i].error_mqh); @@ -1038,6 +1065,11 @@ ParallelWorkerMain(Datum main_arg) /* Must pop active snapshot so resowner.c doesn't complain. */ PopActiveSnapshot(); + /* Send a message to the leader with the heavyweight locks we still retain. */ + pq_beginmessage(&msgbuf, 'L'); + if (GetMyLocks(&msgbuf) != 0) + pq_endmessage(&msgbuf); + /* Shut down the parallel-worker transaction. */ EndParallelWorkerTransaction(); |
