Changeset: a3aa20b524a0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a3aa20b524a0
Modified Files:
monetdb5/mal/mal.c
sql/backends/monet5/iot/Tests/iot14.stable.out
sql/backends/monet5/iot/Tests/logger.sql
sql/backends/monet5/iot/Tests/receptor01.sql
sql/backends/monet5/iot/petrinet.c
Branch: iot
Log Message:
Minor changes
diffs (170 lines):
diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -167,7 +167,11 @@ void mserver_reset(void)
* Beware, mal_exit is also called during a SIGTERM from the monetdb tool
*/
+static int serverstopped;
void mal_exit(void){
+ if( serverstopped)
+ return;
+ serverstopped = 1;
mserver_reset();
GDKexit(0); /* properly end GDK */
}
diff --git a/sql/backends/monet5/iot/Tests/iot14.stable.out
b/sql/backends/monet5/iot/Tests/iot14.stable.out
--- a/sql/backends/monet5/iot/Tests/iot14.stable.out
+++ b/sql/backends/monet5/iot/Tests/iot14.stable.out
@@ -138,7 +138,6 @@ end user.iot_sdel00;
[ 2005-09-23 12:34:26.736000, 1, 12.34 ]
[ 2005-09-23 12:34:26.736000, 4, 12.34 ]
[ 2005-09-23 12:34:26.736000, 1, 12.34 ]
-[ 2005-09-23 12:34:26.736000, 3, 12.34 ]
[ 2005-09-23 12:34:26.736000, 4, 12.34 ]
[ 2005-09-23 12:34:26.736000, 3, 12.34 ]
#call iot.stop();
@@ -157,6 +156,7 @@ end user.iot_sdel00;
[ 2005-09-23 12:34:26.736000, 1, 12.34 ]
[ 2005-09-23 12:34:26.736000, 4, 12.34 ]
[ 2005-09-23 12:34:26.736000, 1, 12.34 ]
+[ 2005-09-23 12:34:26.736000, 4, 12.34 ]
#drop procedure sdel00;
#drop table sdel;
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
@@ -13,7 +13,7 @@ call iot.query('iot','cqlogger');
call iot.heartbeat('iot','log',1000);
-- wait for 2 seconds
-call iot.wait(2000);
+call iot.wait(4000);
select 'RESULT';
select * from log;
diff --git a/sql/backends/monet5/iot/Tests/receptor01.sql
b/sql/backends/monet5/iot/Tests/receptor01.sql
--- a/sql/backends/monet5/iot/Tests/receptor01.sql
+++ b/sql/backends/monet5/iot/Tests/receptor01.sql
@@ -17,7 +17,7 @@ end;
call iot.query('iot','collecttemps');
call iot.resume();
-call iot.wait(1);
+call iot.wait(1000);
select * from temps;
select * from tempresult;
diff --git a/sql/backends/monet5/iot/petrinet.c
b/sql/backends/monet5/iot/petrinet.c
--- a/sql/backends/monet5/iot/petrinet.c
+++ b/sql/backends/monet5/iot/petrinet.c
@@ -283,18 +283,10 @@ PNstatus( Client cntxt, MalBlkPtr mb, Ma
str
PNresume(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){
- str msg= MAL_SUCCEED;
#ifdef DEBUG_PETRINET
mnstr_printf(GDKout, "#resume scheduler\n");
#endif
- if ( pci->argc == 3)
- msg= PNstatus(cntxt, mb, stk, pci, PNWAIT);
- else {
- MT_lock_set(&iotLock);
- pnstatus = PNRUNNING;
- MT_lock_unset(&iotLock);
- }
- return msg;
+ return PNstatus(cntxt, mb, stk, pci, PNWAIT);
}
str
@@ -302,6 +294,7 @@ PNwait(Client cntxt, MalBlkPtr mb, MalSt
#ifdef DEBUG_PETRINET
int old = PNcycle;
#endif
+ int cnt=0, i;
int delay= *getArgReference_int(stk,pci,1);
(void) cntxt;
@@ -311,7 +304,10 @@ PNwait(Client cntxt, MalBlkPtr mb, MalSt
#endif
delay = delay < PNDELAY? PNDELAY:delay;
MT_sleep_ms(delay);
+ for(cnt=0, i = 0; i < pnettop; i++)
+ cnt += pnet[i].status != PNWAIT;
#ifdef DEBUG_PETRINET
+ mnstr_printf(cntxt->fdout, "#pnstop %d waiting for %d queries \n",
pnettop, cnt);
mnstr_printf(cntxt->fdout, "#wait finished after %d cycles\n",PNcycle
-old );
#endif
return MAL_SUCCEED;
@@ -319,19 +315,10 @@ PNwait(Client cntxt, MalBlkPtr mb, MalSt
str
PNpause(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){
- str msg= MAL_SUCCEED;
#ifdef DEBUG_PETRINET
mnstr_printf(GDKout, "#pause scheduler or individual queries\n");
#endif
- if ( pci->argc == 3)
- msg= PNstatus(cntxt, mb, stk, pci, PNPAUSED);
- else {
- MT_lock_set(&iotLock);
- pnstatus = PNPAUSED;
- MT_lock_unset(&iotLock);
- }
- // we should wait for all queries to become paused
- return msg;
+ return PNstatus(cntxt, mb, stk, pci, PNPAUSED);
}
@@ -395,10 +382,10 @@ PNstop(void){
MT_sleep_ms(1000);
for(cnt=0, i = 0; i < pnettop; i++)
cnt += pnet[i].status != PNWAIT;
+ mnstr_printf(GDKout, "#pnstop waiting for %d queries \n", cnt);
#ifdef DEBUG_PETRINET
#endif
- mnstr_printf(GDKout, "#pnstop waiting for %d queries \n", cnt);
- } while(pnstatus != PNINIT );
+ } while(pnstatus != PNINIT && cnt > 0);
/*
for(i = pnettop-1; i >= pnettop; i--)
@@ -580,23 +567,20 @@ PNscheduler(void *dummy)
#endif
cntxt = MCinitClient(0,bstream_create(fin,0),fout);
if( cntxt){
- if( SQLinitClient(cntxt) != MAL_SUCCEED)
+ if( SQLinitClient(cntxt) != MAL_SUCCEED){
GDKerror("Could not initialize PNscheduler");
+ mnstr_printf(GDKout, "#petrinet.controller could not
initalize\n");
+ }
}else{
GDKerror("Could not initialize PNscheduler");
return;
}
-/*
- if( cntxt->scenario == NULL )
- SQLinitEnvironment(cntxt, NULL, NULL, NULL);
-*/
-
MT_lock_set(&iotLock);
pnstatus = PNRUNNING; // global state
MT_lock_unset(&iotLock);
- while( pnettop > 0 && pnstatus != PNSTOP ){
+ while( pnstatus != PNSTOP ){
PNcycle++;
/* Determine which continuous query are eligble to run
Collect latest statistics, note that we don't need a lock
here,
@@ -788,7 +772,6 @@ PNscheduler(void *dummy)
mnstr_printf(GDKout, "#petrinet.controller paused\n");
#endif
}
-
}
#ifdef DEBUG_PETRINET
mnstr_printf(GDKout, "#petrinet.scheduler stopped\n");
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list