Changeset: e7fc78bf3887 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e7fc78bf3887
Modified Files:
        
Branch: default
Log Message:

Merged from Jun2010


diffs (truncated from 309 to 300 lines):

diff -r b257e57f9473 -r e7fc78bf3887 MonetDB5/ChangeLog.Jun2010
--- a/MonetDB5/ChangeLog.Jun2010        Thu Jul 01 14:29:32 2010 +0200
+++ b/MonetDB5/ChangeLog.Jun2010        Thu Jul 01 14:42:59 2010 +0200
@@ -1,6 +1,10 @@
 # ChangeLog file for MonetDB5
 # This file is updated with Maddlog
 
+* Thr Jul 01 2010 Fabian Groffen <fab...@cwi.nl>
+- Return a correct URI for local connection from Sabaoth when the
+  connection is a UNIX domain socket.  Partial fix for bug #2567.
+
 * Wed Jun 30 2010 Stefan Manegold <stefan.maneg...@cwi.nl>
 - various performance fixes in grouping and grouped aggregation code
   (MonetDB5/src/modules/kernel/group.mx, MonetDB5/src/modules/kernel/aggr*.mx)
diff -r b257e57f9473 -r e7fc78bf3887 MonetDB5/src/mal/mal_sabaoth.mx
--- a/MonetDB5/src/mal/mal_sabaoth.mx   Thu Jul 01 14:29:32 2010 +0200
+++ b/MonetDB5/src/mal/mal_sabaoth.mx   Thu Jul 01 14:42:59 2010 +0200
@@ -349,7 +349,13 @@
        if (stats == NULL || stats->conns == NULL || stats->conns->val == NULL) 
{
                *ret = GDKstrdup(str_nil);
        } else {
-               snprintf(data, sizeof(data), "%s%s", stats->conns->val, 
stats->dbname);
+               if (stats->conns->val[15] == '/') {
+                       snprintf(data, sizeof(data), "%s?database=%s",
+                                       stats->conns->val, stats->dbname);
+               } else {
+                       snprintf(data, sizeof(data), "%s%s",
+                                       stats->conns->val, stats->dbname);
+               }
                *ret = GDKstrdup(data);
        }
 
diff -r b257e57f9473 -r e7fc78bf3887 MonetDB5/src/modules/mal/Tests/All
--- a/MonetDB5/src/modules/mal/Tests/All        Thu Jul 01 14:29:32 2010 +0200
+++ b/MonetDB5/src/modules/mal/Tests/All        Thu Jul 01 14:42:59 2010 +0200
@@ -39,6 +39,10 @@
 
 remote10
 
+# this will always return something else
+#sabaoth00
+sabaoth01
+
 partition
 printf
 #some remote related tests
