1 |
dertobi123 08/05/03 19:27:22 |
2 |
|
3 |
Added: bind-dlzmysql5-reconnect.patch |
4 |
Log: |
5 |
Fix dlz/mysql5 autoreconnect, patch by Nicolas Brousse, #180720 |
6 |
(Portage version: 2.1.5_rc6) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 net-dns/bind/files/bind-dlzmysql5-reconnect.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-dns/bind/files/bind-dlzmysql5-reconnect.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-dns/bind/files/bind-dlzmysql5-reconnect.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: bind-dlzmysql5-reconnect.patch |
15 |
=================================================================== |
16 |
--- bind-9.5.0a6.orig/contrib/dlz/drivers/dlz_mysql_driver.c 2007-02-06 06:44:26.000000000 +0100 |
17 |
+++ bind-9.5.0a6/contrib/dlz/drivers/dlz_mysql_driver.c 2007-09-04 23:57:57.000000000 +0200 |
18 |
@@ -92,6 +92,25 @@ |
19 |
*/ |
20 |
|
21 |
/*% |
22 |
+ * Factorize the mysql_ping for adding a log error message |
23 |
+ */ |
24 |
+static isc_result_t |
25 |
+mysqldrv_ping(dbinstance_t *dbi) { |
26 |
+ int pres = 0; |
27 |
+ |
28 |
+ pres = mysql_ping(dbi->dbconn); |
29 |
+ if ( pres != 0 ) { |
30 |
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, |
31 |
+ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1), |
32 |
+ "\nMySQL Ping Error : %s (%i)\n", |
33 |
+ mysql_error(dbi->dbconn), |
34 |
+ mysql_errno(dbi->dbconn)); |
35 |
+ return (ISC_R_FAILURE); |
36 |
+ } |
37 |
+ return (ISC_R_SUCCESS); |
38 |
+} |
39 |
+ |
40 |
+/*% |
41 |
* Allocates memory for a new string, and then constructs the new |
42 |
* string by "escaping" the input string. The new string is |
43 |
* safe to be used in queries. This is necessary because we cannot |
44 |
@@ -225,6 +244,8 @@ |
45 |
} |
46 |
|
47 |
|
48 |
+ mysqldrv_ping(dbi); |
49 |
+ |
50 |
/* |
51 |
* was a zone string passed? If so, make it safe for use in |
52 |
* queries. |
53 |
@@ -324,7 +345,7 @@ |
54 |
qres = mysql_query((MYSQL *) dbi->dbconn, querystring); |
55 |
if (qres == 0) |
56 |
break; |
57 |
- for (j=0; mysql_ping((MYSQL *) dbi->dbconn) != 0 && j < 4; j++) |
58 |
+ for (j=0; mysqldrv_ping(dbi) != 0 && j < 4; j++) |
59 |
; |
60 |
} |
61 |
|
62 |
@@ -923,6 +944,12 @@ |
63 |
pass = getParameterValue(argv[1], "pass="); |
64 |
socket = getParameterValue(argv[1], "socket="); |
65 |
|
66 |
+ if(mysql_options((MYSQL *) dbi->dbconn, MYSQL_OPT_RECONNECT, "1")) { |
67 |
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, |
68 |
+ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR, |
69 |
+ "Could not set database reconnect option"); |
70 |
+ } |
71 |
+ |
72 |
for (j=0; dbc == NULL && j < 4; j++) |
73 |
dbc = mysql_real_connect((MYSQL *) dbi->dbconn, host, |
74 |
user, pass, dbname, port, socket, |
75 |
|
76 |
|
77 |
|
78 |
-- |
79 |
gentoo-commits@l.g.o mailing list |