MonetDB: default - Use uintptr_t as integer type that holds a po...

2017-11-20 Thread Sjoerd Mullender
Changeset: 535e8ec2fceb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=535e8ec2fceb
Modified Files:
gdk/gdk.h
gdk/gdk_utils.c
Branch: default
Log Message:

Use uintptr_t as integer type that holds a pointer.


diffs (49 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2370,7 +2370,7 @@ typedef struct threadStruct {
MT_Id pid;  /* physical thread id (pointer-sized) from the 
OS thread library */
str name;
ptr data[THREADDATA];
-   size_t sp;
+   uintptr_t sp;
 } ThreadRec, *Thread;
 
 
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -1224,13 +1224,13 @@ THRget(int tid)
 #if defined(_MSC_VER) && _MSC_VER >= 1900
 #pragma warning(disable : 4172)
 #endif
-static inline size_t
+static inline uintptr_t
 THRsp(void)
 {
int l = 0;
uintptr_t sp = (uintptr_t) ();
 
-   return (size_t) sp;
+   return sp;
 }
 
 static Thread
@@ -1283,7 +1283,7 @@ THRnew(const char *name)
s->data[0] = THRdata[0];
s->sp = THRsp();
 
-   PARDEBUG fprintf(stderr, "#%x " SZFMT " sp = " SZFMT "\n", 
s->tid, (size_t) pid, s->sp);
+   PARDEBUG fprintf(stderr, "#%x " SZFMT " sp = " SZFMT "\n", 
s->tid, (size_t) pid, (size_t) s->sp);
PARDEBUG fprintf(stderr, "#nrofthreads %d\n", GDKnrofthreads);
 
GDKnrofthreads++;
@@ -1313,7 +1313,7 @@ THRdel(Thread t)
 int
 THRhighwater(void)
 {
-   size_t c;
+   uintptr_t c;
Thread s;
size_t diff;
int rc = 0;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Some cleanup of include files.

2017-11-20 Thread Sjoerd Mullender
Changeset: edae8e97dccf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=edae8e97dccf
Modified Files:
NT/monetdb_config.h.in
clients/mapiclient/dotmonetdb.c
clients/mapiclient/mclient.c
clients/mapilib/mapi.c
clients/odbc/driver/SQLBrowseConnect.c
clients/odbc/driver/SQLConnect.c
clients/odbc/driver/SQLFetch.c
clients/odbc/setup/drvcfg.c
clients/odbc/winsetup/install.c
common/utils/mcrypt.c
common/utils/mutils.c
configure.ag
gdk/gdk.h
gdk/gdk_posix.h
monetdb5/mal/mal_readline.c
monetdb5/modules/mal/txtsim.h
Branch: default
Log Message:

Some cleanup of include files.


diffs (274 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -33,14 +33,12 @@
 #define _CRT_SECURE_NO_DEPRECATE 1
 #endif
 
-#include 
-
+#include 
 #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
 /* In this case, malloc and friends are redefined in crtdbg.h to debug
versions.  We need to include stdlib.h and malloc.h first or else
we get conflicting declarations.
 */
-#include 
 #include 
 #endif
 
@@ -51,7 +49,6 @@
 
 #include 
 #include  /* NULL, printf etc. */
-#include 
 #include 
 #include /* va_alist.. */
 
@@ -331,9 +328,6 @@
 /* Define to 1 if you have the `madvise' function. */
 /* #undef HAVE_MADVISE */
 
-/* Define to 1 if you have the  header file. */
-#define HAVE_MALLOC_H 1
-
 /* Define to 1 if you have the  header file. */
 #define HAVE_MEMORY_H 1
 
@@ -639,9 +633,6 @@
 /* Define to 1 if you have the  header file. */
 #define HAVE_UNISTD_H 1/* generate by the Makefile */
 
-/* Define if you have mallinfo */
-/* #undef HAVE_USEFUL_MALLINFO */
-
 /* Define if you have the LibUriParser library */
 /* #undef HAVE_URIPARSER */
 
@@ -828,9 +819,6 @@
STACK_DIRECTION = 0 => direction of growth unknown */
 /* #undef STACK_DIRECTION */
 
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
 /* read-only single-machine data */
 #define SYSCONFDIR PREFIX "\\etc"
 
diff --git a/clients/mapiclient/dotmonetdb.c b/clients/mapiclient/dotmonetdb.c
--- a/clients/mapiclient/dotmonetdb.c
+++ b/clients/mapiclient/dotmonetdb.c
@@ -9,12 +9,7 @@
 #include "monetdb_config.h"
 #include "dotmonetdb.h"
 #include 
-#ifdef HAVE_STRING_H
 #include 
-#endif
-#ifdef HAVE_STRINGS_H
-#include 
-#endif
 
 void
 parse_dotmonetdb(char **user, char **passwd, char **dbname, char **language, 
int *save_history, char **output, int *pagewidth)
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -30,12 +30,9 @@
 #include 
 #endif
 #ifdef HAVE_STRINGS_H
-#include 
+#include/* strcasecmp */
 #endif
 
-#ifdef HAVE_MALLOC_H
-#include 
-#endif
 #ifdef HAVE_LIBREADLINE
 #include 
 #include 
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -744,10 +744,6 @@
 # include 
 #endif
 
-#ifdef HAVE_MALLOC_H
-#include 
-#endif
-
 #include  
 #include  
 #include  
diff --git a/clients/odbc/driver/SQLBrowseConnect.c 
b/clients/odbc/driver/SQLBrowseConnect.c
--- a/clients/odbc/driver/SQLBrowseConnect.c
+++ b/clients/odbc/driver/SQLBrowseConnect.c
@@ -29,7 +29,7 @@
 #include "ODBCDbc.h"
 #include "ODBCUtil.h"
 #ifdef HAVE_STRINGS_H
-#include 
+#include/* strcasecmp */
 #endif
 
 #ifdef HAVE_ODBCINST_H
diff --git a/clients/odbc/driver/SQLConnect.c b/clients/odbc/driver/SQLConnect.c
--- a/clients/odbc/driver/SQLConnect.c
+++ b/clients/odbc/driver/SQLConnect.c
@@ -29,9 +29,6 @@
 #include "ODBCDbc.h"
 #include "ODBCUtil.h"
 #include 
-#ifdef HAVE_STRINGS_H
-#include 
-#endif
 #ifdef HAVE_TIME_H
 #include 
 #endif
diff --git a/clients/odbc/driver/SQLFetch.c b/clients/odbc/driver/SQLFetch.c
--- a/clients/odbc/driver/SQLFetch.c
+++ b/clients/odbc/driver/SQLFetch.c
@@ -28,10 +28,6 @@
 #include "ODBCGlobal.h"
 #include "ODBCStmt.h"
 #include "ODBCUtil.h"
-#include 
-#ifdef HAVE_STRINGS_H
-#include/* for strncasecmp */
-#endif
 
 SQLRETURN
 MNDBFetch(ODBCStmt *stmt, SQLUSMALLINT *RowStatusArray)
diff --git a/clients/odbc/setup/drvcfg.c b/clients/odbc/setup/drvcfg.c
--- a/clients/odbc/setup/drvcfg.c
+++ b/clients/odbc/setup/drvcfg.c
@@ -24,9 +24,6 @@
 #include /* for memset(), memcpy(), strncpy() */
 
 #include /* for malloc() on Darwin */
-#ifdef HAVE_MALLOC_H
-#include 
-#endif
 
 static const char *aHost[] = {
"localhost",
diff --git a/clients/odbc/winsetup/install.c b/clients/odbc/winsetup/install.c
--- a/clients/odbc/winsetup/install.c
+++ b/clients/odbc/winsetup/install.c
@@ -11,7 +11,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #ifdef __MINGW32__
 #define DLL "-0.dll"
diff --git a/common/utils/mcrypt.c b/common/utils/mcrypt.c
--- 

MonetDB: default - Use remove from the C standard instead of unl...

2017-11-20 Thread Sjoerd Mullender
Changeset: 2fda4ff610b2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2fda4ff610b2
Modified Files:
common/utils/msabaoth.c
gdk/gdk_bat.c
gdk/gdk_bbp.c
gdk/gdk_heap.c
gdk/gdk_logger.c
gdk/gdk_posix.h
gdk/gdk_storage.c
monetdb5/modules/mal/mal_mapi.c
sql/backends/monet5/vaults/bam/bam_export.c
sql/backends/monet5/vaults/bam/bam_wrapper.c
sql/backends/monet5/vaults/vault.c
testing/difflib.c
tools/merovingian/daemon/controlrunner.c
tools/merovingian/daemon/forkmserver.c
tools/merovingian/daemon/merovingian.c
tools/merovingian/utils/database.c
tools/merovingian/utils/utils.c
Branch: default
Log Message:

Use remove from the C standard instead of unlink from the Posix standard.


diffs (truncated from 497 to 300 lines):

diff --git a/common/utils/msabaoth.c b/common/utils/msabaoth.c
--- a/common/utils/msabaoth.c
+++ b/common/utils/msabaoth.c
@@ -186,10 +186,10 @@ msab_init(const char *dbfarm, const char
}
}
closedir(d);
-   /* unlink in a separate loop after reading the 
directory,
+   /* remove in a separate loop after reading the 
directory,
 * so as to not have any interference */
while (dbe != NULL) {
-   unlink(dbe->path);
+   remove(dbe->path);
db = dbe;
dbe = dbe->next;
free(db);
@@ -339,7 +339,7 @@ msab_retreatScenario(const char *lang)
return(NULL);
} else {
(void)fclose(f);
-   unlink(pathbuf);
+   remove(pathbuf);
return(NULL);
}
} else {
@@ -350,7 +350,7 @@ msab_retreatScenario(const char *lang)
(void)fclose(f);
return strdup(buf);
} else
-   unlink(pathbuf);  /* empty file? try to remove 
*/
+   remove(pathbuf);  /* empty file? try to remove 
*/
(void)fclose(f);
return(NULL);
}
@@ -414,19 +414,19 @@ msab_wildRetreat(void)
 
if ((tmp = getDBPath(pathbuf, sizeof(pathbuf), SCENARIOFILE)) != NULL)
return(tmp);
-   unlink(pathbuf);
+   remove(pathbuf);
 
if ((tmp = getDBPath(pathbuf, sizeof(pathbuf), CONNECTIONFILE)) != NULL)
return(tmp);
-   unlink(pathbuf);
+   remove(pathbuf);
 
if ((tmp = getDBPath(pathbuf, sizeof(pathbuf), STARTEDFILE)) != NULL)
return(tmp);
-   unlink(pathbuf);
+   remove(pathbuf);
 
if ((tmp = getDBPath(pathbuf, sizeof(pathbuf), _sabaoth_internal_uuid)) 
!= NULL)
return(tmp);
-   unlink(pathbuf);
+   remove(pathbuf);
 
return(NULL);
 }