diff -r b257e57f9473 -r e7fc78bf3887 
MonetDB5/src/modules/mal/Tests/sabaoth01.mal
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/MonetDB5/src/modules/mal/Tests/sabaoth01.mal      Thu Jul 01 14:42:59 
2010 +0200
@@ -0,0 +1,4 @@
+u := sabaoth.getLocalConnectionURI();
+# if all is well, we can make a connection to ourself
+c := remote.connect(u, "monetdb", "monetdb");
+remote.disconnect(c);
diff -r b257e57f9473 -r e7fc78bf3887 
MonetDB5/src/modules/mal/Tests/sabaoth01.stable.err
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/MonetDB5/src/modules/mal/Tests/sabaoth01.stable.err       Thu Jul 01 
14:42:59 2010 +0200
@@ -0,0 +1,72 @@
+stderr of test 'sabaoth01` in directory 'src/modules/mal` itself:
+
+
+# 14:37:48 >  
+# 14:37:48 >   mserver5 
"--config=/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/etc/monetdb5.conf" 
--debug=10 --set gdk_nr_threads=0 --set 
"monet_mod_path=/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5:/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5/lib:/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5/bin"
 --set 
"gdk_dbfarm=/net/volund.ins.cwi.nl/export/scratch0/fabian/vtmp/mtest-Jun2010-volund.ins.cwi.nl/five/dbfarm"
  --set mapi_open=true --set xrpc_open=true --set mapi_port=38787 --set 
xrpc_port=40577 --set monet_prompt= --set mal_listing=2 --trace  
--dbname=mTests_src_modules_mal  sabaoth01.mal
+# 14:37:48 >  
+
+# builtin opt  gdk_arch = 64bitx86_64-pc-linux-gnu
+# builtin opt  gdk_version = 1.38.1
+# builtin opt  prefix = /ufs/fabian/scratch/monetdb/Jun2010/program-x86_64
+# builtin opt  exec_prefix = ${prefix}
+# builtin opt  gdk_dbname = demo
+# builtin opt  gdk_dbfarm = ${prefix}/var/MonetDB/dbfarm
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_alloc_map = no
+# builtin opt  gdk_vmtrim = yes
+# builtin opt  monet_admin = adm
+# builtin opt  monet_prompt = >
+# builtin opt  monet_welcome = yes
+# builtin opt  monet_mod_path = 
/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB
+# builtin opt  monet_daemon = no
+# builtin opt  host = localhost
+# builtin opt  mapi_port = 50000
+# builtin opt  mapi_clients = 2
+# builtin opt  mapi_open = false
+# builtin opt  mapi_autosense = false
+# builtin opt  sql_debug = 0
+# builtin opt  standoff_ns = 
+# builtin opt  standoff_start = start
+# builtin opt  standoff_end = end
+# config opt   prefix = /ufs/fabian/scratch/monetdb/Jun2010/program-x86_64
+# config opt   config = ${prefix}/etc/monetdb5.conf
+# config opt   prefix = /ufs/fabian/scratch/monetdb/Jun2010/program-x86_64
+# config opt   exec_prefix = ${prefix}
+# config opt   gdk_dbfarm = ${prefix}/var/MonetDB5/dbfarm
+# config opt   monet_mod_path = 
/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5:/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5/lib:/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5/bin
+# config opt   mero_pidfile = ${prefix}/var/run/MonetDB/merovingian.pid
+# config opt   mero_controlport = 50001
+# config opt   sql_optimizer = default_pipe
+# config opt   minimal_pipe = inline,remap,deadcode,multiplex,garbageCollector
+# config opt   default_pipe = 
inline,remap,evaluate,costModel,coercions,emptySet,aliases,mitosis,mergetable,deadcode,commonTerms,joinPath,reorder,deadcode,reduce,dataflow,history,multiplex,garbageCollector
+# config opt   nov2009_pipe = 
inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,multiplex,garbageCollector
+# config opt   replication_pipe = 
inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,replication,multiplex,garbageCollector
+# config opt   accumulator_pipe = 
inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,accumulators,dataflow,history,multiplex,garbageCollector
+# config opt   recycler_pipe = 
inline,remap,evaluate,costModel,coercions,emptySet,aliases,deadcode,constants,commonTerms,joinPath,deadcode,recycle,reduce,dataflow,history,multiplex,garbageCollector
+# config opt   cracker_pipe = 
inline,remap,evaluate,costModel,coercions,emptySet,aliases,selcrack,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,multiplex,garbageCollector
+# config opt   sidcrack_pipe = 
inline,remap,evaluate,costModel,coercions,emptySet,aliases,sidcrack,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,multiplex,garbageCollector
+# config opt   datacell_pipe = 
inline,remap,evaluate,costModel,coercions,emptySet,aliases,deadcode,constants,commonTerms,joinPath,datacell,deadcode,reduce,dataflow,history,multiplex,garbageCollector
+# config opt   octopus_pipe = 
inline,remap,evaluate,costModel,coercions,emptySet,aliases,mitosis,mergetable,deadcode,constants,commonTerms,joinPath,octopus,deadcode,reduce,dataflow,history,multiplex,garbageCollector
+# config opt   mapreduce_pipe = 
inline,remap,evaluate,costModel,coercions,emptySet,aliases,mapreduce,mergetable,deadcode,commonTerms,joinPath,reorder,deadcode,reduce,dataflow,history,multiplex,garbageCollector
+# config opt   datacyclotron_pipe = 
inline,remap,evaluate,costModel,coercions,emptySet,aliases,datacyclotron,mergetable,deadcode,constants,commonTerms,joinPath,reorder,deadcode,reduce,dataflow,history,replication,multiplex,garbageCollector
+# config opt   derive_pipe = 
inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,derivePath,joinPath,deadcode,reduce,dataflow,history,multiplex,garbageCollector
+# config opt   dictionary_pipe = 
inline,remap,dictionary,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,multiplex,garbageCollector
+# config opt   compression_pipe = 
inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,compression,dataflow,history,multiplex,garbageCollector
+# cmdline opt  config = 
/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/etc/monetdb5.conf
+# cmdline opt  gdk_nr_threads = 0
+# cmdline opt  monet_mod_path = 
/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5:/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5/lib:/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5/bin
+# cmdline opt  gdk_dbfarm = 
/net/volund.ins.cwi.nl/export/scratch0/fabian/vtmp/mtest-Jun2010-volund.ins.cwi.nl/five/dbfarm
+# cmdline opt  mapi_open = true
+# cmdline opt  xrpc_open = true
+# cmdline opt  mapi_port = 38787
+# cmdline opt  xrpc_port = 40577
+# cmdline opt  monet_prompt = 
+# cmdline opt  mal_listing = 2
+# cmdline opt  gdk_dbname = mTests_src_modules_mal
+#warning: please don't forget to set your vault key!
+#(see /ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/etc/monetdb5.conf)
+
+# 14:37:48 >  
+# 14:37:48 >  Done.
+# 14:37:48 >  
+
diff -r b257e57f9473 -r e7fc78bf3887 
MonetDB5/src/modules/mal/Tests/sabaoth01.stable.out
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/MonetDB5/src/modules/mal/Tests/sabaoth01.stable.out       Thu Jul 01 
14:42:59 2010 +0200
@@ -0,0 +1,28 @@
+stdout of test 'sabaoth01` in directory 'src/modules/mal` itself:
+
+
+# 14:37:48 >  
+# 14:37:48 >   mserver5 
"--config=/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/etc/monetdb5.conf" 
--debug=10 --set gdk_nr_threads=0 --set 
"monet_mod_path=/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5:/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5/lib:/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5/bin"
 --set 
