View | Details | Raw Unified | Return to bug 143255
Collapse All | Expand All

(-)/usr/ports/databases/mysql-proxy/Makefile (-2 / +1 lines)
Lines 6-13 Link Here
6
#
6
#
7
7
8
PORTNAME=	mysql-proxy
8
PORTNAME=	mysql-proxy
9
PORTVERSION=	0.7.2
9
PORTVERSION=	0.8.0
10
PORTREVISION=	4
11
CATEGORIES=	databases
10
CATEGORIES=	databases
12
MASTER_SITES=	${MASTER_SITE_MYSQL}
11
MASTER_SITES=	${MASTER_SITE_MYSQL}
13
MASTER_SITE_SUBDIR=	MySQL-Proxy
12
MASTER_SITE_SUBDIR=	MySQL-Proxy
(-)/usr/ports/databases/mysql-proxy/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
MD5 (mysql-proxy-0.7.2.tar.gz) = 85caf142acfb4ee7ae5a8bce175579f7
1
MD5 (mysql-proxy-0.8.0.tar.gz) = b6a9748d72e8db7fe3789fbdd60ff451
2
SHA256 (mysql-proxy-0.7.2.tar.gz) = c2962bc4e2c143c4c181d9014396c4e3b8c72c1eed6b9dd808bee6b3cb5e73fc
2
SHA256 (mysql-proxy-0.8.0.tar.gz) = 0a195fe0f86d12df8d9ffc27e91347680521c8702460bac5ed591608a740bc1c
3
SIZE (mysql-proxy-0.7.2.tar.gz) = 704438
3
SIZE (mysql-proxy-0.8.0.tar.gz) = 756371
(-)/usr/ports/databases/mysql-proxy/files/patch-Makefile.in (+11 lines)
Line 0 Link Here
1
--- Makefile.in.orig	2010-01-26 13:59:52.000000000 +0100
2
+++ Makefile.in	2010-01-26 14:00:16.000000000 +0100
3
@@ -238,7 +238,7 @@
4
 		deps
5
 
6
 ACLOCAL_AMFLAGS = -I m4
7
-pkgconfigdir = $(libdir)/pkgconfig
8
+pkgconfigdir = $(libexecdir)/pkgconfig
9
 pkgconfig_DATA = mysql-proxy.pc mysql-chassis.pc
10
 all: config.h
11
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
(-)/usr/ports/databases/mysql-proxy/files/patch-lib-rw-splitting.lua (-73 lines)
Lines 1-73 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
(-)/usr/ports/databases/mysql-proxy/files/patch-src-network-injection-lua.c (-93 lines)
Lines 1-93 Link Here
1
--- src/network-injection-lua.c.orig	2009-06-30 22:47:39.000000000 +0600
2
+++ src/network-injection-lua.c	2009-11-17 09:39:32.000000000 +0500
3
@@ -33,17 +33,18 @@
4
 #define TIME_DIFF_US(t2, t1) \
5
 ((t2.tv_sec - t1.tv_sec) * 1000000.0 + (t2.tv_usec - t1.tv_usec))
6
 
7
+typedef enum {
8
+	PROXY_QUEUE_ADD_PREPEND,
9
+	PROXY_QUEUE_ADD_APPEND
10
+} proxy_queue_add_t;
11
 
12
 /**
13
- * proxy.queries:append(id, packet[, { options }])
14
+ * handle _append() and _prepend() 
15
  *
16
- *   id:      opaque numeric id (numeric)
17
- *   packet:  mysql packet to append (string)  FIXME: support table for multiple packets
18
- *   options: table of options (table)
19
- *     backend_ndx:  backend_ndx to send it to (numeric)
20
- *     resultset_is_needed: expose the result-set into lua (bool)
21
+ * _append() and _prepend() have the same behaviour, parameters, ... 
22
+ * just different in position
23
  */
