@@ -436,7 +436,7 @@ bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
436
436
for (i = 0 ; i < MAX_WAIT_LOOPS ; i ++ )
437
437
{
438
438
MtmTransState * ts = (MtmTransState * )hash_search (MtmXid2State , & xid , HASH_FIND , NULL );
439
- if (ts != NULL && ts -> status != TRANSACTION_STATUS_IN_PROGRESS )
439
+ if (ts != NULL /* && ts->status != TRANSACTION_STATUS_IN_PROGRESS*/ )
440
440
{
441
441
if (ts -> csn > MtmTx .snapshot ) {
442
442
MTM_LOG4 ("%d: tuple with xid=%d(csn=%ld) is invisibile in snapshot %ld" ,
@@ -872,7 +872,7 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
872
872
MtmLock (LW_EXCLUSIVE );
873
873
ts = hash_search (MtmXid2State , & x -> xid , HASH_FIND , NULL );
874
874
Assert (ts != NULL );
875
-
875
+ if ( x -> gid [ 0 ]) MTM_LOG1 ( "Preparing transaction %d (%s) at %ld" , x -> xid , x -> gid , MtmGetCurrentTime ());
876
876
if (!MtmIsCoordinator (ts ) || Mtm -> status == MTM_RECOVERY ) {
877
877
bool found ;
878
878
MtmTransMap * tm = (MtmTransMap * )hash_search (MtmGid2State , x -> gid , HASH_ENTER , & found );
@@ -926,6 +926,7 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
926
926
MTM_LOG3 ("%d: Result of vote: %d" , MyProcPid , ts -> status );
927
927
MtmUnlock ();
928
928
}
929
+ if (x -> gid [0 ]) MTM_LOG1 ("Prepared transaction %d (%s) csn=%ld at %ld: %d" , x -> xid , x -> gid , ts -> csn , MtmGetCurrentTime (), ts -> status );
929
930
if (Mtm -> inject2PCError == 3 ) {
930
931
Mtm -> inject2PCError = 0 ;
931
932
elog (ERROR , "ERROR INJECTION for transaction %d (%s)" , x -> xid , x -> gid );
@@ -1503,6 +1504,7 @@ bool MtmRefreshClusterStatus(bool nowait)
1503
1504
MtmAbortTransaction (ts );
1504
1505
MtmWakeUpBackend (ts );
1505
1506
}
1507
+ #if 0
1506
1508
} else if (TransactionIdIsValid (ts -> gtid .xid ) && BIT_CHECK (disabled , ts -> gtid .node - 1 )) { // coordinator of transaction is on disabled node
1507
1509
if (ts -> gid [0 ]) {
1508
1510
if (ts -> status == TRANSACTION_STATUS_UNKNOWN || ts -> status == TRANSACTION_STATUS_IN_PROGRESS ) {
@@ -1512,6 +1514,7 @@ bool MtmRefreshClusterStatus(bool nowait)
1512
1514
FinishPreparedTransaction (ts -> gid , false);
1513
1515
}
1514
1516
}
1517
+ #endif
1515
1518
}
1516
1519
}
1517
1520
MtmUnlock ();
@@ -1732,13 +1735,8 @@ static void MtmRaftableInitialize()
1732
1735
1733
1736
for (i = 0 ; i < MtmNodes ; i ++ )
1734
1737
{
1735
- char const * raftport = strstr (MtmConnections [i ].connStr , "raftport=" );
1736
- int port ;
1737
- if (raftport != NULL ) {
1738
- if (sscanf (raftport + 9 , "%d" , & port ) != 1 ) {
1739
- elog (ERROR , "Invalid raftable port: %s" , raftport + 9 );
1740
- }
1741
- } else {
1738
+ int port = MtmConnections [i ].raftablePort ;
1739
+ if (port == 0 ) {
1742
1740
port = MtmRaftablePort + i ;
1743
1741
}
1744
1742
raftable_peer (i , MtmConnections [i ].hostName , port );
@@ -1822,10 +1820,12 @@ void MtmUpdateNodeConnectionInfo(MtmConnectionInfo* conn, char const* connStr)
1822
1820
char const * host ;
1823
1821
char const * end ;
1824
1822
int hostLen ;
1823
+ char * port ;
1824
+ int connStrLen = (int )strlen (connStr );
1825
1825
1826
- if (strlen ( connStr ) >= MULTIMASTER_MAX_CONN_STR_SIZE ) {
1826
+ if (connStrLen >= MULTIMASTER_MAX_CONN_STR_SIZE ) {
1827
1827
elog (ERROR , "Too long (%d) connection string '%s': limit is %d" ,
1828
- ( int ) strlen ( connStr ) , connStr , MULTIMASTER_MAX_CONN_STR_SIZE - 1 );
1828
+ connStrLen , connStr , MULTIMASTER_MAX_CONN_STR_SIZE - 1 );
1829
1829
}
1830
1830
strcpy (conn -> connStr , connStr );
1831
1831
@@ -1842,6 +1842,32 @@ void MtmUpdateNodeConnectionInfo(MtmConnectionInfo* conn, char const* connStr)
1842
1842
}
1843
1843
memcpy (conn -> hostName , host , hostLen );
1844
1844
conn -> hostName [hostLen ] = '\0' ;
1845
+
1846
+ port = strstr (connStr , "raftport=" );
1847
+ if (port != NULL ) {
1848
+ int n ;
1849
+ if (sscanf (port + 9 , "%d%d" , & conn -> raftablePort , & n ) != 1 ) {
1850
+ elog (ERROR , "Invalid raftable port: %s" , port + 9 );
1851
+ }
1852
+ n += 9 ;
1853
+ memmove (port , port + n , connStrLen - n + 1 );
1854
+ connStrLen -= n ;
1855
+ } else {
1856
+ conn -> raftablePort = 0 ;
1857
+ }
1858
+
1859
+ port = strstr (connStr , "arbiterport=" );
1860
+ if (port != NULL ) {
1861
+ int n ;
1862
+ if (sscanf (port + 12 , "%d%d" , & conn -> arbiterPort , & n ) != 1 ) {
1863
+ elog (ERROR , "Invalid arbiter port: %s" , port + 12 );
1864
+ }
1865
+ n += 12 ;
1866
+ memmove (port , port + n , connStrLen - n + 1 );
1867
+ connStrLen -= n ;
1868
+ } else {
1869
+ conn -> arbiterPort = 0 ;
1870
+ }
1845
1871
}
1846
1872
1847
1873
static void MtmSplitConnStrs (void )
0 commit comments