"gdk_dbfarm=/net/volund.ins.cwi.nl/export/scratch0/fabian/vtmp/mtest-Jun2010-volund.ins.cwi.nl/five/dbfarm"
  --set mapi_open=true --set xrpc_open=true --set mapi_port=38787 --set 
xrpc_port=40577 --set monet_prompt= --set mal_listing=2 --trace  
--dbname=mTests_src_modules_mal  sabaoth01.mal
+# 14:37:48 >  
+
+# MonetDB server v5.20.1, based on kernel v1.38.1
+# Serving database 'mTests_src_modules_mal', using 4 threads
+# Compiled for x86_64-pc-linux-gnu/64bit with 64bit OIDs dynamically linked
+# Found 7.751 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2010 MonetDB B.V., all rights reserved
+# Visit http://monetdb.cwi.nl/ for further information
+# Listening for connection requests on mapi:monetdb://volund.ins.cwi.nl:38787/
+# MonetDB/SQL module v2.38.1 loaded
+# MonetDB/GIS module v0.18.0 loaded
+function user.main():void;
+    u := sabaoth.getLocalConnectionURI();
+# if all is well, we can make a connection to ourself 
+    c := remote.connect(u,"monetdb","monetdb");
+    remote.disconnect(c);
+end main;
+
+# 14:37:48 >  
+# 14:37:48 >  Done.
+# 14:37:48 >  
+
diff -r b257e57f9473 -r e7fc78bf3887 clients/ChangeLog.Jun2010
--- a/clients/ChangeLog.Jun2010 Thu Jul 01 14:29:32 2010 +0200
+++ b/clients/ChangeLog.Jun2010 Thu Jul 01 14:42:59 2010 +0200
@@ -1,3 +1,6 @@
 # ChangeLog file for clients
 # This file is updated with Maddlog
 
+* Thr Jul  1 2010 Fabian Groffen <fab...@cwi.nl>
+- Fix implementation of mapi_mapiuri to deal with UNIX socket urls
+  properly.  This fixes one part of Bug #2567.
diff -r b257e57f9473 -r e7fc78bf3887 clients/src/mapilib/Mapi.mx
--- a/clients/src/mapilib/Mapi.mx       Thu Jul 01 14:29:32 2010 +0200
+++ b/clients/src/mapilib/Mapi.mx       Thu Jul 01 14:42:59 2010 +0200
@@ -1303,6 +1303,7 @@
 static int unquote(const char *msg, char **start, const char **next, int 
endchar, size_t *lenp);
 static int mapi_slice_row(struct MapiResultSet *result, int cr);
 static void mapi_store_bind(struct MapiResultSet *result, int cr);
