Line 0
Link Here
|
|
|
1 |
--- lib/rw-splitting.lua.orig 2009-06-30 22:47:39.000000000 +0600 |
2 |
+++ lib/rw-splitting.lua 2009-10-20 12:06:21.000000000 +0600 |
3 |
@@ -65,7 +65,7 @@ |
4 |
|
5 |
if is_debug then |
6 |
print() |
7 |
- print("[connect_server] " .. proxy.connection.client.address) |
8 |
+ print("[connect_server] " .. proxy.connection.client.src.name) |
9 |
end |
10 |
|
11 |
local rw_ndx = 0 |
12 |
@@ -143,7 +143,7 @@ |
13 |
-- auth.packet is the packet |
14 |
function read_auth_result( auth ) |
15 |
if is_debug then |
16 |
- print("[read_auth_result] " .. proxy.connection.client.address) |
17 |
+ print("[read_auth_result] " .. proxy.connection.client.src.name) |
18 |
end |
19 |
if auth.packet:byte() == proxy.MYSQLD_PACKET_OK then |
20 |
-- auth was fine, disconnect from the server |
21 |
@@ -175,7 +175,7 @@ |
22 |
|
23 |
-- looks like we have to forward this statement to a backend |
24 |
if is_debug then |
25 |
- print("[read_query] " .. proxy.connection.client.address) |
26 |
+ print("[read_query] " .. proxy.connection.client.src.name) |
27 |
print(" current backend = " .. proxy.connection.backend_ndx) |
28 |
print(" client default db = " .. c.default_db) |
29 |
print(" client username = " .. c.username) |
30 |
@@ -198,7 +198,7 @@ |
31 |
return proxy.PROXY_SEND_RESULT |
32 |
end |
33 |
|
34 |
- proxy.queries:append(1, packet) |
35 |
+ proxy.queries:append(1, packet, { resultset_is_needed = true }) |
36 |
|
37 |
-- read/write splitting |
38 |
-- |
39 |
@@ -278,14 +278,14 @@ |
40 |
print(" server default db: " .. s.default_db) |
41 |
print(" client default db: " .. c.default_db) |
42 |
print(" syncronizing") |
43 |
- proxy.queries:prepend(2, string.char(proxy.COM_INIT_DB) .. c.default_db) |
44 |
+ proxy.queries:prepend(2, string.char(proxy.COM_INIT_DB) .. c.default_db, { resultset_is_needed = true }) |
45 |
end |
46 |
|
47 |
-- send to master |
48 |
if is_debug then |
49 |
if proxy.connection.backend_ndx > 0 then |
50 |
local b = proxy.global.backends[proxy.connection.backend_ndx] |
51 |
- print(" sending to backend : " .. b.address); |
52 |
+ print(" sending to backend : " .. b.dst.name); |
53 |
print(" is_slave : " .. tostring(b.type == proxy.BACKEND_TYPE_RO)); |
54 |
print(" server default db: " .. s.default_db) |
55 |
print(" server username : " .. s.username) |
56 |
@@ -319,7 +319,7 @@ |
57 |
proxy.response = { |
58 |
type = proxy.MYSQLD_PACKET_ERR, |
59 |
errmsg = "can't change DB ".. proxy.connection.client.default_db .. |
60 |
- " to on slave " .. proxy.global.backends[proxy.connection.backend_ndx].address |
61 |
+ " to on slave " .. proxy.global.backends[proxy.connection.backend_ndx].dst.name |
62 |
} |
63 |
|
64 |
return proxy.PROXY_SEND_RESULT |
65 |
@@ -352,7 +352,7 @@ |
66 |
function disconnect_client() |
67 |
local is_debug = proxy.global.config.rwsplit.is_debug |
68 |
if is_debug then |
69 |
- print("[disconnect_client] " .. proxy.connection.client.address) |
70 |
+ print("[disconnect_client] " .. proxy.connection.client.src.name) |
71 |
end |
72 |
|
73 |
-- make sure we are disconnection from the connection |