MonetDB: sessions - Minor corrections.

2019-11-06 Thread Martin Kersten
Changeset: 27d68245352e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=27d68245352e
Modified Files:
monetdb5/mal/mal_dataflow.c
monetdb5/mal/mal_private.h
monetdb5/mal/mal_resource.c
monetdb5/mal/mal_resource.h
Branch: sessions
Log Message:

Minor corrections.


diffs (78 lines):

diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -380,9 +380,9 @@ DFLOWworker(void *T)
continue;
}
 
-   if (MALadmission(flow->cntxt, flow->mb, flow->stk, 
fe->argclaim)) {
+   p= getInstrPtr(flow->mb,fe->pc);
+   if (MALadmission(flow->cntxt, flow->mb, flow->stk, p, 
fe->argclaim)) {
// never block on deblockdataflow()
-   p= getInstrPtr(flow->mb,fe->pc);
if( p->fcn != (MALfcn) deblockdataflow){
fe->hotclaim = 0;   /* don't assume priority 
anymore */
fe->maxclaim = 0;
@@ -396,7 +396,7 @@ DFLOWworker(void *T)
PARDEBUG fprintf(stderr, "#executed pc= %d wrk= %d claim= " 
LLFMT "," LLFMT "," LLFMT " %s\n",
 fe->pc, id, fe->argclaim, 
fe->hotclaim, fe->maxclaim, error ? error : "");
/* release the memory claim */
-   MALadmission(flow->cntxt, flow->mb, flow->stk, -fe->argclaim);
+   MALadmission(flow->cntxt, flow->mb, flow->stk, p,  
-fe->argclaim);
/* update the numa information. keep the thread-id producing 
the value */
p= getInstrPtr(flow->mb,fe->pc);
for( i = 0; i < p->argc; i++)
diff --git a/monetdb5/mal/mal_private.h b/monetdb5/mal/mal_private.h
--- a/monetdb5/mal/mal_private.h
+++ b/monetdb5/mal/mal_private.h
@@ -96,5 +96,3 @@
 
 __hidden mal_export void mal_runtime_reset(void)
__attribute__((__visibility__("hidden")));
-
-extern ATOMIC_TYPE mal_running;
diff --git a/monetdb5/mal/mal_resource.c b/monetdb5/mal/mal_resource.c
--- a/monetdb5/mal/mal_resource.c
+++ b/monetdb5/mal/mal_resource.c
@@ -12,7 +12,7 @@
 #include "mal_resource.h"
 #include "mal_private.h"
 
-/* MEMORY admission does not seem to have a major impact */
+/* MEMORY admission does not seem to have a major impact sofar. */
 static lng memorypool = 0;  /* memory claimed by concurrent threads */
 static int memoryclaims = 0;
 
@@ -109,16 +109,18 @@ static MT_Lock admissionLock = MT_LOCK_I
 /* experiments on sf-100 on small machine showed no real improvement */
 
 int
-MALadmission(Client cntxt, MalBlkPtr mb, MalStkPtr stk, lng argclaim)
+MALadmission(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, lng 
argclaim)
 {
int workers;
lng mbytes;
 
(void) mb;
-   (void) stk;
+   (void) pci;
/* optimistically set memory */
if (argclaim == 0)
return 0;
+   /* if we are dealing with a check instruction, just continue */
+   /* TOBEDONE */
 
MT_lock_set();
/* Check if we are allowed to allocate another worker thread for this 
client */
diff --git a/monetdb5/mal/mal_resource.h b/monetdb5/mal/mal_resource.h
--- a/monetdb5/mal/mal_resource.h
+++ b/monetdb5/mal/mal_resource.h
@@ -21,7 +21,7 @@
 #define heapinfo(X,Id) (((X) && (X)->base ) ? (X)->free : 0)
 #define hashinfo(X,Id) ((X) && (X) != (Hash *) 1 ? heapinfo(&(X)->heap, Id) : 
0)
 
-mal_export int MALadmission(Client cntxt, MalBlkPtr mb, MalStkPtr stk, lng 
argclaim);
+mal_export int MALadmission(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci, lng argclaim);
 
 #define FAIRNESS_THRESHOLD (MAX_DELAYS * DELAYUNIT)
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: sessions - MALfairness would cause worker threads to be...

2019-11-06 Thread Martin Kersten
Changeset: 4d2372ffab9a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4d2372ffab9a
Modified Files:
monetdb5/mal/mal.c
monetdb5/mal/mal_dataflow.c
monetdb5/mal/mal_resource.c
monetdb5/mal/mal_resource.h
monetdb5/mal/mal_runtime.c
Branch: sessions
Log Message:

MALfairness would cause worker threads to be hold up for doing
valuable work. Only rely on the MALadmission scheme.


diffs (145 lines):

diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -72,7 +72,6 @@ int mal_init(void){
 #ifndef HAVE_EMBEDDED
initHeartbeat();
 #endif
-   initResource();
str err = malBootstrap();
if (err != MAL_SUCCEED) {
mal_client_reset();
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -380,7 +380,7 @@ DFLOWworker(void *T)
continue;
}
 
-   if (MALrunningThreads() > 2 && MALadmission(flow->cntxt, 
flow->mb, flow->stk, fe->argclaim)) {
+   if (MALadmission(flow->cntxt, flow->mb, flow->stk, 
fe->argclaim)) {
// never block on deblockdataflow()
p= getInstrPtr(flow->mb,fe->pc);
if( p->fcn != (MALfcn) deblockdataflow){
diff --git a/monetdb5/mal/mal_resource.c b/monetdb5/mal/mal_resource.c
--- a/monetdb5/mal/mal_resource.c
+++ b/monetdb5/mal/mal_resource.c
@@ -105,7 +105,6 @@ getMemoryClaim(MalBlkPtr mb, MalStkPtr s
  * Surpassing this bound may be a reason to not admit the instruction to 
proceed.
  */
 static MT_Lock admissionLock = MT_LOCK_INITIALIZER("admissionLock");
-ATOMIC_TYPE mal_running = ATOMIC_VAR_INIT(0);
 
 /* experiments on sf-100 on small machine showed no real improvement */
 
@@ -186,7 +185,7 @@ MALadmission(Client cntxt, MalBlkPtr mb,
stk->memory += -argclaim;
}
/* release memory claimed before */
-   memorypool += (lng) -argclaim ;
+   memorypool += -argclaim ;
memoryclaims--;
stk->workers--;
 
@@ -196,75 +195,3 @@ MALadmission(Client cntxt, MalBlkPtr mb,
MT_lock_unset();
return 0;
 }
-
-/* The Dataflow by default activates GDnr_thread workers per query.
- * For long running queries this blocks progress of competing queries.
- * A level of fairness is created to watch for long running queries and slow 
them down.
- * The 'problem' with this code is that it also reduces the number of active 
workers,
- * while we merely want to punish one query.
- */
-
-void
-MALresourceFairness(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, 
lng usec)
-{
-   size_t rss;
-   lng clk;
-   int delayed= 0;
-   int users = 2;
-
-   (void) cntxt;
-   (void) mb;
-   (void) stk;
-   (void) pci;
-
-
-   /* don't punish queries whose last instruction was fast to executed in 
the first place */
-   if ( usec <= TIMESLICE)
-   return;
-
-   /* use GDKmem_cursize as MT_getrss() is too expensive */
-   rss = GDKmem_cursize();
-   /* ample of memory available*/
-   if ( rss <= MEMORY_THRESHOLD )
-   return;
-
-   (void) ATOMIC_INC(_running);
-
-   /* worker reporting time spent  in usec! */
-   clk =  usec / 1000;
-
-#if FAIRNESS_THRESHOLD < 1000  /* it's actually 2000 */
-   /* cap the maximum penalty */
-   clk = clk > FAIRNESS_THRESHOLD? FAIRNESS_THRESHOLD:clk;
-#endif
-
-   /* always keep one running to avoid all waiting  */
-   while (clk > DELAYUNIT && users > 1 && rss > MEMORY_THRESHOLD && (int) 
ATOMIC_GET(_running) > GDKnr_threads ) {
-   if ( delayed++ == 0){
-   PARDEBUG fprintf(stderr, "#delay initial 
["LLFMT"] memory  %zu[%f]\n", clk, rss, MEMORY_THRESHOLD );
-   }
-   if ( delayed == MAX_DELAYS){
-   PARDEBUG fprintf(stderr, "#delay abort 
["LLFMT"] memory  %zu[%f]\n", clk, rss, MEMORY_THRESHOLD );
-   PARDEBUG fflush(stderr);
-   break;
-   }
-   MT_sleep_ms(DELAYUNIT);
-   users= MCactiveClients();
-   rss = GDKmem_cursize();
-   clk -= DELAYUNIT;
-   }
-   (void) ATOMIC_DEC(_running);
-}
-
-// Get a hint on the parallel behavior
-size_t
-MALrunningThreads(void)
-{
-   return ATOMIC_GET(_running);
-}
-
-void
-initResource(void)
-{
-   ATOMIC_SET(_running, GDKnr_threads);
-}
diff --git a/monetdb5/mal/mal_resource.h b/monetdb5/mal/mal_resource.h
--- a/monetdb5/mal/mal_resource.h
+++ b/monetdb5/mal/mal_resource.h
@@ -26,7 +26,5 @@ mal_export int MALadmission(Client cntxt
 #define FAIRNESS_THRESHOLD (MAX_DELAYS * DELAYUNIT)
 
 mal_export lng getMemoryClaim(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, int 
i, int flag);
-mal_export void 

MonetDB: sessions - Get the system behave with the workers/memor...

2019-11-06 Thread Martin Kersten
Changeset: 94952b4dc263 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=94952b4dc263
Modified Files:
clients/Tests/exports.stable.out
monetdb5/mal/mal.h
monetdb5/mal/mal_dataflow.c
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_resource.c
monetdb5/mal/mal_resource.h
Branch: sessions
Log Message:

Get the system behave with the workers/memory limits.
More testing needed.


diffs (263 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1347,7 +1347,7 @@ str LIKEjoin(bat *r1, bat *r2, const bat
 str LIKEjoin1(bat *r1, bat *r2, const bat *lid, const bat *rid, const bat 
*slid, const bat *srid, const bit *nil_matches, const lng *estimate);
 str MACROprocessor(Client cntxt, MalBlkPtr mb, Symbol t);
 int MAL_MAXCLIENTS;
-int MALadmission(Client cntxt, MalStkPtr stk, lng argclaim, lng hotclaim);
+int MALadmission(Client cntxt, MalBlkPtr mb, MalStkPtr stk, lng argclaim);
 str MALassertBit(void *ret, bit *val, str *msg);
 str MALassertHge(void *ret, hge *val, str *msg);
 str MALassertInt(void *ret, int *val, str *msg);
diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -271,8 +271,8 @@ typedef struct MALSTK {
char status;/* srunning 'R' suspended 'S', quiting 'Q' */
int pcup;   /* saved pc upon a recursive all */
oid tag;/* unique invocation call tag */
-   ATOMIC_TYPE workers;/* Actual number of concurrent 
workers */
-   ATOMIC_TYPE memory; /* Actual memory claim 
highwater mark */
+   int workers;/* Actual number of concurrent 
workers */
+   lng memory; /* Actual memory claim 
highwater mark */
 
struct MALSTK *up;  /* stack trace list */
struct MALBLK *blk; /* associated definition */
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -380,7 +380,7 @@ DFLOWworker(void *T)
continue;
}
 
-   if (MALrunningThreads() > 2 && MALadmission(flow->cntxt, 
flow->stk, fe->argclaim, fe->hotclaim)) {
+   if (MALrunningThreads() > 2 && MALadmission(flow->cntxt, 
flow->mb, flow->stk, fe->argclaim)) {
// never block on deblockdataflow()
p= getInstrPtr(flow->mb,fe->pc);
if( p->fcn != (MALfcn) deblockdataflow){
@@ -392,13 +392,11 @@ DFLOWworker(void *T)
continue;
}
}
-   (void) ATOMIC_INC(>stk->workers);
error = runMALsequence(flow->cntxt, flow->mb, fe->pc, fe->pc + 
1, flow->stk, 0, 0);
-   (void) ATOMIC_DEC(>stk->workers);
PARDEBUG fprintf(stderr, "#executed pc= %d wrk= %d claim= " 
LLFMT "," LLFMT "," LLFMT " %s\n",
 fe->pc, id, fe->argclaim, 
fe->hotclaim, fe->maxclaim, error ? error : "");
/* release the memory claim */
-   MALadmission(flow->cntxt, flow->stk, -fe->argclaim, 
-fe->hotclaim);
+   MALadmission(flow->cntxt, flow->mb, flow->stk, -fe->argclaim);
/* update the numa information. keep the thread-id producing 
the value */
p= getInstrPtr(flow->mb,fe->pc);
for( i = 0; i < p->argc; i++)
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -264,9 +264,8 @@ prepareMALstack(MalBlkPtr mb, int size)
//stk->stksize = size;
stk->stktop = mb->vtop;
stk->blk = mb;
-   stk->workers = ATOMIC_VAR_INIT(0);
-   stk->memory = ATOMIC_VAR_INIT(0);;
-
+   ATOMIC_SET(>workers, 0);
+   ATOMIC_SET(>memory, 0);
initStack(0, res);
if(!res) {
freeStack(stk);
diff --git a/monetdb5/mal/mal_resource.c b/monetdb5/mal/mal_resource.c
--- a/monetdb5/mal/mal_resource.c
+++ b/monetdb5/mal/mal_resource.c
@@ -58,12 +58,16 @@ mal_resource_reset(void)
 
 /*
  * The memory claim is the estimate for the amount of memory hold.
- * Views are consider cheap and ignored
+ * Views are consider cheap and ignored.
+ * Given that auxiliary structures are important for performance, 
+ * we use their maximum as an indication of the memory footprint.
+ * An alternative would be to focus solely on the base table cost.
+ * (Good for a MSc study)
  */
 lng
 getMemoryClaim(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, int i, int flag)
 {
-   lng total = 0;
+   lng total = 0, itotal = 0, t;
BAT *b;
 
(void)mb;
@@ -76,22 +80,26 @@ getMemoryClaim(MalBlkPtr mb, 

MonetDB: sessions - Accept output

2019-11-06 Thread Martin Kersten
Changeset: 6c9c08a55124 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6c9c08a55124
Added Files:
sql/test/Users/Tests/sessioncontrol.stable.err
sql/test/Users/Tests/sessioncontrol.stable.out
Branch: sessions
Log Message:

Accept output


diffs (109 lines):

diff --git a/sql/test/Users/Tests/sessioncontrol.stable.err 
b/sql/test/Users/Tests/sessioncontrol.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/Users/Tests/sessioncontrol.stable.err
@@ -0,0 +1,46 @@
+stderr of test 'sessioncontrol` in directory 'sql/test/Users` itself:
+
+
+# 18:15:20 >  
+# 18:15:20 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=30383" "--set" 
"mapi_usock=/var/tmp/mtest-5773/.s.monetdb.30383" "--forcemito" 
"--dbpath=/export/scratch1/mk/branches/default//Linux/var/MonetDB/mTests_sql_test_Users"
 "--set" "embedded_c=true"
+# 18:15:20 >  
+
+# builtin opt  gdk_dbpath = 
/export/scratch1/mk/branches/default//Linux/var/monetdb5/dbfarm/demo
+# builtin opt  mapi_port = 5
+# builtin opt  mapi_open = false
+# builtin opt  mapi_ipv6 = 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 = 30383
+# cmdline opt  mapi_usock = /var/tmp/mtest-5773/.s.monetdb.30383
+# cmdline opt  gdk_dbpath = 
/export/scratch1/mk/branches/default//Linux/var/MonetDB/mTests_sql_test_Users
+# cmdline opt  embedded_c = true
+#client2:!ERROR:MALException:sessiontimeout:Session time-out should be >= 0
+#client2:!ERROR:MALException:querytimeout:Query time-out should be >= 0
+#client2:!ERROR:MALException:setworkerlimit:At least one worker needed
+#client2:!ERROR:MALException:setmemorylimit:At least 100 MB needed
+
+# 18:15:20 >  
+# 18:15:20 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-5773" "--port=30383"
+# 18:15:20 >  
+
+MAPI  = (monetdb) /var/tmp/mtest-5773/.s.monetdb.30383
+QUERY = call setsessiontimeout(-1);
+ERROR = !Session time-out should be >= 0
+MAPI  = (monetdb) /var/tmp/mtest-5773/.s.monetdb.30383
+QUERY = call setquerytimeout(-1);
+ERROR = !Query time-out should be >= 0
+MAPI  = (monetdb) /var/tmp/mtest-5773/.s.monetdb.30383
+QUERY = call setworkerlimit( -1);
+ERROR = !At least one worker needed
+MAPI  = (monetdb) /var/tmp/mtest-5773/.s.monetdb.30383
+QUERY = call setmemorylimit(10);
+ERROR = !At least 100 MB needed
+
+# 18:15:20 >  
+# 18:15:20 >  "Done."
+# 18:15:20 >  
+
diff --git a/sql/test/Users/Tests/sessioncontrol.stable.out 
b/sql/test/Users/Tests/sessioncontrol.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/Users/Tests/sessioncontrol.stable.out
@@ -0,0 +1,53 @@
+stdout of test 'sessioncontrol` in directory 'sql/test/Users` itself:
+
+
+# 18:15:20 >  
+# 18:15:20 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=30383" "--set" 
"mapi_usock=/var/tmp/mtest-5773/.s.monetdb.30383" "--forcemito" 
"--dbpath=/export/scratch1/mk/branches/default//Linux/var/MonetDB/mTests_sql_test_Users"
 "--set" "embedded_c=true"
+# 18:15:20 >  
+
+# MonetDB 5 server v11.36.0 (hg id: 160567eeb3fb+)
+# This is an unreleased version
+# Serving database 'mTests_sql_test_Users', using 4 threads
+# Compiled for x86_64-pc-linux-gnu/64bit with 128bit integers
+# Found 31.307 GiB available main-memory.
+# Copyright (c) 1993 - July 2008 CWI.
+# Copyright (c) August 2008 - 2019 MonetDB B.V., all rights reserved
+# Visit https://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://toke.da.cwi.nl:30383/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-5773/.s.monetdb.30383
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+# 18:15:20 >  
+# 18:15:20 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-5773" "--port=30383"
+# 18:15:20 >  
+
+#select sessionid, s."user", s."optimizer", s.sessiontimeout, s.querytimeout, 
s.workerlimit, s.memorylimit from sessions as s;
+% .s,  .s, .s, .s, .s, .s, .s # table_name
+% sessionid,   user,   optimizer,  sessiontimeout, querytimeout,   
workerlimit,memorylimit # name
+% int, clob,   clob,   int,int,int,int # type
+% 1,   7,  12, 1,  1,  1,  1 # length
+[ 0,   "monetdb",  "default_pipe", 0,  0,  0,  0   ]
+#select sessionid, s."user", s."optimizer", s.sessiontimeout, s.querytimeout, 
s.workerlimit, s.memorylimit from sessions as s;
+% .s,  .s, .s, .s, .s, .s, .s # table_name
+% sessionid,   user,   optimizer,  sessiontimeout, querytimeout,   
workerlimit,memorylimit # name
+% int, clob,   clob,   int,int,int,int # type
+% 1,   7,  12, 4,  3,  2,  4 # length
+[ 0,   "monetdb",  "minimal_pipe", 5000,   123,12, 8000   

MonetDB: tracer - Added GDKtracer to remote, pcre and mal_profiler

2019-11-06 Thread Thodoris Zois
Changeset: 211cf4590780 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=211cf4590780
Modified Files:
gdk/gdk_tracer.h
monetdb5/mal/mal_profiler.c
monetdb5/modules/mal/pcre.c
monetdb5/modules/mal/remote.c
monetdb5/modules/mal/remote.h
Branch: tracer
Log Message:

Added GDKtracer to remote, pcre and mal_profiler


diffs (260 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -30,6 +30,7 @@ typedef enum {
// Specific 
ALLOC,
PAR,
+   ALGO,
 
// Modules
GEOM,
@@ -68,6 +69,7 @@ typedef enum {
MAL_REDUCE,
MAL_CLIENT,
MAL_OIDX,
+   MAL_REMOTE,
 
// GDK
GDK_ALL,
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -24,6 +24,7 @@
 #include "mal_runtime.h"
 #include "mal_utils.h"
 #include "mal_resource.h"
+#include "gdk_tracer.h"
 
 #ifdef HAVE_SYS_TIME_H
 #include 
@@ -149,7 +150,7 @@ renderProfilerEvent(Client cntxt, MalBlk
*/
if( !start && pci->calls > HIGHWATERMARK){
if( pci->calls == 1 || pci->calls == 10 || pci->calls 
== 100 || pci->calls == 1000)
-   fprintf(stderr, "#Profiler too many calls %d\n", 
pci->calls);
+   ERROR(M_ALL, "Too many calls: %d\n", pci->calls);
return;
}
 
diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c
--- a/monetdb5/modules/mal/pcre.c
+++ b/monetdb5/modules/mal/pcre.c
@@ -23,6 +23,7 @@
 
 #include "mal.h"
 #include "mal_exception.h"
+#include "gdk_tracer.h"
 
 #include 
 #include 
@@ -555,10 +556,10 @@ pcre_compile_wrap(pcre **res, const char
 /* scan select loop with candidates */
 #define candscanloop(TEST) 
\
do {
\
-   ALGODEBUG fprintf(stderr,   
\
- 
"#BATselect(b=%s#"BUNFMT",s=%s,anti=%d): "\
- "scanselect %s\n", 
BATgetId(b), BATcount(b),  \
- s ? BATgetId(s) : "NULL", 
anti, #TEST);   \
+   DEBUG(ALGO, 
\
+   "BATselect(b=%s#"BUNFMT",s=%s,anti=%d): "   
\
+   "scanselect %s\n", BATgetId(b), BATcount(b),
\
+   s ? BATgetId(s) : "NULL", anti, #TEST); 
\
for (p = 0; p < ci.ncand; p++) {
\
o = canditer_next(); 
\
r = (BUN) (o - off);
\
@@ -571,10 +572,10 @@ pcre_compile_wrap(pcre **res, const char
 /* scan select loop without candidates */
 #define scanloop(TEST) 
\
do {
\
-   ALGODEBUG fprintf(stderr,   
\
- 
"#BATselect(b=%s#"BUNFMT",s=%s,anti=%d): "\
- "scanselect %s\n", 
BATgetId(b), BATcount(b),  \
- s ? BATgetId(s) : "NULL", 
anti, #TEST);   \
+   DEBUG(ALGO, 
\
+   "BATselect(b=%s#"BUNFMT",s=%s,anti=%d): "   
\
+   "scanselect %s\n", BATgetId(b), BATcount(b),
\
+   s ? BATgetId(s) : "NULL", anti, #TEST); 
\
while (p < q) { 
\
v = BUNtvar(bi, p-off); 
\
if (TEST) {

MonetDB: Nov2019 - Use a single error message for every nearby s...

2019-11-06 Thread Pedro Ferreira
Changeset: 6fe3295d6a7c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6fe3295d6a7c
Modified Files:
sql/backends/monet5/rel_bin.c
sql/server/rel_exp.c
sql/server/rel_partition.c
sql/server/rel_propagate.c
sql/server/rel_psm.c
sql/server/rel_rel.c
sql/server/rel_select.c
sql/server/rel_unnest.c
sql/server/sql_partition.c

sql/test/BugTracker-2008/Tests/too_many_nested_operators.SF-2102167.stable.err
sql/test/BugTracker-2016/Tests/trigger_bulk.Bug-4045.stable.err
Branch: Nov2019
Log Message:

Use a single error message for every nearby stack overflow detection, so the 
error output on tests will be always the same


diffs (truncated from 371 to 300 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -453,7 +453,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
stmt *s = NULL;
 
if (THRhighwater())
-   return sql_error(be->mvc, 10, SQLSTATE(42000) "query too 
complex: running out of stack space");
+   return sql_error(be->mvc, 10, SQLSTATE(42000) "Query too 
complex: running out of stack space");
 
if (!e) {
assert(0);
@@ -1441,7 +1441,7 @@ exp2bin_args(backend *be, sql_exp *e, li
mvc *sql = be->mvc;
 
if (THRhighwater())
-   return sql_error(sql, 10, SQLSTATE(42000) "query too complex: 
running out of stack space");
+   return sql_error(sql, 10, SQLSTATE(42000) "Query too complex: 
running out of stack space");
 
if (!e)
return args;
@@ -1519,7 +1519,7 @@ static list *
 rel2bin_args(backend *be, sql_rel *rel, list *args)
 {
if (THRhighwater())
-   return sql_error(be->mvc, 10, SQLSTATE(42000) "query too 
complex: running out of stack space");
+   return sql_error(be->mvc, 10, SQLSTATE(42000) "Query too 
complex: running out of stack space");
 
if (!rel)
return args;
@@ -3220,7 +3220,7 @@ sql_parse(backend *be, sql_allocator *sa
bstream * bst;
 
if (THRhighwater())
-   return sql_error(m, 10, SQLSTATE(42000) "SELECT: too many 
nested operators");
+   return sql_error(m, 10, SQLSTATE(42000) "Query too complex: 
running out of stack space");
 
o = MNEW(mvc);
if (!o)
@@ -5593,7 +5593,7 @@ subrel_bin(backend *be, sql_rel *rel, li
stmt *s = NULL;
 
if (THRhighwater())
-   return sql_error(be->mvc, 10, SQLSTATE(42000) "query too 
complex: running out of stack space");;
+   return sql_error(be->mvc, 10, SQLSTATE(42000) "Query too 
complex: running out of stack space");;
 
if (!rel)
return s;
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -2217,7 +2217,7 @@ static int
 exp_set_list_recurse(mvc *sql, sql_subtype *type, sql_exp *e, const char 
**relname, const char** expname)
 {
if (THRhighwater()) {
-   (void) sql_error(sql, 10, SQLSTATE(42000) "query too complex: 
running out of stack space");
+   (void) sql_error(sql, 10, SQLSTATE(42000) "Query too complex: 
running out of stack space");
return -1;
}
assert(*relname && *expname);
@@ -2243,7 +2243,7 @@ static int
 exp_set_type_recurse(mvc *sql, sql_subtype *type, sql_exp *e, const char 
**relname, const char** expname)
 {
if (THRhighwater()) {
-   (void) sql_error(sql, 10, SQLSTATE(42000) "query too complex: 
running out of stack space");
+   (void) sql_error(sql, 10, SQLSTATE(42000) "Query too complex: 
running out of stack space");
return -1;
}
assert(*relname && *expname);
@@ -2333,7 +2333,7 @@ int
 rel_set_type_recurse(mvc *sql, sql_subtype *type, sql_rel *rel, const char 
**relname, const char **expname)
 {
if (THRhighwater()) {
-   (void) sql_error(sql, 10, SQLSTATE(42000) "query too complex: 
running out of stack space");
+   (void) sql_error(sql, 10, SQLSTATE(42000) "Query too complex: 
running out of stack space");
return -1;
}
assert(*relname && *expname);
diff --git a/sql/server/rel_partition.c b/sql/server/rel_partition.c
--- a/sql/server/rel_partition.c
+++ b/sql/server/rel_partition.c
@@ -45,7 +45,7 @@ static void
 find_basetables(mvc *sql, sql_rel *rel, list *tables )
 {
if (THRhighwater()) {
-   (void) sql_error(sql, 10, SQLSTATE(42000) "query too complex: 
running out of stack space");
+   (void) sql_error(sql, 10, SQLSTATE(42000) "Query too complex: 
running out of stack space");
return;
}
 
@@ -143,7 +143,7 @@ sql_rel *
 rel_partition(mvc *sql, sql_rel *rel) 
 {
if (THRhighwater())
-   return sql_error(sql, 

MonetDB: tracer - Added GDKtracer to mal_namespace

2019-11-06 Thread Thodoris Zois
Changeset: 05a76afe1dae for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=05a76afe1dae
Modified Files:
monetdb5/mal/mal_namespace.c
Branch: tracer
Log Message:

Added GDKtracer to mal_namespace


diffs (20 lines):

diff --git a/monetdb5/mal/mal_namespace.c b/monetdb5/mal/mal_namespace.c
--- a/monetdb5/mal/mal_namespace.c
+++ b/monetdb5/mal/mal_namespace.c
@@ -14,6 +14,7 @@
 #include "mal_namespace.h"
 #include "mal_exception.h"
 #include "mal_private.h"
+#include "gdk_tracer.h"
 
 #define MAXIDENTIFIERS 4096
 #define HASHMASK  4095
@@ -120,7 +121,7 @@ static str findName(const char *nme, siz
struct namespace *ns = GDKmalloc(sizeof(struct namespace));
if (ns == NULL) {
/* error we cannot recover from */
-   fprintf(stderr, "!findName" SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
+   CRITICAL(M_ALL, SQLSTATE(HY001) MAL_MALLOC_FAIL "\n");
mal_exit(1);
}
ns->next = namespace;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: tracer - Added GDKtracer to orderidx

2019-11-06 Thread Thodoris Zois
Changeset: 1c182eb109eb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1c182eb109eb
Modified Files:
gdk/gdk_tracer.h
monetdb5/modules/mal/orderidx.c
monetdb5/modules/mal/orderidx.h
Branch: tracer
Log Message:

Added GDKtracer to orderidx


diffs (62 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -67,6 +67,7 @@ typedef enum {
MAL_WLC,
MAL_REDUCE,
MAL_CLIENT,
+   MAL_OIDX,
 
// GDK
GDK_ALL,
diff --git a/monetdb5/modules/mal/orderidx.c b/monetdb5/modules/mal/orderidx.c
--- a/monetdb5/modules/mal/orderidx.c
+++ b/monetdb5/modules/mal/orderidx.c
@@ -13,6 +13,7 @@
 #include "monetdb_config.h"
 #include "orderidx.h"
 #include "gdk.h"
+#include "gdk_tracer.h"
 
 #define MIN_PIECE  ((BUN) 1000)/* TODO use realistic size in 
production */
 
@@ -91,10 +92,9 @@ OIDXcreateImplementation(Client cntxt, i
} else if (BATcount(b) < (BUN) pieces || BATcount(b) < MIN_PIECE) {
pieces = 1;
}
-#ifdef _DEBUG_OIDX_
-   fprintf(stderr,"#bat.orderidx pieces %d\n",pieces);
-   fprintf(stderr,"#oidx ttype %s bat %s\n", 
ATOMname(b->ttype),ATOMname(tpe));
-#endif
+
+   DEBUG(MAL_OIDX, "Pieces: %d\n", pieces);
+   DEBUG(MAL_OIDX, "oidx ttype: %s - bat: %s\n", ATOMname(b->ttype), 
ATOMname(tpe));
 
/* create a temporary MAL function to sort the BAT in parallel */
snprintf(name, IDLENGTH, "sort%d", rand()%1000);
@@ -184,9 +184,11 @@ OIDXcreateImplementation(Client cntxt, i
msg = runMALsequence(cntxt, smb, 1, 0, newstk, 0, 0);
freeStack(newstk);
}
-#ifdef _DEBUG_OIDX_
-   fprintFunction(stderr, smb, 0, LIST_MAL_ALL);
-#endif
+
+   /* CHECK */
+   // Uncomment this line when fprintfFunction is fixed
+   // fprintFunction(MAL_OIDX, smb, 0, LIST_MAL_ALL);
+
/* get rid of temporary MAL block */
 bailout:
freeSymbol(snew);
diff --git a/monetdb5/modules/mal/orderidx.h b/monetdb5/modules/mal/orderidx.h
--- a/monetdb5/modules/mal/orderidx.h
+++ b/monetdb5/modules/mal/orderidx.h
@@ -25,7 +25,6 @@
 #define orderidx_export extern
 #endif
 
-//#define _DEBUG_OIDX_
 orderidx_export str OIDXcreate(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 orderidx_export str OIDXcreateImplementation(Client cntxt, int tpe, BAT *b, 
int pieces);
 orderidx_export str OIDXdropImplementation(Client cntxt, BAT *b);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: tracer - Added GDKtracer to mal_client & minor fix to m...

2019-11-06 Thread Thodoris Zois
Changeset: e624f1971a1f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e624f1971a1f
Modified Files:
gdk/gdk_tracer.h
monetdb5/mal/mal_client.c
monetdb5/mal/mal_client.h
monetdb5/mal/mal_debugger.c
Branch: tracer
Log Message:

Added GDKtracer to mal_client & minor fix to mal_debugger


diffs (168 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -66,6 +66,7 @@ typedef enum {
MAL_PARSER,
MAL_WLC,
MAL_REDUCE,
+   MAL_CLIENT,
 
// GDK
GDK_ALL,
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
@@ -46,6 +46,7 @@
 #include "mal_private.h"
 #include "mal_runtime.h"
 #include "mal_authorize.h"
+#include "gdk_tracer.h"
 
 int MAL_MAXCLIENTS = 0;
 ClientRec *mal_clients;
@@ -69,7 +70,7 @@ MCinit(void)
if (maxclients <= 0) {
maxclients = 64;
if (GDKsetenv("max_clients", "64") != GDK_SUCCEED) {
-   fprintf(stderr, "!MCinit: GDKsetenv failed");
+   CRITICAL(M_ALL, "GDKsetenv failed\n");
return false;
}
}
@@ -77,7 +78,7 @@ MCinit(void)
MAL_MAXCLIENTS = /* client connections */ maxclients;
mal_clients = GDKzalloc(sizeof(ClientRec) * MAL_MAXCLIENTS);
if( mal_clients == NULL){
-   fprintf(stderr,"!MCinit:" MAL_MALLOC_FAIL);
+   CRITICAL(M_ALL, "Initialization failed: " MAL_MALLOC_FAIL "\n");
return false;
}
for (int i = 0; i < MAL_MAXCLIENTS; i++)
@@ -144,9 +145,7 @@ MCnewClient(void)
if (c == mal_clients + MAL_MAXCLIENTS)
return NULL;
c->idx = (int) (c - mal_clients);
-#ifdef MAL_CLIENT_DEBUG
-   fprintf(stderr,"New client created %d\n", (int) (c - mal_clients));
-#endif
+   DEBUG(MAL_CLIENT, "New client created: %d\n", (int) (c - mal_clients));
return c;
 }
 
@@ -187,9 +186,7 @@ MCresetProfiler(stream *fdout)
 void
 MCexitClient(Client c)
 {
-#ifdef MAL_CLIENT_DEBUG
-   fprintf(stderr,"# Exit client %d\n", c->idx);
-#endif
+   DEBUG(MAL_CLIENT, "Exit client: %d\n", c->idx);
finishSessionProfiler(c);
MCresetProfiler(c->fdout);
if (c->father == NULL) { /* normal client */
@@ -225,7 +222,7 @@ MCinitClientRecord(Client c, oid user, b
MT_lock_set(_contextLock);
c->mode = FREECLIENT;
MT_lock_unset(_contextLock);
-   fprintf(stderr,"!initClientRecord:" MAL_MALLOC_FAIL);
+   CRITICAL(M_ALL, "Initialization failed: " MAL_MALLOC_FAIL "\n");
return NULL;
}
c->yycur = 0;
@@ -264,7 +261,7 @@ MCinitClientRecord(Client c, oid user, b
c->mode = FREECLIENT;
MT_lock_unset(_contextLock);
}
-   fprintf(stderr, "!initClientRecord:" MAL_MALLOC_FAIL);
+   CRITICAL(M_ALL, "Initialization failed: " MAL_MALLOC_FAIL "\n");
return NULL;
}
c->promptlength = strlen(prompt);
@@ -413,9 +410,7 @@ MCfreeClient(Client c)
return;
c->mode = FINISHCLIENT;
 
-#ifdef MAL_CLIENT_DEBUG
-   fprintf(stderr,"# Free client %d\n", c->idx);
-#endif
+   DEBUG(MAL_CLIENT, "Free client: %d\n", c->idx);
MCexitClient(c);
 
/* scope list and curprg can not be removed, because the client may
@@ -533,9 +528,7 @@ MCactiveClients(void)
 void
 MCcloseClient(Client c)
 {
-#ifdef MAL_DEBUG_CLIENT
-   fprintf(stderr,"closeClient %d " OIDFMT "\n", (int) (c - mal_clients), 
c->user);
-#endif
+   DEBUG(MAL_CLIENT, "Close client: %d " OIDFMT "\n", (int) (c - 
mal_clients), c->user);
/* free resources of a single thread */
MCfreeClient(c);
 }
@@ -585,10 +578,7 @@ MCreadClient(Client c)
 {
bstream *in = c->fdin;
 
-#ifdef MAL_CLIENT_DEBUG
-   fprintf(stderr,"# streamClient %d %d\n", c->idx, 
isa_block_stream(in->s));
-#endif
-
+   DEBUG(MAL_CLIENT, "Stream client: %d %d\n", c->idx, 
isa_block_stream(in->s));
while (in->pos < in->len &&
   (isspace((unsigned char) (in->buf[in->pos])) ||
in->buf[in->pos] == ';' || !in->buf[in->pos]))
@@ -620,15 +610,11 @@ MCreadClient(Client c)
if (p != in->buf + in->len - 1)
in->len++;
}
-#ifdef MAL_CLIENT_DEBUG
-   fprintf(stderr, "# simple stream received %d sum %zu\n", 
c->idx, sum);
-#endif
+   DEBUG(MAL_CLIENT, "Received simple stream: %d - sum %zu\n", 
c->idx, sum);
}
if (in->pos >= in->len) {
/* end of stream reached */
-#ifdef MAL_CLIENT_DEBUG
-   fprintf(stderr,"# end of stream received %d 

MonetDB: default - Merge with Nov2019

2019-11-06 Thread Pedro Ferreira
Changeset: fb7cafba74ea for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fb7cafba74ea
Added Files:
sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.sql

sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.stable.err

sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.stable.out
Modified Files:
.hgignore
NT/rules.msc
buildtools/autogen/autogen/am.py
buildtools/autogen/autogen/codegen.py
buildtools/autogen/autogen/filesplit.py
buildtools/autogen/autogen/msc.py
buildtools/conf/rules.mk
configure.ag
monetdb5/modules/atoms/strptime.c
sql/backends/monet5/sql_statement.c
sql/common/sql_types.c
sql/server/rel_dump.c
sql/test/BugTracker-2019/Tests/All
sql/test/Tests/truncate-statements-extra.sql
sql/test/Tests/truncate-statements-extra.stable.out
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
sql/test/sys-schema/Tests/systemfunctions.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out.int128
Branch: default
Log Message:

Merge with Nov2019


diffs (truncated from 741 to 300 lines):

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -49,7 +49,6 @@ sql/backends/monet5/UDF/capi/cheader.tex
 .#*
 
 # files generated by compilers
-lex.yy.c
 *.tab.c
 *.tab.h
 .libs
diff --git a/NT/rules.msc b/NT/rules.msc
--- a/NT/rules.msc
+++ b/NT/rules.msc
@@ -186,8 +186,7 @@ libpy3_CFLAGS = -DHAVE_LIBPY3 "-I$(PYTHO
 # PYTHON may be either a version 2 or a version 3
 # here we let %Path% determine which version we get
 PYTHON = python
-YACC = bison
-LEX = flex
+BISON = bison
 
 ARCHIVER = lib /nologo
 GENDLL =
diff --git a/buildtools/autogen/autogen/am.py b/buildtools/autogen/autogen/am.py
--- a/buildtools/autogen/autogen/am.py
+++ b/buildtools/autogen/autogen/am.py
@@ -19,7 +19,7 @@ from filesplit import split_filename, rs
 # buildtools/conf.  The generated sources should therefore be included
 # in the tar ball and not be removed with `make distclean' when
 # running "in" said tar ball.
-buildtools_ext = ['brg', 'l', 'pm.i', 'syms', 't', 'y']
+buildtools_ext = ['syms', 'y']
 
 am_assign = "+="
 
@@ -150,6 +150,8 @@ def am_find_srcs(target, deps, am, cond)
 am['CLEAN'].append(pf)
 b, ext = split_filename(pf)
 if ext in automake_ext:
+if ext in ['tab.c', 'tab.h']:
+dist = True
 return dist, pf
 return dist, ""
 
@@ -563,7 +565,7 @@ def am_binary(fd, var, binmap, am):
 if ext in scripts_ext:
 if target not in SCRIPTS:
 SCRIPTS.append(target)
-elif ext in ('o', 'glue.o', 'tab.o', 'yy.o'):
+elif ext in ('o', 'tab.o'):
 dist, src = am_find_srcs(target, binmap['DEPS'], am, cond)
 if src in binmap['SOURCES']:
 dist = True
diff --git a/buildtools/autogen/autogen/codegen.py 
b/buildtools/autogen/autogen/codegen.py
--- a/buildtools/autogen/autogen/codegen.py
+++ b/buildtools/autogen/autogen/codegen.py
@@ -21,25 +21,15 @@ from filesplit import split_filename
 # direct rules
 code_gen = {'y':[ '.tab.c', '.tab.h' ],
 'tab.c':[ '.tab.o' ],
-'l':[ '.yy.c', '.yy.h' ],
-'yy.c': [ '.yy.o' ],
 'mt':   [ '.symbols.h', '.c' ],
-'brg':  [ '.c' ],
 't':[ '.c' ],
 'c':[ '.o' ],
-'cpp':  [ '.o' ],
-#'java': [ '.class' ],
-#'tex':  [ '.html', '.dvi', '.pdf' ],
-#'dvi':  [ '.ps' ],
-#'fig':  [ '.eps' ],
-#'feps': [ '.eps' ],
 'in':   [ '' ],
 '1.in': [ '.1' ],  # TODO: add more manpage sections as needed
 'cfg.in':   [ '.cfg' ],
 'java.in':  [ '.java' ],
 'mal.in':   [ '.mal' ],
 'py.in':[ '.py' ],
-'pl.in':[ '.pl' ],
 'bat.in':   [ '.bat' ],
 'mt.sed':   [ '.mt' ],
 'c.sed':[ '.c' ],
@@ -69,15 +59,8 @@ t_inc = re.compile(t_inc, re.MULTILINE)
 
 scan_map = {
 'c': [ c_inc, None, '' ],
-'cpp': [ c_inc, None, '' ],
 'h': [ c_inc, None, '' ],
 'y': [ c_inc, None, '' ],
-'l': [ c_inc, None, '' ],
-'mt': [ c_inc, None, '' ],
-'brg': [ c_inc, None, '' ],
-'t': [ t_inc, None, '' ],
-'xsl': [ xsl_inc, None, '' ],
-'tex': [ tex_inc, None, '' ],
 }
 
 def readfile(f):
diff --git a/buildtools/autogen/autogen/filesplit.py 
b/buildtools/autogen/autogen/filesplit.py
--- a/buildtools/autogen/autogen/filesplit.py
+++ b/buildtools/autogen/autogen/filesplit.py
@@ -13,7 +13,7 @@ def rsplit_filename(f):
 return f[:s], f[s+1:]
 return base, ext
 
-automake_ext = 

MonetDB: tracer - Added GDKtracer to inet, mal_instruction, mal_...

2019-11-06 Thread Thodoris Zois
Changeset: f8f9bf36f8d5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f8f9bf36f8d5
Modified Files:
gdk/gdk_tracer.h
monetdb5/mal/mal.c
monetdb5/mal/mal_debugger.c
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_instruction.h
monetdb5/modules/atoms/inet.c
Branch: tracer
Log Message:

Added GDKtracer to inet, mal_instruction, mal_debugger and mal


diffs (224 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -26,19 +26,24 @@
 typedef enum { 
// ALL
M_ALL,
+
+   // Specific 
ALLOC,
PAR,
+
+   // Modules
GEOM,
-   
+   ATOMS, 
+   LIDAR,
+   BAM,
+   FITS,
+
// SQL
SQL_ALL,
-
-   
SQL_ATOM_TR,
SQL_STATISTICS,
SQL_ORDERIDX,
SQL_OPTIMIZER,
-   SQL_FITS,
SQL_WLR,
SQL_USER,
SQL_SCENARIO,
@@ -49,8 +54,6 @@ typedef enum {
SQL_MVC,
SQL_STORE,
SQL_STORE_FLUSHER,
-   SQL_LIDAR,
-   SQL_BAM,
 
// MAL
MAL_ALL,
@@ -62,6 +65,7 @@ typedef enum {
MAL_FACTORY,
MAL_PARSER,
MAL_WLC,
+   MAL_REDUCE,
 
// GDK
GDK_ALL,
diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -9,6 +9,7 @@
 /* (author) M. Kersten */
 #include "monetdb_config.h"
 #include "mal.h"
+#include "gdk_tracer.h"
 
 char   monet_cwd[FILENAME_MAX] = { 0 };
 size_t monet_memory = 0;
@@ -79,7 +80,7 @@ int mal_init(void){
 #ifndef NDEBUG
mdbExit();
 #endif
-   fprintf(stderr, "%s", err);
+   ERROR(M_ALL, "%s\n", err);
freeException(err);
return -1;
}
@@ -109,11 +110,11 @@ void mserver_reset(void)
AUTHreset();
if (!GDKinmemory()) {
if ((err = msab_wildRetreat()) != NULL) {
-   fprintf(stderr, "!%s", err);
+   ERROR(M_ALL, "%s\n", err);
free(err);
}
if ((err = msab_registerStop()) != NULL) {
-   fprintf(stderr, "!%s", err);
+   ERROR(M_ALL, "%s\n", err);
free(err);
}
}
diff --git a/monetdb5/mal/mal_debugger.c b/monetdb5/mal/mal_debugger.c
--- a/monetdb5/mal/mal_debugger.c
+++ b/monetdb5/mal/mal_debugger.c
@@ -20,6 +20,7 @@
 #include "mal_parser.h"
 #include "mal_namespace.h"
 #include "mal_private.h"
+#include "gdk_tracer.h"
 
 typedef struct {
MalBlkPtr brkBlock[MAXBREAKS];
@@ -293,7 +294,7 @@ mdbInit(void)
 */
mdbTable = GDKzalloc(sizeof(mdbStateRecord) * MAL_MAXCLIENTS);
if (mdbTable == NULL) {
-   fprintf(stderr,"#mdbInit:" MAL_MALLOC_FAIL);
+   CRITICAL(M_ALL, "Initialization failed: \n" MAL_MALLOC_FAIL);
return false;
}
return true;
diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -15,6 +15,7 @@
 #include "mal_function.h"  /* for getPC() */
 #include "mal_utils.h"
 #include "mal_exception.h"
+#include "gdk_tracer.h"
 
 void
 addMalException(MalBlkPtr mb, str msg)
@@ -904,9 +905,8 @@ trimMalVariables_(MalBlkPtr mb, MalStkPt
 
/* build the alias table */
for (i = 0; i < mb->vtop; i++) {
-#ifdef DEBUG_REDUCE
-   fprintf(stderr,"used %s %d\n", getVarName(mb,i), 
isVarUsed(mb,i));
-#endif
+   DEBUG(MAL_REDUCE, "Used: %s %d\n", getVarName(mb,i), 
isVarUsed(mb,i));
+
if ( isVarUsed(mb,i) == 0) {
if (glb && isVarConstant(mb, i))
VALclear(>stk[i]);
@@ -929,20 +929,17 @@ trimMalVariables_(MalBlkPtr mb, MalStkPt
}
cnt++;
}
-#ifdef DEBUG_REDUCE
-   fprintf(stderr, "Variable reduction %d -> %d\n", mb->vtop, cnt);
+
+   DEBUG(MAL_REDUCE, "Variable reduction %d -> %d\n", mb->vtop, cnt);
for (i = 0; i < mb->vtop; i++)
-   fprintf(stderr, "map %d->%d\n", i, alias[i]);
-#endif
+   DEBUG(MAL_REDUCE, "map %d -> %d\n", i, alias[i]);
 
/* remap all variable references to their new position. */
if (cnt < mb->vtop) {
for (i = 0; i < mb->stop; i++) {
q = getInstrPtr(mb, i);
for (j = 0; j < q->argc; j++){
-#ifdef DEBUG_REDUCE
-   fprintf(stderr, "map %d->%d\n", getArg(q,j), 
alias[getArg(q,j)]);

MonetDB: tracer - Replaced components in files: lidar, fits, bam...

2019-11-06 Thread Thodoris Zois
Changeset: ff8caae13261 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ff8caae13261
Modified Files:
sql/backends/monet5/vaults/bam/bam_db_interface.h
sql/backends/monet5/vaults/bam/bam_loader.c
sql/backends/monet5/vaults/bam/bam_wrapper.c
sql/backends/monet5/vaults/fits/fits.c
sql/backends/monet5/vaults/lidar/lidar.c
Branch: tracer
Log Message:

Replaced components in files: lidar, fits, bam_*. Now they belong to separate 
category and not in one of the main layers


diffs (truncated from 493 to 300 lines):

diff --git a/sql/backends/monet5/vaults/bam/bam_db_interface.h 
b/sql/backends/monet5/vaults/bam/bam_db_interface.h
--- a/sql/backends/monet5/vaults/bam/bam_db_interface.h
+++ b/sql/backends/monet5/vaults/bam/bam_db_interface.h
@@ -38,7 +38,7 @@
 }
 #endif */
 #define RUN_SQL(cntxt, sql, descr, msg) {   \
-   DEBUG(SQL_BAM, "%s\n", sql);\
+   DEBUG(BAM, "%s\n", sql);\
msg = SQLstatementIntern(cntxt, sql, descr, TRUE, FALSE, NULL); \
 }
 
diff --git a/sql/backends/monet5/vaults/bam/bam_loader.c 
b/sql/backends/monet5/vaults/bam/bam_loader.c
--- a/sql/backends/monet5/vaults/bam/bam_loader.c
+++ b/sql/backends/monet5/vaults/bam/bam_loader.c
@@ -119,14 +119,14 @@ run_process_bam_alignments(void *d)
bam_wrapper *bw;
 
for (;;) {
-   DEBUG(SQL_BAM, " Starting on next file\n", 
data->thread_id);
+   DEBUG(BAM, " Starting on next file\n", 
data->thread_id);
/* First, find out on which bam wrapper we have to work */
MT_lock_set(data->reader_lock);
if (*data->cur_file == data->nr_files - 1) {
/* The last file is already (being) processed, this
 * thread is done */
MT_lock_unset(data->reader_lock);
-   DEBUG(SQL_BAM, 
+   DEBUG(BAM, 
" No files left to work on; thread 
done\n",
data->thread_id);
return;
@@ -134,7 +134,7 @@ run_process_bam_alignments(void *d)
(*data->cur_file) += 1;
bw = >bws[*data->cur_file];
MT_lock_unset(data->reader_lock);
-   DEBUG(SQL_BAM, 
+   DEBUG(BAM, 
" Processing alignments of file '%s' (file 
id " LLFMT ")\n", 
data->thread_id, bw->file_location, bw->file_id);
 
@@ -153,7 +153,7 @@ run_process_bam_alignments(void *d)
return;
}
 
-   DEBUG(SQL_BAM, 
+   DEBUG(BAM, 
" All alignments in file '%s' (file id " 
LLFMT ") processed!\n", 
data->thread_id, bw->file_location, bw->file_id);
}
@@ -187,7 +187,7 @@ bam_loader(Client cntxt, MalBlkPtr mb, s
int i, errnr;
str msg = MAL_SUCCEED;
 
-   DEBUG(SQL_BAM, "Loader started for %d BAM file%s\n", nr_files, 
(nr_files != 1 ? "s" : ""));
+   DEBUG(BAM, "Loader started for %d BAM file%s\n", nr_files, (nr_files != 
1 ? "s" : ""));
 
/* Check sanity of input */
if (dbschema != 0 && dbschema != 1) {
@@ -222,7 +222,7 @@ bam_loader(Client cntxt, MalBlkPtr mb, s
goto cleanup;
 
/* Get next file id from files table */
-   DEBUG(SQL_BAM, "Retrieving next file id\n");
+   DEBUG(BAM, "Retrieving next file id\n");
if ((msg = next_file_id(m, files_table, _file_id)) != MAL_SUCCEED) {
goto cleanup;
}
@@ -240,7 +240,7 @@ bam_loader(Client cntxt, MalBlkPtr mb, s
 
for (i = 0; i < nr_files; ++i) {
int fln = strlen(filenames[i]);
-   DEBUG(SQL_BAM, "Initializing BAM wrapper for file '%s'\n", 
filenames[i]);
+   DEBUG(BAM, "Initializing BAM wrapper for file '%s'\n", 
filenames[i]);
if ((msg =
 init_bam_wrapper(bws + i, (IS_BAM(filenames[i], fln) ? 
BAM : SAM),
  filenames[i], cur_file_id++, 
dbschema)) != MAL_SUCCEED) {
@@ -250,7 +250,7 @@ bam_loader(Client cntxt, MalBlkPtr mb, s
 
/* Parse all headers */
for (i = 0; i < nr_files; ++i) {
-   DEBUG(SQL_BAM, "Parsing header for file '%s'\n",
+   DEBUG(BAM, "Parsing header for file '%s'\n",
   filenames[i]);
if ((msg = process_header(bws + i)) != MAL_SUCCEED) {
goto cleanup;
@@ -262,7 +262,7 @@ bam_loader(Client cntxt, MalBlkPtr mb, s
 * QNAME */
if (dbschema == 1) {
for (i = 0; i < nr_files; ++i) {
-   DEBUG(SQL_BAM, "Checking sortedness for BAM file 
'%s'\n", filenames[i]);
+   DEBUG(BAM, "Checking sortedness for BAM file 

MonetDB: mosaic - Update TODO's.

2019-11-06 Thread Aris Koning
Changeset: b95e01e84897 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b95e01e84897
Modified Files:
monetdb5/modules/mosaic/TODO_MOSAIC.txt
Branch: mosaic
Log Message:

Update TODO's.


diffs (27 lines):

diff --git a/monetdb5/modules/mosaic/TODO_MOSAIC.txt 
b/monetdb5/modules/mosaic/TODO_MOSAIC.txt
--- a/monetdb5/modules/mosaic/TODO_MOSAIC.txt
+++ b/monetdb5/modules/mosaic/TODO_MOSAIC.txt
@@ -1,11 +1,13 @@
 technical depth
-Test null semantics
-mosaic.select (c,nil:any_1, nil:any_1,true,true,(true|false)) is not working 
correctly: should result in c == nil or c!=nil(anti).
+null semantics plus tests
+make sure candidate lists are working properly for select, theta_select and 
join
 Use bit vectors more aggressively in mosaic_delta --- then resolve test 
mosaic_delta_timestamp --- and possibly other compression techniques as well.
 Be sure alignment is correct. Use asserts for this.
+consider packing mosaic_block_header's more efficiently.
 Check MOSanalysis and its test.
 Fix/check/test MOSlayout.
 Add test for float/double
+Add test for huge
 delta compression: check if the hardcoded compression expression are correct. 
See also (2)
 Add asserts on type degeneration for bit => bte daytime => lng timestmap => 
lng date => int.
 See if we can re-introduce landmark stuff somehow.
@@ -15,7 +17,6 @@ benchmark
 Update copyright.
 create dedicated type for bitvector internal type which is currently unsignned 
int. E.g. introduce #define BitVectorChunkType unsigned int.
 move mask, bits, framebits from  MosaicHdr to MosaicBlkHeader_frame_t.
-mosaic_prefix.c: prefix code does not use macro's
 mosaic_delta.c: improve the macro's: for instance get rid of hardcoded 
expression arguments in DELTAcompress. (2*)
 mosaic_.c: for type macro's use macro-wised inline functions.
 Improve the administration of the various hard coded compression techniques. 
(2*)
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mosaic - Remove redundant flag set.

2019-11-06 Thread Aris Koning
Changeset: c05c3069198b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c05c3069198b
Modified Files:
monetdb5/modules/mosaic/mosaic_frame.c
Branch: mosaic
Log Message:

Remove redundant flag set.


diffs (11 lines):

diff --git a/monetdb5/modules/mosaic/mosaic_frame.c 
b/monetdb5/modules/mosaic/mosaic_frame.c
--- a/monetdb5/modules/mosaic/mosaic_frame.c
+++ b/monetdb5/modules/mosaic/mosaic_frame.c
@@ -172,7 +172,6 @@ do {\
MosaicBlkHeader_frame_t parameters;\
determineFrameParameters(parameters, src, limit, TPE, DELTA_TPE);\
assert(parameters.base.cnt > 0);/*Should always compress.*/\
-   current->is_applicable = true;\
current->uncompressed_size += (BUN) (parameters.base.cnt * 
sizeof(TPE));\
current->compressed_size += 
wordaligned(sizeof(MosaicBlkHeader_frame_t), lng) + 
wordaligned((parameters.base.cnt * parameters.bits) / CHAR_BIT, lng);\
current->compression_strategy.cnt = (unsigned int) parameters.base.cnt;\
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mosaic - Introduce nil semantics for prefix compression:

2019-11-06 Thread Aris Koning
Changeset: c2bd6373d3cd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c2bd6373d3cd
Added Files:
monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.prefix.MAL.py
monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.prefix.options5
monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.prefix.stable.err
monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.prefix.stable.out
monetdb5/modules/mosaic/Tests/mosaic_date_with_nills_1.prefix.MAL.py
monetdb5/modules/mosaic/Tests/mosaic_date_with_nills_1.prefix.options5
monetdb5/modules/mosaic/Tests/mosaic_date_with_nills_1.prefix.stable.err
monetdb5/modules/mosaic/Tests/mosaic_date_with_nills_1.prefix.stable.out
monetdb5/modules/mosaic/Tests/mosaic_lng_with_nills_1.prefix.MAL.py
monetdb5/modules/mosaic/Tests/mosaic_lng_with_nills_1.prefix.options5
monetdb5/modules/mosaic/Tests/mosaic_lng_with_nills_1.prefix.stable.err
monetdb5/modules/mosaic/Tests/mosaic_lng_with_nills_1.prefix.stable.out
monetdb5/modules/mosaic/Tests/mosaic_oid_with_nills_1.prefix.MAL.py
monetdb5/modules/mosaic/Tests/mosaic_oid_with_nills_1.prefix.options5
monetdb5/modules/mosaic/Tests/mosaic_oid_with_nills_1.prefix.stable.err
monetdb5/modules/mosaic/Tests/mosaic_oid_with_nills_1.prefix.stable.out

monetdb5/modules/mosaic/Tests/mosaic_timestamp_with_nills_1.prefix.MAL.py

monetdb5/modules/mosaic/Tests/mosaic_timestamp_with_nills_1.prefix.options5

monetdb5/modules/mosaic/Tests/mosaic_timestamp_with_nills_1.prefix.stable.err

monetdb5/modules/mosaic/Tests/mosaic_timestamp_with_nills_1.prefix.stable.out
Modified Files:
monetdb5/modules/mosaic/Tests/All
monetdb5/modules/mosaic/mosaic.c
monetdb5/modules/mosaic/mosaic_prefix.c
monetdb5/modules/mosaic/mosaic_prefix.h
Branch: mosaic
Log Message:

Introduce nil semantics for prefix compression:
Major clean up of prefix compression code along the way.


diffs (truncated from 12238 to 300 lines):

diff --git a/monetdb5/modules/mosaic/Tests/All 
b/monetdb5/modules/mosaic/Tests/All
--- a/monetdb5/modules/mosaic/Tests/All
+++ b/monetdb5/modules/mosaic/Tests/All
@@ -86,3 +86,8 @@ mosaic_lng_1.prefix
 mosaic_oid_1.prefix
 mosaic_date_1.prefix
 mosaic_timestamp_1.prefix
+mosaic_bit_with_nills_1.prefix
+mosaic_lng_with_nills_1.prefix
+mosaic_oid_with_nills_1.prefix
+mosaic_date_with_nills_1.prefix
+mosaic_timestamp_with_nills_1.prefix
diff --git a/monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.frame.MAL.py 
b/monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.prefix.MAL.py
copy from monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.frame.MAL.py
copy to monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.prefix.MAL.py
diff --git 
a/monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.frame.options5 
b/monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.prefix.options5
copy from monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.frame.options5
copy to monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.prefix.options5
diff --git 
a/monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.frame.stable.err 
b/monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.prefix.stable.err
copy from monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.frame.stable.err
copy to monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.prefix.stable.err
--- a/monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.frame.stable.err
+++ b/monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.prefix.stable.err
@@ -1,4 +1,4 @@
-stderr of test 'mosaic_bit_with_nills_1.frame` in directory 
'monetdb5/modules/mosaic` itself:
+stderr of test 'mosaic_bit_with_nills_1.prefix` in directory 
'monetdb5/modules/mosaic` itself:
 
 
 # 13:33:23 >  
diff --git 
a/monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.frame.stable.out 
b/monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.prefix.stable.out
copy from monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.frame.stable.out
copy to monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.prefix.stable.out
--- a/monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.frame.stable.out
+++ b/monetdb5/modules/mosaic/Tests/mosaic_bit_with_nills_1.prefix.stable.out
@@ -1,4 +1,4 @@
-stdout of test 'mosaic_bit_with_nills_1.frame` in directory 
'monetdb5/modules/mosaic` itself:
+stdout of test 'mosaic_bit_with_nills_1.prefix` in directory 
'monetdb5/modules/mosaic` itself:
 
 
 # 16:26:45 >  
@@ -16,614 +16,609 @@ stdout of test 'mosaic_bit_with_nills_1.
 # Listening for connection requests on mapi:monetdb://aris-XPS-13-9380:34578/
 # Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-26512/.s.monetdb.34578
 # MonetDB/SQL module loaded
-
-# 16:26:45 >  
-# 16:26:45 >  "mclient" "-lmal" "-ftest" "-tnone" "-Eutf-8" 
"--host=/var/tmp/mtest-26512" "--port=34578"
-# 16:26:45 >  
-

MonetDB: mosaic - Fix thetaselect for dictionary techniques

2019-11-06 Thread Aris Koning
Changeset: 7519839484d9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7519839484d9
Modified Files:
monetdb5/modules/mosaic/mosaic_capped.c
monetdb5/modules/mosaic/mosaic_var.c
Branch: mosaic
Log Message:

Fix thetaselect for dictionary techniques


diffs (30 lines):

diff --git a/monetdb5/modules/mosaic/mosaic_capped.c 
b/monetdb5/modules/mosaic/mosaic_capped.c
--- a/monetdb5/modules/mosaic/mosaic_capped.c
+++ b/monetdb5/modules/mosaic/mosaic_capped.c
@@ -597,9 +597,9 @@ MOSselect_capped(MOStask task, void *low
if ( strcmp(oper,"==") == 0){\
hgh= low= *(TPE*) val;\
} \
-   for( ; first < last; first++){\
+   for(int i=0 ; first < last; first++, i++){\
MOSskipit();\
-   j= getBitVector(base, first, bits); \
+   j= getBitVector(base, i, bits); \
if( (is_nil(TPE, low) || dict[j] >= low) && (dict[j] <= hgh || 
is_nil(TPE, hgh)) ){\
if ( !anti) {\
*o++ = (oid) first;\
diff --git a/monetdb5/modules/mosaic/mosaic_var.c 
b/monetdb5/modules/mosaic/mosaic_var.c
--- a/monetdb5/modules/mosaic/mosaic_var.c
+++ b/monetdb5/modules/mosaic/mosaic_var.c
@@ -489,9 +489,9 @@ MOSselect_var(MOStask task, void *low, v
if ( strcmp(oper,"==") == 0){\
hgh= low= *(TPE*) val;\
} \
-   for( ; first < last; first++){\
+   for(int i=0 ; first < last; first++, i++){\
MOSskipit();\
-   j= getBitVector(base,first,bits); \
+   j= getBitVector(base,i,bits); \
if( (is_nil(TPE, low) || dict[j] >= low) && (dict[j] <= hgh || 
is_nil(TPE, hgh)) ){\
if ( !anti) {\
*o++ = (oid) first;\
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: tracer - Added GDKtracer to mal_factory, mal_parser & wlc

2019-11-06 Thread Thodoris Zois
Changeset: bfc52bd56da8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bfc52bd56da8
Modified Files:
gdk/gdk_tracer.h
monetdb5/mal/mal_factory.c
monetdb5/mal/mal_factory.h
monetdb5/mal/mal_parser.c
monetdb5/modules/mal/wlc.c
monetdb5/modules/mal/wlc.h
Branch: tracer
Log Message:

Added GDKtracer to mal_factory, mal_parser & wlc


diffs (198 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -58,6 +58,10 @@ typedef enum {
MAL_SESSION,
MAL_INTERPRETER,
MAL_SCHEDULER,
+   MAL_LISTING,
+   MAL_FACTORY,
+   MAL_PARSER,
+   MAL_WLC,
 
// GDK
GDK_ALL,
diff --git a/monetdb5/mal/mal_factory.c b/monetdb5/mal/mal_factory.c
--- a/monetdb5/mal/mal_factory.c
+++ b/monetdb5/mal/mal_factory.c
@@ -19,6 +19,7 @@
 #include "mal_session.h"
 #include "mal_namespace.h"
 #include "mal_private.h"
+#include "gdk_tracer.h"
 
 typedef struct {
int id; /* unique plant number */
@@ -62,9 +63,8 @@ runFactory(Client cntxt, MalBlkPtr mb, M
char cmd;
str msg;
 
-#ifdef DEBUG_MAL_FACTORY
-   fprintf(stderr, "#factoryMgr called\n");
-#endif
+   DEBUG(MAL_FACTORY, "Enter runFactory\n");
+
/* the lookup can be largely avoided by handing out the index
   upon factory definition. todo
Alternative is to move them to the front
@@ -275,9 +275,7 @@ yieldResult(MalBlkPtr mb, InstrPtr p, in
if( pl->env == NULL)
return(int) (pl-plants);
for (i = 0; i < p->retc; i++) {
-#ifdef DEBUG_MAL_FACTORY
-   fprintf(stderr,"#lhs %d rhs %d\n", 
getArg(pl->pci, i), getArg(p, i));
-#endif
+   DEBUG(MAL_FACTORY, "lhs %d rhs %d\n", 
getArg(pl->pci, i), getArg(p, i));
rhs = >stk->stk[getArg(p, i)];
lhs = >env->stk[getArg(pl->pci, i)];
if (VALcopy(lhs, rhs) == NULL)
diff --git a/monetdb5/mal/mal_factory.h b/monetdb5/mal/mal_factory.h
--- a/monetdb5/mal/mal_factory.h
+++ b/monetdb5/mal/mal_factory.h
@@ -9,8 +9,6 @@
 #ifndef _MAL_FACTORY_H
 #define _MAL_FACTORY_H
 
-/* #define DEBUG_MAL_FACTORY  */
-
 #include "mal.h"
 #include "mal_client.h"
 
diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -21,6 +21,7 @@
 #include "mal_builder.h"
 #include "mal_type.h"
 #include "mal_private.h"
+#include "gdk_tracer.h"
 
 #define FATALINPUT MAXERRORS+1
 #define NL(X) ((X)=='\n' || (X)=='\r')
@@ -991,9 +992,7 @@ parseModule(Client cntxt)
// ignore this module definition
} else 
if( getModule(modnme) == NULL){
-#ifdef _DEBUG_PARSER_
-   fprintf(stderr,"Module create %s\n",modnme);
-#endif
+   DEBUG(MAL_PARSER, "Module create %s\n", modnme);
if( globalModule(modnme) == NULL)
parseError(cntxt," could not be created");
}
diff --git a/monetdb5/modules/mal/wlc.c b/monetdb5/modules/mal/wlc.c
--- a/monetdb5/modules/mal/wlc.c
+++ b/monetdb5/modules/mal/wlc.c
@@ -162,8 +162,7 @@
 #include 
 #include "mal_builder.h"
 #include "wlc.h"
-
-#undef _WLC_DEBUG_
+#include "gdk_tracer.h"
 
 MT_Lock wlc_lock = MT_LOCK_INITIALIZER("wlc_lock");
 
@@ -295,7 +294,7 @@ WLCsetlogger(void)
wlc_fd = open_wastream(path);
if( wlc_fd == 0){
MT_lock_unset(_lock);
-   fprintf(stderr, "wlc.logger:Could not create %s\n",path);
+   ERROR(M_ALL, "Cloud not create: %s\n", path);
throw(MAL,"wlc.logger","Could not create %s\n",path);
}
 
@@ -366,7 +365,7 @@ WLClogger(void *arg)
if( wlc_dir[0] && wlc_fd ){
MT_lock_set(_lock);
if((msg = WLCcloselogger()) != MAL_SUCCEED) {
-   fprintf(stderr, "%s",msg);
+   ERROR(M_ALL, "%s\n", msg);
freeException(msg);
}
MT_lock_unset(_lock);
@@ -402,10 +401,10 @@ WLCinit(void)
 
msg =  WLCgetConfig();
if( msg)
-   fprintf(stderr, "%s",msg);
+   INFO(MAL_ALL, "%s\n", msg);
if (MT_create_thread(_logger, WLClogger , (void*) 0,
 MT_THR_DETACHED, 
"WLClogger") < 0) {
-   fprintf(stderr, "wlc.logger thread could not be 
spawned");
+   ERROR(M_ALL, "Thread could not be spawned\n");
}
}
return MAL_SUCCEED;
@@ -552,19 +551,18 @@ static str
 WLCpreparewrite(Client 

MonetDB: Nov2019 - Fix for bug 6783 on Windows. Added missing '%...

2019-11-06 Thread Pedro Ferreira
Changeset: fbdb41cd5249 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fbdb41cd5249
Modified Files:
monetdb5/modules/atoms/strptime.c
Branch: Nov2019
Log Message:

Fix for bug 6783 on Windows. Added missing '%s' case at Windows port of 
strptime function


diffs (26 lines):

diff --git a/monetdb5/modules/atoms/strptime.c 
b/monetdb5/modules/atoms/strptime.c
--- a/monetdb5/modules/atoms/strptime.c
+++ b/monetdb5/modules/atoms/strptime.c
@@ -296,6 +296,22 @@ literal:
if (!(strptime_conv_num(, >tm_sec, 0, 
61)))
return NULL;
break;
+   case 's': /* number of seconds since epoch */
+   LEGAL_ALT(ALT_O);
+   {
+   time_t secs = 0;
+   if (*bp < '0' || *bp > '9') /* at least 
one digit */
+   return NULL;
+
+   do {
+   secs *= 10;
+   secs += *bp++ - '0';
+   } while (*bp >= '0' && *bp <= '9');
+
+   /* convert the number of seconds to tm 
structure */
+   if (localtime_s(tm, ))
+   return NULL;
+   } break;
case 'U':   /* The week of year, beginning on 
sunday. */
case 'W':   /* The week of year, beginning on 
monday. */
LEGAL_ALT(ALT_O);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


monetdb-java: default - Remove catch code from finally part wher...

2019-11-06 Thread Martin van Dinther
Changeset: 45155894aece for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=45155894aece
Modified Files:
src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
Branch: default
Log Message:

Remove catch code from finally part where original timeout is reset on server.
Simplify code: stmt.getQueryTimeout() always returns this.lastSetQueryTimeout 
so use it directly.


diffs (42 lines):

diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java 
b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
@@ -1297,11 +1297,10 @@ public class MonetConnection
Statement stmt = null;
ResultSet rs = null;
boolean isValid = false;
-   int original_timeout = 0;
+   final int original_timeout = this.lastSetQueryTimeout;
try {
stmt = createStatement();
if (stmt != null) {
-   original_timeout = stmt.getQueryTimeout();
if (timeout > 0 && original_timeout != timeout) 
{
// we need to change the requested 
timeout for this test query
stmt.setQueryTimeout(timeout);
@@ -1322,20 +1321,17 @@ public class MonetConnection
}
/* ignore stmt errors/exceptions, we are only testing 
if the connection is still alive and usable */
} finally {
-   /* restore the original server timeout value, whenever 
an Exception has occurred or not */
-   if (timeout > 0 && original_timeout != timeout) {
+   /* when changed, reset the original server timeout 
value on the server */
+   if (timeout > 0 && original_timeout != 
this.lastSetQueryTimeout) {
+   this.lastSetQueryTimeout = original_timeout;
Statement stmt2 = null;
-   this.lastSetQueryTimeout = original_timeout;
try {
/* we have to set in the server 
explicitly, because the test 'queryTimeout != connection.lastSetQueryTimeout' 
-  on 'internalExecute' won't pass and 
the server won't be set back */
+  on 
MonetStatement.internalExecute(sql) won't pass and the server won't be set back 
*/
stmt2 = this.createStatement();
stmt2.execute("CALL 
\"sys\".\"settimeout\"(" + this.lastSetQueryTimeout + ")");
} catch (SQLException se) {
-   String msg = se.getMessage();
-   if (msg != null && 
msg.equalsIgnoreCase("Current transaction is aborted (please ROLLBACK)")) {
-   isValid = true;
-   }
+   /* ignore stmt errors/exceptions, we 
are only testing if the connection is still alive and usable */
} finally {
closeResultsetStatement(null, stmt2);
}
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: tracer - Removed DEBUG_GEOM directive

2019-11-06 Thread Thodoris Zois
Changeset: dc010fa32a4b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dc010fa32a4b
Modified Files:
geom/monetdb5/geom.c
geom/monetdb5/geom.h
Branch: tracer
Log Message:

Removed DEBUG_GEOM directive


diffs (50 lines):

diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -904,9 +904,8 @@ segmentizeLineString(GEOSGeometry **outG
 
//compute the distance of the current point to the last added 
one
while ((dist = sqrt(pow(xl - xCoords_org[i], 2) + pow(yl - 
yCoords_org[i], 2) + pow(zl - zCoords_org[i], 2))) > sz) {
-#ifdef DEBUG_GEOM
DEBUG(GEOM, "Old : (%f, %f, %f) vs (%f, %f, %f) = 
%f\n", xl, yl, zl, xCoords_org[i], yCoords_org[i], zCoords_org[i], dist);
-#endif
+
additionalPoints++;
//compute the point
xl = xl + (xCoords_org[i] - xl) * sz / dist;
@@ -954,10 +953,8 @@ segmentizeLineString(GEOSGeometry **outG
//compute the distance of the current point to the last added 
one
double dist;
while ((dist = sqrt(pow(xl - xCoords_org[i], 2) + pow(yl - 
yCoords_org[i], 2) + pow(zl - zCoords_org[i], 2))) > sz) {
-
-#ifdef DEBUG_GEOM
DEBUG(GEOM, "Old: (%f, %f, %f) vs (%f, %f, %f) = %f\n", 
xl, yl, zl, xCoords_org[i], yCoords_org[i], zCoords_org[i], dist);
-#endif
+   
assert(j < additionalPoints);
 
//compute intermediate point
@@ -2397,11 +2394,7 @@ wkbAsBinary(char **toStr, wkb **geomWKB)
*s++ = hexit[val];
val = (*geomWKB)->data[i] & 0xf;
*s++ = hexit[val];
-
-   #ifdef DEBUG_GEOM
DEBUG(GEOM, "%d: First: %c - Second: %c ==> Original %c 
(%d)\n", i, *(s-2), *(s-1), (*geomWKB)->data[i], (int)((*geomWKB)->data[i]));
-   #endif
-
}
*s = '\0';
return MAL_SUCCEED;
diff --git a/geom/monetdb5/geom.h b/geom/monetdb5/geom.h
--- a/geom/monetdb5/geom.h
+++ b/geom/monetdb5/geom.h
@@ -35,8 +35,6 @@
 #define geom_export extern
 #endif
 
-/* #define DEBUG_GEOM */
-
 /* general functions */
 geom_export str geoHasZ(int* res, int* info);
 geom_export str geoHasM(int* res, int* info);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: tracer - Added GDKtracer to mal_session & mal_interpreter

2019-11-06 Thread Thodoris Zois
Changeset: a77c3d49fb66 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a77c3d49fb66
Modified Files:
gdk/gdk_tracer.h
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_session.c
monetdb5/scheduler/run_memo.c
Branch: tracer
Log Message:

Added GDKtracer to mal_session & mal_interpreter


diffs (157 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -54,7 +54,11 @@ typedef enum {
// MAL
MAL_ALL,
MAL_MEMORUN,
-   
+   MAL_SESSION,
+   MAL_PAR,
+   MAL_INTERPRETER,
+   MAL_SCHEDULER,
+
// GDK
GDK_ALL,
GDK_LOGGER
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -18,6 +18,7 @@
 #include "mal_debugger.h"   /* for mdbStep() */
 #include "mal_type.h"
 #include "mal_private.h"
+#include "gdk_tracer.h"
 
 static lng qptimeout = 0; /* how often we print still running queries (usec) */
 
@@ -389,10 +390,11 @@ callMAL(Client cntxt, MalBlkPtr mb, MalS
InstrPtr pci = getInstrPtr(mb, 0);
 
cntxt->lastcmd= time(0);
-#ifdef DEBUG_CALLMAL
-   fprintf(stderr, "callMAL\n");
-   fprintInstruction(stderr, mb, 0, pci, LIST_MAL_ALL);
-#endif
+   DEBUG(MAL_INTERPRETER, "Enter callMAL\n");
+   /* CHECK */
+   // Remove from comments
+   // fprintInstruction(mb, 0, pci, LIST_MAL_ALL);
+
switch (pci->token) {
case FUNCTIONsymbol:
case FCNcall:
@@ -568,10 +570,10 @@ str runMALsequence(Client cntxt, MalBlkP
 * time and print the query */
if (ATOMIC_CAS(>lastprint, , t)) {
const char *q = cntxt->getquery ? 
cntxt->getquery(cntxt) : NULL;
-   fprintf(stderr, "#%s: query already 
running "LLFMT"s: %.200s\n",
-   cntxt->mythread->name,
-   (lng) (time(0) - 
cntxt->lastcmd),
-   q ? q : "");
+   INFO(MAL_ALL, "%s: query already 
running "LLFMT"s: %.200s\n",
+   cntxt->mythread->name,
+   (lng) (time(0) - 
cntxt->lastcmd),
+   q ? q : "");
}
}
}
@@ -867,7 +869,7 @@ str runMALsequence(Client cntxt, MalBlkP
bat bid = stk->stk[a].val.bval;
 
if (garbage[i] >= 0) {
-   PARDEBUG 
fprintf(stderr, "#GC pc=%d bid=%d %s done\n", stkpc, bid, getVarName(mb, 
garbage[i]));
+   DEBUG(MAL_PAR, "GC 
pc=%d bid=%d %s done\n", stkpc, bid, getVarName(mb, garbage[i]));
bid = 
stk->stk[garbage[i]].val.bval;

stk->stk[garbage[i]].val.bval = bat_nil;
BBPrelease(bid);
diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -19,6 +19,7 @@
 #include "msabaoth.h"
 #include "mal_private.h"
 #include "gdk.h"   /* for opendir and friends */
+#include "gdk_tracer.h"
 
 /*
  * The MonetDB server uses a startup script to boot the system.
@@ -101,13 +102,13 @@ MSresetClientPrg(Client cntxt, str mod, 
p->argc = 1;
p->argv[0] = 0;
 
-#ifdef _DEBUG_SESSION_
-   fprintf(stderr,"reset sym %s %s to %s, id %d\n", 
-   cntxt->curprg->name, getFunctionId(p), nme, 
findVariable(mb,nme) );
-   fprintf(stderr,"vtop %d\n", mb->vtop);
+   /* CHECK */
+   // nme variable is missing?
+   // DEBUG(MAL_SESSION, "Reset sym '%s %s' to '%s', id %d\n", 
cntxt->curprg->name, getFunctionId(p), nme, findVariable(mb, nme));
+   
+   DEBUG(MAL_SESSION, "vtop: %d\n", mb->vtop);
if( mb->vtop)
-   fprintf(stderr,"first var %s\n", mb->var[0].id);
-#endif
+   DEBUG(MAL_SESSION, "First variable: %s\n", mb->var[0].id);
 
setModuleId(p, mod);
setFunctionId(p, fcn);
@@ -287,7 +288,7 @@ MSscheduleClient(str command, str challe
if (err != NULL) {
/* this is kind of awful, but we need to get 
rid of this
 * message */
-   fprintf(stderr, "!msab_getMyStatus: %s\n", err);
+   

MonetDB: tracer - Renamed component MAL_PAR to PAR

2019-11-06 Thread Thodoris Zois
Changeset: bedeefadfd02 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bedeefadfd02
Modified Files:
gdk/gdk_tracer.h
monetdb5/mal/mal_interpreter.c
Branch: tracer
Log Message:

Renamed component MAL_PAR to PAR


diffs (31 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -27,6 +27,7 @@ typedef enum {
// ALL
M_ALL,
ALLOC,
+   PAR,
GEOM,

// SQL
@@ -55,7 +56,6 @@ typedef enum {
MAL_ALL,
MAL_MEMORUN,
MAL_SESSION,
-   MAL_PAR,
MAL_INTERPRETER,
MAL_SCHEDULER,
 
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -869,7 +869,7 @@ str runMALsequence(Client cntxt, MalBlkP
bat bid = stk->stk[a].val.bval;
 
if (garbage[i] >= 0) {
-   DEBUG(MAL_PAR, "GC 
pc=%d bid=%d %s done\n", stkpc, bid, getVarName(mb, garbage[i]));
+   DEBUG(PAR, "GC pc=%d 
bid=%d %s done\n", stkpc, bid, getVarName(mb, garbage[i]));
bid = 
stk->stk[garbage[i]].val.bval;

stk->stk[garbage[i]].val.bval = bat_nil;
BBPrelease(bid);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: tracer - Added GDKtracer to MAL scheduler

2019-11-06 Thread Thodoris Zois
Changeset: 75d66e7893de for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=75d66e7893de
Modified Files:
gdk/gdk_tracer.h
monetdb5/scheduler/run_memo.c
monetdb5/scheduler/run_pipeline.c
monetdb5/scheduler/run_pipeline.h
Branch: tracer
Log Message:

Added GDKtracer to MAL scheduler


diffs (95 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -53,7 +53,8 @@ typedef enum {
 
// MAL
MAL_ALL,
-
+   MAL_MEMORUN,
+   
// GDK
GDK_ALL,
GDK_LOGGER
diff --git a/monetdb5/scheduler/run_memo.c b/monetdb5/scheduler/run_memo.c
--- a/monetdb5/scheduler/run_memo.c
+++ b/monetdb5/scheduler/run_memo.c
@@ -96,6 +96,7 @@
 #include "monetdb_config.h"
 #include "run_memo.h"
 #include "mal_runtime.h"
+#include "gdk_tracer.h"
 
 static void
 propagateNonTarget(MalBlkPtr mb, int pc)
@@ -175,11 +176,10 @@ RUNchoice(Client cntxt, MalBlkPtr mb, Ma
 
}
}
-#ifdef DEBUG_RUN_MEMORUN
-   fprintf(stderr, "#function target %s cost %d\n", getVarName(mb, 
target), mincost);
-#else
+
+   DEBUG(MAL_MEMORUN, "Function target '%s' cost: %lld\n", getVarName(mb, 
target), mincost);
(void) cntxt;
-#endif
+
/* remove non-qualifying variables */
for (i = 2; i < p->argc; i += 2)
if (getArg(p, i) != target) {
@@ -188,11 +188,13 @@ RUNchoice(Client cntxt, MalBlkPtr mb, Ma
}
 
propagateNonTarget(mb, pc + 1);
-#ifdef DEBUG_RUN_MEMORUN
-   fprintf(stderr, "#cost choice selected %s %d\n",
-   getVarName(mb, target), mincost);
-   fprintFunction(stderr, mb, 1);
-#endif
+
+   DEBUG(MAL_MEMORUN, "Cost choice selected: %s %lld\n", getVarName(mb, 
target), mincost);
+   /* CHECK */
+   // Uncomment this line below!
+   // fprintFunction(mb, stk, 1);
+
+
return MAL_SUCCEED;
 }
 /*
diff --git a/monetdb5/scheduler/run_pipeline.c 
b/monetdb5/scheduler/run_pipeline.c
--- a/monetdb5/scheduler/run_pipeline.c
+++ b/monetdb5/scheduler/run_pipeline.c
@@ -128,6 +128,7 @@
 #include "mal_interpreter.h"   /* for showErrors() */
 #include "opt_prelude.h"
 #include "opt_macro.h"
+#include "gdk_tracer.h"
 
 /*
  * The implementation approach of the scheduler aligns with that of the
@@ -212,10 +213,9 @@ RUNsqlbind(Client cntxt, MalBlkPtr mb, M
p->token = NOOPsymbol;
}
}
-#ifdef DEBUG_MAL_SCHEDULER
-   fprintf(stderr, "scheduler.sqlbind results\n");
-   fprintFunction(stderr, mb, stk, LIST_MAL_ALL);
-#endif
+
+   DEBUG(MAL_SCHEDULER, "Results from scheduler.sqlbind");
+   fprintFunction(mb, stk, LIST_MAL_ALL);
return msg;
 }
 #endif
diff --git a/monetdb5/scheduler/run_pipeline.h 
b/monetdb5/scheduler/run_pipeline.h
--- a/monetdb5/scheduler/run_pipeline.h
+++ b/monetdb5/scheduler/run_pipeline.h
@@ -12,8 +12,6 @@
 #include "mal_instruction.h"
 #include "mal_client.h"
 
-#define DEBUG_MAL_SCHEDULER
-
 #ifdef HAVE_SYS_TIMES_H
 # include 
 #endif
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: tracer - Added GDKtracer to geom

2019-11-06 Thread Thodoris Zois
Changeset: c778bf1f516f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c778bf1f516f
Modified Files:
gdk/gdk_tracer.h
geom/lib/libgeom.c
geom/monetdb5/geom.c
geom/monetdb5/geom.h
Branch: tracer
Log Message:

Added GDKtracer to geom


diffs (105 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -27,6 +27,7 @@ typedef enum {
// ALL
M_ALL,
ALLOC,
+   GEOM,

// SQL
SQL_ALL,
diff --git a/geom/lib/libgeom.c b/geom/lib/libgeom.c
--- a/geom/lib/libgeom.c
+++ b/geom/lib/libgeom.c
@@ -15,6 +15,7 @@
 
 #include "monetdb_config.h"
 #include "libgeom.h"
+#include "gdk_tracer.h"
 
 #include 
 
@@ -193,18 +194,14 @@ geom_type2str(int t, int flag)
 str
 geomerty_2_geometry(wkb *res, wkb **geom, int *columnType, int *columnSRID, 
int *valueSRID)
 {
-
//char* geomStr;
//size_t len = 0;
-   //fprintf(stderr, "geometry_2_geometry\n");
+   DEBUG(GEOM, "Enter geometry_2_geometry\n");
//wkbTOSTR(, , *geom);
if (*geom != NULL)
-   fprintf(stderr, "type:%d - wkbTOSTR cannot be seen at this 
point\n", *columnType);
+   DEBUG(GEOM, "Type: %d - wkbTOSTR cannot be seen at this 
point\n", *columnType);
 
-   if (res == NULL)
-   fprintf(stderr, "-> ");
-
-   fprintf(stderr, "%d vs %d\n", *columnSRID, *valueSRID);
+   DEBUG(GEOM, "%s %d vs %d\n", res == NULL ? "->" : "", *columnSRID, 
*valueSRID);
return "0";
 }
 */
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -904,7 +904,9 @@ segmentizeLineString(GEOSGeometry **outG
 
//compute the distance of the current point to the last added 
one
while ((dist = sqrt(pow(xl - xCoords_org[i], 2) + pow(yl - 
yCoords_org[i], 2) + pow(zl - zCoords_org[i], 2))) > sz) {
-//fprintf(stderr, "OLD : (%f, %f, %f) vs (%f, %f, %f) = %f\n", xl, yl, zl, 
xCoords_org[i], yCoords_org[i], zCoords_org[i], dist);
+#ifdef DEBUG_GEOM
+   DEBUG(GEOM, "Old : (%f, %f, %f) vs (%f, %f, %f) = 
%f\n", xl, yl, zl, xCoords_org[i], yCoords_org[i], zCoords_org[i], dist);
+#endif
additionalPoints++;
//compute the point
xl = xl + (xCoords_org[i] - xl) * sz / dist;
@@ -917,7 +919,9 @@ segmentizeLineString(GEOSGeometry **outG
zl = zCoords_org[i];
 
}
-//fprintf(stderr, "Adding %u\n", additionalPoints);
+
+   DEBUG(GEOM, "Adding %u\n", additionalPoints);
+
//create the coordinates sequence for the translated geometry
if ((gcs_new = GEOSCoordSeq_create(pointsNum + additionalPoints, 
coordinatesNum)) == NULL) {
*outGeometry = NULL;
@@ -950,7 +954,10 @@ segmentizeLineString(GEOSGeometry **outG
//compute the distance of the current point to the last added 
one
double dist;
while ((dist = sqrt(pow(xl - xCoords_org[i], 2) + pow(yl - 
yCoords_org[i], 2) + pow(zl - zCoords_org[i], 2))) > sz) {
-//fprintf(stderr, "OLD : (%f, %f, %f) vs (%f, %f, %f) = %f\n", xl, yl, zl, 
xCoords_org[i], yCoords_org[i], zCoords_org[i], dist);
+
+#ifdef DEBUG_GEOM
+   DEBUG(GEOM, "Old: (%f, %f, %f) vs (%f, %f, %f) = %f\n", 
xl, yl, zl, xCoords_org[i], yCoords_org[i], zCoords_org[i], dist);
+#endif
assert(j < additionalPoints);
 
//compute intermediate point
@@ -2390,7 +2397,11 @@ wkbAsBinary(char **toStr, wkb **geomWKB)
*s++ = hexit[val];
val = (*geomWKB)->data[i] & 0xf;
*s++ = hexit[val];
-//fprintf(stderr, "%d First: %c - Second: %c ==> Original %c (%d)\n", i, 
*(s-2), *(s-1), (*geomWKB)->data[i], (int)((*geomWKB)->data[i]));
+
+   #ifdef DEBUG_GEOM
+   DEBUG(GEOM, "%d: First: %c - Second: %c ==> Original %c 
(%d)\n", i, *(s-2), *(s-1), (*geomWKB)->data[i], (int)((*geomWKB)->data[i]));
+   #endif
+
}
*s = '\0';
return MAL_SUCCEED;
diff --git a/geom/monetdb5/geom.h b/geom/monetdb5/geom.h
--- a/geom/monetdb5/geom.h
+++ b/geom/monetdb5/geom.h
@@ -35,6 +35,7 @@
 #define geom_export extern
 #endif
 
+/* #define DEBUG_GEOM */
 
 /* general functions */
 geom_export str geoHasZ(int* res, int* info);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: tracer - Reverted store_init(...)

2019-11-06 Thread Thodoris Zois
Changeset: 33ec146f1857 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=33ec146f1857
Modified Files:
sql/server/sql_mvc.c
sql/storage/sql_storage.h
sql/storage/store.c
Branch: tracer
Log Message:

Reverted store_init(...)


diffs (53 lines):

diff --git a/sql/server/sql_mvc.c b/sql/server/sql_mvc.c
--- a/sql/server/sql_mvc.c
+++ b/sql/server/sql_mvc.c
@@ -99,7 +99,6 @@ bailout:
 int
 mvc_init(int debug, store_type store, int ro, int su, backend_stack stk)
 {
-   (void) debug;
int first = 0;
sql_schema *s;
sql_table *t;
@@ -114,7 +113,7 @@ mvc_init(int debug, store_type store, in
return -1;
}
 
-   if ((first = store_init(store, ro, su, stk)) < 0) {
+   if ((first = store_init(debug, store, ro, su, stk)) < 0) {
CRITICAL(ALL, "Unable to create system tables\n");
return -1;
}
diff --git a/sql/storage/sql_storage.h b/sql/storage/sql_storage.h
--- a/sql/storage/sql_storage.h
+++ b/sql/storage/sql_storage.h
@@ -367,7 +367,7 @@ extern res_table *res_tables_remove(res_
 extern void res_tables_destroy(res_table *results);
 extern res_table *res_tables_find(res_table *results, int res_id);
 
-extern int store_init(store_type store, int readonly, int singleuser, 
backend_stack stk);
+extern int store_init(int debug, store_type store, int readonly, int 
singleuser, backend_stack stk);
 extern void store_exit(void);
 
 extern int store_apply_deltas(bool locked);
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -1964,7 +1964,7 @@ store_load(void) {
 }
 
 int
-store_init(store_type store, int readonly, int singleuser, backend_stack stk)
+store_init(int debug, store_type store, int readonly, int singleuser, 
backend_stack stk)
 {
int v = 1;
 
@@ -1990,8 +1990,6 @@ store_init(store_type store, int readonl
break;
}
active_store_type = store;
-   /* CHECK -> Remove debug! */
-   int debug = 0;
if (!logger_funcs.create ||
logger_funcs.create(debug, "sql_logs", CATALOG_VERSION*v) != 
LOG_OK) {
MT_lock_unset(_lock);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


monetdb-java: default - Update name of MonetDB JDBC jar file in ...

2019-11-06 Thread Martin van Dinther
Changeset: 8985d2409c10 for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=8985d2409c10
Modified Files:
tests/SQLcopyinto.java
Branch: default
Log Message:

Update name of MonetDB JDBC jar file in error msg.


diffs (12 lines):

diff --git a/tests/SQLcopyinto.java b/tests/SQLcopyinto.java
--- a/tests/SQLcopyinto.java
+++ b/tests/SQLcopyinto.java
@@ -26,7 +26,7 @@ public class SQLcopyinto {
System.out.println("SQLcopyinto started");
if (args.length == 0) {
System.err.println("Error: missing startup argument: 
the jdbc connection url !");
-   System.err.println("Usage: java -cp 
monetdb-jdbc-2.28.jar:. SQLcopyinto 
\"jdbc:monetdb://localhost:5/demo?user=monetdb=monetdb\"");
+   System.err.println("Usage: java -cp 
monetdb-jdbc-2.29.jre7.jar:. SQLcopyinto 
\"jdbc:monetdb://localhost:5/demo?user=monetdb=monetdb\"");
System.exit(-1);
}
String jdbc_url = args[0];
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: tracer - Added GDK_LOGGER component in tracer

2019-11-06 Thread Thodoris Zois
Changeset: b924647c0de6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b924647c0de6
Modified Files:
gdk/gdk_tracer.h
Branch: tracer
Log Message:

Added GDK_LOGGER component in tracer


diffs (13 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -54,7 +54,8 @@ typedef enum {
MAL_ALL,
 
// GDK
-   GDK_ALL
+   GDK_ALL,
+   GDK_LOGGER
 
   } COMPONENT;
   
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: tracer - Changed message level

2019-11-06 Thread Thodoris Zois
Changeset: deadcfe628d4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=deadcfe628d4
Modified Files:
sql/storage/bat/bat_table.c
Branch: tracer
Log Message:

Changed message level


diffs (12 lines):

diff --git a/sql/storage/bat/bat_table.c b/sql/storage/bat/bat_table.c
--- a/sql/storage/bat/bat_table.c
+++ b/sql/storage/bat/bat_table.c
@@ -259,7 +259,7 @@ table_insert(sql_trans *tr, sql_table *t
va_end(va);
if (n) {
// This part of the code should never get reached  
-   CRITICAL(M_ALL, "Called table_insert(%s) with wrong number of 
args (%d,%d)\n", t->base.name, list_length(t->columns.set), cnt);
+   ERROR(M_ALL, "Called table_insert(%s) with wrong number of args 
(%d,%d)\n", t->base.name, list_length(t->columns.set), cnt);
assert(0);
return LOG_ERR;
}
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Nov2019 - Making truncate statement plans more readable

2019-11-06 Thread Pedro Ferreira
Changeset: 1606744f0f53 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1606744f0f53
Modified Files:
sql/server/rel_dump.c
sql/test/Tests/truncate-statements-extra.sql
sql/test/Tests/truncate-statements-extra.stable.out
Branch: Nov2019
Log Message:

Making truncate statement plans more readable


diffs (187 lines):

diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c
--- a/sql/server/rel_dump.c
+++ b/sql/server/rel_dump.c
@@ -510,8 +510,14 @@ rel_print_(mvc *sql, stream  *fout, sql_
mnstr_printf(fout, "update(");
else if (rel->op == op_delete)
mnstr_printf(fout, "delete(");
-   else if (rel->op == op_truncate)
-   mnstr_printf(fout, "truncate(");
+   else if (rel->op == op_truncate) {
+   assert(list_length(rel->exps) == 2);
+   sql_exp *first = (sql_exp*) rel->exps->h->data, *second 
= (sql_exp*) rel->exps->h->next->data;
+   int restart_sequences = 
((atom*)first->l)->data.val.ival,
+   drop_action = ((atom*)second->l)->data.val.ival;
+   mnstr_printf(fout, "truncate %s identity, %s(", 
restart_sequences ? "restart" : "continue", 
+   
   drop_action ? "cascade" : "restrict");
+   }
 
if (rel_is_ref(rel->l)) {
int nr = find_ref(refs, rel->l);
@@ -530,7 +536,7 @@ rel_print_(mvc *sql, stream  *fout, sql_
}
print_indent(sql, fout, depth, decorate);
mnstr_printf(fout, ")");
-   if (rel->exps)
+   if (rel->op != op_truncate && rel->exps)
exps_print(sql, fout, rel->exps, depth, refs, 1, 0);
}   break;
default:
@@ -1279,15 +1285,27 @@ rel_read(mvc *sql, char *r, int *pos, li
}
 
if (r[*pos] == 't' && r[*pos+1] == 'r' && r[*pos+2] == 'u') {
-   *pos += (int) strlen("truncate");
+   int restart_sequences = 0, drop_action = 0;
+   *pos += (int) strlen("truncate ");
+   if (r[*pos] == 'r') {
+   restart_sequences = 1;
+   *pos += (int) strlen("restart identity, ");
+   } else {
+   *pos += (int) strlen("continue identity, ");
+   }
+   if (r[*pos] == 'c') {
+   drop_action = 1;
+   *pos += (int) strlen("cascade");
+   } else {
+   *pos += (int) strlen("restrict");
+   }
skipWS(r, pos);
(*pos)++; /* ( */
lrel = rel_read(sql, r, pos, refs); /* to be truncated relation 
*/
skipWS(r,pos);
(*pos)++; /* ) */
 
-   /* TODO drop_action and check_identity options */
-   return rel_truncate(sql->sa, lrel, 0, 0);
+   return rel_truncate(sql->sa, lrel, drop_action, 
restart_sequences);
}
 
if (r[*pos] == 'u' && r[*pos+1] == 'p' && r[*pos+2] == 'd') {
diff --git a/sql/test/Tests/truncate-statements-extra.sql 
b/sql/test/Tests/truncate-statements-extra.sql
--- a/sql/test/Tests/truncate-statements-extra.sql
+++ b/sql/test/Tests/truncate-statements-extra.sql
@@ -10,11 +10,13 @@ TRUNCATE testing4; --error
 SELECT a FROM testing4;
 SELECT abc FROM testing5;
 
+PLAN TRUNCATE testing4 RESTRICT;
 TRUNCATE testing4  RESTRICT; --error
 SELECT a FROM testing4;
 SELECT abc FROM testing5;
 
-TRUNCATE testing4  CASCADE;
+PLAN TRUNCATE testing4 CASCADE;
+TRUNCATE testing4 CASCADE;
 SELECT a FROM testing4;
 SELECT abc FROM testing5;
 
@@ -24,16 +26,22 @@ CREATE TABLE testing6 (a INT AUTO_INCREM
 INSERT INTO testing6 (b) VALUES (1);
 INSERT INTO testing6 (b) VALUES (1);
 SELECT a, b FROM testing6;
+
+PLAN TRUNCATE testing6;
 TRUNCATE testing6;
 
 INSERT INTO testing6 (b) VALUES (3);
 INSERT INTO testing6 (b) VALUES (4);
 SELECT a, b FROM testing6;
+
+PLAN TRUNCATE testing6 CONTINUE IDENTITY;
 TRUNCATE testing6 CONTINUE IDENTITY;
 
 INSERT INTO testing6 (b) VALUES (5);
 INSERT INTO testing6 (b) VALUES (6);
 SELECT a, b FROM testing6;
+
+PLAN TRUNCATE testing6 RESTART IDENTITY;
 TRUNCATE testing6 RESTART IDENTITY;
 
 INSERT INTO testing6 (b) VALUES (7);
diff --git a/sql/test/Tests/truncate-statements-extra.stable.out 
b/sql/test/Tests/truncate-statements-extra.stable.out
--- a/sql/test/Tests/truncate-statements-extra.stable.out
+++ b/sql/test/Tests/truncate-statements-extra.stable.out
@@ -82,6 +82,14 @@ stdout of test 'truncate-statements-extr
 % int # type
 % 1 # length
 [ 1]
+#PLAN TRUNCATE testing4 RESTRICT;
+% .plan # table_name
+% rel # name
+% clob # type
+% 87 # length
+truncate continue identity, restrict(
+| table(sys.testing4) [ "testing4"."a" 

MonetDB: Nov2019 - Use bison in bison mode; store generated file...

2019-11-06 Thread Sjoerd Mullender
Changeset: c0dae2eba165 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c0dae2eba165
Modified Files:
NT/rules.msc
buildtools/autogen/autogen/am.py
buildtools/autogen/autogen/msc.py
buildtools/conf/rules.mk
configure.ag
Branch: Nov2019
Log Message:

Use bison in bison mode; store generated files in tar ball.
Instead of working around the yacc compatibility that AC_PROG_YACC
imposes, just use bison properly.  Also, if bison cannot be found,
just reuse the generated files from the tar ball.


diffs (100 lines):

diff --git a/NT/rules.msc b/NT/rules.msc
--- a/NT/rules.msc
+++ b/NT/rules.msc
@@ -186,7 +186,7 @@ libpy3_CFLAGS = -DHAVE_LIBPY3 "-I$(PYTHO
 # PYTHON may be either a version 2 or a version 3
 # here we let %Path% determine which version we get
 PYTHON = python
-YACC = bison
+BISON = bison
 
 ARCHIVER = lib /nologo
 GENDLL =
diff --git a/buildtools/autogen/autogen/am.py b/buildtools/autogen/autogen/am.py
--- a/buildtools/autogen/autogen/am.py
+++ b/buildtools/autogen/autogen/am.py
@@ -150,6 +150,8 @@ def am_find_srcs(target, deps, am, cond)
 am['CLEAN'].append(pf)
 b, ext = split_filename(pf)
 if ext in automake_ext:
+if ext in ['tab.c', 'tab.h']:
+dist = True
 return dist, pf
 return dist, ""
 
diff --git a/buildtools/autogen/autogen/msc.py 
b/buildtools/autogen/autogen/msc.py
--- a/buildtools/autogen/autogen/msc.py
+++ b/buildtools/autogen/autogen/msc.py
@@ -326,12 +326,14 @@ def msc_dep(fd, tar, deplist, msc):
 fd.write(getsrc)
 x, de = split_filename(deplist[0])
 of = b + '.' + de
-fd.write('\t$(YACC) $(YFLAGS) $(AM_YFLAGS) "%s"\n' % of)
+fd.write('\t$(BISON) -o %s.tmpc.c --defines=%s.tab.h $(YFLAGS) 
$(AM_YFLAGS) %s\n' % (b, b, of))
+fd.write('\trm -f %s.tmpc.c\n' % b)
 elif ext == "tab.c":
 fd.write(getsrc)
 x, de = split_filename(deplist[0])
 of = b + '.' + de
-fd.write('\t$(YACC) $(YFLAGS) $(AM_YFLAGS) "%s"\n' % of)
+fd.write('\t$(BISON) -o %s.tab.c --defines=%s.tmph.h $(YFLAGS) 
$(AM_YFLAGS) %s\n' % (b, b, of))
+fd.write('\trm -f %s.tmph.h\n' % b)
 elif ext in ("obj", "tab.obj"):
 target, name = msc_find_target(tar, msc)
 if name[0] == '_':
diff --git a/buildtools/conf/rules.mk b/buildtools/conf/rules.mk
--- a/buildtools/conf/rules.mk
+++ b/buildtools/conf/rules.mk
@@ -10,18 +10,12 @@ CP=cp
 MV=mv
 
 %.tab.c: %.y
-   touch waiting. && until ln waiting. waiting 2>/dev/null; do 
sleep 1; done && rm waiting.
-   $(YACC) $(YFLAGS) $(AM_YFLAGS) $< || { $(RM) waiting ; exit 1 ; }
-   if [ -f y.tab.c ]; then $(MV) y.tab.c $*.tab.c ; fi
-   [ ! -f y.tab.h ] || $(RM) y.tab.h
-   $(RM) waiting
+   $(BISON) -o $*.tab.c --defines=$*.tmph.h $(YFLAGS) $(AM_YFLAGS) $<
+   rm -f $*.tmph.h
 
 %.tab.h: %.y
-   touch waiting. && until ln waiting. waiting 2>/dev/null; do 
sleep 1; done && rm waiting.
-   $(YACC) $(YFLAGS) $(AM_YFLAGS) $< || { $(RM) waiting ; exit 1 ; }
-   if [ -f y.tab.h ]; then $(MV) y.tab.h $*.tab.h ; fi
-   [ ! -f y.tab.c ] || $(RM) y.tab.c
-   $(RM) waiting
+   $(BISON) -o $*.tmpc.c --defines=$*.tab.h $(YFLAGS) $(AM_YFLAGS) $<
+   rm -f $*.tmpc.c
 
 %.def: %.syms
case `(uname -s) 2> /dev/null || echo unknown` in CYGWIN*) cat $<;; *) 
sed '/DllMain/d;s/=.*//' $<;; esac > $@
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -1113,25 +1113,7 @@ XPYTHON_LIBDIR=`$translatepath "$QPYTHON
 QXPYTHON_LIBDIR=`AS_ECHO(["$XPYTHON_LIBDIR"]) | sed 's///g'`
 AC_SUBST([QXPYTHON_LIBDIR])
 
-AC_PROG_YACC
-AS_CASE([$YACC],
-   [bison*],
-   [
-   # Ubuntu still comes with an ancient bison that uses defines
-   # without checking if they are defined.  This triggers a warning
-   # from gcc with -Wundef.  If we have a bison < 2.4.3, then
-   # disable the warning.
-   BISON_VER=`$YACC --version | head -n1 | sed -e 's/^.* //'`
-   AS_VERSION_COMPARE([$BISON_VER],
-   [2.4.3],
-   [X_CFLAGS=`AS_ECHO(["${X_CFLAGS}"]) | sed -e 
's/-Wundef//g'`])
-   ],
-   [
-   # in embedded mode, we ship the bison-generated files
-   AS_VAR_IF([enable_embedded], [no],
-   [AC_MSG_ERROR([MonetDB/SQL requires bison])],
-   [AC_MSG_WARN([ignoring missing bison in embedded 
configuration])])
-   ])
+AC_CHECK_PROG([BISON], [bison], [bison], [:])
 
 INSTALL_BACKUP=""
 AC_MSG_CHECKING([$INSTALL --backup option])
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Nov2019 - Removed old cruft.

2019-11-06 Thread Sjoerd Mullender
Changeset: 9f229b7a0086 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9f229b7a0086
Modified Files:
.hgignore
NT/rules.msc
buildtools/autogen/autogen/am.py
buildtools/autogen/autogen/codegen.py
buildtools/autogen/autogen/filesplit.py
buildtools/autogen/autogen/msc.py
buildtools/conf/rules.mk
Branch: Nov2019
Log Message:

Removed old cruft.


diffs (173 lines):

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -49,7 +49,6 @@ sql/backends/monet5/UDF/capi/cheader.tex
 .#*
 
 # files generated by compilers
-lex.yy.c
 *.tab.c
 *.tab.h
 .libs
diff --git a/NT/rules.msc b/NT/rules.msc
--- a/NT/rules.msc
+++ b/NT/rules.msc
@@ -187,7 +187,6 @@ libpy3_CFLAGS = -DHAVE_LIBPY3 "-I$(PYTHO
 # here we let %Path% determine which version we get
 PYTHON = python
 YACC = bison
-LEX = flex
 
 ARCHIVER = lib /nologo
 GENDLL =
diff --git a/buildtools/autogen/autogen/am.py b/buildtools/autogen/autogen/am.py
--- a/buildtools/autogen/autogen/am.py
+++ b/buildtools/autogen/autogen/am.py
@@ -19,7 +19,7 @@ from filesplit import split_filename, rs
 # buildtools/conf.  The generated sources should therefore be included
 # in the tar ball and not be removed with `make distclean' when
 # running "in" said tar ball.
-buildtools_ext = ['brg', 'l', 'pm.i', 'syms', 't', 'y']
+buildtools_ext = ['syms', 'y']
 
 am_assign = "+="
 
@@ -563,7 +563,7 @@ def am_binary(fd, var, binmap, am):
 if ext in scripts_ext:
 if target not in SCRIPTS:
 SCRIPTS.append(target)
-elif ext in ('o', 'glue.o', 'tab.o', 'yy.o'):
+elif ext in ('o', 'tab.o'):
 dist, src = am_find_srcs(target, binmap['DEPS'], am, cond)
 if src in binmap['SOURCES']:
 dist = True
diff --git a/buildtools/autogen/autogen/codegen.py 
b/buildtools/autogen/autogen/codegen.py
--- a/buildtools/autogen/autogen/codegen.py
+++ b/buildtools/autogen/autogen/codegen.py
@@ -21,25 +21,15 @@ from filesplit import split_filename
 # direct rules
 code_gen = {'y':[ '.tab.c', '.tab.h' ],
 'tab.c':[ '.tab.o' ],
-'l':[ '.yy.c', '.yy.h' ],
-'yy.c': [ '.yy.o' ],
 'mt':   [ '.symbols.h', '.c' ],
-'brg':  [ '.c' ],
 't':[ '.c' ],
 'c':[ '.o' ],
-'cpp':  [ '.o' ],
-#'java': [ '.class' ],
-#'tex':  [ '.html', '.dvi', '.pdf' ],
-#'dvi':  [ '.ps' ],
-#'fig':  [ '.eps' ],
-#'feps': [ '.eps' ],
 'in':   [ '' ],
 '1.in': [ '.1' ],  # TODO: add more manpage sections as needed
 'cfg.in':   [ '.cfg' ],
 'java.in':  [ '.java' ],
 'mal.in':   [ '.mal' ],
 'py.in':[ '.py' ],
-'pl.in':[ '.pl' ],
 'bat.in':   [ '.bat' ],
 'mt.sed':   [ '.mt' ],
 'c.sed':[ '.c' ],
@@ -69,15 +59,8 @@ t_inc = re.compile(t_inc, re.MULTILINE)
 
 scan_map = {
 'c': [ c_inc, None, '' ],
-'cpp': [ c_inc, None, '' ],
 'h': [ c_inc, None, '' ],
 'y': [ c_inc, None, '' ],
-'l': [ c_inc, None, '' ],
-'mt': [ c_inc, None, '' ],
-'brg': [ c_inc, None, '' ],
-'t': [ t_inc, None, '' ],
-'xsl': [ xsl_inc, None, '' ],
-'tex': [ tex_inc, None, '' ],
 }
 
 def readfile(f):
diff --git a/buildtools/autogen/autogen/filesplit.py 
b/buildtools/autogen/autogen/filesplit.py
--- a/buildtools/autogen/autogen/filesplit.py
+++ b/buildtools/autogen/autogen/filesplit.py
@@ -13,7 +13,7 @@ def rsplit_filename(f):
 return f[:s], f[s+1:]
 return base, ext
 
-automake_ext = ['', 'c', 'cpp', 'def', 'h', 'lo', 'o', 'pm.c', 'tab.c', 
'tab.h', 'yy.c', 'pm.i']
+automake_ext = set(['', 'c', 'def', 'h', 'lo', 'o', 'tab.c', 'tab.h'])
 automake_extra_extensions = set([rsplit_filename(x)[1] for x in automake_ext 
if '.' in x])
 extra_extensions = ['in', 'bat', 'sed']
 
diff --git a/buildtools/autogen/autogen/msc.py 
b/buildtools/autogen/autogen/msc.py
--- a/buildtools/autogen/autogen/msc.py
+++ b/buildtools/autogen/autogen/msc.py
@@ -332,16 +332,13 @@ def msc_dep(fd, tar, deplist, msc):
 x, de = split_filename(deplist[0])
 of = b + '.' + de
 fd.write('\t$(YACC) $(YFLAGS) $(AM_YFLAGS) "%s"\n' % of)
-elif ext == "yy.c":
-fd.write(getsrc)
-fd.write('\t$(LEX) $(LFLAGS) $(AM_LFLAGS) "%s.l"\n' % b)
-elif ext in ("obj", "tab.obj", "yy.obj"):
+elif ext in ("obj", "tab.obj"):
 target, name = msc_find_target(tar, msc)
 if name[0] == '_':
 name = name[1:]
 if target == "LIB":
 d, dext = split_filename(deplist[0])
-if dext in ("c", "cpp", "yy.c", "tab.c"):
+if dext in ("c", "tab.c"):
 fd.write('\t$(CC) /EHsc $(CFLAGS) $(%s_CFLAGS) $(GENDLL) 
-D_CRT_SECURE_NO_WARNINGS 

MonetDB: Nov2019 - Several changes:

2019-11-06 Thread Pedro Ferreira
Changeset: f445d2949471 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f445d2949471
Modified Files:
sql/common/sql_types.c
sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.sql

sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.stable.out
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
sql/test/sys-schema/Tests/systemfunctions.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out.int128
Branch: Nov2019
Log Message:

Several changes:

-Removed 'avg' window function aggregate with sec_interval as input, derived 
from the respective aggregate being removed.
-Added SYS.STR_TO_TIMESTAMP('0', '%s') call back in bug 6783 test, because it's 
failing on Windows.
-Approved tests from recent changes.


diffs (133 lines):

diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -1858,7 +1858,7 @@ sqltypeinit( sql_allocator *sa)
 #endif
 
sql_create_analytic(sa, "avg", "sql", "avg", MONINT, DBL, SCALE_NONE);
-   sql_create_analytic(sa, "avg", "sql", "avg", SECINT, DBL, SCALE_NONE);
+   //sql_create_analytic(sa, "avg", "sql", "avg", SECINT, DBL, SCALE_NONE);
 
 #if 0
t = decimals; // BTE
diff --git 
a/sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.sql 
b/sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.sql
--- a/sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.sql
+++ b/sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.sql
@@ -3,4 +3,6 @@ CREATE TABLE bug6783 (t TIMESTAMP);
 INSERT INTO bug6783 values (SYS.STR_TO_TIMESTAMP('1970-01-01 00:02:55', 
'%Y-%m-%d %T'));
 SELECT t - SYS.STR_TO_TIMESTAMP('1970-01-01 00:00:00', '%Y-%m-%d %T') FROM 
bug6783;
 SELECT AVG(t - SYS.STR_TO_TIMESTAMP('1970-01-01 00:00:00', '%Y-%m-%d %T')) 
FROM bug6783;
+
+INSERT INTO bug6783 values (SYS.STR_TO_TIMESTAMP('0', '%s'));
 ROLLBACK;
diff --git 
a/sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.stable.out 
b/sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.stable.out
--- a/sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.stable.out
+++ b/sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.stable.out
@@ -70,6 +70,8 @@ stdout of test 'avg-changes-value-scale.
 % double # type
 % 24 # length
 [ 175  ]
+#INSERT INTO bug6783 values (SYS.STR_TO_TIMESTAMP('0', '%s'));
+[ 1]
 #ROLLBACK;
 
 # 16:29:22 >  
diff --git a/sql/test/emptydb/Tests/check.stable.out 
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -2206,7 +2206,6 @@ drop function pcre_replace(string, strin
 [ "sys",   "avg",  "SYSTEM",   "avg",  "aggr", "Internal C",   
"Aggregate function",   false,  false,  false,  "res",  "double",   53, 
0,  "out",  "arg",  "int",  32, 0,  "in",   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL]
 [ "sys",   "avg",  "SYSTEM",   "avg",  "aggr", "Internal C",   
"Aggregate function",   false,  false,  false,  "res",  "double",   53, 
0,  "out",  "arg",  "month_interval",   32, 0,  "in",   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL]
 [ "sys",   "avg",  "SYSTEM",   "avg",  "aggr", "Internal C",   
"Aggregate function",   false,  false,  false,  "res",  "double",   53, 
0,  "out",  "arg",  "real", 24, 0,  "in",   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   

MonetDB: Nov2019 - Approved output and make test produce same ou...

2019-11-06 Thread Pedro Ferreira
Changeset: c5f28d8b77d9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c5f28d8b77d9
Modified Files:
sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.sql

sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.stable.out
Branch: Nov2019
Log Message:

Approved output and make test produce same output independently of the current 
timezone


diffs (26 lines):

diff --git 
a/sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.sql 
b/sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.sql
--- a/sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.sql
+++ b/sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.sql
@@ -1,4 +1,6 @@
+START TRANSACTION;
 CREATE TABLE bug6783 (t TIMESTAMP);
-INSERT INTO bug6783 values ('1970-01-01 00:02:55.00');
-SELECT t - SYS.STR_TO_TIMESTAMP('0', '%s') FROM bug6783;
-SELECT AVG(t - SYS.STR_TO_TIMESTAMP('0', '%s')) FROM bug6783;
+INSERT INTO bug6783 values (SYS.STR_TO_TIMESTAMP('1970-01-01 00:02:55', 
'%Y-%m-%d %T'));
+SELECT t - SYS.STR_TO_TIMESTAMP('1970-01-01 00:00:00', '%Y-%m-%d %T') FROM 
bug6783;
+SELECT AVG(t - SYS.STR_TO_TIMESTAMP('1970-01-01 00:00:00', '%Y-%m-%d %T')) 
FROM bug6783;
+ROLLBACK;
diff --git 
a/sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.stable.out 
b/sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.stable.out
--- a/sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.stable.out
+++ b/sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.stable.out
@@ -69,7 +69,8 @@ stdout of test 'avg-changes-value-scale.
 % L2 # name
 % double # type
 % 24 # length
-[ 1.75e+02 ]
+[ 175  ]
+#ROLLBACK;
 
 # 16:29:22 >  
 # 16:29:22 >  "Done."
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list