24
-static int proxy_queue_append(lua_State *L) {
25
+static int proxy_queue_add(lua_State *L, proxy_queue_add_t type) {
26
 	GQueue *q = *(GQueue **)luaL_checkself(L);
27
 	int resp_type = luaL_checkinteger(L, 2);
28
 	size_t str_len;
29
@@ -68,7 +69,12 @@
30
 		} else if (lua_isboolean(L, -1)) {
31
 			inj->resultset_is_needed = lua_toboolean(L, -1);
32
 		} else {
33
-			luaL_argerror(L, 4, ":append(..., { resultset_is_needed = boolean } ), is %s");
34
+			switch (type) {
35
+			case PROXY_QUEUE_ADD_APPEND:
36
+				return luaL_argerror(L, 4, ":append(..., { resultset_is_needed = boolean } ), is %s");
37
+			case PROXY_QUEUE_ADD_PREPEND:
38
+				return luaL_argerror(L, 4, ":prepend(..., { resultset_is_needed = boolean } ), is %s");
39
+			}
40
 		}
41
 
42
 		lua_pop(L, 1);
43
@@ -78,25 +84,34 @@
44
 		luaL_typerror(L, 4, "table");
45
 		break;
46
 	}
47
-    
48
-	network_injection_queue_append(q, inj);
49
-    
50
-	return 0;
51
+
52
+	switch (type) {
53
+	case PROXY_QUEUE_ADD_APPEND:
54
+		network_injection_queue_append(q, inj);
55
+		return 0;
56
+	case PROXY_QUEUE_ADD_PREPEND:
57
+		network_injection_queue_prepend(q, inj);
58
+		return 0;
59
+	}
60
+
61
+	g_assert_not_reached();
62
+}
63
+
64
+/**
65
+ * proxy.queries:append(id, packet[, { options }])
66
+ *
67
+ *   id:      opaque numeric id (numeric)
68
+ *   packet:  mysql packet to append (string)  FIXME: support table for multiple packets
69
+ *   options: table of options (table)
70
+ *     backend_ndx:  backend_ndx to send it to (numeric)
71
+ *     resultset_is_needed: expose the result-set into lua (bool)
72
+ */
73
+static int proxy_queue_append(lua_State *L) {
74
+	return proxy_queue_add(L, PROXY_QUEUE_ADD_APPEND);
75
 }
76
 
77
 static int proxy_queue_prepend(lua_State *L) {
78
-	/* we expect 2 parameters */
79
-	GQueue *q = *(GQueue **)luaL_checkself(L);
80
-	int resp_type = luaL_checkinteger(L, 2);
81
-	size_t str_len;
82
-	const char *str = luaL_checklstring(L, 3, &str_len);
83
-    
84
-	GString *query = g_string_sized_new(str_len);
85
-	g_string_append_len(query, str, str_len);
86
-    
87
-	network_injection_queue_prepend(q, injection_new(resp_type, query));
88
-    
89
-	return 0;
90
+	return proxy_queue_add(L, PROXY_QUEUE_ADD_PREPEND);
91
 }
92
 
