[Kamailio-Users] kam 1.5 sqlops sql_query timeout value

Robert McGilvray rmcgilvr at globeop.com
Mon Mar 29 14:58:47 CEST 2010


 

Hello,

 

I'm using the sqlops module for some custom queries against mysql.
Sometimes during a cluster failure the mysqld nodes will hang there
waiting for the backend to finish up whatever it's doing, it still
accepts the connection and the query but doesn't return results. I have
a pair of F5 load balancers in front of the two sql nodes, so there is
redundancy as long as the cluster is operational. I'd prefer to keep the
cross-site failover in kamailio. 

 

I looked through the docs on sqlops and I can't find any reference to a
timeout value. I'd like to implement a failover in the script to my
other database cluster but if kam waits for a long time before returning
a negative it may not work very well. Consider this code in my script
for 911 services in my US offices: (I rewrite the rpid/pai and ruri
based on IP address then send it to my provider(s))

 

modparam("sqlops","sqlcon","gokam=>mysql://*****:*****@172.20.180.21/sip
_gokam")

 

        if (!sql_query("gokam", "select
location,cidname,cidnum,ciddomain,e911number,inet_ntoa(network) as
network,inet_ntoa(netmask) \

                                 as netmask from e911 where
(inet_aton('$si') & netmask) = network", "result")) {

                sl_send_reply("500", "Database error");

                exit;

        }

 

What I'd like to do is:

 

modparam("sqlops","sqlcon","gokam=>mysql://****:****@172.20.180.21/sip_g
okam")

modparam("sqlops","sqlcon","gokam_site2=>mysql://*****:*****@172.23.180.
21/sip_gokam")

 

if (!sql_query("gokam", "select
location,cidname,cidnum,ciddomain,e911number,inet_ntoa(network) as
network,inet_ntoa(netmask) \

                                 as netmask from e911 where
(inet_aton('$si') & netmask) = network", "result")) {

                xlog("L_CRIT", "Primary database failure, using
alternate\n");

                        if (!sql_query("gokam_site2", "select
location,cidname,cidnum,ciddomain,e911number,inet_ntoa(network) as
network,inet_ntoa(netmask) \

                                 as netmask from e911 where
(inet_aton('$si') & netmask) = network", "result")) {

                        sl_send_reply("500", Database error");

                        exit;                

        }

 

What is the default timeout for sql_query before it returns a negative,
is it configurable?

 

Thanks!

 

Bob 

 


--------------------------------------------------------------------------
This email with all information contained herein or attached hereto may contain confidential and/or privileged information intended for the addressee(s) only. If you have received this email in error, please contact the sender and immediately delete this email in its entirety and any attachments thereto.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20100329/68170427/attachment.htm>


More information about the sr-users mailing list