Update of /cvsroot/monetdb/sql/src/backends/monet5/merovingian
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv29873

Modified Files:
      Tag: Nov2009
        ChangeLog.Nov2009 merovingian.c merovingian_forkmserver.c 
        monetdb.c properties.c 
Log Message:
Add optpipe setting to control the SQL optimiser pipeline, useful for 
experimentation per database, implemented a FIXME and string abbreviation like 
monetdb status does for monetdb get.

U merovingian_forkmserver.c
Index: merovingian_forkmserver.c
===================================================================
RCS file: 
/cvsroot/monetdb/sql/src/backends/monet5/merovingian/merovingian_forkmserver.c,v
retrieving revision 1.3.2.3
retrieving revision 1.3.2.4
diff -u -d -r1.3.2.3 -r1.3.2.4
--- merovingian_forkmserver.c   8 Oct 2009 11:46:43 -0000       1.3.2.3
+++ merovingian_forkmserver.c   8 Oct 2009 12:51:42 -0000       1.3.2.4
@@ -224,7 +224,8 @@
                str nthreads = NULL;
                str master = NULL;
                str slave = NULL;
-               str argv[23];   /* for the exec arguments */
+               str pipeline = NULL;
+               str argv[25];   /* for the exec arguments */
                confkeyval *ckv, *kv;
                int c = 0;
 
@@ -244,6 +245,14 @@
                        snprintf(nthreads, 24, "gdk_nr_threads=%s", kv->val);
                }
 
