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

Function finishDistributedTransactionContext

src/backend/cdb/cdbtm.c:1987–2017  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1985}
1986
1987void
1988finishDistributedTransactionContext(char *debugCaller, bool aborted)
1989{
1990 DistributedTransactionId gxid;
1991
1992 /*
1993 * We let the 2 retry states go up to PostgresMain.c, otherwise everything
1994 * MUST be complete.
1995 */
1996 if (isCurrentDtxActivated() &&
1997 (MyTmGxactLocal->state != DTX_STATE_RETRY_COMMIT_PREPARED &&
1998 MyTmGxactLocal->state != DTX_STATE_RETRY_ABORT_PREPARED))
1999 {
2000 ereport(FATAL,
2001 (errmsg("Unexpected dtx status (caller = %s).", debugCaller),
2002 TM_ERRDETAIL));
2003 }
2004
2005 gxid = getDistributedTransactionId();
2006 elog(DTM_DEBUG5,
2007 "finishDistributedTransactionContext called to change DistributedTransactionContext from %s to %s (caller = %s, gxid = "UINT64_FORMAT")",
2008 DtxContextToString(DistributedTransactionContext),
2009 DtxContextToString(DTX_CONTEXT_LOCAL_ONLY),
2010 debugCaller,
2011 gxid);
2012
2013 setDistributedTransactionContext(DTX_CONTEXT_LOCAL_ONLY);
2014
2015 DtxContextInfo_Reset(&QEDtxContextInfo);
2016
2017}
2018
2019static void
2020rememberDtxExplicitBegin(void)

Callers 5

CommitTransactionFunction · 0.85
CleanupTransactionFunction · 0.85

Calls 6

isCurrentDtxActivatedFunction · 0.85
DtxContextToStringFunction · 0.85
DtxContextInfo_ResetFunction · 0.85
errmsgFunction · 0.50

Tested by

no test coverage detected