Update of /cvsroot/monetdb/sql/src/backends/monet5/merovingian
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv20852

Modified Files:
        ChangeLog merovingian.c merovingian_client.c 
        merovingian_forkmserver.c 
Log Message:
When merovingian proxies for a database, use a UNIX domain socket for speed.  
In the near future we can even pass a filedescriptor over it to get transparant 
forwarding for even more speed.

Index: merovingian_forkmserver.c
===================================================================
RCS file: 
/cvsroot/monetdb/sql/src/backends/monet5/merovingian/merovingian_forkmserver.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- merovingian_forkmserver.c   4 Mar 2010 09:06:44 -0000       1.9
+++ merovingian_forkmserver.c   16 Mar 2010 11:44:31 -0000      1.10
@@ -220,12 +220,13 @@
                str dbname = alloca(sizeof(char) * 512);
                str port = alloca(sizeof(char) * 24);
                str muri = alloca(sizeof(char) * 512); /* possibly undersized */
+               str usock = alloca(sizeof(char) * 512);
                char mydoproxy;
                str nthreads = NULL;
                str master = NULL;
                str slave = NULL;
                str pipeline = NULL;
-               str argv[25];   /* for the exec arguments */
+               str argv[27];   /* for the exec arguments */
                confkeyval *ckv, *kv;
                int c = 0;
 
@@ -288,24 +289,29 @@
                snprintf(vaultkey, 512, "monet_vault_key=%s/.vaultkey", 
(*stats)->path);
                snprintf(muri, 512, "merovingian_uri=mapi:monetdb://%s:%d/%s",
                                _mero_hostname, _mero_port, database);
-               /* avoid this mserver binding to the same port as merovingian
-                * but on another interface, (INADDR_ANY ... sigh) causing
-                * endless redirects since 0.0.0.0 is not a valid address to
-                * connect to, and hence the hostname is advertised instead */
-               snprintf(port, 24, "mapi_port=%d", _mero_port + 1);
                argv[c++] = _mero_mserver;
                argv[c++] = conffile;
                argv[c++] = dbname;
                argv[c++] = "--dbinit=include sql;"; /* yep, no quotes needed! 
*/
                argv[c++] = "--set"; argv[c++] = muri;
-               argv[c++] = "--set"; argv[c++] = "monet_daemon=yes";
                if (mydoproxy == 1) {
                        argv[c++] = "--set"; argv[c++] = "mapi_open=false";
+                       /* we "proxy", so we can just solely use UNIX domain 
sockets
+                        * internally */
+                       snprintf(port, 24, "mapi_port=0");
+                       snprintf(usock, 512, "mapi_usock=%s/.mapi.sock", 
(*stats)->path);
                } else {
                        argv[c++] = "--set"; argv[c++] = "mapi_open=true";
+                       argv[c++] = "--set"; argv[c++] = "mapi_autosense=true";
+                       /* avoid this mserver binding to the same port as 
merovingian
+                        * but on another interface, (INADDR_ANY ... sigh) 
causing
+                        * endless redirects since 0.0.0.0 is not a valid 
address to
+                        * connect to, and hence the hostname is advertised 
instead */
+                       snprintf(port, 24, "mapi_port=%d", _mero_port + 1);
+                       snprintf(usock, 512, "mapi_usock=");
                }
-               argv[c++] = "--set"; argv[c++] = "mapi_autosense=true";
                argv[c++] = "--set"; argv[c++] = port;
+               argv[c++] = "--set"; argv[c++] = usock;
                argv[c++] = "--set"; argv[c++] = vaultkey;
                if (nthreads != NULL) {
                        argv[c++] = "--set"; argv[c++] = nthreads;
@@ -319,6 +325,8 @@
                if (slave != NULL) {
                        argv[c++] = "--set"; argv[c++] = slave;
                }
+               /* keep this one last for easy copy/paste with gdb */
+               argv[c++] = "--set"; argv[c++] = "monet_daemon=yes";
                argv[c++] = NULL;
 
                fprintf(stdout, "arguments:");

Index: merovingian.c
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/merovingian.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- merovingian.c       14 Jan 2010 16:13:28 -0000      1.70
+++ merovingian.c       16 Mar 2010 11:44:29 -0000      1.71
@@ -47,7 +47,7 @@
  * number of times over a recent period.
  */
 
-#define MERO_VERSION   "1.2"
+#define MERO_VERSION   "1.3"
 #define MERO_PORT      50000
 
 #include "sql_config.h"

Index: merovingian_client.c
===================================================================
RCS file: 
/cvsroot/monetdb/sql/src/backends/monet5/merovingian/merovingian_client.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- merovingian_client.c        10 Mar 2010 14:29:42 -0000      1.3
+++ merovingian_client.c        16 Mar 2010 11:44:31 -0000      1.4
@@ -288,7 +288,8 @@
                fflush(stdout);
                stream_flush(fout);
        } else {
-               Mfprintf(stdout, "proxying client %s for database '%s' to 
%s%s\n",
+               Mfprintf(stdout, "proxying client %s for database '%s' to "
+                               "%s?database=%s\n",
                                host, database, redirs[0].conns->val, 
redirs[0].dbname);
                /* merovingian is in control, only consider the first redirect 
*/
                stream_printf(fout, "^mapi:merovingian://proxy?database=%s\n",

Index: ChangeLog
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/ChangeLog,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- ChangeLog   16 Mar 2010 11:39:43 -0000      1.33
+++ ChangeLog   16 Mar 2010 11:44:29 -0000      1.34
@@ -2,6 +2,13 @@
 # This file is updated with mchangelog (Gentoo echangelog bastard script)
 
   16 Mar 2010; Fabian Groffen <[email protected]>
+  merovingian_forkmserver.c, merovingian_proxy.c:
+  Use mserver5's UNIX domain socket support when Merovingian is supposed
+  to proxy the connection to the database.
+
+*May2010
+
+  16 Mar 2010; Fabian Groffen <[email protected]>
   merovingian_controlrunner.c:
   Enlarged buffer to avoid incomplete output being sent to monetdb(1),
   causing commands like status and get to fail on certain


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to