List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 23 1999 9:41pm
Subject:Pike MySQL module error handling
View as plain text  
>>>>> "Dan" == Dan Nelson <dnelson@stripped> writes:

Dan> I've got a little problem with the Pike Mysql module.  It seems to
Dan> reconnect to the database on any error:

Dan> roxencvs/Pike/0.7/src/modules/Mysql/mysql.c

Dan>   if (socket) {
Dan>     tmp = mysql_real_query(socket, query, qlen);
Dan>   }
Dan>   if (!socket || (tmp < 0)) {
Dan>     pike_mysql_reconnect();
Dan>     socket = PIKE_MYSQL->socket;
Dan>     tmp = mysql_real_query(socket, query, qlen);
Dan>   }

Dan> I'm having trouble holding locks since Pike seems to keep disconnecting
Dan> after every failed insert, etc.

Dan> Shouldn't a reconnect be done on CR_SERVER_GONE_ERROR or
Dan> CR_UNKNOWN_ERROR only?  Actually, now that I look at the source,
Dan> doesn't mysql_real_query do a reconnect if necessary anyway?


Yes, mysql_real_query() should do a reconnect if necessary.

And you are right that normally one should only reconnect in case of
the above errors.

Pike MySQL module error handlingDan Nelson23 Sep
  • Pike MySQL module error handlingMichael Widenius24 Sep