Changeset: 06032a14b588 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=06032a14b588
Added Files:
monetdb5/modules/mal/Tests/flags.malC
monetdb5/modules/mal/Tests/flags.stable.err
monetdb5/modules/mal/Tests/flags.stable.out
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
monetdb5/mal/mal.c
monetdb5/mal/mal.h
monetdb5/modules/mal/Tests/All
monetdb5/modules/mal/mdb.c
monetdb5/modules/mal/mdb.h
monetdb5/modules/mal/mdb.mal
monetdb5/optimizer/opt_aliases.c
monetdb5/optimizer/opt_candidates.c
monetdb5/optimizer/opt_coercion.c
monetdb5/optimizer/opt_commonTerms.c
monetdb5/optimizer/opt_commonTerms.h
monetdb5/optimizer/opt_constants.c
monetdb5/optimizer/opt_costModel.c
monetdb5/optimizer/opt_dataflow.c
monetdb5/optimizer/opt_deadcode.c
monetdb5/optimizer/opt_emptybind.c
monetdb5/optimizer/opt_emptybind.h
monetdb5/optimizer/opt_evaluate.c
monetdb5/optimizer/opt_garbageCollector.c
monetdb5/optimizer/opt_generator.c
monetdb5/optimizer/opt_inline.c
monetdb5/optimizer/opt_jit.c
monetdb5/optimizer/opt_json.c
monetdb5/optimizer/opt_json.h
monetdb5/optimizer/opt_macro.c
monetdb5/optimizer/opt_matpack.c
monetdb5/optimizer/opt_matpack.h
monetdb5/optimizer/opt_mergetable.c
monetdb5/optimizer/opt_mitosis.c
monetdb5/optimizer/opt_multiplex.c
monetdb5/optimizer/opt_oltp.c
monetdb5/optimizer/opt_oltp.h
monetdb5/optimizer/opt_pipes.c
monetdb5/optimizer/opt_postfix.c
monetdb5/optimizer/opt_prelude.h
monetdb5/optimizer/opt_profiler.c
monetdb5/optimizer/opt_projectionpath.c
monetdb5/optimizer/opt_pushselect.c
monetdb5/optimizer/opt_querylog.c
monetdb5/optimizer/opt_reduce.c
monetdb5/optimizer/opt_remap.c
monetdb5/optimizer/opt_remoteQueries.c
monetdb5/optimizer/opt_reorder.c
monetdb5/optimizer/opt_volcano.c
monetdb5/optimizer/opt_wlc.c
monetdb5/optimizer/opt_wlc.h
monetdb5/optimizer/opt_wrapper.c
monetdb5/optimizer/optimizer.h
sql/scripts/25_debug.sql
Branch: default
Log Message:
Add the dynamic control over tracing the MAL optimizers.
Expand the SQL/MAL layer to toggle the debug flags
SELECT * from sys.debugflags();
diffs (truncated from 2732 to 300 lines):
diff --git a/clients/Tests/MAL-signatures.stable.out
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -11266,7 +11266,8 @@ stdout of test 'MAL-signatures` in direc
[ "mdb", "List", "pattern mdb.List():void ", "MDBlistDetail;",
"Dump the current routine on standard out." ]
[ "mdb", "dump", "pattern mdb.dump():void ", "MDBdump;", "Dump
instruction, stacktrace, and stack" ]
[ "mdb", "getContext", "command mdb.getContext(s:str):str ",
"MDBgetExceptionContext;", "Extract the context string from the exception
message" ]
-[ "mdb", "getDebug", "command mdb.getDebug():int ", "MDBgetDebug;",
"Get the kernel debugging bit-set.\nSee the MonetDB configuration file for
details" ]
+[ "mdb", "getDebug", "pattern mdb.getDebug():int ", "MDBgetDebug;",
"Get the kernel debugging bit-set.\nSee the MonetDB configuration file for
details" ]
+[ "mdb", "getDebugFlags", "pattern mdb.getDebugFlags()
(flg:bat[:str], val:bat[:bit]) ", "MDBgetDebugFlags;", "Get the kernel
debugging flags bit-set" ]
[ "mdb", "getDefinition", "pattern mdb.getDefinition():bat[:str]
", "MDBgetDefinition;", "Returns a string representation of the
current function \n\twith typing information attached" ]
[ "mdb", "getException", "command mdb.getException(s:str):str ",
"MDBgetExceptionVariable;", "Extract the variable name from the exception
message" ]
[ "mdb", "getReason", "command mdb.getReason(s:str):str ",
"MDBgetExceptionReason;", "Extract the reason from the exception message"
]
@@ -11280,8 +11281,8 @@ stdout of test 'MAL-signatures` in direc
[ "mdb", "listMapi", "pattern mdb.listMapi():void ", "MDBlistMapi;",
"Dump the current routine on standard out with Mapi prefix." ]
[ "mdb", "modules", "command mdb.modules():bat[:str] ",
"CMDmodules;", "List available modules" ]
[ "mdb", "setCatch", "pattern mdb.setCatch(b:bit):void ",
"MDBsetCatch;", "Turn on/off catching exceptions" ]
-[ "mdb", "setDebug", "command mdb.setDebug(flg:int):int ",
"MDBsetDebug;", "Set the kernel debugging bit-set and return its previous
value." ]
-[ "mdb", "setDebug", "command mdb.setDebug(flg:str):int ",
"MDBsetDebugStr;", "Set the kernel debugging bit-set and return its
previous value.\nThe recognized options are: threads, memory, properties,\nio,
transactions, modules, algorithms, estimates." ]
+[ "mdb", "setDebug", "pattern mdb.setDebug(flg:int):int ",
"MDBsetDebug;", "Set the kernel debugging bit-set and return its previous
value." ]
+[ "mdb", "setDebug", "pattern mdb.setDebug(flg:str):int ",
"MDBsetDebugStr;", "Set the kernel debugging bit-set and return its
previous value.\nThe recognized options are: threads, memory, properties,\nio,
transactions, modules, algorithms, estimates." ]
[ "mdb", "setTrace", "pattern mdb.setTrace(b:bit):void ",
"MDBsetTrace;", "Turn on/off tracing of current routine" ]
[ "mdb", "setTrace", "pattern mdb.setTrace(b:str):void ",
"MDBsetVarTrace;", "Turn on/off tracing of a variable " ]
[ "mdb", "start", "pattern mdb.start():void ", "MDBstart;",
"Start interactive debugger" ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -15669,7 +15669,8 @@ stdout of test 'MAL-signatures` in direc
[ "mdb", "List", "pattern mdb.List():void ", "MDBlistDetail;",
"Dump the current routine on standard out." ]
[ "mdb", "dump", "pattern mdb.dump():void ", "MDBdump;", "Dump
instruction, stacktrace, and stack" ]
[ "mdb", "getContext", "command mdb.getContext(s:str):str ",
"MDBgetExceptionContext;", "Extract the context string from the exception
message" ]
-[ "mdb", "getDebug", "command mdb.getDebug():int ", "MDBgetDebug;",
"Get the kernel debugging bit-set.\nSee the MonetDB configuration file for
details" ]
+[ "mdb", "getDebug", "pattern mdb.getDebug():int ", "MDBgetDebug;",
"Get the kernel debugging bit-set.\nSee the MonetDB configuration file for
details" ]
+[ "mdb", "getDebugFlags", "pattern mdb.getDebugFlags()
(flg:bat[:str], val:bat[:bit]) ", "MDBgetDebugFlags;", "Get the kernel
debugging flags bit-set" ]
[ "mdb", "getDefinition", "pattern mdb.getDefinition():bat[:str]
", "MDBgetDefinition;", "Returns a string representation of the
current function \n\twith typing information attached" ]
[ "mdb", "getException", "command mdb.getException(s:str):str ",
"MDBgetExceptionVariable;", "Extract the variable name from the exception
message" ]
[ "mdb", "getReason", "command mdb.getReason(s:str):str ",
"MDBgetExceptionReason;", "Extract the reason from the exception message"
]
@@ -15683,8 +15684,8 @@ stdout of test 'MAL-signatures` in direc
[ "mdb", "listMapi", "pattern mdb.listMapi():void ", "MDBlistMapi;",
"Dump the current routine on standard out with Mapi prefix." ]
[ "mdb", "modules", "command mdb.modules():bat[:str] ",
"CMDmodules;", "List available modules" ]
[ "mdb", "setCatch", "pattern mdb.setCatch(b:bit):void ",
"MDBsetCatch;", "Turn on/off catching exceptions" ]
-[ "mdb", "setDebug", "command mdb.setDebug(flg:int):int ",
"MDBsetDebug;", "Set the kernel debugging bit-set and return its previous
value." ]
-[ "mdb", "setDebug", "command mdb.setDebug(flg:str):int ",
"MDBsetDebugStr;", "Set the kernel debugging bit-set and return its
previous value.\nThe recognized options are: threads, memory, properties,\nio,
transactions, modules, algorithms, estimates." ]
+[ "mdb", "setDebug", "pattern mdb.setDebug(flg:int):int ",
"MDBsetDebug;", "Set the kernel debugging bit-set and return its previous
value." ]
+[ "mdb", "setDebug", "pattern mdb.setDebug(flg:str):int ",
"MDBsetDebugStr;", "Set the kernel debugging bit-set and return its
previous value.\nThe recognized options are: threads, memory, properties,\nio,
transactions, modules, algorithms, estimates." ]
[ "mdb", "setTrace", "pattern mdb.setTrace(b:bit):void ",
"MDBsetTrace;", "Turn on/off tracing of current routine" ]
[ "mdb", "setTrace", "pattern mdb.setTrace(b:str):void ",
"MDBsetVarTrace;", "Turn on/off tracing of a variable " ]
[ "mdb", "start", "pattern mdb.start():void ", "MDBstart;",
"Start interactive debugger" ]
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
@@ -1356,6 +1356,7 @@ str MALassertStr(void *ret, str *val, st
str MALassertTriple(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
str MALcallback(Client c, str msg);
int MALcommentsOnly(MalBlkPtr mb);
+lng MALdebug;
str MALengine(Client c);
str MALexitClient(Client c);
str MALgarbagesink(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
@@ -1456,7 +1457,9 @@ str MDBStkDepth(Client cntxt, MalBlkPtr
str MDBStkTrace(Client cntxt, MalBlkPtr m, MalStkPtr s, InstrPtr p);
str MDBdummy(int *ret);
str MDBdump(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
-str MDBgetDebug(int *ret);
+str MDBgetDebug(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
+str MDBgetDebugFlags(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
+str MDBgetDebugStr(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
str MDBgetDefinition(Client cntxt, MalBlkPtr m, MalStkPtr stk, InstrPtr p);
str MDBgetExceptionContext(str *ret, str *msg);
str MDBgetExceptionReason(str *ret, str *msg);
@@ -1470,8 +1473,8 @@ str MDBlist3Detail(Client cntxt, MalBlkP
str MDBlistDetail(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
str MDBlistMapi(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
str MDBsetCatch(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
-str MDBsetDebug(int *ret, int *flg);
-str MDBsetDebugStr(int *ret, str *nme);
+str MDBsetDebug(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
+str MDBsetDebugStr(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
str MDBsetTrace(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
str MDBsetVarTrace(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
str MDBstart(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
@@ -1604,6 +1607,7 @@ str OPTconstantsImplementation(Client cn
str OPTcostModelImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
str OPTdataflowImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr p);
str OPTdeadcodeImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
+lng OPTdebug;
str OPTemptybindImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr p);
str OPTevaluateImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
str OPTgarbageCollectorImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr
stk, InstrPtr pci);
diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -14,6 +14,10 @@ char monet_cwd[FILENAME_MAX] = { 0 };
size_t monet_memory = 0;
char monet_characteristics[4096];
+/* The compile time debugging flags are turned into bit masks, akin to GDK */
+lng MALdebug;
+lng OPTdebug;
+
#ifdef HAVE_HGE
int have_hge;
#endif
diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -38,6 +38,47 @@
*/
#define MAXSCRIPT 64
+/* The compile time debugging flags are turned into bit masks, akin to GDK */
+mal_export lng OPTdebug;
+
+#define OPTaliases (1 )
+#define OPTcandidates ((lng)1 << 1)
+#define OPTcoercion ((lng)1 << 2)
+#define OPTcommonterms ((lng)1 << 3)
+#define OPTconstants ((lng)1 << 4)
+#define OPTcostmodel ((lng)1 << 5)
+#define OPTdataflow ((lng)1 << 6)
+#define OPTdeadcode ((lng)1 << 7)
+#define OPTemptybind ((lng)1 << 8)
+#define OPTevaluate ((lng)1 << 9)
+#define OPTgarbagecollector ((lng)1 << 10)
+#define OPTgenerator ((lng)1 << 11)
+#define OPTinline ((lng)1 << 12)
+#define OPTjit ((lng)1 << 13)
+#define OPTjson ((lng)1 << 14)
+#define OPTmacros ((lng)1 << 15)
+#define OPTmatpack ((lng)1 << 15)
+#define OPTmergetable ((lng)1 << 16)
+#define OPTmitosis ((lng)1 << 17)
+#define OPTmultiplex ((lng)1 << 18)
+#define OPToltp ((lng)1 << 19)
+#define OPTpipes ((lng)1 << 20)
+#define OPTpostfix ((lng)1 << 21)
+#define OPTprelude ((lng)1 << 22)
+#define OPTprofiler ((lng)1 << 23)
+#define OPTprojectionpath ((lng)1 << 24)
+#define OPTpushselect ((lng)1 << 25)
+#define OPTquerylog ((lng)1 << 26)
+#define OPTreduce ((lng)1 << 27)
+#define OPTremap ((lng)1 << 28)
+#define OPTremotequeries ((lng)1 << 29)
+#define OPTreorder ((lng)1 << 30)
+#define OPTsupport ((lng)1 << 31)
+#define OPTvolcano ((lng)1 << 32)
+#define OPTwlc ((lng)1 << 33)
+
+mal_export lng MALdebug;
+
/*
* MonetDB assumes it can use most of the machines memory,
* leaving a small portion for other programs.
diff --git a/monetdb5/modules/mal/Tests/All b/monetdb5/modules/mal/Tests/All
--- a/monetdb5/modules/mal/Tests/All
+++ b/monetdb5/modules/mal/Tests/All
@@ -24,6 +24,7 @@ call00
callstring
callfunction
+flags
ascii_io2
diff --git a/monetdb5/modules/mal/Tests/flags.malC
b/monetdb5/modules/mal/Tests/flags.malC
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/Tests/flags.malC
@@ -0,0 +1,16 @@
+# Check the basic functionality of the debugging flags
+d := mdb.getDebug();
+io.print(d);
+
+(f,v) := mdb.getDebugFlags();
+io.print(f,v);
+
+mdb.setDebug("threads");
+mdb.setDebug("dataflow");
+
+(f,v) := mdb.getDebugFlags();
+io.print(f,v);
+
+mdb.setDebug("threads");
+(f,v) := mdb.getDebugFlags();
+io.print(f,v);
diff --git a/monetdb5/modules/mal/Tests/flags.stable.err
b/monetdb5/modules/mal/Tests/flags.stable.err
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/Tests/flags.stable.err
@@ -0,0 +1,30 @@
+stderr of test 'flags` in directory 'monetdb5/modules/mal` itself:
+
+
+# 23:08:04 >
+# 23:08:04 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=31291" "--set"
"mapi_usock=/var/tmp/mtest-28522/.s.monetdb.31291" "--forcemito"
"--dbpath=/export/scratch1/mk/branches/default//Linux/var/MonetDB/mTests_monetdb5_modules_mal"
"--set" "embedded_c=true"
+# 23:08:04 >
+
+# builtin opt gdk_dbpath =
/export/scratch1/mk/branches/default//Linux/var/monetdb5/dbfarm/demo
+# builtin opt mapi_port = 50000
+# 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 = 31291
+# cmdline opt mapi_usock = /var/tmp/mtest-28522/.s.monetdb.31291
+# cmdline opt gdk_dbpath =
/export/scratch1/mk/branches/default//Linux/var/MonetDB/mTests_monetdb5_modules_mal
+# cmdline opt embedded_c = true
+
+# 23:08:04 >
+# 23:08:04 > "mclient" "-lmal" "-ftest" "-tnone" "-Eutf-8"
"--host=/var/tmp/mtest-28522" "--port=31291"
+# 23:08:04 >
+
+
+# 23:08:04 >
+# 23:08:04 > "Done."
+# 23:08:04 >
+
diff --git a/monetdb5/modules/mal/Tests/flags.stable.out
b/monetdb5/modules/mal/Tests/flags.stable.out
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/Tests/flags.stable.out
@@ -0,0 +1,177 @@
+stdout of test 'flags` in directory 'monetdb5/modules/mal` itself:
+
+
+# 23:08:04 >
+# 23:08:04 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=31291" "--set"
"mapi_usock=/var/tmp/mtest-28522/.s.monetdb.31291" "--forcemito"
"--dbpath=/export/scratch1/mk/branches/default//Linux/var/MonetDB/mTests_monetdb5_modules_mal"
"--set" "embedded_c=true"
+# 23:08:04 >
+
+# MonetDB 5 server v11.36.0 (hg id: 57e878e3a9e7+)
+# This is an unreleased version
+# Serving database 'mTests_monetdb5_modules_mal', 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:31291/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-28522/.s.monetdb.31291
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+# 23:08:04 >
+# 23:08:04 > "mclient" "-lmal" "-ftest" "-tnone" "-Eutf-8"
"--host=/var/tmp/mtest-28522" "--port=31291"
+# 23:08:04 >
+
+[ 553648138 ]
+#--------------------------#
+# t t t # name
+# void str bit # type
+#--------------------------#
+[ 0@0, "threads", false ]
+[ 1@0, "memory", false ]
+[ 2@0, "properties", true ]
+[ 3@0, "io", false ]
+[ 4@0, "heaps", false ]
+[ 5@0, "transactions", false ]
+[ 6@0, "modules", false ]
+[ 7@0, "algorithms", false ]
+[ 8@0, "performance", false ]
+[ 9@0, "forcemito", true ]
+[ 10@0, "aliases", false ]
+[ 11@0, "candidates", false ]
+[ 12@0, "coercion", false ]
+[ 13@0, "commonterms", false ]
+[ 14@0, "constants", false ]
+[ 15@0, "costmodel", false ]
+[ 16@0, "dataflow", false ]
+[ 17@0, "deadcode", false ]
+[ 18@0, "emptybind", false ]
+[ 19@0, "evaluate", false ]
+[ 20@0, "garbagecollector", false ]
+[ 21@0, "generator", false ]
+[ 22@0, "inline", false ]
+[ 23@0, "jit", false ]
+[ 24@0, "json", false ]
+[ 25@0, "macros", false ]
+[ 26@0, "matpack", false ]
+[ 27@0, "mergetable", false ]
+[ 28@0, "mitosis", false ]
+[ 29@0, "multiplex", false ]
+[ 30@0, "oltp", false ]
+[ 31@0, "pipes", false ]
+[ 32@0, "postfix", false ]
+[ 33@0, "prelude", false ]
+[ 34@0, "profiler", false ]
+[ 35@0, "projectionpath", false ]
+[ 36@0, "pushselect", false ]
+[ 37@0, "querylog", false ]
+[ 38@0, "reduce", false ]
+[ 39@0, "remap", false ]
+[ 40@0, "remotequeries", false ]
+[ 41@0, "reorder", false ]
+[ 42@0, "support", false ]
+[ 43@0, "volcano", false ]
+[ 44@0, "wlc", false ]
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list