@@ -798,7 +798,7 @@ MtmEndTransaction(MtmCurrentTrans* x, bool commit)
798798 * Send notification only if ABORT happens during transaction processing at replicas,
799799 * do not send notification if ABORT is receiver from master
800800 */
801- MTM_TRACE ("%d: send ABORT notification to coordinator %d\n" ,MyProcPid ,x -> gtid .node );
801+ MTM_INFO ("%d: send ABORT notificationabort transaction %d to coordinator %d\n" ,MyProcPid , x -> gtid . xid ,x -> gtid .node );
802802if (ts == NULL ) {
803803Assert (TransactionIdIsValid (x -> xid ));
804804ts = hash_search (MtmXid2State ,& x -> xid ,HASH_ENTER ,NULL );
@@ -1602,6 +1602,11 @@ MtmSlotMode MtmReceiverSlotMode(int nodeId)
16021602return Mtm -> recoverySlot ?SLOT_CREATE_NEW :SLOT_OPEN_ALWAYS ;
16031603}
16041604
1605+ static bool MtmIsBroadcast ()
1606+ {
1607+ return application_name != NULL && strcmp (application_name ,MULTIMASTER_BROADCAST_SERVICE )== 0 ;
1608+ }
1609+
16051610void MtmRecoverNode (int nodeId )
16061611{
16071612if (nodeId <=0 || nodeId > Mtm -> nNodes )
@@ -1611,7 +1616,7 @@ void MtmRecoverNode(int nodeId)
16111616if (!BIT_CHECK (Mtm -> disabledNodeMask ,nodeId - 1 )) {
16121617elog (ERROR ,"Node %d was not disabled" ,nodeId );
16131618}
1614- if (!IsTransactionBlock ())
1619+ if (!MtmIsBroadcast ())
16151620{
16161621MtmBroadcastUtilityStmt (psprintf ("select pg_create_logical_replication_slot('" MULTIMASTER_SLOT_PATTERN "', '" MULTIMASTER_NAME "')" ,nodeId ), true);
16171622}
@@ -1628,7 +1633,7 @@ void MtmDropNode(int nodeId, bool dropSlot)
16281633}
16291634BIT_SET (Mtm -> disabledNodeMask ,nodeId - 1 );
16301635Mtm -> nNodes -= 1 ;
1631- if (!IsTransactionBlock ())
1636+ if (!MtmIsBroadcast ())
16321637{
16331638MtmBroadcastUtilityStmt (psprintf ("select mtm.drop_node(%d,%s)" ,nodeId ,dropSlot ?"true" :"false" ), true);
16341639}
@@ -1648,7 +1653,6 @@ MtmReplicationShutdownHook(struct PGLogicalShutdownHookArgs* args)
16481653static bool
16491654MtmReplicationTxnFilterHook (struct PGLogicalTxnFilterArgs * args )
16501655{
1651- elog (WARNING ,"MtmReplicationTxnFilterHook: args->origin_id=%d, MtmReplicationNodeId=%d" ,args -> origin_id ,MtmReplicationNodeId );
16521656return args -> origin_id == InvalidRepOriginId || MtmIsRecoveredNode (MtmReplicationNodeId );
16531657}
16541658
@@ -1795,7 +1799,6 @@ static bool MtmRunUtilityStmt(PGconn* conn, char const* sql, char **errmsg)
17951799{
17961800PGresult * result = PQexec (conn ,sql );
17971801int status = PQresultStatus (result );
1798- char * errstr ;
17991802
18001803bool ret = status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK ;
18011804
@@ -1815,25 +1818,18 @@ static bool MtmRunUtilityStmt(PGconn* conn, char const* sql, char **errmsg)
18151818
18161819static void MtmBroadcastUtilityStmt (char const * sql ,bool ignoreError )
18171820{
1818- char * conn_str = pstrdup (MtmConnStrs );
1819- char * conn_str_end = conn_str + strlen (conn_str );
18201821int i = 0 ;
18211822nodemask_t disabledNodeMask = Mtm -> disabledNodeMask ;
18221823int failedNode = -1 ;
18231824char const * errorMsg = NULL ;
18241825PGconn * * conns = palloc0 (sizeof (PGconn * )* MtmNodes );
18251826char * utility_errmsg ;
18261827
1827- while ( conn_str < conn_str_end )
1828+ for ( i = 0 ; i < MtmNodes ; i ++ )
18281829{
1829- char * p = strchr (conn_str ,',' );
1830- if (p == NULL ) {
1831- p = conn_str_end ;
1832- }
1833- * p = '\0' ;
18341830if (!BIT_CHECK (disabledNodeMask ,i ))
18351831{
1836- conns [i ]= PQconnectdb (conn_str );
1832+ conns [i ]= PQconnectdb (psprintf ( "%s application_name=%s" , Mtm -> nodes [ i ]. con . connStr , MULTIMASTER_BROADCAST_SERVICE ) );
18371833if (PQstatus (conns [i ])!= CONNECTION_OK )
18381834{
18391835if (ignoreError )
@@ -1845,12 +1841,10 @@ static void MtmBroadcastUtilityStmt(char const* sql, bool ignoreError)
18451841do {
18461842PQfinish (conns [i ]);
18471843}while (-- i >=0 );
1848- elog (ERROR ,"Failed to establish connection '%s' to node %d" ,conn_str ,failedNode );
1844+ elog (ERROR ,"Failed to establish connection '%s' to node %d" ,Mtm -> nodes [ i ]. con . connStr ,failedNode );
18491845}
18501846}
18511847}
1852- conn_str = p + 1 ;
1853- i += 1 ;
18541848}
18551849Assert (i == MtmNodes );
18561850