Changeset: 8650fb72a6be for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8650fb72a6be
Added Files:
sql/backends/monet5/Tests/cquery21.sql
sql/backends/monet5/Tests/cquery21.stable.err
sql/backends/monet5/Tests/cquery21.stable.out
Modified Files:
monetdb5/mal/mal_client.c
monetdb5/mal/mal_client.h
sql/backends/monet5/Tests/All
sql/backends/monet5/sql_basket.c
sql/backends/monet5/sql_cquery.c
Branch: trails
Log Message:
Tumble only when the streaming table is accessed by a CQ, which should be
identified in the MAL client
diffs (truncated from 305 to 300 lines):
diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -206,6 +206,7 @@ MCinitClientRecord(Client c, oid user, b
c->user = user;
c->username = 0;
+ c->iscqscheduleruser = 0;
c->scenario = NULL;
c->oldscenario = NULL;
c->srcFile = NULL;
diff --git a/monetdb5/mal/mal_client.h b/monetdb5/mal/mal_client.h
--- a/monetdb5/mal/mal_client.h
+++ b/monetdb5/mal/mal_client.h
@@ -78,6 +78,7 @@ typedef struct CLIENT {
int idx; /* entry in mal_clients */
oid user; /* user id in the auth administration */
str username; /* for event processor */
+ int iscqscheduleruser; /* is the continious query client? */
/*
* The actions for a client is separated into several stages:
* parsing, strategic optimization, tactical optimization, and
diff --git a/sql/backends/monet5/Tests/All b/sql/backends/monet5/Tests/All
--- a/sql/backends/monet5/Tests/All
+++ b/sql/backends/monet5/Tests/All
@@ -106,6 +106,7 @@ cquery17
cquery18
cquery19
cquery20
+cquery21
cqstream00
cqstream01
diff --git a/sql/backends/monet5/Tests/cquery21.sql
b/sql/backends/monet5/Tests/cquery21.sql
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/Tests/cquery21.sql
@@ -0,0 +1,52 @@
+create stream table cqinput21(input integer) set window 2 stride 1;
+
+create table cqresult21(output real);
+
+create procedure cq_basic21()
+begin
+ insert into cqresult21 (select avg(input) from cqinput21);
+end;
+
+start continuous procedure cq_basic21() with cycles 2 as myname;
+
+insert into cqinput21 values (10);
+
+call cquery.wait(1000);
+
+select input from cqinput21; --should not tumble
+
+select output from cqresult21; --nothing
+
+call cquery.wait(1000);
+
+insert into cqinput21 values (20);
+
+call cquery.wait(1000);
+
+select input from cqinput21;
+
+select output from cqresult21; --15
+
+call cquery.wait(1000);
+
+insert into cqinput21 values (30);
+
+call cquery.wait(1000);
+
+select input from cqinput21;
+
+select output from cqresult21; --25
+
+call cquery.wait(1000);
+
+insert into cqinput21 values (40);
+
+select input from cqinput21;
+
+select output from cqresult21; --15, 25
+
+call cquery.wait(1000);
+
+drop procedure cq_basic21;
+drop table cqinput21;
+drop table cqresult21;
diff --git a/sql/backends/monet5/Tests/cquery21.stable.err
b/sql/backends/monet5/Tests/cquery21.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/Tests/cquery21.stable.err
@@ -0,0 +1,34 @@
+stderr of test 'cquery21` in directory 'sql/backends/monet5` itself:
+
+
+# 15:39:03 >
+# 15:39:03 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=35602" "--set"
"mapi_usock=/var/tmp/mtest-4457/.s.monetdb.35602" "--set" "monet_prompt="
"--forcemito"
"--dbpath=/home/ferreira/repositories/MonetDB-trails/BUILD/var/MonetDB/mTests_sql_backends_monet5"
+# 15:39:03 >
+
+# builtin opt gdk_dbpath =
/home/ferreira/repositories/MonetDB-trails/BUILD/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 = 35602
+# cmdline opt mapi_usock = /var/tmp/mtest-4457/.s.monetdb.35602
+# cmdline opt monet_prompt =
+# cmdline opt gdk_dbpath =
/home/ferreira/repositories/MonetDB-trails/BUILD/var/MonetDB/mTests_sql_backends_monet5
+# cmdline opt gdk_debug = 536870922
+
+# 15:39:03 >
+# 15:39:03 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-4457" "--port=35602"
+# 15:39:03 >
+
+
+# 15:39:11 >
+# 15:39:11 > "Done."
+# 15:39:11 >
+
diff --git a/sql/backends/monet5/Tests/cquery21.stable.out
b/sql/backends/monet5/Tests/cquery21.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/Tests/cquery21.stable.out
@@ -0,0 +1,146 @@
+stdout of test 'cquery21` in directory 'sql/backends/monet5` itself:
+
+
+# 15:39:03 >
+# 15:39:03 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=35602" "--set"
"mapi_usock=/var/tmp/mtest-4457/.s.monetdb.35602" "--set" "monet_prompt="
"--forcemito"
"--dbpath=/home/ferreira/repositories/MonetDB-trails/BUILD/var/MonetDB/mTests_sql_backends_monet5"
+# 15:39:03 >
+
+# MonetDB 5 server v11.28.0
+# This is an unreleased version
+# Serving database 'mTests_sql_backends_monet5', using 8 threads
+# Compiled for x86_64-pc-linux-gnu/64bit with 128bit integers
+# Found 15.498 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved
+# Visit https://www.monetdb.org/ for further information
+# Listening for connection requests on
mapi:monetdb://localhost.localdomain:35602/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-4457/.s.monetdb.35602
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+# MonetDB/Timetrails module loaded
+
+Ready.
+# SQL catalog created, loading sql scripts once
+# loading sql script: 09_like.sql
+# loading sql script: 10_math.sql
+# loading sql script: 11_times.sql
+# loading sql script: 12_url.sql
+# loading sql script: 13_date.sql
+# loading sql script: 14_inet.sql
+# loading sql script: 15_querylog.sql
+# loading sql script: 16_tracelog.sql
+# loading sql script: 17_temporal.sql
+# loading sql script: 18_index.sql
+# loading sql script: 20_vacuum.sql
+# loading sql script: 21_dependency_functions.sql
+# loading sql script: 22_clients.sql
+# loading sql script: 23_skyserver.sql
+# loading sql script: 25_debug.sql
+# loading sql script: 26_sysmon.sql
+# loading sql script: 27_rejects.sql
+# loading sql script: 39_analytics.sql
+# loading sql script: 39_analytics_hge.sql
+# loading sql script: 40_geom.sql
+# loading sql script: 40_json.sql
+# loading sql script: 40_json_hge.sql
+# loading sql script: 41_md5sum.sql
+# loading sql script: 45_uuid.sql
+# loading sql script: 46_profiler.sql
+# loading sql script: 50_cquery.sql
+# loading sql script: 51_sys_schema_extension.sql
+# loading sql script: 60_wlcr.sql
+# loading sql script: 75_storagemodel.sql
+# loading sql script: 80_statistics.sql
+# loading sql script: 80_udf.sql
+# loading sql script: 80_udf_hge.sql
+# loading sql script: 90_generator.sql
+# loading sql script: 90_generator_hge.sql
+# loading sql script: 99_system.sql
+
+# 15:39:03 >
+# 15:39:03 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-4457" "--port=35602"
+# 15:39:03 >
+
+#create stream table cqinput21(input integer) set window 2 stride 1;
+#create stream table cqinput21(input integer) set window 2 stride 1;
+#create table cqresult21(output real);
+#create table cqresult21(output real);
+#create procedure cq_basic21()
+#begin
+# insert into cqresult21 (select avg(input) from cqinput21);
+#end;
+#create procedure cq_basic21()
+#begin
+# insert into cqresult21 (select avg(input) from cqinput21);
+#end;
+#start continuous procedure cq_basic21() with cycles 2 as myname;
+#start continuous procedure cq_basic21() with cycles 2 as myname;
+#insert into cqinput21 values (10);
+[ 1 ]
+#select input from cqinput21; --should not tumble
+% sys.cqinput21 # table_name
+% input # name
+% int # type
+% 2 # length
+[ 10 ]
+#select output from cqresult21; --nothing
+% sys.cqresult21 # table_name
+% output # name
+% real # type
+% 15 # length
+#insert into cqinput21 values (20);
+[ 1 ]
+#select input from cqinput21;
+% sys.cqinput21 # table_name
+% input # name
+% int # type
+% 2 # length
+[ 20 ]
+#select output from cqresult21; --15
+% sys.cqresult21 # table_name
+% output # name
+% real # type
+% 15 # length
+[ 15 ]
+#insert into cqinput21 values (30);
+[ 1 ]
+#select input from cqinput21;
+% sys.cqinput21 # table_name
+% input # name
+% int # type
+% 2 # length
+[ 30 ]
+#select output from cqresult21; --25
+% sys.cqresult21 # table_name
+% output # name
+% real # type
+% 15 # length
+[ 15 ]
+[ 25 ]
+#insert into cqinput21 values (40);
+[ 1 ]
+#select input from cqinput21;
+% sys.cqinput21 # table_name
+% input # name
+% int # type
+% 2 # length
+[ 30 ]
+[ 40 ]
+#select output from cqresult21; --15, 25
+% sys.cqresult21 # table_name
+% output # name
+% real # type
+% 15 # length
+[ 15 ]
+[ 25 ]
+#drop procedure cq_basic21;
+#drop procedure cq_basic21;
+#drop table cqinput21;
+#drop table cqinput21;
+#drop table cqresult21;
+#drop table cqresult21;
+
+# 15:39:11 >
+# 15:39:11 > "Done."
+# 15:39:11 >
+
diff --git a/sql/backends/monet5/sql_basket.c b/sql/backends/monet5/sql_basket.c
--- a/sql/backends/monet5/sql_basket.c
+++ b/sql/backends/monet5/sql_basket.c
@@ -455,8 +455,8 @@ BSKTtumble(Client cntxt, MalBlkPtr mb, M
msg = BSKTregisterInternal(cntxt, mb, sch, tbl, &idx);
if( msg != MAL_SUCCEED)
return msg;
- // don't tumble when the window constraint has not been set to at least 0
- if( baskets[idx].window < 0)
+ // don't tumble when the window constraint has not been set to at least
0 o
+ if( baskets[idx].window < 0 || !cntxt->iscqscheduleruser)
return MAL_SUCCEED;
/* also take care of time-based tumbling */
elw =(int) baskets[idx].window;
diff --git a/sql/backends/monet5/sql_cquery.c b/sql/backends/monet5/sql_cquery.c
--- a/sql/backends/monet5/sql_cquery.c
+++ b/sql/backends/monet5/sql_cquery.c
@@ -1560,6 +1560,7 @@ CQstartScheduler(void)
mnstr_destroy(cntxt->fdout);
throw(MAL, "cquery.startScheduler",SQLSTATE(HY001) "Could not
initialize CQscheduler\n");
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list