+               kv = findConfKey(ckv, "optpipe");
+               if (kv->val == NULL)
+                       kv = findConfKey(_mero_props, "optpipe");
+               if (kv->val != NULL) {
+                       nthreads = alloca(sizeof(char) * 512);
+                       snprintf(nthreads, 512, "sql_optimizer=%s", kv->val);
+               }
+
                kv = findConfKey(ckv, "master");
                /* can't have master configured by default */
                if (kv->val != NULL && strcmp(kv->val, "yes") == 0) {
@@ -300,6 +309,9 @@
                if (nthreads != NULL) {
                        argv[c++] = "--set"; argv[c++] = nthreads;
                }
+               if (pipeline != NULL) {
+                       argv[c++] = "--set"; argv[c++] = pipeline;
+               }
                if (master != NULL) {
                        argv[c++] = "--set"; argv[c++] = master;
                }

U monetdb.c
Index: monetdb.c
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/monetdb.c,v
retrieving revision 1.65.2.5
retrieving revision 1.65.2.6
diff -u -d -r1.65.2.5 -r1.65.2.6
--- monetdb.c   8 Oct 2009 08:55:08 -0000       1.65.2.5
+++ monetdb.c   8 Oct 2009 12:51:42 -0000       1.65.2.6
@@ -1066,10 +1066,16 @@
                        property = argv[i];
                        argv[i] = NULL;
                        if (strcmp(property, "all") == 0) {
+                               size_t off = 0;
                                /* die hard leak (can't use constant, strtok 
modifies
                                 * (and hence crashes)) */
-                               /* FIXME: make this read keys from defaultprops 
*/
-                               property = 
GDKstrdup("name,forward,shared,nthreads,master,slave");
+                               property = GDKmalloc(sizeof(char) * 512);
+                               kv = defprops;
+                               off += snprintf(property, 512, "name");
+                               while (kv->key != NULL) {
+                                       off += snprintf(property + off, 512 - 
off, ",%s", kv->key);
+                                       kv++;
+                               }
                        }
                } else {
                        doall = 0;
@@ -1133,9 +1139,10 @@
        /* name = 15 */
        /* prop = 8 */
        /* source = 7 */
-       twidth -= 15 - 2 - 8 - 2 - 7 - 2;
+       twidth -= 15 + 2 + 8 + 2 + 7 + 2;
        if (twidth < 6)
                twidth = 6;
+       value = alloca(sizeof(char) * twidth + 1);
        printf("     name          prop     source           value\n");
        while ((p = strtok(property, ",")) != NULL) {
                property = NULL;
@@ -1144,7 +1151,7 @@
                        /* special virtual case */
                        if (strcmp(p, "name") == 0) {
                                source = "-";
-                               value = stats->dbname;
+                               abbreviateString(value, stats->dbname, twidth);
                        } else {
                                e = control_send(&buf, mero_host, mero_port,
                                                stats->dbname, "get", 1, 
mero_pass);
@@ -1168,10 +1175,11 @@
                                if (kv->val == NULL) {
                                        kv = findConfKey(defprops, p);
                                        source = "default";
-                                       value = kv != NULL && kv->val != NULL ? 
kv->val : "<unknown>";
+                                       abbreviateString(value,
+                                                       kv != NULL && kv->val 
!= NULL ? kv->val : "<unknown>", twidth);
                                } else {
                                        source = "local";
-                                       value = kv->val;
+                                       abbreviateString(value, kv->val, 
twidth);
                                }
                        }
                        printf("%-15s  %-8s  %-7s  %s\n",

U merovingian.c
Index: merovingian.c
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/merovingian.c,v
retrieving revision 1.65.2.2
retrieving revision 1.65.2.3
diff -u -d -r1.65.2.2 -r1.65.2.3
--- merovingian.c       30 Sep 2009 14:20:07 -0000      1.65.2.2
+++ merovingian.c       8 Oct 2009 12:51:42 -0000       1.65.2.3
@@ -446,6 +446,7 @@
                {"prefix",             GDKstrdup(MONETDB5_PREFIX), STR},
                {"gdk_dbfarm",         NULL,                       STR},
                {"gdk_nr_threads",     NULL,                       INT},
+               {"sql_optimizer",      NULL,                       STR},
                {"mero_msglog",        NULL,                       STR},
                {"mero_errlog",        NULL,                       STR},
                {"mero_port",          NULL,                       INT},
@@ -611,6 +612,12 @@
        kv->val = GDKstrdup("no");
        kv = findConfKey(_mero_props, "slave");
        kv->val = NULL; /* MURI */
+       kv = findConfKey(ckv, "sql_optimizer");
+       p = kv->val;
+       if (p != NULL) {
+               kv = findConfKey(_mero_props, "optpipe");
+               kv->val = GDKstrdup(p);
+       }
 
        /* we no longer need prefix */
        freeConfFile(ckv);

U properties.c
Index: properties.c
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/properties.c,v
retrieving revision 1.13.2.1
retrieving revision 1.13.2.2
diff -u -d -r1.13.2.1 -r1.13.2.2
--- properties.c        30 Sep 2009 14:20:07 -0000      1.13.2.1
+++ properties.c        8 Oct 2009 12:51:42 -0000       1.13.2.2
@@ -38,6 +38,7 @@
        {"forward",  NULL, OTHER},
        {"shared",   NULL, STR},
        {"nthreads", NULL, INT},
+       {"optpipe",  NULL, STR},
        {"master",   NULL, BOOL},
        {"slave",    NULL, MURI},
        { NULL,      NULL, INVALID}

U ChangeLog.Nov2009
Index: ChangeLog.Nov2009
===================================================================
RCS file: 
/cvsroot/monetdb/sql/src/backends/monet5/merovingian/ChangeLog.Nov2009,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- ChangeLog.Nov2009   8 Oct 2009 11:46:43 -0000       1.1.2.2
+++ ChangeLog.Nov2009   8 Oct 2009 12:51:42 -0000       1.1.2.3
@@ -3,6 +3,11 @@
 
 *Nov2009
 
+  08 Oct 2009; Fabian Groffen <[email protected]> merovingian.c,
+  merovingian_forkmserver.c, monetdb.c, properties.c:
+  Add optpipe setting to control the SQL optimiser pipeline, useful for
+  experimentation per database
+
   08 Oct 2009; Fabian Groffen <[email protected]> merovingian_forkmserver.c:
   Export the URI the database is reachable from remotely to the database via
   merovingian_uri GDKenvironment setting. This can be used by applications


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to