@@ -846,18 +846,23 @@ monitor_register_node(Monitor *monitor, char *formation,
846846 MonitorAssignedStateParseContext parseContext =
847847 { { 0 }, assignedState , false };
848848 const char * nodeStateString = NodeStateToString (initialState );
849+ IntString portStr = intToString (port );
850+ IntString systemIdentifierStr = intToString (system_identifier );
851+ IntString desiredNodeIdStr = intToString (desiredNodeId );
852+ IntString desiredGroupIdStr = intToString (desiredGroupId );
853+ IntString candidatePriorityStr = intToString (candidatePriority );
849854
850855 paramValues [0 ] = formation ;
851856 paramValues [1 ] = host ;
852- paramValues [2 ] = intToString ( port ) .strValue ;
857+ paramValues [2 ] = portStr .strValue ;
853858 paramValues [3 ] = dbname ;
854859 paramValues [4 ] = name == NULL ? "" : name ;
855- paramValues [5 ] = intToString ( system_identifier ) .strValue ;
856- paramValues [6 ] = intToString ( desiredNodeId ) .strValue ;
857- paramValues [7 ] = intToString ( desiredGroupId ) .strValue ;
860+ paramValues [5 ] = systemIdentifierStr .strValue ;
861+ paramValues [6 ] = desiredNodeIdStr .strValue ;
862+ paramValues [7 ] = desiredGroupIdStr .strValue ;
858863 paramValues [8 ] = nodeStateString ;
859864 paramValues [9 ] = nodeKindToString (kind );
860- paramValues [10 ] = intToString ( candidatePriority ) .strValue ;
865+ paramValues [10 ] = candidatePriorityStr .strValue ;
861866 paramValues [11 ] = quorum ? "true" : "false" ;
862867 paramValues [12 ] =
863868 IS_EMPTY_STRING_BUFFER (citusClusterName )
@@ -945,13 +950,16 @@ monitor_node_active(Monitor *monitor,
945950 MonitorAssignedStateParseContext parseContext =
946951 { { 0 }, assignedState , false };
947952 const char * nodeStateString = NodeStateToString (currentState );
953+ IntString nodeIdStr = intToString (nodeId );
954+ IntString groupIdStr = intToString (groupId );
955+ IntString currentTLIStr = intToString (currentTLI );
948956
949957 paramValues [0 ] = formation ;
950- paramValues [1 ] = intToString ( nodeId ) .strValue ;
951- paramValues [2 ] = intToString ( groupId ) .strValue ;
958+ paramValues [1 ] = nodeIdStr .strValue ;
959+ paramValues [2 ] = groupIdStr .strValue ;
952960 paramValues [3 ] = nodeStateString ;
953961 paramValues [4 ] = pgIsRunning ? "true" : "false" ;
954- paramValues [5 ] = intToString ( currentTLI ) .strValue ;
962+ paramValues [5 ] = currentTLIStr .strValue ;
955963 paramValues [6 ] = currentLSN ;
956964 paramValues [7 ] = pgsrSyncState ;
957965
@@ -1001,7 +1009,8 @@ monitor_set_node_candidate_priority(Monitor *monitor,
10011009 int paramCount = 3 ;
10021010 Oid paramTypes [3 ] = { TEXTOID , TEXTOID , INT4OID };
10031011 const char * paramValues [3 ];
1004- char * candidatePriorityText = intToString (candidate_priority ).strValue ;
1012+ IntString candidatePriorityStr = intToString (candidate_priority );
1013+ char * candidatePriorityText = candidatePriorityStr .strValue ;
10051014 bool success = true;
10061015
10071016 paramValues [0 ] = formation ;
@@ -1218,8 +1227,10 @@ monitor_set_formation_number_sync_standbys(Monitor *monitor, char *formation,
12181227 Oid paramTypes [2 ] = { TEXTOID , INT4OID };
12191228 const char * paramValues [2 ];
12201229 SingleValueResultContext parseContext = { { 0 }, PGSQL_RESULT_BOOL , false };
1230+ IntString numberSyncStandbysStr = intToString (numberSyncStandbys );
1231+
12211232 paramValues [0 ] = formation ;
1222- paramValues [1 ] = intToString ( numberSyncStandbys ) .strValue ;
1233+ paramValues [1 ] = numberSyncStandbysStr .strValue ;
12231234
12241235 if (!pgsql_execute_with_params (pgsql , sql ,
12251236 paramCount , paramTypes , paramValues ,
@@ -1256,9 +1267,10 @@ monitor_remove_by_hostname(Monitor *monitor, char *host, int port, bool force,
12561267 int paramCount = 3 ;
12571268 Oid paramTypes [3 ] = { TEXTOID , INT4OID , BOOLOID };
12581269 const char * paramValues [3 ];
1270+ IntString portStr = intToString (port );
12591271
12601272 paramValues [0 ] = host ;
1261- paramValues [1 ] = intToString ( port ) .strValue ;
1273+ paramValues [1 ] = portStr .strValue ;
12621274 paramValues [2 ] = force ? "true" : "false" ;
12631275
12641276 if (!pgsql_execute_with_params (pgsql , sql ,
@@ -1495,9 +1507,10 @@ monitor_perform_failover(Monitor *monitor, char *formation, int group)
14951507 int paramCount = 2 ;
14961508 Oid paramTypes [2 ] = { TEXTOID , INT4OID };
14971509 const char * paramValues [2 ];
1510+ IntString groupStr = intToString (group );
14981511
14991512 paramValues [0 ] = formation ;
1500- paramValues [1 ] = intToString ( group ) .strValue ;
1513+ paramValues [1 ] = groupStr .strValue ;
15011514
15021515 /*
15031516 * pgautofailover.perform_failover() returns VOID.
@@ -2738,12 +2751,13 @@ monitor_create_formation(Monitor *monitor,
27382751 int paramCount = 5 ;
27392752 Oid paramTypes [5 ] = { TEXTOID , TEXTOID , TEXTOID , BOOLOID , INT4OID };
27402753 const char * paramValues [5 ];
2754+ IntString numberSyncStandbysStr = intToString (numberSyncStandbys );
27412755
27422756 paramValues [0 ] = formation ;
27432757 paramValues [1 ] = kind ;
27442758 paramValues [2 ] = dbname ;
27452759 paramValues [3 ] = hasSecondary ? "true" : "false" ;
2746- paramValues [4 ] = intToString ( numberSyncStandbys ) .strValue ;
2760+ paramValues [4 ] = numberSyncStandbysStr .strValue ;
27472761
27482762 if (!pgsql_execute_with_params (pgsql , sql ,
27492763 paramCount , paramTypes , paramValues ,
@@ -3429,11 +3443,13 @@ monitor_update_node_metadata(Monitor *monitor,
34293443 const char * paramValues [4 ];
34303444
34313445 SingleValueResultContext context = { { 0 }, PGSQL_RESULT_BOOL , false };
3446+ IntString nodeIdStr = intToString (nodeId );
3447+ IntString portStr = intToString (port );
34323448
3433- paramValues [0 ] = intToString ( nodeId ) .strValue ;
3449+ paramValues [0 ] = nodeIdStr .strValue ;
34343450 paramValues [1 ] = name ;
34353451 paramValues [2 ] = hostname ;
3436- paramValues [3 ] = intToString ( port ) .strValue ;
3452+ paramValues [3 ] = portStr .strValue ;
34373453
34383454 if (!pgsql_execute_with_params (pgsql , sql ,
34393455 paramCount , paramTypes , paramValues ,
@@ -3477,9 +3493,11 @@ monitor_set_node_system_identifier(Monitor *monitor,
34773493
34783494 NodeAddress node = { 0 };
34793495 NodeAddressParseContext parseContext = { { 0 }, & node , false };
3496+ IntString nodeIdStr = intToString (nodeId );
3497+ IntString systemIdentifierStr = intToString (system_identifier );
34803498
3481- paramValues [0 ] = intToString ( nodeId ) .strValue ;
3482- paramValues [1 ] = intToString ( system_identifier ) .strValue ;
3499+ paramValues [0 ] = nodeIdStr .strValue ;
3500+ paramValues [1 ] = systemIdentifierStr .strValue ;
34833501
34843502 if (!pgsql_execute_with_params (pgsql , sql ,
34853503 paramCount , paramTypes , paramValues ,
@@ -3525,9 +3543,11 @@ monitor_set_group_system_identifier(Monitor *monitor,
35253543 const char * paramValues [2 ];
35263544
35273545 SingleValueResultContext context = { 0 };
3546+ IntString groupIdStr = intToString (groupId );
3547+ IntString systemIdentifierStr = intToString (system_identifier );
35283548
3529- paramValues [0 ] = intToString ( groupId ) .strValue ;
3530- paramValues [1 ] = intToString ( system_identifier ) .strValue ;
3549+ paramValues [0 ] = groupIdStr .strValue ;
3550+ paramValues [1 ] = systemIdentifierStr .strValue ;
35313551
35323552 if (!pgsql_execute_with_params (pgsql , sql ,
35333553 paramCount , paramTypes , paramValues ,
@@ -3640,8 +3660,9 @@ monitor_start_maintenance(Monitor *monitor, int64_t nodeId, bool *mayRetry)
36403660 int paramCount = 1 ;
36413661 Oid paramTypes [1 ] = { INT8OID };
36423662 const char * paramValues [1 ];
3663+ IntString nodeIdStr = intToString (nodeId );
36433664
3644- paramValues [0 ] = intToString ( nodeId ) .strValue ;
3665+ paramValues [0 ] = nodeIdStr .strValue ;
36453666
36463667 if (!pgsql_execute_with_params (pgsql , sql ,
36473668 paramCount , paramTypes , paramValues ,
@@ -3688,8 +3709,9 @@ monitor_stop_maintenance(Monitor *monitor, int64_t nodeId, bool *mayRetry)
36883709 int paramCount = 1 ;
36893710 Oid paramTypes [1 ] = { INT8OID };
36903711 const char * paramValues [1 ];
3712+ IntString nodeIdStr = intToString (nodeId );
36913713
3692- paramValues [0 ] = intToString ( nodeId ) .strValue ;
3714+ paramValues [0 ] = nodeIdStr .strValue ;
36933715
36943716 if (!pgsql_execute_with_params (pgsql , sql ,
36953717 paramCount , paramTypes , paramValues ,
@@ -4854,10 +4876,12 @@ monitor_find_node_by_nodeid(Monitor *monitor,
48544876 const char * paramValues [3 ];
48554877
48564878 NodeAddressArrayParseContext parseContext = { { 0 }, nodesArray , false };
4879+ IntString groupIdStr = intToString (groupId );
4880+ IntString nodeIdStr = intToString (nodeId );
48574881
48584882 paramValues [0 ] = formation ;
4859- paramValues [1 ] = intToString ( groupId ) .strValue ;
4860- paramValues [2 ] = intToString ( nodeId ) .strValue ;
4883+ paramValues [1 ] = groupIdStr .strValue ;
4884+ paramValues [2 ] = nodeIdStr .strValue ;
48614885
48624886 if (!pgsql_execute_with_params (pgsql , sql ,
48634887 paramCount , paramTypes , paramValues ,
0 commit comments