+static void parse_uri_query(Mapi mid, char *uri);
 
 static int mapi_initialized = 0;
 
@@ -2093,39 +2094,43 @@
        }
 
        /* copy to a writable working buffer */
-       snprintf(uri, 8096, "%s", url +sizeof("mapi:monetdb://") - 1);
-
-       if ((p = strchr(uri, ':')) == NULL) {
-               mapi_setError(mid, "URI must contain a port number after the 
hostname", "mapi_mapiuri", MERROR);
-               return mid;
-       }
-       *p++ = '\0';
-       host = uri;
-       dbname = p;             /* temp misuse */
-
-       if ((p = strchr(dbname, '/')) == NULL) {
-               p = dbname;
-               dbname = NULL;
-       } else {
+       snprintf(uri, 8096, "%s", url + sizeof("mapi:monetdb://") - 1);
+
+       if (uri[0] != '/') {
+               if ((p = strchr(uri, ':')) == NULL) {
+                       mapi_setError(mid, "URI must contain a port number 
after "
+                                       "the hostname", "mapi_mapiuri", MERROR);
+                       return mid;
+               }
                *p++ = '\0';
-               if (*p == '\0') {
+               dbname = p;             /* temp misuse */
+               host = uri;
+               if ((p = strchr(dbname, '/')) == NULL) {
                        p = dbname;
                        dbname = NULL;
                } else {
-                       char *t = dbname;
-                       dbname = p;
-                       p = t;
+                       *p++ = '\0';
+                       if (*p == '\0') {
+                               p = dbname;
+                               dbname = NULL;
+                       } else {
+                               char *t = dbname;
+                               dbname = p;
+                               p = t;
+                       }
                }
+               port = atoi(p);
+               if (port <= 0) {
+                       mapi_setError(mid, "URI contains invalid port",
+                                       "mapi_mapiuri", MERROR);
+                       return mid;
+               }
+       } else {
+               host = uri;
+               port = 0;
+               dbname = NULL;
        }
-       port = atoi(p);
-       if (port <= 0) {
-               mapi_setError(mid, "URI contains invalid port", "mapi_mapiuri", 
MERROR);
-               return mid;
-       }
-
-       if (mid->hostname)
-               free(mid->hostname);
-       mid->hostname = strdup(host);
+
        mid->port = port;
        if (mid->username != NULL)
                free(mid->username);
@@ -2145,7 +2150,18 @@
                mid->languageId = LANG_XQUERY;
        if (mid->database)
                free(mid->database);
-       mid->database = dbname == NULL ? NULL : strdup(dbname);
+       mid->database = NULL;
+
+       /* this is in particular important for unix sockets */
+       parse_uri_query(mid, uri);
+
+       /* doing this here, because parse_uri_query will terminate the
+        * string if a ? is in place */
+       if (mid->hostname)
+               free(mid->hostname);
+       mid->hostname = strdup(host);
+       if (mid->database == NULL && dbname != NULL)
+               mid->database = strdup(dbname);
 
        return mid;
 }
@@ -2267,7 +2283,7 @@
        if ((uri = strchr(uri, '?')) == NULL)
                return;
 
-       uri++;                  /* skip '?' */
+       *uri++ = '\0';                  /* skip '?' */
 
        do {
                if ((amp = strchr(uri, '&')) != NULL)
@@ -2281,6 +2297,14 @@
                        } else if (strcmp("language", uri) == 0) {
                                free(mid->language);
                                mid->language = strdup(val);
+                               if (strcmp(val, "mil") == 0)
+                                       mid->languageId = LANG_MIL;
+                               else if (strcmp(val, "mal") == 0)
+                                       mid->languageId = LANG_MAL;
+                               else if (strcmp(val, "sql") == 0)
+                                       mid->languageId = LANG_SQL;
+                               else if (strcmp(val, "xquery") == 0)
+                                       mid->languageId = LANG_XQUERY;
                        } else if (strcmp("user", uri) == 0) {
                                /* until we figure out how this can be
                                   done safely wrt security, ignore */
diff -r b257e57f9473 -r e7fc78bf3887 
sql/src/backends/monet5/merovingian/merovingian.c
--- a/sql/src/backends/monet5/merovingian/merovingian.c Thu Jul 01 14:29:32 
2010 +0200
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to