Changeset: a53e6b4694ac for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a53e6b4694ac Added Files: sql/backends/monet5/iot/Tests/cleanup.stable.err sql/backends/monet5/iot/Tests/cleanup.stable.out sql/backends/monet5/iot/Tests/inputoutput.sql sql/backends/monet5/iot/Tests/inputoutput.stable.err sql/backends/monet5/iot/Tests/inputoutput.stable.out sql/backends/monet5/iot/Tests/iot00.stable.err sql/backends/monet5/iot/Tests/iot00.stable.out sql/backends/monet5/iot/Tests/iot02.stable.err sql/backends/monet5/iot/Tests/iot02.stable.out sql/backends/monet5/iot/Tests/iot05.stable.err sql/backends/monet5/iot/Tests/iot05.stable.out sql/backends/monet5/iot/Tests/iot10.stable.err sql/backends/monet5/iot/Tests/iot10.stable.out sql/backends/monet5/iot/Tests/receptor00.sql sql/backends/monet5/iot/Tests/webtest.stable.err sql/backends/monet5/iot/Tests/webtest.stable.out Modified Files: monetdb5/optimizer/opt_iot.c monetdb5/optimizer/opt_prelude.c monetdb5/optimizer/opt_prelude.h sql/backends/monet5/iot/50_iot.sql sql/backends/monet5/iot/Tests/All sql/backends/monet5/iot/Tests/cleanup.sql sql/backends/monet5/iot/Tests/iot00.sql sql/backends/monet5/iot/Tests/iot03.sql sql/backends/monet5/iot/Tests/iot10.sql sql/backends/monet5/iot/Tests/iot12.sql sql/backends/monet5/iot/basket.c sql/backends/monet5/iot/basket.h sql/backends/monet5/iot/basket.mal sql/backends/monet5/iot/iot.mal sql/backends/monet5/iot/petrinet.c Branch: iot Log Message:
Intermittent commit diffs (truncated from 1530 to 300 lines): diff --git a/monetdb5/optimizer/opt_iot.c b/monetdb5/optimizer/opt_iot.c --- a/monetdb5/optimizer/opt_iot.c +++ b/monetdb5/optimizer/opt_iot.c @@ -48,8 +48,8 @@ OPTiotImplementation(Client cntxt, MalBl int *alias; str schemas[MAXBSKT]; str tables[MAXBSKT]; - int mvc[MAXBSKT]; - int done[MAXBSKT]= {0}; + int input[MAXBSKT]= {0}; + int output[MAXBSKT]= {0}; int btop=0, lastmvc=0; int noerror=0; int cq= strncmp(getFunctionId(getInstrPtr(mb,0)),"cq",2) == 0; @@ -74,10 +74,9 @@ OPTiotImplementation(Client cntxt, MalBl schemas[btop]= getVarConstant(mb, getArg(p,2)).val.sval; tables[btop]= getVarConstant(mb, getArg(p,3)).val.sval; for( j =0; j< btop ; j++) - if( strcmp(schemas[j], schemas[j+1])==0 && strcmp(tables[j],tables[j+1]) ==0) + if( strcmp(schemas[j], schemas[btop])==0 && strcmp(tables[j],tables[btop]) ==0) break; - lastmvc = mvc[j] = getArg(p,0); - done[j]= done[j] || getFunctionId(p)== registerRef; + input[j]= 1; if( j == btop) btop++; } @@ -86,10 +85,10 @@ OPTiotImplementation(Client cntxt, MalBl schemas[btop]= getVarConstant(mb, getArg(p,2)).val.sval; tables[btop]= getVarConstant(mb, getArg(p,3)).val.sval; for( j =0; j< btop ; j++) - if( strcmp(schemas[j], schemas[j+1])==0 && strcmp(tables[j],tables[j+1]) ==0) + if( strcmp(schemas[j], schemas[btop])==0 && strcmp(tables[j],tables[btop]) ==0) break; - lastmvc = mvc[j] = getArg(p,0); + output[j]= output[j] || 1; if( j == btop) btop++; } @@ -98,7 +97,7 @@ OPTiotImplementation(Client cntxt, MalBl schemas[btop]= getVarConstant(mb, getArg(p,1)).val.sval; tables[btop]= getVarConstant(mb, getArg(p,2)).val.sval; for( j =0; j< btop ; j++) - if( strcmp(schemas[j], schemas[j+1])==0 && strcmp(tables[j],tables[j+1]) ==0) + if( strcmp(schemas[j], schemas[btop])==0 && strcmp(tables[j],tables[btop]) ==0) break; if( j == btop) btop++; @@ -138,15 +137,17 @@ OPTiotImplementation(Client cntxt, MalBl } if(getModuleId(p) == sqlRef && getFunctionId(p)== mvcRef){ pushInstruction(mb,p); - k= getArg(p,0); + lastmvc = getArg(p,0); // register all baskets used for( j=0; j<btop; j++) - if( done[j]==0) { + if( input[j] || output[j]) { p= newStmt(mb,basketRef,registerRef); - p= pushArgument(mb,p,k); + p= pushArgument(mb,p,lastmvc); p= pushStr(mb,p, schemas[j]); p= pushStr(mb,p, tables[j]); - alias[k] = getArg(p,0); + p= pushInt(mb,p, output[j]); + alias[lastmvc] = getArg(p,0); + lastmvc = getArg(p,0); } continue; } @@ -161,6 +162,7 @@ OPTiotImplementation(Client cntxt, MalBl continue; } } + if (getModuleId(p) == algebraRef && getFunctionId(p) == projectionRef && alias[getArg(p,1)] < 0){ alias[getArg(p,0)] = getArg(p,2); freeInstruction(p); @@ -179,19 +181,22 @@ OPTiotImplementation(Client cntxt, MalBl noerror++; if (p->token == ENDsymbol && btop > 0 && noerror==0) { // empty all baskets used only when we are optimizing a cq - for(j = 0; cq && j < btop; j++){ + for(j = 0; j < btop; j++) + if( input[j] && output[j]==0){ r = newStmt(mb, basketRef, tumbleRef); r = pushArgument(mb,r, lastmvc); r = pushStr(mb,r, schemas[j]); r = pushStr(mb,r, tables[j]); + lastmvc = getArg(r,0); } /* non-contiguous queries call for releasing the lock on the basket */ - for( j=0; !cq && j<btop; j++) - if( done[j]==0) { + for( j=btop-1; j>= 0; j--) + if( input[j] || output[j]) { p= newStmt(mb,basketRef,commitRef); p= pushArgument(mb,p, lastmvc); p= pushStr(mb,p, schemas[j]); p= pushStr(mb,p, tables[j]); + lastmvc = getArg(p,0); } /* catch any exception left behind */ @@ -224,17 +229,13 @@ OPTiotImplementation(Client cntxt, MalBl break; } - for (j = 0; j < p->argc; j++) if (alias[getArg(p, j)] > 0) getArg(p, j) = alias[getArg(p, j)]; - if (getModuleId(p) == sqlRef && getFunctionId(p) == appendRef ){ - //getStreamTableInfo(getVarConstant(mb,getArg(p,3)).val.sval, getVarConstant(mb,getArg(p,4)).val.sval ); - /* the appends come in multiple steps. - The first initializes an basket update statement, - which is triggered when we commit the transaction. - */ + if ( (getModuleId(p) == sqlRef ||getModuleId(p)== basketRef) && getFunctionId(p) == appendRef ){ + getArg(p,1) = lastmvc; + lastmvc = getArg(p,0); } pushInstruction(mb, p); } diff --git a/monetdb5/optimizer/opt_prelude.c b/monetdb5/optimizer/opt_prelude.c --- a/monetdb5/optimizer/opt_prelude.c +++ b/monetdb5/optimizer/opt_prelude.c @@ -234,6 +234,7 @@ str unlockRef; str unpackRef; str unpinRef; str updateRef; +str windowRef; str timestampRef; str tumbleRef; str transactionRef; @@ -466,6 +467,7 @@ void optimizerInit(void) unpackRef = putName("unpack"); unpinRef = putName("unpin"); updateRef = putName("update"); + windowRef = putName("window"); subselectRef = putName("subselect"); thetasubselectRef = putName("thetasubselect"); likesubselectRef = putName("likesubselect"); diff --git a/monetdb5/optimizer/opt_prelude.h b/monetdb5/optimizer/opt_prelude.h --- a/monetdb5/optimizer/opt_prelude.h +++ b/monetdb5/optimizer/opt_prelude.h @@ -231,6 +231,7 @@ opt_export str unpackRef; opt_export str unpinRef; opt_export str unlockRef; opt_export str updateRef; +opt_export str windowRef; opt_export str subselectRef; opt_export str thetasubselectRef; opt_export str likesubselectRef; diff --git a/sql/backends/monet5/iot/50_iot.sql b/sql/backends/monet5/iot/50_iot.sql --- a/sql/backends/monet5/iot/50_iot.sql +++ b/sql/backends/monet5/iot/50_iot.sql @@ -74,9 +74,6 @@ create procedure iot.tumble("schema" str create procedure iot.window("schema" string, "table" string, elem int) external name iot.window; -create procedure iot.window("schema" string, "table" string, elem int, slide int) - external name iot.window; - -- Inspection tables create function iot.baskets() returns table( "schema" string, "table" string, "status" string, threshold int, winsize int, winstride int, timeslice int, timestride int, heartbeat int, seen timestamp, events int) @@ -86,11 +83,11 @@ create function iot.queries() returns table( "schema" string, "function" string, "status" string, lastrun timestamp, cycles int, events int, time bigint, error string) external name iot.queries; -create function iot.inputplaces() +create function iot.inputs() returns table( "s" string, "t" string, "sch" string, "qry" string) external name iot.inputplaces; -create function iot.outputplaces() +create function iot.outputs() returns table( "s" string, "t" string, "sch" string, "qry" string) external name iot.outputplaces; diff --git a/sql/backends/monet5/iot/Tests/All b/sql/backends/monet5/iot/Tests/All --- a/sql/backends/monet5/iot/Tests/All +++ b/sql/backends/monet5/iot/Tests/All @@ -4,9 +4,10 @@ iot03 #iot05 iot10 iot12 -iot15 +#iot15 receptor00 receptor01 cleanup #petrinet00 webtest +inputoutput diff --git a/sql/backends/monet5/iot/Tests/cleanup.sql b/sql/backends/monet5/iot/Tests/cleanup.sql --- a/sql/backends/monet5/iot/Tests/cleanup.sql +++ b/sql/backends/monet5/iot/Tests/cleanup.sql @@ -7,4 +7,3 @@ drop procedure clk3; drop table result; drop table stmp; drop table stmp1; -drop table stmp2; diff --git a/sql/backends/monet5/iot/Tests/cleanup.stable.err b/sql/backends/monet5/iot/Tests/cleanup.stable.err new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/iot/Tests/cleanup.stable.err @@ -0,0 +1,34 @@ +stderr of test 'cleanup` in directory 'sql/backends/monet5/iot` itself: + + +# 00:19:46 > +# 00:19:46 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=38802" "--set" "mapi_usock=/var/tmp/mtest-14198/.s.monetdb.38802" "--set" "monet_prompt=" "--forcemito" "--dbpath=/export/scratch1/mk/iot//Linux/var/MonetDB/mTests_sql_backends_monet5_iot" +# 00:19:46 > + +# builtin opt gdk_dbpath = /export/scratch1/mk/iot//Linux/var/monetdb5/dbfarm/demo +# builtin opt gdk_debug = 0 +# builtin opt gdk_vmtrim = no +# builtin opt monet_prompt = > +# builtin opt monet_daemon = no +# builtin opt mapi_port = 50000 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# cmdline opt gdk_nr_threads = 0 +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 38802 +# cmdline opt mapi_usock = /var/tmp/mtest-14198/.s.monetdb.38802 +# cmdline opt monet_prompt = +# cmdline opt gdk_dbpath = /export/scratch1/mk/iot//Linux/var/MonetDB/mTests_sql_backends_monet5_iot +# cmdline opt gdk_debug = 536870922 + +# 00:19:46 > +# 00:19:46 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-14198" "--port=38802" +# 00:19:46 > + + +# 00:19:46 > +# 00:19:46 > "Done." +# 00:19:46 > + diff --git a/sql/backends/monet5/iot/Tests/cleanup.stable.out b/sql/backends/monet5/iot/Tests/cleanup.stable.out new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/iot/Tests/cleanup.stable.out @@ -0,0 +1,40 @@ +stdout of test 'cleanup` in directory 'sql/backends/monet5/iot` itself: + + +# 00:19:46 > +# 00:19:46 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=38802" "--set" "mapi_usock=/var/tmp/mtest-14198/.s.monetdb.38802" "--set" "monet_prompt=" "--forcemito" "--dbpath=/export/scratch1/mk/iot//Linux/var/MonetDB/mTests_sql_backends_monet5_iot" +# 00:19:46 > + +# MonetDB 5 server v11.24.0 +# This is an unreleased version +# Serving database 'mTests_sql_backends_monet5_iot', using 8 threads +# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs and 128bit integers dynamically linked +# Found 15.589 GiB available main-memory. +# Copyright (c) 1993-July 2008 CWI. +# Copyright (c) August 2008-2016 MonetDB B.V., all rights reserved +# Visit http://www.monetdb.org/ for further information +# Listening for connection requests on mapi:monetdb://vienna.da.cwi.nl:38802/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-14198/.s.monetdb.38802 +# MonetDB/GIS module loaded +# MonetDB/SQL module loaded +# MonetDB/iot loaded + +Ready. + +# 00:19:46 > +# 00:19:46 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-14198" "--port=38802" +# 00:19:46 > + +#set schema iot; +#drop procedure cq00; +#drop procedure clk1; +#drop procedure clk3; +#drop table result; +#drop table stmp; +#drop table stmp1; +#drop table stmp2; + +# 00:19:46 > +# 00:19:46 > "Done." +# 00:19:46 > + diff --git a/sql/backends/monet5/iot/Tests/inputoutput.sql b/sql/backends/monet5/iot/Tests/inputoutput.sql new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/iot/Tests/inputoutput.sql @@ -0,0 +1,29 @@ +-- Setting stream parameters after iot00 +set schema iot; +set optimizer='iot_pipe'; + +-- simple input/output pipeline _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list