/* ---------------- * EndCommand - clean up the destination at end of command * ---------------- */ void EndCommand(const char *commandTag, CommandDest dest) { StringInfoData buf; if (Gp_role == GP_ROLE_DISPATCH) { /* * Just before a successful reply, let's see if the DTM has * phase 2 retry work. */ doDtxPhase2Retry(); } switch (dest) { case DestRemote: case DestRemoteExecute: if (Gp_role == GP_ROLE_EXECUTE && Gp_is_writer) { /* * Extra information that indicates if the transaction made * updates. */ sendQEDetails(); pq_beginmessage(&buf, 'g'); pq_sendstring(&buf, commandTag); AddQEWriterTransactionInfo(&buf); pq_endmessage(&buf); } else if (Gp_role == GP_ROLE_EXECUTE) { sendQEDetails(); pq_beginmessage(&buf, 'C'); pq_sendstring(&buf, commandTag); pq_endmessage(&buf); } else pq_puttextmessage('C', commandTag); break; case DestNone: case DestDebug: case DestSPI: case DestTuplestore: case DestIntoRel: case DestCopyOut: break; } }
/* ---------------- * ReadyForQuery_QE - tell dest that we are ready for a new query that * includes QE Writer transaction information. * * ---------------- * * NOTE: this is GPDB specific, and shouldn't fall inside the codepath * of QD->client communication. * */ void ReadyForQuery_QEWriter(CommandDest dest) { switch (dest) { case DestRemote: case DestRemoteExecute: if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3) { StringInfoData buf; sendQEDetails(); pq_beginmessage(&buf, 'z'); pq_sendbyte(&buf, TransactionBlockStatusCode()); AddQEWriterTransactionInfo(&buf); pq_endmessage(&buf); } else if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 2) pq_putemptymessage('Z'); /* Flush output at end of cycle in any case. */ pq_flush(); break; case DestNone: case DestDebug: case DestSPI: case DestTuplestore: case DestIntoRel: case DestCopyOut: break; } }
/* ---------------- * EndCommand - clean up the destination at end of command * ---------------- */ void EndCommand(const char *commandTag, CommandDest dest) { StringInfoData buf; switch (dest) { case DestRemote: case DestRemoteExecute: if (Gp_role == GP_ROLE_EXECUTE) { sendQEDetails(); pq_beginmessage(&buf, 'C'); pq_sendstring(&buf, commandTag); pq_endmessage(&buf); } else pq_puttextmessage('C', commandTag); break; case DestNone: case DestDebug: case DestSPI: case DestTuplestore: case DestIntoRel: case DestCopyOut: break; } }
/* ---------------- * EndCommand - clean up the destination at end of command * ---------------- */ void EndCommand(const char *commandTag, CommandDest dest) { StringInfoData buf; if (Gp_role == GP_ROLE_DISPATCH) { /* * Just before a successful reply, let's see if the DTM has * phase 2 retry work. */ doDtxPhase2Retry(); } switch (dest) { case DestRemote: case DestRemoteExecute: /* * We assume the commandTag is plain ASCII and therefore * requires no encoding conversion. */ if (Gp_role == GP_ROLE_EXECUTE) { sendQEDetails(); pq_beginmessage(&buf, 'C'); pq_send_ascii_string(&buf, commandTag); pq_endmessage(&buf); } else pq_putmessage('C', commandTag, strlen(commandTag) + 1); break; case DestNone: case DestDebug: case DestSPI: case DestTuplestore: case DestIntoRel: case DestCopyOut: break; } }