@@ -480,7 +480,7 @@ msab_registerStarting(void)
/* remove any stray file that would suggest we've finished starting up 
*/
if ((tmp = getDBPath(pathbuf, sizeof(pathbuf), STARTEDFILE)) != NULL)
return(tmp);
-   unlink(pathbuf);
+   remove(pathbuf);
 
 
return(NULL);
@@ -540,7 +540,7 @@ msab_registerStop(void)
 * but for the sake of keeping things clean ... */
if ((tmp = getDBPath(pathbuf, sizeof(pathbuf), _sabaoth_internal_uuid)) 
!= NULL)
return(tmp);
-   unlink(pathbuf);
+   remove(pathbuf);
return(NULL);
 }
 
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -1706,9 +1706,9 @@ backup_new(Heap *hp, int lockbat)
IODEBUG fprintf(stderr, "#rename(%s,%s) = %d\n", batpath, 
bakpath, ret);
} else if (batret == 0) {
/* there is a backup already; just remove the X.new */
-   if ((ret = unlink(batpath)) < 0)
-   GDKsyserror("backup_new: unlink %s failed\n", batpath);
-   IODEBUG fprintf(stderr, "#unlink(%s) = %d\n", batpath, ret);
+   if ((ret = remove(batpath)) != 0)
+   GDKsyserror("backup_new: remove %s failed\n", batpath);
+   IODEBUG fprintf(stderr, "#remove(%s) = %d\n", batpath, ret);
}
GDKfree(batpath);
GDKfree(bakpath);
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -3600,10 +3600,10 @@ force_move(int farmid, const char *srcdi
 
/* step 1: remove the X.new file that is going to be
 * overridden by X */
-   if (unlink(dstpath) < 0 && errno != ENOENT) {
+   

MonetDB: default - Please check for allocation failures

2017-11-20 Thread Pedro Ferreira
Changeset: cd3b01df1308 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cd3b01df1308
Modified Files:
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_interpreter.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_execute.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_statement.c
sql/server/sql_mvc.c
sql/server/sql_mvc.h
Branch: default
Log Message:

Please check for allocation failures


diffs (truncated from 311 to 300 lines):

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
@@ -1242,7 +1242,8 @@ defConstant(MalBlkPtr mb, int type, ValP
setVarCleanup(mb, k);
else
clrVarCleanup(mb, k);
-   VALcopy( (mb, k),cst);
+   if(VALcopy( (mb, k),cst) == NULL)
+   return -1;
if (ATOMextern(cst->vtype) && cst->val.pval)
VALclear(cst);
return k;
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
@@ -238,13 +238,14 @@ str malCommandCall(MalStkPtr stk, InstrP
  * Also we cannot overwrite values on the stack as this maybe part of a
  * sequence of factory calls.
  */
-#define initStack(S)\
+#define initStack(S, R)\
for (i = S; i < mb->vtop; i++) {\
lhs = >stk[i];\
if (isVarConstant(mb, i) > 0) {\
if (!isVarDisabled(mb, i)) {\
rhs = (mb, i);\
-   VALcopy(lhs, rhs);\
+   if(VALcopy(lhs, rhs) == NULL) \
+   R = 0; \
}\
} else {\
lhs->vtype = getVarGDKType(mb, i);\
@@ -267,7 +268,7 @@ MalStkPtr
 prepareMALstack(MalBlkPtr mb, int size)
 {
MalStkPtr stk = NULL;
-   int i;
+   int i, res = 1;
ValPtr lhs, rhs;
 
stk = newGlobalStack(size);
@@ -279,7 +280,9 @@ prepareMALstack(MalBlkPtr mb, int size)
stk->stktop = mb->vtop;
stk->blk = mb;
 
-   initStack(0);
+   initStack(0, res);
+   if(!res)
+   return NULL;
return stk;
 }
 
@@ -307,12 +310,15 @@ str runMAL(Client cntxt, MalBlkPtr mb, M
 */
cntxt->lastcmd= time(0);
if (env != NULL) {
+   int res = 1;
stk = env;
if (mb != stk->blk)
throw(MAL, "mal.interpreter","misalignment of symbols");
if (mb->vtop > stk->stksize)
throw(MAL, "mal.interpreter","stack too small");
-   initStack(env->stkbot);
+   initStack(env->stkbot, res);
+   if(!res)
+   throw(MAL, "mal.interpreter", MAL_MALLOC_FAIL);
} else {
stk = prepareMALstack(mb, mb->vsize);
if (stk == 0)
@@ -415,9 +421,12 @@ callMAL(Client cntxt, MalBlkPtr mb, MalS
*env = stk;
} else {
ValPtr lhs, rhs;
+   int res = 1;
 
stk = *env;
-   initStack(0);
+   initStack(0, res);
+   if(!res)
+   throw(MAL, "mal.interpreter", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
}
assert(stk);
for (i = pci->retc; i < pci->argc; i++) {
@@ -618,8 +627,10 @@ str runMALsequence(Client cntxt, MalBlkP
for (k = 0, i = pci->retc; k < pci->retc && i < 
pci->argc; i++, k++) {
lhs = >stk[pci->argv[k]];
rhs = >stk[pci->argv[i]];
-   VALcopy(lhs, rhs);
-   if (lhs->vtype == TYPE_bat && 
!is_bat_nil(lhs->val.bval))
+   if(VALcopy(lhs, rhs) == NULL) {
+   ret = createException(MAL, 
"mal.interpreter", MAL_MALLOC_FAIL);
+   break;
+   } else if (lhs->vtype == TYPE_bat && 
!is_bat_nil(lhs->val.bval))
BBPretain(lhs->val.bval);
}
freeException(ret);
@@ -627,7 +638,7 @@ str runMALsequence(Client cntxt, MalBlkP
break;
case PATcall:
if (pci->fcn == NULL) {
-   ret = createException(MAL,"interpreter", 
"address of pattern %s.%s missing", pci->modname, pci->fcnname);
+   ret = createException(MAL,"mal.interpreter", 
"address of pattern %s.%s missing", pci->modname, pci->fcnname);
  

MonetDB: data-vaults - Approve Test output

2017-11-20 Thread Panagiotis Koutsourakis
Changeset: e4216d41036c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e4216d41036c
Modified Files:
sql/backends/monet5/vaults/lidar/Tests/lidar-directory.sql.in
sql/backends/monet5/vaults/lidar/Tests/lidar-directory.stable.out
sql/backends/monet5/vaults/lidar/Tests/lidar-single-file.sql.in
sql/backends/monet5/vaults/lidar/Tests/lidar-single-file.stable.out
Branch: data-vaults
Log Message:

Approve Test output


diffs (108 lines):

diff --git a/sql/backends/monet5/vaults/lidar/Tests/lidar-directory.sql.in 
b/sql/backends/monet5/vaults/lidar/Tests/lidar-directory.sql.in
--- a/sql/backends/monet5/vaults/lidar/Tests/lidar-directory.sql.in
+++ b/sql/backends/monet5/vaults/lidar/Tests/lidar-directory.sql.in
@@ -1,6 +1,6 @@
 call lidarattach('$TSTDATAPATH/lidar/directory_loading/', 'tbl1', 
'XYZainrcpedM');
-select column_id, type, width, "sample", count, "unique", nils, minval, 
maxval, sorted, revsorted from sys.statistics;
-select * from vault_journal;
+select type, width, "sample", count, "unique", nils, minval, maxval, sorted, 
revsorted from sys.statistics;
+select table_name, vault_reader_id, vault_type, version from vault_journal;
 call lidarload('tbl1');
 select * from tbl1;
 select count(*) from tbl1;
diff --git a/sql/backends/monet5/vaults/lidar/Tests/lidar-directory.stable.out 
b/sql/backends/monet5/vaults/lidar/Tests/lidar-directory.stable.out
--- a/sql/backends/monet5/vaults/lidar/Tests/lidar-directory.stable.out
+++ b/sql/backends/monet5/vaults/lidar/Tests/lidar-directory.stable.out
@@ -24,24 +24,24 @@ Ready.
 # 16:54:25 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-10899" "--port=34483"
 # 16:54:25 >  
 
-#select column_id, type, width, "sample", count, "unique", nils, minval, 
maxval, sorted, revsorted from sys.statistics;
-% sys.statistics,  sys.statistics, sys.statistics, sys.statistics, 
sys.statistics, sys.statistics, sys.statistics, sys.statistics, sys.statistics, 
sys.statistics, sys.statistics # table_name
-% column_id,   type,   width,  sample, count,  unique, nils,   minval, maxval, 
sorted, revsorted # name
-% int, clob,   int,bigint, bigint, bigint, bigint, clob,   clob,   
boolean,boolean # type
-% 4,   12, 1,  1,  1,  1,  1,  13, 13, 5,  
5 # length
-[ 8414,"decimal(8,2)", 8,  0,  0,  0,  0,  
"635616.31","638864.60",false,  false   ]
-[ 8415,"decimal(8,2)", 8,  0,  0,  0,  0,  
"848977.79","853362.37",false,  false   ]
-[ 8416,"decimal(5,2)", 5,  0,  0,  0,  0,  
"407.35",   "536.84",   false,  false   ]
-[ 8428,"decimal(8,2)", 8,  0,  0,  0,  0,  
"635616.31","638864.60",false,  false   ]
-[ 8429,"decimal(8,2)", 8,  0,  0,  0,  0,  
"848977.79","853362.37",false,  false   ]
-[ 8430,"decimal(5,2)", 5,  0,  0,  0,  0,  
"407.35",   "536.84",   false,  false   ]
-#select * from vault_journal;
-% sys.vault_journal,   sys.vault_journal,  sys.vault_journal,  
sys.vault_journal,  sys.vault_journal # table_name
-% table_id,table_name, vault_reader_id,vault_type, version 
# name
-% int, varchar,int,varchar,varchar # type
-% 4,   4,  1,  5,  5 # length
-[ 8413,"tbl0", 1,  "lidar","1.8.0" ]
-[ 8427,"tbl1", 1,  "lidar","1.8.0" ]
+#select type, width, "sample", count, "unique", nils, minval, maxval, sorted, 
revsorted from sys.statistics;
+% sys.statistics,  sys.statistics, sys.statistics, sys.statistics, 
sys.statistics, sys.statistics, sys.statistics, sys.statistics, sys.statistics, 
sys.statistics # table_name
+% type,width,  sample, count,  unique, nils,   minval, maxval, sorted, 
revsorted # name
+% clob,int,bigint, bigint, bigint, bigint, clob,   clob,   
boolean,boolean # type
+% 12,  1,  1,  1,  1,  1,  13, 13, 5,  5 # 
length
+[ "decimal(8,2)",  8,  0,  0,  0,  0,  
"635616.31","638864.60",false,  false   ]
+[ "decimal(8,2)",  8,  0,  0,  0,  0,  
"848977.79","853362.37",false,  false   ]
+[ "decimal(5,2)",  5,  0,  0,  0,  0,  "407.35",   
"536.84",   false,  false   ]
+[ "decimal(8,2)",  8,  0,  0,  0,  0,  
"635616.31","638864.60",false,  false   ]
+[ "decimal(8,2)",  8,  0,  0,  0,  0,  
"848977.79","853362.37",false,  false   ]
+[ "decimal(5,2)",  5,  0,  0,  0,  0,  "407.35",   
"536.84",   false,  false   ]
+#select table_name, vault_reader_id, 

MonetDB: data-vaults - Merge with default

2017-11-20 Thread Panagiotis Koutsourakis
Changeset: 54c993692e47 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=54c993692e47
Added Files:
sql/test/BugTracker-2017/Tests/check_system_schema.Bug-6437.sql
sql/test/BugTracker-2017/Tests/check_system_schema.Bug-6437.stable.err
sql/test/BugTracker-2017/Tests/check_system_schema.Bug-6437.stable.out
sql/test/BugTracker-2017/Tests/date_to_str.Bug-6467.sql
sql/test/BugTracker-2017/Tests/date_to_str.Bug-6467.stable.err
sql/test/BugTracker-2017/Tests/date_to_str.Bug-6467.stable.out
sql/test/BugTracker-2017/Tests/drop_schema_restrict.Bug-6438.sql
sql/test/BugTracker-2017/Tests/drop_schema_restrict.Bug-6438.stable.err
sql/test/BugTracker-2017/Tests/drop_schema_restrict.Bug-6438.stable.out
sql/test/BugTracker-2017/Tests/drop_system_schema.Bug-6437.sql
sql/test/BugTracker-2017/Tests/drop_system_schema.Bug-6437.stable.err
sql/test/BugTracker-2017/Tests/drop_system_schema.Bug-6437.stable.out
sql/test/BugTracker-2017/Tests/limit.Bug-6322.sql
sql/test/BugTracker-2017/Tests/limit.Bug-6322.stable.err
sql/test/BugTracker-2017/Tests/limit.Bug-6322.stable.out

sql/test/BugTracker-2017/Tests/python_loader_clobbers_default_with_null.Bug-6464.sql

sql/test/BugTracker-2017/Tests/python_loader_clobbers_default_with_null.Bug-6464.stable.err

sql/test/BugTracker-2017/Tests/python_loader_clobbers_default_with_null.Bug-6464.stable.out
sql/test/BugTracker-2017/Tests/skip_problem_best_effort.Bug-6442.sql

sql/test/BugTracker-2017/Tests/skip_problem_best_effort.Bug-6442.stable.err

sql/test/BugTracker-2017/Tests/skip_problem_best_effort.Bug-6442.stable.out
sql/test/mergetables/Tests/mergedb.Bug-6820.reqtests
sql/test/mergetables/Tests/mergedb_drop.reqtests
sql/test/mergetables/Tests/qlsmith-exist-lateral.reqtests
sql/test/mergetables/Tests/sqlsmith-apply-outer-join-or.sql
sql/test/mergetables/Tests/sqlsmith-apply-outer-join-or.stable.err
sql/test/mergetables/Tests/sqlsmith-apply-outer-join-or.stable.out
sql/test/mergetables/Tests/sqlsmith-exist-lateral.reqtests
sql/test/mergetables/Tests/sqlsmith-exist-lateral.sql
sql/test/mergetables/Tests/sqlsmith-exist-lateral.stable.err
sql/test/mergetables/Tests/sqlsmith-exist-lateral.stable.out
sql/test/mergetables/Tests/sqlsmith.Bug-6426.reqtests
sql/test/mergetables/Tests/sqlsmith.Bug-6451.reqtests
sql/test/mergetables/Tests/sqlsmith.Bug-6453.reqtests
sql/test/mergetables/Tests/sqlsmith.Bug-6455.reqtests
sql/test/mergetables/Tests/sqlsmith.Bug-6459.reqtests
sql/test/mergetables/Tests/sqlsmith.Bug-6459.sql
sql/test/mergetables/Tests/sqlsmith.Bug-6459.stable.err
sql/test/mergetables/Tests/sqlsmith.Bug-6459.stable.out
sql/test/mergetables/Tests/sqlsmith.Bug-6459.stable.out.int128
Removed Files:
sql/benchmarks/tpch/fileleak/Tests/All
sql/benchmarks/tpch/fileleak/Tests/check0.reqtests
sql/benchmarks/tpch/fileleak/Tests/check0.sql
sql/benchmarks/tpch/fileleak/Tests/check0.stable.err
sql/benchmarks/tpch/fileleak/Tests/check0.stable.out
sql/benchmarks/tpch/fileleak/Tests/check1.reqtests
sql/benchmarks/tpch/fileleak/Tests/check1.sql
sql/benchmarks/tpch/fileleak/Tests/check1.stable.err
sql/benchmarks/tpch/fileleak/Tests/check1.stable.out
sql/benchmarks/tpch/fileleak/Tests/create.sql.src
sql/benchmarks/tpch/fileleak/Tests/create.stable.err
sql/benchmarks/tpch/fileleak/Tests/create.stable.out
sql/benchmarks/tpch/fileleak/Tests/delete_all.SQL.py
sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.err
sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.out
sql/benchmarks/tpch/fileleak/Tests/leaks.SQL.py
sql/benchmarks/tpch/fileleak/Tests/leaks.stable.err
sql/benchmarks/tpch/fileleak/Tests/leaks.stable.out
sql/benchmarks/tpch/fileleak/Tests/leaks.stable.out.Windows
sql/benchmarks/tpch/fileleak/Tests/load.SQL.py
sql/benchmarks/tpch/fileleak/Tests/load.reqtests
sql/benchmarks/tpch/fileleak/Tests/load.stable.err
sql/benchmarks/tpch/fileleak/Tests/load.stable.out
sql/benchmarks/tpch/fileleak/Tests/test.py
sql/benchmarks/tpch/fileleak/Tests/test.sql
sql/test/BugTracker-2017/Tests/limit.bug-6322.sql
sql/test/leaks/Tests/All
sql/test/leaks/Tests/check1.reqtests
sql/test/leaks/Tests/check1.sql
sql/test/leaks/Tests/check1.stable.err
sql/test/leaks/Tests/check1.stable.out
sql/test/leaks/Tests/check1.stable.out.int128
sql/test/leaks/Tests/check2.reqtests
sql/test/leaks/Tests/check2.sql.src
sql/test/leaks/Tests/check2.stable.err
sql/test/leaks/Tests/check2.stable.out

MonetDB: default - Forgot to release lock in case of failure, pl...

2017-11-20 Thread Pedro Ferreira
Changeset: 234d6a70715b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=234d6a70715b
Modified Files:
sql/backends/monet5/sql.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_user.c
sql/server/sql_mvc.c
sql/server/sql_mvc.h
sql/storage/store.c
Branch: default
Log Message:

Forgot to release lock in case of failure, plus more allocation checks


diffs (239 lines):

diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -557,10 +557,14 @@ setVariable(Client cntxt, MalBlkPtr mb, 
msg = addPipeDefinition(cntxt, buf, newopt);
if (msg)
return msg;
-   if (stack_find_var(m, varname))
-   stack_set_string(m, varname, buf);
-   } else if (stack_find_var(m, varname))
-   stack_set_string(m, varname, newopt);
+   if (stack_find_var(m, varname)) {
+   if(!stack_set_string(m, varname, buf))
+   throw(SQL, "sql.setVariable", 
SQLSTATE(HY001) MAL_MALLOC_FAIL);
+   }
+   } else if (stack_find_var(m, varname)) {
+   if(!stack_set_string(m, varname, newopt))
+   throw(SQL, "sql.setVariable", 
SQLSTATE(HY001) MAL_MALLOC_FAIL);
+   }
}
return MAL_SUCCEED;
}
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -285,7 +285,7 @@ SQLinit(void)
if(stack_push_var(sql, name, ))   
\
stack_set_var(sql, name, VALset(, ctype.type->localtype, 
val)); \
else
\
-   failure++;  
\
+   failure--;  
\
 
 #define NR_GLOBAL_VARS 10
 /* NR_GLOBAL_VAR should match exactly the number of variables created
@@ -399,6 +399,11 @@ SQLtrans(mvc *m)
if (s->schema_name)
GDKfree(s->schema_name);
s->schema_name = monet5_user_get_def_schema(m, 
m->user_id);
+   if(!s->schema_name) {
+   mvc_cancel_session(m);
+   (void) sql_error(m, 02, SQLSTATE(HY001) 
"Allocation failure while starting the transaction");
+   return;
+   }
assert(s->schema_name);
s->schema = find_sql_schema(s->tr, s->schema_name);
assert(s->schema);
@@ -441,6 +446,7 @@ SQLinitClient(Client c)
bstream *fdin;
 
if( b == NULL || cbuf == NULL) {
+   MT_lock_unset(_contextLock);
GDKfree(b);
GDKfree(cbuf);
throw(SQL,"sql.initClient",SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
@@ -449,12 +455,14 @@ SQLinitClient(Client c)
buffer_init(b, cbuf, len);
buf = buffer_rastream(b, "si");
if( buf == NULL) {
+   MT_lock_unset(_contextLock);
buffer_destroy(b);
throw(SQL,"sql.initClient",SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
}
 
fdin = bstream_create(buf, b->len);
if( fdin == NULL) {
+   MT_lock_unset(_contextLock);
buffer_destroy(b);
throw(SQL,"sql.initClient",SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
}
@@ -465,20 +473,30 @@ SQLinitClient(Client c)
}
if (c->sqlcontext == 0) {
m = mvc_create(c->idx, 0, SQLdebug, c->fdin, c->fdout);
-   if( m == NULL)
+   if( m == NULL) {
+   MT_lock_unset(_contextLock);
throw(SQL,"sql.initClient",SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
-   if(global_variables(m, "monetdb", "sys"))
+   }
+   if(global_variables(m, "monetdb", "sys") < 0) {
+   MT_lock_unset(_contextLock);
+   mvc_destroy(m);
throw(SQL,"sql.initClient",SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
+   }
if (isAdministrator(c) || strcmp(c->scenario, "msql") == 0) 
/* console should return everything */
m->reply_size = -1;

MonetDB: jitudf - Merge with default

2017-11-20 Thread Mark Raasveldt
Changeset: c6dada6109ea for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c6dada6109ea
Added Files:
sql/test/BugTracker-2017/Tests/date_to_str.Bug-6467.sql
sql/test/BugTracker-2017/Tests/date_to_str.Bug-6467.stable.err
sql/test/BugTracker-2017/Tests/date_to_str.Bug-6467.stable.out
sql/test/BugTracker-2017/Tests/limit.Bug-6322.sql
sql/test/BugTracker-2017/Tests/limit.Bug-6322.stable.err
sql/test/BugTracker-2017/Tests/limit.Bug-6322.stable.out

sql/test/BugTracker-2017/Tests/python_loader_clobbers_default_with_null.Bug-6464.sql

sql/test/BugTracker-2017/Tests/python_loader_clobbers_default_with_null.Bug-6464.stable.err

sql/test/BugTracker-2017/Tests/python_loader_clobbers_default_with_null.Bug-6464.stable.out
sql/test/BugTracker-2017/Tests/skip_problem_best_effort.Bug-6442.sql

sql/test/BugTracker-2017/Tests/skip_problem_best_effort.Bug-6442.stable.err

sql/test/BugTracker-2017/Tests/skip_problem_best_effort.Bug-6442.stable.out
sql/test/mergetables/Tests/mergedb.Bug-6820.reqtests
sql/test/mergetables/Tests/mergedb_drop.reqtests
sql/test/mergetables/Tests/qlsmith-exist-lateral.reqtests
sql/test/mergetables/Tests/sqlsmith-apply-outer-join-or.sql
sql/test/mergetables/Tests/sqlsmith-apply-outer-join-or.stable.err
sql/test/mergetables/Tests/sqlsmith-apply-outer-join-or.stable.out
sql/test/mergetables/Tests/sqlsmith-exist-lateral.reqtests
sql/test/mergetables/Tests/sqlsmith-exist-lateral.sql
sql/test/mergetables/Tests/sqlsmith-exist-lateral.stable.err
sql/test/mergetables/Tests/sqlsmith-exist-lateral.stable.out
sql/test/mergetables/Tests/sqlsmith.Bug-6426.reqtests
sql/test/mergetables/Tests/sqlsmith.Bug-6451.reqtests
sql/test/mergetables/Tests/sqlsmith.Bug-6453.reqtests
sql/test/mergetables/Tests/sqlsmith.Bug-6455.reqtests
sql/test/mergetables/Tests/sqlsmith.Bug-6459.reqtests
sql/test/mergetables/Tests/sqlsmith.Bug-6459.stable.out.int128
Removed Files:
sql/benchmarks/tpch/fileleak/Tests/All
sql/benchmarks/tpch/fileleak/Tests/check0.reqtests
sql/benchmarks/tpch/fileleak/Tests/check0.sql
sql/benchmarks/tpch/fileleak/Tests/check0.stable.err
sql/benchmarks/tpch/fileleak/Tests/check0.stable.out
sql/benchmarks/tpch/fileleak/Tests/check1.reqtests
sql/benchmarks/tpch/fileleak/Tests/check1.sql
sql/benchmarks/tpch/fileleak/Tests/check1.stable.err
sql/benchmarks/tpch/fileleak/Tests/check1.stable.out
sql/benchmarks/tpch/fileleak/Tests/create.sql.src
sql/benchmarks/tpch/fileleak/Tests/create.stable.err
sql/benchmarks/tpch/fileleak/Tests/create.stable.out
sql/benchmarks/tpch/fileleak/Tests/delete_all.SQL.py
sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.err
sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.out
sql/benchmarks/tpch/fileleak/Tests/leaks.SQL.py
sql/benchmarks/tpch/fileleak/Tests/leaks.stable.err
sql/benchmarks/tpch/fileleak/Tests/leaks.stable.out
sql/benchmarks/tpch/fileleak/Tests/leaks.stable.out.Windows
sql/benchmarks/tpch/fileleak/Tests/load.SQL.py
sql/benchmarks/tpch/fileleak/Tests/load.reqtests
sql/benchmarks/tpch/fileleak/Tests/load.stable.err
sql/benchmarks/tpch/fileleak/Tests/load.stable.out
sql/benchmarks/tpch/fileleak/Tests/test.py
sql/benchmarks/tpch/fileleak/Tests/test.sql
sql/test/BugTracker-2017/Tests/limit.bug-6322.sql
sql/test/leaks/Tests/All
sql/test/leaks/Tests/check1.reqtests
sql/test/leaks/Tests/check1.sql
sql/test/leaks/Tests/check1.stable.err
sql/test/leaks/Tests/check1.stable.out
sql/test/leaks/Tests/check1.stable.out.int128
sql/test/leaks/Tests/check2.reqtests
sql/test/leaks/Tests/check2.sql.src
sql/test/leaks/Tests/check2.stable.err
sql/test/leaks/Tests/check2.stable.out
sql/test/leaks/Tests/check2.stable.out.int128
sql/test/leaks/Tests/check3.reqtests
sql/test/leaks/Tests/check3.sql.src
sql/test/leaks/Tests/check3.stable.err
sql/test/leaks/Tests/check3.stable.out
sql/test/leaks/Tests/check3.stable.out.int128
sql/test/leaks/Tests/check4.reqtests
sql/test/leaks/Tests/check4.sql.src
sql/test/leaks/Tests/check4.stable.err
sql/test/leaks/Tests/check4.stable.out
sql/test/leaks/Tests/check4.stable.out.int128
sql/test/leaks/Tests/check5.reqtests
sql/test/leaks/Tests/check5.sql.src
sql/test/leaks/Tests/check5.stable.err
sql/test/leaks/Tests/check5.stable.out
sql/test/leaks/Tests/check5.stable.out.int128
sql/test/leaks/Tests/drop3.reqtests
sql/test/leaks/Tests/drop3.sql
sql/test/leaks/Tests/drop3.stable.err