Changeset: 7dde69bad172 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7dde69bad172
Added Files:
        monetdb5/modules/mal/Tests/flags.malC
        monetdb5/modules/mal/Tests/flags.stable.err
        monetdb5/modules/mal/Tests/flags.stable.out
        sql/test/miscellaneous/Tests/alter_table_add_column.sql
        sql/test/miscellaneous/Tests/alter_table_add_column.stable.err
        sql/test/miscellaneous/Tests/alter_table_add_column.stable.out
        sql/test/subquery/Tests/subquery3.stable.err
        sql/test/subquery/Tests/subquery3.stable.out
Modified Files:
        clients/R/Tests/copy_into_fwf.stable.err
        clients/R/Tests/dbi.stable.err
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        clients/Tests/exports.stable.out
        configure.ag
        gdk/gdk_analytic_func.c
        gdk/gdk_logger.c
        gdk/gdk_utils.c
        monetdb5/mal/Tests/tst903.stable.out
        monetdb5/mal/Tests/tst904.stable.out
        monetdb5/mal/Tests/tst907.stable.out
        monetdb5/mal/mal.c
        monetdb5/mal/mal.h
        monetdb5/mal/mal_client.h
        monetdb5/mal/mal_profiler.c
        monetdb5/mal/mal_runtime.c
        monetdb5/mal/mal_runtime.h
        monetdb5/modules/mal/Tests/All
        monetdb5/modules/mal/clients.c
        monetdb5/modules/mal/mdb.c
        monetdb5/modules/mal/mdb.h
        monetdb5/modules/mal/mdb.mal
        monetdb5/modules/mal/pcre.c
        monetdb5/modules/mal/sysmon.c
        monetdb5/optimizer/Tests/Mexample.stable.out
        monetdb5/optimizer/Tests/inlineFunction2.stable.out
        monetdb5/optimizer/Tests/manifold2.stable.out
        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/backends/monet5/sql_rank.c
        sql/backends/monet5/sql_upgrades.c
        sql/backends/monet5/wlr.c
        sql/scripts/25_debug.sql
        sql/server/rel_exp.c
        sql/server/rel_exp.h
        sql/server/rel_optimizer.c
        sql/server/rel_rel.c
        sql/server/rel_rel.h
        sql/server/rel_select.c
        sql/server/rel_unnest.c
        sql/server/sql_mvc.c
        sql/server/sql_mvc.h
        sql/storage/store.c
        
sql/test/BugTracker-2016/Tests/set-negative-querytimeout.Bug-6070.stable.err
        
sql/test/BugTracker-2016/Tests/set-negative-querytimeout.Bug-6070.stable.out
        sql/test/analytics/Tests/analytics01.sql
        sql/test/analytics/Tests/analytics01.stable.out
        sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
        
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128
        sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
        sql/test/emptydb-upgrade/Tests/upgrade.stable.out
        sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit
        sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
        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/miscellaneous/Tests/All
        sql/test/miscellaneous/Tests/simple_selects.sql
        sql/test/miscellaneous/Tests/simple_selects.stable.out
        sql/test/subquery/Tests/subquery3.sql
        sql/test/sys-schema/Tests/systemfunctions.stable.out
        sql/test/sys-schema/Tests/systemfunctions.stable.out.int128
        sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade/Tests/upgrade.stable.out
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
Branch: grouping-analytics
Log Message:

Merge with default


diffs (truncated from 8550 to 300 lines):

diff --git a/clients/R/Tests/copy_into_fwf.stable.err 
b/clients/R/Tests/copy_into_fwf.stable.err
--- a/clients/R/Tests/copy_into_fwf.stable.err
+++ b/clients/R/Tests/copy_into_fwf.stable.err
@@ -28,8 +28,6 @@ stderr of test 'copy_into_fwf` in direct
 # 16:40:23 >  "R" "--vanilla" "--slave" "--args" "30658"
 # 16:40:23 >  
 
