@@ -441,7 +441,7 @@ bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
441
441
for (i = 0 ; i < MAX_WAIT_LOOPS ; i ++ )
442
442
{
443
443
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*/ )
445
445
{
446
446
if (ts -> csn > MtmTx .snapshot ) {
447
447
MTM_LOG4 ("%d: tuple with xid=%d(csn=%ld) is invisibile in snapshot %ld" ,
@@ -881,7 +881,7 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
881
881
MtmLock (LW_EXCLUSIVE );
882
882
ts = hash_search (MtmXid2State , & x -> xid , HASH_FIND , NULL );
883
883
Assert (ts != NULL );
884
-
884
+ if ( x -> gid [ 0 ]) MTM_LOG1 ( "Preparing transaction %d (%s) at %ld" , x -> xid , x -> gid , MtmGetCurrentTime ());
885
885
if (!MtmIsCoordinator (ts ) || Mtm -> status == MTM_RECOVERY ) {
886
886
bool found ;
887
887
MtmTransMap * tm = (MtmTransMap * )hash_search (MtmGid2State , x -> gid , HASH_ENTER , & found );
@@ -935,6 +935,7 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
935
935
MTM_LOG3 ("%d: Result of vote: %d" , MyProcPid , ts -> status );
936
936
MtmUnlock ();
937
937
}
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 );
938
939
if (Mtm -> inject2PCError == 3 ) {
939
940
Mtm -> inject2PCError = 0 ;
940
941
elog (ERROR , "ERROR INJECTION for transaction %d (%s)" , x -> xid , x -> gid );
@@ -1512,6 +1513,7 @@ bool MtmRefreshClusterStatus(bool nowait)
1512
1513
MtmAbortTransaction (ts );
1513
1514
MtmWakeUpBackend (ts );
1514
1515
}
1516
+ #if 0
1515
1517
} else if (TransactionIdIsValid (ts -> gtid .xid ) && BIT_CHECK (disabled , ts -> gtid .node - 1 )) { // coordinator of transaction is on disabled node
1516
1518
if (ts -> gid [0 ]) {
1517
1519
if (ts -> status == TRANSACTION_STATUS_UNKNOWN || ts -> status == TRANSACTION_STATUS_IN_PROGRESS ) {
@@ -1521,6 +1523,7 @@ bool MtmRefreshClusterStatus(bool nowait)
1521
1523
FinishPreparedTransaction (ts -> gid , false);
1522
1524
}
1523
1525
}
1526
+ #endif
1524
1527
}
1525
1528
}
1526
1529
MtmUnlock ();
@@ -1741,13 +1744,8 @@ static void MtmRaftableInitialize()
1741
1744
1742
1745
for (i = 0 ; i < MtmNodes ; i ++ )
1743
1746
{
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 ) {
1751
1749
port = MtmRaftablePort + i ;
1752
1750
}
1753
1751
raftable_peer (i , MtmConnections [i ].hostName , port );
@@ -1831,10 +1829,12 @@ void MtmUpdateNodeConnectionInfo(MtmConnectionInfo* conn, char const* connStr)
1831
1829
char const * host ;
1832
1830
char const * end ;
1833
1831
int hostLen ;
1832
+ char * port ;
1833
+ int connStrLen = (int )strlen (connStr );
1834
1834
1835
- if (strlen ( connStr ) >= MULTIMASTER_MAX_CONN_STR_SIZE ) {
1835
+ if (connStrLen >= MULTIMASTER_MAX_CONN_STR_SIZE ) {
1836
1836
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 );
1838
1838
}
1839
1839
strcpy (conn -> connStr , connStr );
1840
1840
@@ -1851,6 +1851,32 @@ void MtmUpdateNodeConnectionInfo(MtmConnectionInfo* conn, char const* connStr)
1851
1851
}
1852
1852
memcpy (conn -> hostName , host , hostLen );
1853
1853
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
+ }
1854
1880
}
1855
1881
1856
1882
static void MtmSplitConnStrs (void )
0 commit comments