93
 static int proxy_queue_reset(lua_State *L) {
(-)/usr/ports/databases/mysql-proxy/pkg-plist (-1 / +47 lines)
Lines 1-13 Link Here
1
@comment $FreeBSD: ports/databases/mysql-proxy/pkg-plist,v 1.5 2009/10/28 01:38:01 clsung Exp $
1
@comment $FreeBSD: ports/databases/mysql-proxy/pkg-plist,v 1.5 2009/10/28 01:38:01 clsung Exp $
2
sbin/mysql-proxy
2
bin/mysql-proxy
3
bin/mysql-binlog-dump
3
bin/mysql-binlog-dump
4
bin/mysql-myisam-dump
4
bin/mysql-myisam-dump
5
include/network-mysqld.h
6
include/network-mysqld-lua.h
7
include/network-mysqld-proto.h
8
include/network-mysqld-binlog.h
9
include/network-mysqld-packet.h
10
include/network-mysqld-masterinfo.h
11
include/network-conn-pool.h
12
include/network-conn-pool-lua.h
13
include/network-queue.h
14
include/network-socket.h
15
include/network-socket-lua.h
16
include/network-address.h
17
include/network-address-lua.h
18
include/sys-pedantic.h
19
include/chassis-plugin.h
20
include/chassis-log.h
21
include/chassis-keyfile.h
22
include/chassis-mainloop.h
23
include/chassis-path.h
24
include/chassis-filemode.h
25
include/chassis-limits.h
26
include/chassis-event-thread.h
27
include/glib-ext.h
28
include/glib-ext-ref.h
29
include/string-len.h
30
include/lua-load-factory.h
31
include/lua-scope.h
32
include/lua-env.h
33
include/network-injection.h
34
include/network-injection-lua.h
35
include/chassis-exports.h
36
include/network-exports.h
37
include/network-backend.h
38
include/network-backend-lua.h
39
include/disable-dtrace.h
40
include/lua-registry-keys.h
41
include/chassis-stats.h
42
include/chassis-timings.h
43
include/my_rdtsc.h
5
libexec/mysql-proxy
44
libexec/mysql-proxy
6
libexec/mysql-binlog-dump
45
libexec/mysql-binlog-dump
7
libexec/mysql-myisam-dump
46
libexec/mysql-myisam-dump
47
libexec/pkgconfig/mysql-proxy.pc
48
libexec/pkgconfig/mysql-chassis.pc
8
lib/libmysql-chassis.so.0
49
lib/libmysql-chassis.so.0
9
lib/libmysql-chassis.so
50
lib/libmysql-chassis.so
10
lib/libmysql-chassis.la
51
lib/libmysql-chassis.la
52
lib/libmysql-chassis-timing.so.0
53
lib/libmysql-chassis-timing.so
54
lib/libmysql-chassis-timing.la
11
lib/libmysql-proxy.so.0
55
lib/libmysql-proxy.so.0
12
lib/libmysql-proxy.so
56
lib/libmysql-proxy.so
13
lib/libmysql-proxy.la
57
lib/libmysql-proxy.la
Lines 62-67 Link Here
62
%%EXAMPLESDIR%%/tutorial-resultset.lua
106
%%EXAMPLESDIR%%/tutorial-resultset.lua
63
%%EXAMPLESDIR%%/tutorial-rewrite.lua
107
%%EXAMPLESDIR%%/tutorial-rewrite.lua
64
%%EXAMPLESDIR%%/tutorial-routing.lua
108
%%EXAMPLESDIR%%/tutorial-routing.lua
109
%%EXAMPLESDIR%%/tutorial-scramble.lua
65
%%EXAMPLESDIR%%/tutorial-states.lua
110
%%EXAMPLESDIR%%/tutorial-states.lua
66
%%EXAMPLESDIR%%/tutorial-tokenize.lua
111
%%EXAMPLESDIR%%/tutorial-tokenize.lua
67
%%EXAMPLESDIR%%/tutorial-union.lua
112
%%EXAMPLESDIR%%/tutorial-union.lua
Lines 70-75 Link Here
70
@dirrmtry lib/mysql-proxy/lua/proxy
115
@dirrmtry lib/mysql-proxy/lua/proxy
71
@dirrmtry lib/mysql-proxy/lua
116
@dirrmtry lib/mysql-proxy/lua
72
@dirrmtry lib/mysql-proxy
117
@dirrmtry lib/mysql-proxy
118
@dirrmtry libexec/pkgconfig
73
@dirrmtry %%EXAMPLESDIR%%
119
@dirrmtry %%EXAMPLESDIR%%
74
@dirrmtry %%DATADIR%%/lua/proxy
120
@dirrmtry %%DATADIR%%/lua/proxy
75
@dirrmtry %%DATADIR%%/lua
121
@dirrmtry %%DATADIR%%/lua

Return to bug 143255