-Warning message:
-S3 methods ‘[.fun_list’, ‘[.grouped_df’, ‘all.equal.tbl_df’, 
‘anti_join.data.frame’, ‘anti_join.tbl_df’, ‘arrange.data.frame’, 
‘arrange.default’, ‘arrange.grouped_df’, ‘arrange.tbl_df’, 
‘arrange_.data.frame’, ‘arrange_.tbl_df’, ‘as.data.frame.grouped_df’, 
‘as.data.frame.rowwise_df’, ‘as.data.frame.tbl_cube’, ‘as.table.tbl_cube’, 
‘as.tbl.data.frame’, ‘as.tbl.tbl’, ‘as.tbl_cube.array’, 
‘as.tbl_cube.data.frame’, ‘as.tbl_cube.matrix’, ‘as.tbl_cube.table’, 
‘as_tibble.grouped_df’, ‘as_tibble.tbl_cube’, ‘auto_copy.tbl_cube’, 
‘auto_copy.tbl_df’, ‘cbind.grouped_df’, ‘collapse.data.frame’, 
‘collect.data.frame’, ‘common_by.NULL’, ‘common_by.character’, 
‘common_by.default’, ‘common_by.list’, ‘compute.data.frame’, 
‘copy_to.DBIConnection’, ‘copy_to.src_local’, ‘default_missing.data.frame’, 
‘default_missing.default’, ‘dim.tbl_cube’, ‘distinct.data.f [... truncated] 
 
 # 16:40:23 >  
 # 16:40:23 >  "Done."
diff --git a/clients/R/Tests/dbi.stable.err b/clients/R/Tests/dbi.stable.err
--- a/clients/R/Tests/dbi.stable.err
+++ b/clients/R/Tests/dbi.stable.err
@@ -30,8 +30,6 @@ stderr of test 'dbi` in directory 'clien
 # 12:27:25 >  "R" "--vanilla" "--slave" "--args" "31728"
 # 12:27:25 >  
 
-Warning message:
-S3 methods ‘[.fun_list’, ‘[.grouped_df’, ‘all.equal.tbl_df’, 
‘anti_join.data.frame’, ‘anti_join.tbl_df’, ‘arrange.data.frame’, 
‘arrange.default’, ‘arrange.grouped_df’, ‘arrange.tbl_df’, 
‘arrange_.data.frame’, ‘arrange_.tbl_df’, ‘as.data.frame.grouped_df’, 
‘as.data.frame.rowwise_df’, ‘as.data.frame.tbl_cube’, ‘as.table.tbl_cube’, 
‘as.tbl.data.frame’, ‘as.tbl.tbl’, ‘as.tbl_cube.array’, 
‘as.tbl_cube.data.frame’, ‘as.tbl_cube.matrix’, ‘as.tbl_cube.table’, 
‘as_tibble.grouped_df’, ‘as_tibble.tbl_cube’, ‘auto_copy.tbl_cube’, 
‘auto_copy.tbl_df’, ‘cbind.grouped_df’, ‘collapse.data.frame’, 
‘collect.data.frame’, ‘common_by.NULL’, ‘common_by.character’, 
‘common_by.default’, ‘common_by.list’, ‘compute.data.frame’, 
‘copy_to.DBIConnection’, ‘copy_to.src_local’, ‘default_missing.data.frame’, 
‘default_missing.default’, ‘dim.tbl_cube’, ‘distinct.data.f [... truncated] 
 Identifier(s) "Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width", 
"Species" contain uppercase or reserved SQL characters and need(s) to be quoted 
in queries.
 Warning message:
 'MonetDBLite::isIdCurrent' is deprecated.
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);
@@ -2668,6 +2672,7 @@ int wlc_state;
 lng wlc_tag;
 char wlc_write[26];
 str wlrRef;
+Workingset workingset[THREADS];
 str zero_or_oneRef;
 
 # stream
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -1666,12 +1666,22 @@ AS_VAR_IF([enable_rintegration], [no], [
                         enable_rintegration=no
                         why_not_rintegration="(libR library not found)"])],
                [AS_IF([RHOME=`$RCMD RHOME` && libr_CFLAGS=`$RCMD CMD config 
--cppflags` && libr_LIBS=`$RCMD CMD config --ldflags | sed -e 's|-fopenmp 
|-fopenmp=libgomp |'`],
-                       [have_libr=yes
-                        AC_DEFINE([HAVE_LIBR], 1, [Define if you have libR 
installed])
-                        AC_SUBST([libr_CFLAGS], [$libr_CFLAGS])
-                        AC_SUBST([libr_LIBS], [$libr_LIBS])
-                        AC_SUBST([RHOME], [$RHOME])
-                        AC_DEFINE_UNQUOTED([RHOME], ["$RHOME"], [The home of 
R])])])])
+                       [save_CPPFLAGS="$CPPFLAGS"
+                        CPPFLAGS="$CPPFLAGS $libr_CFLAGS"
+                        AC_CHECK_HEADER([Rembedded.h],
+                               [have_libr=yes
+                                AC_DEFINE([HAVE_LIBR], 1, [Define if you have 
libR installed])
+                                AC_SUBST([libr_CFLAGS], [$libr_CFLAGS])
+                                AC_SUBST([libr_LIBS], [$libr_LIBS])
+                                AC_SUBST([RHOME], [$RHOME])
+                                AC_DEFINE_UNQUOTED([RHOME], ["$RHOME"], [The 
home of R])],
+                               [AS_VAR_IF([enable_rintegration], [yes],
+                                       [AC_MSG_ERROR([libR library required 
for R integration support])],
+                                       [have_libr=no
+                                        why_not_libr="(Rembedded.h not found)"
+                                        enable_rintegration=no
+                                        why_not_rintegration="(Rembedded.h not 
found)"])])
+                        CPPFLAGS="$save_CPPFLAGS"])])])
 AM_CONDITIONAL([HAVE_LIBR], [test x"$have_libr" != xno])
 
 # Python API (Python UDFs)
