MCPcopy Create free account
hub / github.com/apache/cloudberry / doDispatchDtxProtocolCommand

Function doDispatchDtxProtocolCommand

src/backend/cdb/cdbtm.c:1267–1419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1265}
1266
1267bool
1268doDispatchDtxProtocolCommand(DtxProtocolCommand dtxProtocolCommand,
1269 char *gid,
1270 bool raiseError,
1271 List *dtxSegments,
1272 char *serializedDtxContextInfo,
1273 int serializedDtxContextInfoLen)
1274{
1275 int i,
1276 resultCount,
1277 numOfFailed = 0;
1278
1279 const char *dtxProtocolCommandStr;
1280
1281 struct pg_result **results;
1282 MemoryContext oldContext;
1283 int *waitGxids = NULL;
1284 int totalWaits = 0;
1285
1286 if (!dtxSegments)
1287 return true;
1288
1289 dtxProtocolCommandStr = DtxProtocolCommandToString(dtxProtocolCommand);
1290
1291 if (Test_print_direct_dispatch_info)
1292 elog(INFO, "Distributed transaction command '%s' to %s",
1293 dtxProtocolCommandStr,
1294 segmentsToContentStr(dtxSegments));
1295
1296 ereport(DTM_DEBUG5,
1297 (errmsg("dispatchDtxProtocolCommand: %d ('%s'), direct content #: %s",
1298 dtxProtocolCommand, dtxProtocolCommandStr,
1299 segmentsToContentStr(dtxSegments))));
1300
1301 ErrorData *qeError;
1302 results = CdbDispatchDtxProtocolCommand(dtxProtocolCommand,
1303 dtxProtocolCommandStr,
1304 gid,
1305 &qeError, &resultCount, dtxSegments,
1306 serializedDtxContextInfo, serializedDtxContextInfoLen);
1307
1308 if (qeError)
1309 {
1310 /*
1311 * Report the ERROR under Debug_print_full_dtm, as it can be lost as we
1312 * flush below and the caller may forget to CopyErrorData(). Also, in
1313 * some cases caller may not be able to act on the copy (e.g. due to
1314 * another error).
1315 */
1316 ereportif(Debug_print_full_dtm, LOG,
1317 (errmsg("error on dispatch of dtx protocol command '%s' for gid '%s'",
1318 dtxProtocolCommandStr, gid),
1319 errdetail("QE reported error: %s", qeError->message)));
1320
1321 if (raiseError)
1322 {
1323 /* flush then rethrow, to avoid overflowing the error stack */
1324 FlushErrorState();

Callers 4

doNotifyCommittedInDoubtFunction · 0.85
doAbortInDoubtFunction · 0.85

Calls 15

segmentsToContentStrFunction · 0.85
PQresultStatusFunction · 0.85
PQcmdStatusFunction · 0.85
PQclearFunction · 0.85
MemoryContextSwitchToFunction · 0.85
lappend_intFunction · 0.85
errmsgFunction · 0.50
errdetailFunction · 0.50
FlushErrorStateFunction · 0.50
ThrowErrorDataFunction · 0.50

Tested by

no test coverage detected