ports/140039: [FIX] databases/mysql-proxy fix broken rw-spliting
Vladimir Korkodinov
viper at perm.raid.ru
Wed Oct 28 05:50:02 UTC 2009
>Number: 140039
>Category: ports
>Synopsis: [FIX] databases/mysql-proxy fix broken rw-spliting
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Oct 28 05:50:00 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Vladimir Korkodinov
>Release: FreeBSD 7.2-STABLE
>Organization:
>Environment:
FreeBSD xxxxx 7.2-STABLE FreeBSD 7.2-STABLE #2: Thu Jul 16 03:52:44 YEKST 2009 root at xxxx:/usr/obj/usr/src/sys/kernel amd64
>Description:
set is_debug = true in rw-splitting.lua.
"2009-10-28 10:27:09: (critical) proxy-plugin.c:1389: (connect_server)
[string "/usr/local/share/mysql-proxy/rw-splitting.l..."]:69: .address is
deprecated. Use .src.name or .dst.name instead
2009-10-28 10:27:09: (critical) (read_query) [string
"/usr/local/share/mysql-proxy/rw-splitting.l..."]:179: .address is
deprecated. Use .src.name or .dst.name instead
2009-10-28 10:27:09: (critical) proxy-plugin.c.1129: I have no server
backend, closing connection
2009-10-28 10:27:09: (critical) network-mysqld.c.1188:
plugin_call(CON_STATE_READ_QUERY) failed
2009-10-28 10:27:09: (debug) [network-mysqld.c:784]: error on a connection
(fd: -1 event: 0). closing client connection.
2009-10-28 10:27:09: (critical) proxy-plugin.c.1684: (disconnect_client)
[string "/usr/local/share/mysql-proxy/rw-splitting.l..."]:356: .address is
deprecated. Use .src.name or .dst.name instead"
with patch
"[connect_server] 127.0.0.1:17059
[1].connected_clients = 0
[1].pool.cur_idle = 0
[1].pool.max_idle = 8
[1].pool.min_idle = 4
[1].type = 1
[1].state = 0
[1] idle-conns below min-idle
[read_query] 127.0.0.1:17059
current backend = 0
client default db =
client username = root
sending to backend : 127.0.0.1:3306
is_slave : false
server default db:
server username : root
in_trans : false
in_calc_found : false
COM_QUERY : false
"
patch-mysql-proxy.txt
>How-To-Repeat:
>Fix:
apply patch
Patch attached with submission follows:
diff -ruN mysql-proxy.old/Makefile mysql-proxy/Makefile
--- mysql-proxy.old/Makefile 2009-10-28 06:38:01.000000000 +0500
+++ mysql-proxy/Makefile 2009-10-28 10:35:09.000000000 +0500
@@ -7,7 +7,7 @@
PORTNAME= mysql-proxy
PORTVERSION= 0.7.2
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= databases
MASTER_SITES= ${MASTER_SITE_MYSQL}
MASTER_SITE_SUBDIR= MySQL-Proxy
diff -ruN mysql-proxy.old/files/patch-lib:rw-splitting.lua mysql-proxy/files/patch-lib:rw-splitting.lua
--- mysql-proxy.old/files/patch-lib:rw-splitting.lua 1970-01-01 05:00:00.000000000 +0500
+++ mysql-proxy/files/patch-lib:rw-splitting.lua 2009-10-20 12:08:01.000000000 +0600
@@ -0,0 +1,73 @@
+--- lib/rw-splitting.lua.orig 2009-06-30 22:47:39.000000000 +0600
++++ lib/rw-splitting.lua 2009-10-20 12:06:21.000000000 +0600
+@@ -65,7 +65,7 @@
+
+ if is_debug then
+ print()
+- print("[connect_server] " .. proxy.connection.client.address)
++ print("[connect_server] " .. proxy.connection.client.src.name)
+ end
+
+ local rw_ndx = 0
+@@ -143,7 +143,7 @@
+ -- auth.packet is the packet
+ function read_auth_result( auth )
+ if is_debug then
+- print("[read_auth_result] " .. proxy.connection.client.address)
++ print("[read_auth_result] " .. proxy.connection.client.src.name)
+ end
+ if auth.packet:byte() == proxy.MYSQLD_PACKET_OK then
+ -- auth was fine, disconnect from the server
+@@ -175,7 +175,7 @@
+
+ -- looks like we have to forward this statement to a backend
+ if is_debug then
+- print("[read_query] " .. proxy.connection.client.address)
++ print("[read_query] " .. proxy.connection.client.src.name)
+ print(" current backend = " .. proxy.connection.backend_ndx)
+ print(" client default db = " .. c.default_db)
+ print(" client username = " .. c.username)
+@@ -198,7 +198,7 @@
+ return proxy.PROXY_SEND_RESULT
+ end
+
+- proxy.queries:append(1, packet)
++ proxy.queries:append(1, packet, { resultset_is_needed = true })
+
+ -- read/write splitting
+ --
+@@ -278,14 +278,14 @@
+ print(" server default db: " .. s.default_db)
+ print(" client default db: " .. c.default_db)
+ print(" syncronizing")
+- proxy.queries:prepend(2, string.char(proxy.COM_INIT_DB) .. c.default_db)
++ proxy.queries:prepend(2, string.char(proxy.COM_INIT_DB) .. c.default_db, { resultset_is_needed = true })
+ end
+
+ -- send to master
+ if is_debug then
+ if proxy.connection.backend_ndx > 0 then
+ local b = proxy.global.backends[proxy.connection.backend_ndx]
+- print(" sending to backend : " .. b.address);
++ print(" sending to backend : " .. b.dst.name);
+ print(" is_slave : " .. tostring(b.type == proxy.BACKEND_TYPE_RO));
+ print(" server default db: " .. s.default_db)
+ print(" server username : " .. s.username)
+@@ -319,7 +319,7 @@
+ proxy.response = {
+ type = proxy.MYSQLD_PACKET_ERR,
+ errmsg = "can't change DB ".. proxy.connection.client.default_db ..
+- " to on slave " .. proxy.global.backends[proxy.connection.backend_ndx].address
++ " to on slave " .. proxy.global.backends[proxy.connection.backend_ndx].dst.name
+ }
+
+ return proxy.PROXY_SEND_RESULT
+@@ -352,7 +352,7 @@
+ function disconnect_client()
+ local is_debug = proxy.global.config.rwsplit.is_debug
+ if is_debug then
+- print("[disconnect_client] " .. proxy.connection.client.address)
++ print("[disconnect_client] " .. proxy.connection.client.src.name)
+ end
+
+ -- make sure we are disconnection from the connection
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list