@@ -1199,11 +1199,13 @@ static void
1199
1199
MtmLogAbortLogicalMessage (int nodeId , char const * gid )
1200
1200
{
1201
1201
MtmAbortLogicalMessage msg ;
1202
+ XLogRecPtr lsn ;
1202
1203
strcpy (msg .gid , gid );
1203
1204
msg .origin_node = nodeId ;
1204
1205
msg .origin_lsn = replorigin_session_origin_lsn ;
1205
- MTM_LOG2 ("[TRACE] MtmLogAbortLogicalMessage(%d, %s)" , nodeId , gid );
1206
- XLogFlush (LogLogicalMessage ("A" , (char * )& msg , sizeof msg , false));
1206
+ lsn = LogLogicalMessage ("A" , (char * )& msg , sizeof msg , false);
1207
+ XLogFlush (lsn );
1208
+ MTM_LOG1 ("MtmLogAbortLogicalMessage node=%d transaction=%s lsn=%lx" , nodeId , gid , lsn );
1207
1209
}
1208
1210
1209
1211
static void
@@ -1260,7 +1262,7 @@ MtmEndTransaction(MtmCurrentTrans* x, bool commit)
1260
1262
* Send notification only if ABORT happens during transaction processing at replicas,
1261
1263
* do not send notification if ABORT is received from master
1262
1264
*/
1263
- MTM_LOG1 ("%d: send ABORT notification for transaction %d to coordinator %d" , MyProcPid , x -> gtid .xid , x -> gtid .node );
1265
+ MTM_LOG1 ("%d: send ABORT notification for transaction %d (%s) to coordinator %d" , MyProcPid , x -> gtid .xid , x -> gid , x -> gtid .node );
1264
1266
if (ts == NULL ) {
1265
1267
bool found ;
1266
1268
Assert (TransactionIdIsValid (x -> xid ));
@@ -1408,7 +1410,7 @@ static void MtmLoadPreparedTransactions(void)
1408
1410
bool found ;
1409
1411
char const * gid = pxacts [i ].gid ;
1410
1412
MtmTransMap * tm = (MtmTransMap * )hash_search (MtmGid2State , gid , HASH_ENTER , & found );
1411
- if (!found ) {
1413
+ if (!found || tm -> state == NULL ) {
1412
1414
TransactionId xid = GetNewTransactionId (false);
1413
1415
MtmTransState * ts = (MtmTransState * )hash_search (MtmXid2State , & xid , HASH_ENTER , & found );
1414
1416
MTM_LOG1 ("Recover prepared transaction %s xid=%d state=%s" , gid , xid , pxacts [i ].state_3pc );
@@ -1532,9 +1534,11 @@ XidStatus MtmExchangeGlobalTransactionStatus(char const* gid, XidStatus new_stat
1532
1534
}
1533
1535
if (tm -> state != NULL && old_status == TRANSACTION_STATUS_IN_PROGRESS ) {
1534
1536
/* Return UNKNOWN to mark that transaction was prepared */
1537
+ MTM_LOG1 ("Change status of in-progress transaction %s to %s" , gid , MtmTxtStatusMnem [new_status ]);
1535
1538
old_status = TRANSACTION_STATUS_UNKNOWN ;
1536
1539
}
1537
1540
} else {
1541
+ MTM_LOG1 ("Set status of unknown transaction %s to %s" , gid , MtmTxtStatusMnem [new_status ]);
1538
1542
tm -> state = NULL ;
1539
1543
tm -> status = new_status ;
1540
1544
}
@@ -2996,6 +3000,8 @@ void MtmRollbackPreparedTransaction(int nodeId, char const* gid)
2996
3000
CommitTransactionCommand ();
2997
3001
MtmEndSession (nodeId , true);
2998
3002
} else if (status == TRANSACTION_STATUS_IN_PROGRESS ) {
3003
+ char state3pc [MAX_3PC_STATE_SIZE ];
3004
+ Assert (!GetPreparedTransactionState (gid , state3pc ));
2999
3005
MtmBeginSession (nodeId );
3000
3006
MtmLogAbortLogicalMessage (nodeId , gid );
3001
3007
MtmEndSession (nodeId , true);
0 commit comments