@@ -441,7 +441,7 @@ bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
441441 for (i = 0 ; i < MAX_WAIT_LOOPS ; i ++ )
442442 {
443443 MtmTransState * ts = (MtmTransState * )hash_search (MtmXid2State , & xid , HASH_FIND , NULL );
444- if (ts != NULL && ts -> status != TRANSACTION_STATUS_IN_PROGRESS )
444+ if (ts != NULL /* && ts->status != TRANSACTION_STATUS_IN_PROGRESS*/ )
445445 {
446446 if (ts -> csn > MtmTx .snapshot ) {
447447 MTM_LOG4 ("%d: tuple with xid=%d(csn=%ld) is invisibile in snapshot %ld" ,
@@ -881,7 +881,7 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
881881 MtmLock (LW_EXCLUSIVE );
882882 ts = hash_search (MtmXid2State , & x -> xid , HASH_FIND , NULL );
883883 Assert (ts != NULL );
884-
884+ if ( x -> gid [ 0 ]) MTM_LOG1 ( "Preparing transaction %d (%s) at %ld" , x -> xid , x -> gid , MtmGetCurrentTime ());
885885 if (!MtmIsCoordinator (ts ) || Mtm -> status == MTM_RECOVERY ) {
886886 bool found ;
887887 MtmTransMap * tm = (MtmTransMap * )hash_search (MtmGid2State , x -> gid , HASH_ENTER , & found );
@@ -935,6 +935,7 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
935935 MTM_LOG3 ("%d: Result of vote: %d" , MyProcPid , ts -> status );
936936 MtmUnlock ();
937937 }
938+ if (x -> gid [0 ]) MTM_LOG1 ("Prepared transaction %d (%s) csn=%ld at %ld: %d" , x -> xid , x -> gid , ts -> csn , MtmGetCurrentTime (), ts -> status );
938939 if (Mtm -> inject2PCError == 3 ) {
939940 Mtm -> inject2PCError = 0 ;
940941 elog (ERROR , "ERROR INJECTION for transaction %d (%s)" , x -> xid , x -> gid );
@@ -1512,6 +1513,7 @@ bool MtmRefreshClusterStatus(bool nowait)
15121513 MtmAbortTransaction (ts );
15131514 MtmWakeUpBackend (ts );
15141515 }
1516+ #if 0
15151517 } else if (TransactionIdIsValid (ts -> gtid .xid ) && BIT_CHECK (disabled , ts -> gtid .node - 1 )) { // coordinator of transaction is on disabled node
15161518 if (ts -> gid [0 ]) {
15171519 if (ts -> status == TRANSACTION_STATUS_UNKNOWN || ts -> status == TRANSACTION_STATUS_IN_PROGRESS ) {
@@ -1521,6 +1523,7 @@ bool MtmRefreshClusterStatus(bool nowait)
15211523 FinishPreparedTransaction (ts -> gid , false);
15221524 }
15231525 }
1526+ #endif
15241527 }
15251528 }
15261529 MtmUnlock ();
@@ -1741,13 +1744,8 @@ static void MtmRaftableInitialize()
17411744
17421745 for (i = 0 ; i < MtmNodes ; i ++ )
17431746 {
1744- char const * raftport = strstr (MtmConnections [i ].connStr , "raftport=" );
1745- int port ;
1746- if (raftport != NULL ) {
1747- if (sscanf (raftport + 9 , "%d" , & port ) != 1 ) {
1748- elog (ERROR , "Invalid raftable port: %s" , raftport + 9 );
1749- }
1750- } else {
1747+ int port = MtmConnections [i ].raftablePort ;
1748+ if (port == 0 ) {
17511749 port = MtmRaftablePort + i ;
17521750 }
17531751 raftable_peer (i , MtmConnections [i ].hostName , port );
@@ -1831,10 +1829,12 @@ void MtmUpdateNodeConnectionInfo(MtmConnectionInfo* conn, char const* connStr)
18311829 char const * host ;
18321830 char const * end ;
18331831 int hostLen ;
1832+ char * port ;
1833+ int connStrLen = (int )strlen (connStr );
18341834
1835- if (strlen ( connStr ) >= MULTIMASTER_MAX_CONN_STR_SIZE ) {
1835+ if (connStrLen >= MULTIMASTER_MAX_CONN_STR_SIZE ) {
18361836 elog (ERROR , "Too long (%d) connection string '%s': limit is %d" ,
1837- ( int ) strlen ( connStr ) , connStr , MULTIMASTER_MAX_CONN_STR_SIZE - 1 );
1837+ connStrLen , connStr , MULTIMASTER_MAX_CONN_STR_SIZE - 1 );
18381838 }
18391839 strcpy (conn -> connStr , connStr );
18401840
@@ -1851,6 +1851,32 @@ void MtmUpdateNodeConnectionInfo(MtmConnectionInfo* conn, char const* connStr)
18511851 }
18521852 memcpy (conn -> hostName , host , hostLen );
18531853 conn -> hostName [hostLen ] = '\0' ;
1854+
1855+ port = strstr (connStr , "raftport=" );
1856+ if (port != NULL ) {
1857+ int n ;
1858+ if (sscanf (port + 9 , "%d%d" , & conn -> raftablePort , & n ) != 1 ) {
1859+ elog (ERROR , "Invalid raftable port: %s" , port + 9 );
1860+ }
1861+ n += 9 ;
1862+ memmove (port , port + n , connStrLen - n + 1 );
1863+ connStrLen -= n ;
1864+ } else {
1865+ conn -> raftablePort = 0 ;
1866+ }
1867+
1868+ port = strstr (connStr , "arbiterport=" );
1869+ if (port != NULL ) {
1870+ int n ;
1871+ if (sscanf (port + 12 , "%d%d" , & conn -> arbiterPort , & n ) != 1 ) {
1872+ elog (ERROR , "Invalid arbiter port: %s" , port + 12 );
1873+ }
1874+ n += 12 ;
1875+ memmove (port , port + n , connStrLen - n + 1 );
1876+ connStrLen -= n ;
1877+ } else {
1878+ conn -> arbiterPort = 0 ;
1879+ }
18541880}
18551881
18561882static void MtmSplitConnStrs (void )
0 commit comments