Changeset: 53ac25f19c38 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=53ac25f19c38 Modified Files: MonetDB/HowToStart.rst MonetDB/src/gdk/gdk_relop.mx clients/src/mapiclient/Makefile.ag clients/src/mapiclient/stethoscope.c sql/NT/MSQLserver.bat sql/src/backends/monet5/embeddedclient.c.in sql/src/backends/monet5/merovingian/merovingian_forkmserver.c sql/src/server/sql_mvc.mx sql/src/server/sql_parser.mx sql/src/server/sql_semantic.mx sql/src/test/Connections/run.all sql/src/test/Update_Delete_action/run.all testing/README testing/src/Mtest.py.in testing/src/process.py testing/src/quicktest Branch: default Log Message:
merging with Niels', Fabian's & Stefan's recent changes [Stefan on behalf of Martin] diffs (truncated from 425 to 300 lines): diff -r 76f86b906e80 -r 53ac25f19c38 MonetDB/HowToStart.rst --- a/MonetDB/HowToStart.rst Mon May 10 10:02:24 2010 +0200 +++ b/MonetDB/HowToStart.rst Mon May 10 10:22:56 2010 +0200 @@ -404,13 +404,17 @@ The disadvantage of running the systems interactively is that you don't get readline support (if available on your system). A more pleasant environment can be had by using the system as a server and -using ``mclient`` to interact with the system. For MonetDB4 use:: +using ``mclient`` to interact with the system. + +When MonetDB5 is started as above, it automatically starts the MAL +server in addition to the interactive "console". In case the +MonetDB/SQL package is also installed, MonetDB5 does automatically +load it and start the SQL server. + +In case of MonetDB4, to start only the MIL server use:: Mserver --dbinit 'module(mapi); mil_start();' -When MonetDB5 is started as above, it automatically starts the server -in addition to the interactive "console". - In order to use the XQuery back-end, which is only available with MonetDB4, start the server as follows:: @@ -421,18 +425,6 @@ Mserver --dbinit 'module(pathfinder); mil_start();' -In order to use the SQL back-end with MonetDB4, use:: - - Mserver --dbinit 'module(sql_server);' - -If you want to have a MIL server in addition to the SQL server, use:: - - Mserver --dbinit 'module(sql_server); mil_start();' - -In order to use the SQL back-end with MonetDB5, use:: - - mserver5 --dbinit 'include sql;' - Once the server is running, you can use ``mclient`` to interact with the server. ``mclient`` needs to be told which language you want to use, but it does not need to be told whether you're using diff -r 76f86b906e80 -r 53ac25f19c38 MonetDB/src/gdk/gdk_relop.mx --- a/MonetDB/src/gdk/gdk_relop.mx Mon May 10 10:02:24 2010 +0200 +++ b/MonetDB/src/gdk/gdk_relop.mx Mon May 10 10:22:56 2010 +0200 @@ -1293,23 +1293,30 @@ required (i.e., re-order allowed) */ BAT *ls, *rs, *j; + /* if not yet sorted on tail, sort left input on tail */ ls = BATtordered(l) & 1 ? l : BATmirror(BATsort(BATmirror(l))); ERRORcheck(ls == NULL, "BATjoin: BATmirror(BATsort(BATmirror(l))) failed"); + /* if not yet sorted on head, sort right input on head */ rs = BAThordered(r) & 1 ? r : BATsort(r); ERRORcheck(rs == NULL, "BATjoin: BATsort(r) failed"); if (swap && rsize > lsize) { + /* left-order-preserving not required: user smaller input as inner (right) */ + /* (not sure, though, whether this makes a difference with merge-join ...) */ ALGODEBUG THRprintf(GDKout, "#BATjoin: BATmirror(BATmergejoin(BATmirror(BATsort(r)), BATsort(BATmirror(l)), " BUNFMT "));\n", estimate); j = BATmirror(batmergejoin(BATmirror(rs), BATmirror(ls), estimate, swap, NULL)); ERRORcheck(j == NULL, "BATjoin: BATmirror(batmergejoin(BATmirror(rs), BATmirror(ls), estimate, swap, NULL)) failed"); } else { + /* left-order-preserving required, or inner (right) input is smaller one */ ALGODEBUG THRprintf(GDKout, "#BATjoin: BATmergejoin(BATmirror(BATsort(BATmirror(l))), BATsort(r), " BUNFMT "));\n", estimate); j = batmergejoin(ls, rs, estimate, swap, NULL); ERRORcheck(j == NULL, "BATjoin: batmergejoin(ls, rs, estimate, swap, NULL) failed"); } if (ls != l) { + /* release temp. tail-ordered copy of left input */ BBPunfix(ls->batCacheid); } if (rs != r) { + /* release temp. head-ordered copy of right input */ BBPunfix(rs->batCacheid); } return j; @@ -1324,20 +1331,28 @@ BAT *ls, *rs, *jj, *j; ALGODEBUG THRprintf(GDKout, "#BATjoin: BAT[s]sort(BATmergejoin(BATmirror(BAT[s]sort(BATmirror(l))), BATsort(r), " BUNFMT "));\n", estimate); + /* sort left input on tail, use stable sort to maintain original order of duplicate head values */ ls = BAThkey(l) ? BATmirror(BATsort(BATmirror(l))) : BATmirror(BATssort(BATmirror(l))); ERRORcheck(ls == NULL, "BATjoin: BATmirror(BAT[s]sort(BATmirror(l))) failed"); + /* if not yet sorted on head, sort right input on head */ rs = BAThordered(r) & 1 ? r : BATsort(r); ERRORcheck(rs == NULL, "BATjoin: BATsort(r) failed"); + /* perform merge join */ jj = batmergejoin(ls, rs, estimate, swap, NULL); ERRORcheck(jj == NULL, "BATjoin: batmergejoin(ls, rs, estimate, swap, NULL) failed"); + /* release temp. tail-ordered copy of left input */ BBPunfix(ls->batCacheid); ls = NULL; if (rs != r) { + /* release temp. head-ordered copy of right input */ BBPunfix(rs->batCacheid); rs = NULL; } + /* sort join result on head to restore physical left-input-order; + * use stable sort to maintain original order of duplicate head values */ j = BAThkey(l) ? BATsort(jj) : BATssort(jj); ERRORcheck(j == NULL, "BATjoin: BAT[s]sort(jj) failed"); + /* release temp. unordered join result */ BBPunfix(jj->batCacheid); jj = NULL; return j; @@ -1352,32 +1367,44 @@ BAT *lh, *lt, *ls, *rs, *jj, *js, *j; ALGODEBUG THRprintf(GDKout, "#BATjoin: BATmirror(batfetchjoin(BATmirror(BATsort(BATmergejoin(BATmirror(BATsort(BATmark(BATmirror(l),0))), BATsort(r), " BUNFMT "))), BATmirror(BATmark(l,0))));\n", estimate); + /* separate left head & tail using BATmark */ lh = BATmark(l, 0); ERRORcheck(lh == NULL, "BATjoin: BATmark(l,0) failed"); lt = BATmirror(BATmark(BATmirror(l), 0)); ERRORcheck(lt == NULL, "BATjoin: BATmirror(BATmark(BATmirror(l),0)) failed"); + /* sort left tail */ ls = BATmirror(BATsort(BATmirror(lt))); ERRORcheck(ls == NULL, "BATjoin: BATmirror(BATsort(BATmirror(lt))) failed"); + /* release temp. unsorted left tail */ BBPunfix(lt->batCacheid); lt = NULL; + /* if not yet sorted on head, sort right input on head */ rs = BAThordered(r) & 1 ? r : BATsort(r); ERRORcheck(rs == NULL, "BATjoin: BATsort(r) failed"); + /* perform merge join */ jj = batmergejoin(ls, rs, estimate, swap, NULL); ERRORcheck(jj == NULL, "BATjoin: batmergejoin(ls, rs, estimate, swap, NULL) failed"); + /* release temp. ordered copy of left tail */ BBPunfix(ls->batCacheid); ls = NULL; if (rs != r) { + /* release temp. head-ordered copy of right input */ BBPunfix(rs->batCacheid); rs = NULL; } + /* sort join result on head to restore physical left-input-order */ js = BATsort(jj); ERRORcheck(js == NULL, "BATjoin: BATsort(jj) failed"); + /* release temp. unordered join result */ BBPunfix(jj->batCacheid); jj = NULL; + /* restore original left head values */ j = BATmirror(batfetchjoin(BATmirror(js), BATmirror(lh), BATcount(js), swap, TRUE)); ERRORcheck(j == NULL, "BATjoin: BATmirror(batfetchjoin(BATmirror(js), BATmirror(lh), BATcount(js), swap, TRUE)) failed"); + /* release temp.sorted join result */ BBPunfix(js->batCacheid); js = NULL; + /* release temp. copy of left head */ BBPunfix(lh->batCacheid); lh = NULL; return j; diff -r 76f86b906e80 -r 53ac25f19c38 clients/src/mapiclient/Makefile.ag --- a/clients/src/mapiclient/Makefile.ag Mon May 10 10:02:24 2010 +0200 +++ b/clients/src/mapiclient/Makefile.ag Mon May 10 10:22:56 2010 +0200 @@ -27,7 +27,7 @@ #Name alignment of tools in M5 context. bin_mclient = { - SOURCES = MapiClient.mx ReadlineTools.mx + SOURCES = mclient.mx ReadlineTools.mx LIBS = libmcutil ../mapilib/libMapi $(MAPI_LIBS) $(READLINE_LIBS) \ $(MONETDB_LIBS) -lmutils -lstream \ $(ICONV_LIBS) diff -r 76f86b906e80 -r 53ac25f19c38 clients/src/mapiclient/stethoscope.c --- a/clients/src/mapiclient/stethoscope.c Mon May 10 10:02:24 2010 +0200 +++ b/clients/src/mapiclient/stethoscope.c Mon May 10 10:22:56 2010 +0200 @@ -63,8 +63,8 @@ * Ideally, the stream of events should be piped into a * 2D graphical tool, like xosview (Linux). * - * A convenient way to watch most of the SQL interaction - * you may use the command: + * For a convenient way to watch most of the SQL interaction you may use + * the command: * stethoscope -umonetdb -Pmonetdb -hhost +tis "algebra.*" "bat.*" "group.*" "sql.*" "aggr.*" */ diff -r 76f86b906e80 -r 53ac25f19c38 sql/NT/MSQLserver.bat --- a/sql/NT/MSQLserver.bat Mon May 10 10:02:24 2010 +0200 +++ b/sql/NT/MSQLserver.bat Mon May 10 10:22:56 2010 +0200 @@ -10,6 +10,6 @@ rem start the real server -"%MONETDB%\M5server.bat" --dbinit="include sql;" %* +"%MONETDB%\M5server.bat" %* endlocal diff -r 76f86b906e80 -r 53ac25f19c38 sql/src/backends/monet5/embeddedclient.c.in --- a/sql/src/backends/monet5/embeddedclient.c.in Mon May 10 10:02:24 2010 +0200 +++ b/sql/src/backends/monet5/embeddedclient.c.in Mon May 10 10:22:56 2010 +0200 @@ -101,7 +101,6 @@ out = ((stream **) arg)[1]; free(arg); snprintf(buf, sizeof(buf), - "include sql;\n" "in := \"" PTRFMT "\":streams;\n" "out := \"" PTRFMT "\":streams;\n" "mapi.malclient(in, out);\n", PTRFMTCAST in, PTRFMTCAST out); diff -r 76f86b906e80 -r 53ac25f19c38 sql/src/backends/monet5/merovingian/merovingian_forkmserver.c --- a/sql/src/backends/monet5/merovingian/merovingian_forkmserver.c Mon May 10 10:02:24 2010 +0200 +++ b/sql/src/backends/monet5/merovingian/merovingian_forkmserver.c Mon May 10 10:22:56 2010 +0200 @@ -226,7 +226,7 @@ str master = NULL; str slave = NULL; str pipeline = NULL; - str argv[27]; /* for the exec arguments */ + str argv[26]; /* for the exec arguments */ confkeyval *ckv, *kv; int c = 0; @@ -292,7 +292,6 @@ 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; if (mydoproxy == 1) { argv[c++] = "--set"; argv[c++] = "mapi_open=false"; diff -r 76f86b906e80 -r 53ac25f19c38 sql/src/server/sql_mvc.mx --- a/sql/src/server/sql_mvc.mx Mon May 10 10:02:24 2010 +0200 +++ b/sql/src/server/sql_mvc.mx Mon May 10 10:22:56 2010 +0200 @@ -97,7 +97,6 @@ atom **args; int argc; int argmax; - int argfixed; struct symbol *sym; int user_id; @@ -107,6 +106,7 @@ /* current session variables */ int timezone; /* minutes west of UTC */ int cache; /* some queries should not be cached ! */ + int caching; /* cache current query ? */ int history; /* queries statistics are kept */ int reply_size; /* reply size */ int debug; @@ -293,7 +293,7 @@ mvc *m = mvc_create(0, stk, 0, NULL, NULL); /* disable caching */ - m->cache = 0; + m->caching = 0; /* disable history */ m->history = 0; mvc_trans(m); @@ -611,7 +611,6 @@ m->argmax = MAXPARAMS; m->args = NEW_ARRAY(atom*,m->argmax); m->argc = 0; - m->argfixed = 0; m->sym = NULL; m->last_id = m->role_id = m->user_id = -1; @@ -623,6 +622,7 @@ m->reply_size = 100; m->debug = debug; m->cache = 1; + m->caching = m->cache; m->history = 0; m->label = 0; @@ -692,6 +692,7 @@ if (m->cache != 1) stack_set_number(m, "cache", 1); m->cache = 1; + m->caching = m->cache; if (m->history != 0) stack_set_number(m, "history", 0); m->history = 0; diff -r 76f86b906e80 -r 53ac25f19c38 sql/src/server/sql_parser.mx --- a/sql/src/server/sql_parser.mx Mon May 10 10:02:24 2010 +0200 +++ b/sql/src/server/sql_parser.mx Mon May 10 10:22:56 2010 +0200 @@ -2709,8 +2709,7 @@ { mvc *m = (mvc*)parm; - if (m->emode == m_normal && - (!m->argfixed || m->argc < MAXPARAMS-2) && m->cache){ + if (m->emode == m_normal && m->caching && m->argc < MAXPARAMS-2) { /* replace by argument */ atom *a = atom_general( sql_bind_localtype("str"), NULL, 0); @@ -3046,12 +3045,18 @@ */ /* Basket expression, TODO window */ - | '[' select_no_parens ']' table_name + | '[' + { + mvc *m = (mvc*)parm; + + m->caching = 0; + } + select_no_parens ']' table_name { dlist *op = L(); _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list