Changeset: 987fc444b589 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=987fc444b589
Modified Files:
sql/backends/monet5/datacell/Tests/datacell00.sql
sql/backends/monet5/datacell/Tests/scenario01.sql
sql/backends/monet5/datacell/datacell.c
sql/backends/monet5/datacell/receptor.c
Branch: default
Log Message:
Better report on errors found at receptors
diffs (120 lines):
diff --git a/sql/backends/monet5/datacell/Tests/datacell00.sql
b/sql/backends/monet5/datacell/Tests/datacell00.sql
--- a/sql/backends/monet5/datacell/Tests/datacell00.sql
+++ b/sql/backends/monet5/datacell/Tests/datacell00.sql
@@ -9,3 +9,6 @@ begin
-- insert into datacell.Y select *, cast(now() as milliseconds) -
cast(tag as milliseconds) from datacell.X;
insert into datacell.Y select *, 1 from datacell.X;
end;
+drop procedure datacell.transport;
+drop table datacell.X;
+drop table datacell.Y;
diff --git a/sql/backends/monet5/datacell/Tests/scenario01.sql
b/sql/backends/monet5/datacell/Tests/scenario01.sql
--- a/sql/backends/monet5/datacell/Tests/scenario01.sql
+++ b/sql/backends/monet5/datacell/Tests/scenario01.sql
@@ -13,7 +13,7 @@ create table datacell.bsktin(
create table datacell.bsktout( like datacell.bsktin);
-- initialize the baskets
-call datacell.prelude();
+-- call datacell.prelude(); performs the next two statements
call datacell.basket('datacell.bsktin');
call datacell.basket('datacell.bsktout');
@@ -24,7 +24,7 @@ call datacell.protocol('datacell.bsktin'
call datacell.resume('datacell.bsktin');
-- externally, activate the sensor leaving some in the basket
---sensor --host=localhost --port=50500 --events=100 --columns=3 --delay=1
+--sensor --host=localhost --port=50501 --events=100 --columns=3 --delay=1
-- initialize emitter
call datacell.emitter('datacell.bsktout','localhost',50601);
@@ -33,7 +33,7 @@ call datacell.protocol('datacell.bsktout
call datacell.resume('datacell.bsktout');
-- externally, activate the actuator server to listen
--- actuator
+-- nc -u localhost 50601
-- compile the continous query
call datacell.query('datacell.pass', 'insert into datacell.bsktout select *
from datacell.bsktin;');
diff --git a/sql/backends/monet5/datacell/datacell.c
b/sql/backends/monet5/datacell/datacell.c
--- a/sql/backends/monet5/datacell/datacell.c
+++ b/sql/backends/monet5/datacell/datacell.c
@@ -198,7 +198,7 @@ DCresume(Client cntxt, MalBlkPtr mb, Mal
str
DCremove(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
- int idx;
+ int idx,ret;
str nme= *(str*) getArgReference(stk, pci,1);
(void) cntxt;
@@ -206,8 +206,10 @@ DCremove(Client cntxt, MalBlkPtr mb, Mal
idx = BSKTlocate(nme);
if ( idx == 0)
throw(MAL,"datacell.remove","Basket not found");
- /* remove basket and corresponding receptor/emitters depending on it*/
- return MAL_SUCCEED;
+ /* first remove the dependent continous queries */
+
+ /* finally remove the basket itself, the underlying table is *not*
dropped */
+ return BSKTdrop(&ret, &nme);
}
str
diff --git a/sql/backends/monet5/datacell/receptor.c
b/sql/backends/monet5/datacell/receptor.c
--- a/sql/backends/monet5/datacell/receptor.c
+++ b/sql/backends/monet5/datacell/receptor.c
@@ -49,6 +49,8 @@
#include "stream_socket.h"
#include "mal_builder.h"
+/* #define _DEBUG_RECEPTOR_ */
+
#define TCP 1
#define UDP 2
#define CSV 3
@@ -394,7 +396,7 @@ RCbody(Receptor rc)
size_t j;
str e, he;
str line = "\0";
- int i, n;
+ int i, k, n;
#ifdef _DEBUG_RECEPTOR_
int m = 0;
#endif
@@ -497,6 +499,7 @@ bodyRestart:
goto parse;
}
+/* this code should be optimized for block-based reads */
while (cnt < counter) {
if ((n = (int)mnstr_readline(rc->receptor, buf,
MYBUFSIZ)) > 0) {
buf[n + 1] = 0;
@@ -513,9 +516,9 @@ parse:
/* only keep the last
errorenous event for analysis */
if ( rcError )
GDKfree(rcError);
- rcError= (char*)
GDKmalloc(strlen(line)+1 );
+ rcError= (char*)
GDKmalloc( k =strlen(line)+100 );
if ( rcError)
-
strncpy(rcError,line, strlen(line) + 1);
+
snprintf(rcError,k,"newline missing:%s",line);
rcErrorEvent = cnt;
cnt--;
break;
@@ -527,6 +530,13 @@ parse:
if (insert_line(&rc->table,
line, NULL, 0, rc->table.nr_attrs) < 0) {
if (
baskets[rc->bskt].errors)
BUNappend(baskets[rc->bskt].errors, line, TRUE);
+ /* only keep the last
errorenous event for analysis */
+ if ( rcError )
+
GDKfree(rcError);
+ rcError= (char*)
GDKmalloc( k =strlen(line)+100 );
+ if ( rcError)
+
snprintf(rcError,k,"parsing error:%s",line);
+ rcErrorEvent = cnt;
break;
}
rc->received++;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list