Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 147075c

Browse files
knizhnikkelvich
authored andcommitted
Check for prepared transactions in MtmRollbackPreparedTransaction
1 parent 0df255b commit 147075c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

multimaster.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3106,9 +3106,11 @@ void MtmReleaseRecoverySlot(int nodeId)
31063106
*/
31073107
void MtmRollbackPreparedTransaction(int nodeId, char const* gid)
31083108
{
3109+
char state3pc[MAX_3PC_STATE_SIZE];
31093110
XidStatus status = MtmExchangeGlobalTransactionStatus(gid, TRANSACTION_STATUS_ABORTED);
31103111
MTM_LOG1("Abort prepared transaction %s status %s from node %d originId=%d", gid, MtmTxnStatusMnem[status], nodeId, Mtm->nodes[nodeId-1].originId);
3111-
if (status == TRANSACTION_STATUS_UNKNOWN) {
3112+
if (status == TRANSACTION_STATUS_UNKNOWN || (status == TRANSACTION_STATUS_IN_PROGRESS && GetPreparedTransactionState(gid, state3pc)))
3113+
{
31123114
MTM_LOG1("PGLOGICAL_ABORT_PREPARED commit: gid=%s #2", gid);
31133115
MtmResetTransaction();
31143116
StartTransactionCommand();
@@ -3118,8 +3120,6 @@ void MtmRollbackPreparedTransaction(int nodeId, char const* gid)
31183120
CommitTransactionCommand();
31193121
MtmEndSession(nodeId, true);
31203122
} else if (status == TRANSACTION_STATUS_IN_PROGRESS) {
3121-
char state3pc[MAX_3PC_STATE_SIZE];
3122-
Assert(!GetPreparedTransactionState(gid, state3pc));
31233123
MtmBeginSession(nodeId);
31243124
MtmLogAbortLogicalMessage(nodeId, gid);
31253125
MtmEndSession(nodeId, true);

tests2/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ if [ "$1" = 'postgres' ]; then
6969
multimaster.conn_strings = '$CONNSTRS'
7070
multimaster.heartbeat_recv_timeout = 1100
7171
multimaster.heartbeat_send_timeout = 250
72-
multimaster.min_2pc_timeout = 2000
72+
multimaster.min_2pc_timeout = 100000
7373
EOF
7474

7575
cat $PGDATA/postgresql.conf

0 commit comments

Comments
 (0)