2222 * 
2323 * This timeouts, when set in the postgres config file, affect all process. 
2424 * The multimaster needs his sessions not to be interrupted, so we disable 
25-  * these timeouts.   
25+  * these timeouts. 
2626 * 
2727 * This function raises an error on PQExec failed. 
2828 */ 
29- static  void 
29+ static  bool 
3030disable_client_timeouts (PGconn  * conn )
3131{
3232	PGresult    * res ;
3333
3434	res  =  PQexec (conn , "SET statement_timeout = 0" );
3535	if  (PQresultStatus (res ) !=  PGRES_COMMAND_OK )
36- 	{
37- 		char 	   * msg  =  pchomp (PQerrorMessage (conn ));
38- 		mtm_log (ERROR , "failed to set statement_timeout: %s" , msg );
39- 	}
36+ 		mtm_log (ERROR , "failed to set statement_timeout: %s" ,
37+ 				pchomp (PQerrorMessage (conn )));
4038
4139	res  =  PQexec (conn , "SET lock_timeout = 0" );
4240	if  (PQresultStatus (res ) !=  PGRES_COMMAND_OK )
43- 	{
44- 		char 	   * msg  =  pchomp (PQerrorMessage (conn ));
45- 		mtm_log (ERROR , "failed to set lock_timeout: %s" , msg );
46- 	}
41+ 		mtm_log (ERROR , "failed to set lock_timeout: %s" ,
42+ 				pchomp (PQerrorMessage (conn )));
4743
4844	res  =  PQexec (conn , "SET idle_in_transaction_session_timeout = 0" );
4945	if  (PQresultStatus (res ) !=  PGRES_COMMAND_OK )
50- 	{
51- 		char 	   * msg  =  pchomp (PQerrorMessage (conn ));
52- 		mtm_log (ERROR , "failed to set idle_in_transaction_session_timeout: %s" , msg );
53- 	}
46+ 		mtm_log (ERROR , "failed to set idle_in_transaction_session_timeout: %s" ,
47+ 				pchomp (PQerrorMessage (conn )));
5448
5549	res  =  PQexec (conn , "SET idle_session_timeout = 0" );
5650	if  (PQresultStatus (res ) !=  PGRES_COMMAND_OK )
57- 	{ 
58- 		char 	    * msg   =   pchomp (PQerrorMessage (conn ));
59- 		 mtm_log ( ERROR ,  "failed to set idle_session_timeout: %s" ,  msg ); 
60- 	} 
51+ 		 mtm_log ( ERROR ,  "failed to set idle_session_timeout: %s" , 
52+ 				 pchomp (PQerrorMessage (conn ) ));
53+ 
54+ 	return  true; 
6155}
6256
6357/* 
@@ -73,24 +67,13 @@ extern void
7367MtmDisableTimeouts (void )
7468{
7569	if  (get_timeout_active (STATEMENT_TIMEOUT ))
76- 	{
7770		disable_timeout (STATEMENT_TIMEOUT , false);
78- 	}
79- 
8071	if  (get_timeout_active (LOCK_TIMEOUT ))
81- 	{
8272		disable_timeout (LOCK_TIMEOUT , false);
83- 	}
84- 
8573	if  (get_timeout_active (IDLE_IN_TRANSACTION_SESSION_TIMEOUT ))
86- 	{
8774		disable_timeout (IDLE_IN_TRANSACTION_SESSION_TIMEOUT , false);
88- 	}
89- 
9075	if  (get_timeout_active (IDLE_SESSION_TIMEOUT ))
91- 	{
9276		disable_timeout (IDLE_SESSION_TIMEOUT , false);
93- 	}
9477}
9578
9679/* 
0 commit comments