Changeset: 47a483ec0635 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=47a483ec0635
Modified Files:
sql/backends/monet5/iot/50_iot.sql
sql/backends/monet5/iot/Tests/iot02.sql
sql/backends/monet5/iot/Tests/iot03.sql
sql/backends/monet5/iot/Tests/iot04.sql
sql/backends/monet5/iot/Tests/iot04.stable.out
sql/backends/monet5/iot/Tests/iot10.sql
sql/backends/monet5/iot/Tests/iot12.sql
sql/backends/monet5/iot/Tests/iot12.stable.out
sql/backends/monet5/iot/Tests/iot13.sql
sql/backends/monet5/iot/Tests/iot14.sql
sql/backends/monet5/iot/Tests/iot16.sql
sql/backends/monet5/iot/Tests/logger.sql
sql/backends/monet5/iot/iot.c
sql/backends/monet5/iot/iot.h
sql/backends/monet5/iot/iot.mal
sql/backends/monet5/iot/petrinet.c
sql/backends/monet5/iot/petrinet.h
sql/backends/monet5/iot/petrinet.mal
Branch: iot
Log Message:
Dealing with heartbeat
diffs (truncated from 792 to 300 lines):
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
@@ -18,9 +18,15 @@
create schema iot;
-- register and start a continuous query
+create procedure iot.query(qry string, maxcalls integer)
+ external name iot.query;
+
create procedure iot.query(qry string)
external name iot.query;
+create procedure iot.query("schema" string, name string, maxcalls integer)
+ external name iot.query;
+
create procedure iot.query("schema" string, name string)
external name iot.query;
@@ -48,10 +54,6 @@ create procedure iot.deregister("schema"
create procedure iot.deregister()
external name iot.deregister;
--- resume with limited the number of scheduler loops before next pause
-create procedure iot.cycles(n integer)
- external name iot.cycles;
-
-- set the scheduler periodic delay
create procedure iot.period(n integer)
external name iot.period;
diff --git a/sql/backends/monet5/iot/Tests/iot02.sql
b/sql/backends/monet5/iot/Tests/iot02.sql
--- a/sql/backends/monet5/iot/Tests/iot02.sql
+++ b/sql/backends/monet5/iot/Tests/iot02.sql
@@ -23,8 +23,8 @@ insert into stmp2 values('2005-09-23 12:
call iot.resume('iot','cq02');
--- wait for 1 cycle in the scheduler
-call iot.wait(5);
+-- wait for 5 seconds for handler
+call iot.wait(5000);
select 'RESULT';
select * from stmp2;
diff --git a/sql/backends/monet5/iot/Tests/iot03.sql
b/sql/backends/monet5/iot/Tests/iot03.sql
--- a/sql/backends/monet5/iot/Tests/iot03.sql
+++ b/sql/backends/monet5/iot/Tests/iot03.sql
@@ -20,7 +20,8 @@ insert into stmp3 values('2005-09-23 12:
insert into stmp3 values('2005-09-23 12:34:28.000',1,15.0);
call iot.resume('iot','cq03');
-call iot.wait(4);
+-- wait a few seconds
+call iot.wait(5000);
select * from stmp3;
select * from result3;
diff --git a/sql/backends/monet5/iot/Tests/iot04.sql
b/sql/backends/monet5/iot/Tests/iot04.sql
--- a/sql/backends/monet5/iot/Tests/iot04.sql
+++ b/sql/backends/monet5/iot/Tests/iot04.sql
@@ -10,7 +10,7 @@ begin
insert into result select min(t), count(*), avg(val) from stmp;
end;
-call iot.query('iot','cq00');
+call iot.query('iot','cq00',1);
--call iot.query('insert into iot.result select min(t), count(*), avg(val)
from iot.stmp;');
--select * from iot.baskets();
@@ -25,16 +25,15 @@ insert into stmp values('2005-09-23 12:3
select * from stmp;
-- let the cq run only wanse
-call iot.cycles('iot','cq00',1);
call iot.resume();
--- wait for 1 cycle in the scheduler
-call iot.wait(10);
+-- wait a few seconds
+call iot.wait(5000);
select 'RESULT';
select * from result;
--select * from iot.baskets();
-select * from iot.queries();
+--select * from iot.queries();
select * from iot.errors();
call iot.stop();
drop procedure cq00;
diff --git a/sql/backends/monet5/iot/Tests/iot04.stable.out
b/sql/backends/monet5/iot/Tests/iot04.stable.out
--- a/sql/backends/monet5/iot/Tests/iot04.stable.out
+++ b/sql/backends/monet5/iot/Tests/iot04.stable.out
@@ -53,11 +53,6 @@ Ready.
% timestamp, int, decimal # type
% 26, 1, 10 # length
[ 2005-09-23 12:34:26.736000, 1, 12.34 ]
-#select * from iot.queries();
-% ., ., ., ., ., ., ., . # table_name
-% schema, function, status, lastrun, cycles, events, time,
error # name
-% clob, clob, clob, timestamp, int, int, bigint, clob #
type
-% 0, 0, 0, 26, 1, 1, 1, 0 # length
#select * from iot.errors();
% ., . # table_name
% table, error # name
diff --git a/sql/backends/monet5/iot/Tests/iot10.sql
b/sql/backends/monet5/iot/Tests/iot10.sql
--- a/sql/backends/monet5/iot/Tests/iot10.sql
+++ b/sql/backends/monet5/iot/Tests/iot10.sql
@@ -28,7 +28,8 @@ call iot.query('iot','collector');
--select * from iot.queries();
call iot.resume();
-call iot.wait(1);
+-- wait a few seconds
+call iot.wait(5000);
select * from tmp_aggregate;
diff --git a/sql/backends/monet5/iot/Tests/iot12.sql
b/sql/backends/monet5/iot/Tests/iot12.sql
--- a/sql/backends/monet5/iot/Tests/iot12.sql
+++ b/sql/backends/monet5/iot/Tests/iot12.sql
@@ -3,32 +3,39 @@ set schema iot;
set optimizer='iot_pipe';
-- we don't have global variables
-create stream table clocks(cnt integer,clk1 integer);
+create stream table clocks(cnt integer,clk integer);
insert into clocks values(0,0);
-call iot.heartbeat('iot','clocks',5);
-create procedure clk1()
+create table clocklog( t timestamp, clk integer);
+
+call iot.heartbeat('iot','clocks',2000);
+
+create procedure clk()
begin
update iot.clocks
- set clk1 = clk1+1,
+ set clk = clk+1,
cnt = cnt +1;
+ insert into clocklog values (current_timestamp(),(select clk from
iot.clocks));
end;
--- alternative is a simple query
-call iot.query('iot','clk1');
-call iot.pause();
-
-select * from clocks;
-call iot.cycles('iot','clk1',5);
-call iot.resume();
select * from clocks;
+-- run a continuous query a limited number of times
+call iot.query('iot','clk',5);
+
-- wait long enough to let the cycles run
-call iot.wait(1000);
-call iot.stop();
+call iot.wait(5000);
+select * from clocks;
+--select * from clocklog;
+call iot.wait(5000);
+select * from clocks;
+--select * from clocklog;
+call iot.wait(5000);
+select * from clocks;
+--select * from clocklog;
--select * from iot.baskets();
-select * from iot.queries();
+--select * from iot.queries();
select * from iot.errors();
-drop procedure clk1;
+drop procedure clk;
drop table clocks;
-
+drop table clocklog;
diff --git a/sql/backends/monet5/iot/Tests/iot12.stable.out
b/sql/backends/monet5/iot/Tests/iot12.stable.out
--- a/sql/backends/monet5/iot/Tests/iot12.stable.out
+++ b/sql/backends/monet5/iot/Tests/iot12.stable.out
@@ -38,16 +38,28 @@ Ready.
#end;
#select * from clocks;
% iot.clocks, iot.clocks # table_name
-% cnt, clk1 # name
+% cnt, clk # name
+% int, int # type
+% 1, 1 # length
+[ 0, 0 ]
+#select * from clocks;
+% iot.clocks, iot.clocks # table_name
+% cnt, clk # name
% int, int # type
% 1, 1 # length
[ 1, 1 ]
#select * from clocks;
% iot.clocks, iot.clocks # table_name
-% cnt, clk1 # name
+% cnt, clk # name
% int, int # type
% 1, 1 # length
-[ 9, 9 ]
+[ 3, 3 ]
+#select * from clocks;
+% iot.clocks, iot.clocks # table_name
+% cnt, clk # name
+% int, int # type
+% 1, 1 # length
+[ 5, 5 ]
#select * from iot.errors();
% ., . # table_name
% table, error # name
diff --git a/sql/backends/monet5/iot/Tests/iot13.sql
b/sql/backends/monet5/iot/Tests/iot13.sql
--- a/sql/backends/monet5/iot/Tests/iot13.sql
+++ b/sql/backends/monet5/iot/Tests/iot13.sql
@@ -3,13 +3,13 @@ set schema iot;
set optimizer='iot_pipe';
create stream table tmp13 (t timestamp, sensor integer, val decimal(8,2)) ;
-create table agenda13(t timestamp, cnt integer, msg string);
+create table agenda13(i integer, msg string);
-- Queries can fire based on both the actual state of the streams and heartbeat
-call iot.window('iot','tmp13',4);
+call iot.window('iot','tmp13',2);
--- every 5 seconds inspect the basket regardless filling
-call iot.heartbeat('iot','tmp13',5000);
+-- every second inspect the basket regardless filling
+call iot.heartbeat('iot','tmp13',1000);
create procedure cq13()
begin
@@ -20,18 +20,20 @@ call iot.query('iot','cq13');
call iot.pause();
insert into tmp13 values('2005-09-23 12:34:26.736',1,12.34);
+insert into tmp13 values('2005-09-23 12:34:26.736',1,12.35);
+insert into tmp13 values('2005-09-23 12:34:26.736',1,12.36);
select * from tmp13;
-- reactivate all continuous queries
call iot.resume();
--- wait for 1 cycle in the scheduler
-call iot.wait(1);
+-- wait a few seconds
+call iot.wait(5000);
select 'RESULT';
select * from agenda13;
+call iot.stop();
select * from iot.errors();
-call iot.stop();
drop procedure cq13;
drop table tmp13;
drop table agenda13;
diff --git a/sql/backends/monet5/iot/Tests/iot14.sql
b/sql/backends/monet5/iot/Tests/iot14.sql
--- a/sql/backends/monet5/iot/Tests/iot14.sql
+++ b/sql/backends/monet5/iot/Tests/iot14.sql
@@ -21,7 +21,7 @@ begin
delete from sdel where sensor = 3;
end;
-call iot.query('iot','sdel00');
+call iot.query('iot','sdel00',3);
call iot.show('iot','sdel00');
call iot.pause();
insert into sdel values('2005-09-23 12:34:26.736',1,12.34);
@@ -31,8 +31,8 @@ insert into sdel values('2005-09-23 12:3
select * from sdel;
call iot.resume();
-call iot.cycles('iot','sdel00',1);
-call iot.wait(10);
+-- wait a few seconds
+call iot.wait(5000);
select * from sdel;
drop procedure sdel00;
diff --git a/sql/backends/monet5/iot/Tests/iot16.sql
b/sql/backends/monet5/iot/Tests/iot16.sql
--- a/sql/backends/monet5/iot/Tests/iot16.sql
+++ b/sql/backends/monet5/iot/Tests/iot16.sql
@@ -1,4 +1,4 @@
--- introduce a heartbeat and windo directly on a stream
+-- introduce a heartbeat and window directly on a stream
set schema iot;
set optimizer='iot_pipe';
diff --git a/sql/backends/monet5/iot/Tests/logger.sql
b/sql/backends/monet5/iot/Tests/logger.sql
--- a/sql/backends/monet5/iot/Tests/logger.sql
+++ b/sql/backends/monet5/iot/Tests/logger.sql
@@ -1,4 +1,4 @@
--- A simple heartbeat continuous query.
+-- A simple heartbeat continuous query triggered.
set schema iot;
set optimizer='iot_pipe';
@@ -12,8 +12,8 @@ end;
call iot.query('iot','cqlogger');
call iot.heartbeat('iot','log',1000);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list