diff --git a/gdk/gdk_analytic_func.c b/gdk/gdk_analytic_func.c
--- a/gdk/gdk_analytic_func.c
+++ b/gdk/gdk_analytic_func.c
@@ -585,7 +585,7 @@ GDKanalyticalnthvalue(BAT *r, BAT *b, BA
 
 #define ANALYTICAL_LAG_IMP(TPE)                                                
\
        do {                                                            \
-               TPE *rp, *rb, *bp, *rend,                               \
+               TPE *rp, *rb, *bp, *nbp, *rend,                         \
                        def = *((TPE *) default_value), next;           \
                bp = (TPE*)Tloc(b, 0);                                  \
                rb = rp = (TPE*)Tloc(r, 0);                             \
@@ -601,8 +601,9 @@ GDKanalyticalnthvalue(BAT *r, BAT *b, BA
                                if (*np) {                              \
                                        ncnt = (np - pnp);              \
                                        rp += ncnt;                     \
+                                       nbp = bp + ncnt; \
                                        ANALYTICAL_LAG_CALC(TPE);       \
-                                       bp += (lag < ncnt) ? lag : 0;   \
+                                       bp = nbp; \
                                        pnp = np;                       \
                                }                                       \
                        }                                               \
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2564,6 +2564,7 @@ logger_exit(logger *lg)
 
        if (lg->inmemory || LOG_DISABLED(lg)) {
                logger_close(lg);
+               lg->changes = 0;
                return GDK_SUCCEED;
        }
 
@@ -2942,7 +2943,7 @@ log_bat(logger *lg, BAT *b, const char *
 
        l.tid = lg->tid;
        l.nr = (BUNlast(b) - b->batInserted);
-       lg->changes += l.nr;
+       lg->changes += (b->batInserted)?l.nr:1; /* initial large inserts is 
counted as 1 change */
 
        if (LOG_DISABLED(lg) || lg->inmemory) {
                /* logging is switched off */
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -402,39 +402,76 @@ MT_init(void)
 # error "don't know how to get the amount of physical memory for your OS"
 #endif
 
-#ifndef WIN32
+#ifdef __linux__
        /* limit values to whatever cgroups gives us */
-       FILE *f;
-       /* limit of memory usage */
-       f = fopen("/sys/fs/cgroup/memory/memory.limit_in_bytes", "r");
-       if (f != NULL) {
-               uint64_t mem;
-               if (fscanf(f, "%" SCNu64, &mem) == 1
-                   && mem < (uint64_t) _MT_pagesize * _MT_npages) {
-                       _MT_npages = (size_t) (mem / _MT_pagesize);
+       FILE *fc;
+       fc = fopen("/proc/self/cgroup", "r");
+       if (fc != NULL) {
+               char buf[1024];
+               while (fgets(buf, (int) sizeof(buf), fc) != NULL) {
+                       char *p, *q;
+                       p = strchr(buf, ':');
+                       if (p == NULL)
+                               break;
+                       q = p + 1;
+                       p = strchr(q, ':');
+                       if (p == NULL)
+                               break;
+                       *p++ = 0;
+                       if (strstr(q, "memory") != NULL) {
+                               char pth[1024];
+                               FILE *f;
+                               q = strchr(p, '\n');
+                               if (q == NULL)
+                                       break;
+                               *q = 0;
+                               q = stpconcat(pth, "/sys/fs/cgroup/memory",
+                                             p, NULL);
+                               /* sometimes the path in
+                                * /proc/self/cgroup ends in "/" (or
+                                * actually, is "/"); in all other
+                                * cases add one */
+                               if (q[-1] != '/')
+                                       *q++ = '/';
+                               /* limit of memory usage */
+                               strcpy(q, "memory.limit_in_bytes");
+                               f = fopen(pth, "r");
+                               if (f != NULL) {
+                                       uint64_t mem;
+                                       if (fscanf(f, "%" SCNu64, &mem) == 1
+                                           && mem < (uint64_t) _MT_pagesize * 
_MT_npages) {
+                                               _MT_npages = (size_t) (mem / 
_MT_pagesize);
+                                       }
+                                       fclose(f);
+                               }
+                               /* soft limit of memory usage */
+                               strcpy(q, "memory.soft_limit_in_bytes");
+                               f = fopen(pth, "r");
+                               if (f != NULL) {
+                                       uint64_t mem;
+                                       if (fscanf(f, "%" SCNu64, &mem) == 1
+                                           && mem < (uint64_t) _MT_pagesize * 
_MT_npages) {
+                                               _MT_npages = (size_t) (mem / 
_MT_pagesize);
+                                       }
+                                       fclose(f);
+                               }
+                               /* limit of memory+swap usage
+                                * we use this as maximum virtual memory size */
+                               strcpy(q, "memory.memsw.limit_in_bytes");
+                               f = fopen(pth, "r");
+                               if (f != NULL) {
+                                       uint64_t mem;
+                                       if (fscanf(f, "%" SCNu64, &mem) == 1
+                                           && mem < (uint64_t) GDK_vm_maxsize) 
{
+                                               GDK_vm_maxsize = (size_t) mem;
+                                       }
+                                       fclose(f);
+                               }
+                               break;
+
+                       }
                }
-               fclose(f);
-       }
-       /* soft limit of memory usage */
-       f = fopen("/sys/fs/cgroup/memory/memory.soft_limit_in_bytes", "r");
-       if (f != NULL) {
-               uint64_t mem;
-               if (fscanf(f, "%" SCNu64, &mem) == 1
-                   && mem < (uint64_t) _MT_pagesize * _MT_npages) {
-                       _MT_npages = (size_t) (mem / _MT_pagesize);
-               }
-               fclose(f);
-       }
-       /* limit of memory+swap usage
-        * we use this as maximum virtual memory size */
-       f = fopen("/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes", "r");
-       if (f != NULL) {
-               uint64_t mem;
-               if (fscanf(f, "%" SCNu64, &mem) == 1
-                   && mem < (uint64_t) GDK_vm_maxsize) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to