Changeset: 2a5757fe11ee for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2a5757fe11ee
Modified Files:
gdk/gdk_bbp.c
gdk/gdk_heap.c
gdk/gdk_string.c
monetdb5/mal/mal_linker.c
Branch: default
Log Message:
Merge with Jul2021 branch.
diffs (truncated from 321 to 300 lines):
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -298,7 +298,6 @@ BBPinithash(int j)
;
BBP_hash = (bat *) GDKzalloc(BBP_mask * sizeof(bat));
if (BBP_hash == NULL) {
- GDKerror("cannot allocate memory\n");
return GDK_FAIL;
}
BBP_mask--;
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -143,16 +143,17 @@ HEAPalloc(Heap *h, size_t nitems, size_t
{
h->base = NULL;
h->size = 1;
- if (itemsize)
+ if (itemsize) {
+ /* check for overflow */
+ if (nitems > BUN_NONE / itemsize) {
+ GDKerror("allocating more than heap can accomodate\n");
+ return GDK_FAIL;
+ }
h->size = MAX(1, nitems) * itemsize;
+ }
h->free = 0;
h->cleanhash = false;
- /* check for overflow */
- if (itemsize && nitems > (h->size / itemsize)) {
- GDKerror("allocating more than heap can accomodate\n");
- return GDK_FAIL;
- }
if (GDKinmemory(h->farmid) ||
(GDKmem_cursize() + h->size < GDK_mem_maxsize &&
h->size < (h->farmid == 0 ? GDK_mmap_minsize_persistent :
GDK_mmap_minsize_transient))) {
diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c
--- a/gdk/gdk_string.c
+++ b/gdk/gdk_string.c
@@ -267,7 +267,7 @@ strPut(BAT *b, var_t *dst, const void *V
assert(newsize);
if (h->free + pad + len >= (size_t) VAR_MAX) {
- GDKerror("string heaps gets larger than %zuGiB.\n",
(size_t) VAR_MAX >> 30);
+ GDKerror("string heap gets larger than %zuGiB.\n",
(size_t) VAR_MAX >> 30);
return (var_t) -1;
}
TRC_DEBUG(HEAP, "HEAPextend in strPut %s %zu %zu\n",
h->filename, h->size, newsize);
diff --git a/monetdb5/mal/mal_linker.c b/monetdb5/mal/mal_linker.c
--- a/monetdb5/mal/mal_linker.c
+++ b/monetdb5/mal/mal_linker.c
@@ -264,7 +264,30 @@ loadLibrary(const char *filename, int fl
}
if (handle == NULL) {
- if (flag)
+ if (strcmp(filename, "monetdb5") != 0 && strcmp(filename,
"sql") != 0
+ && strcmp(filename, "generator") != 0
+#ifdef HAVE_GEOM
+ && strcmp(filename, "geom") != 0
+#endif
+#ifdef HAVE_LIBR
+ && strcmp(filename, "rapi") != 0
+#endif
+#ifdef HAVE_LIBPY3
+ && strcmp(filename, "pyapi3") != 0
+#endif
+#ifdef HAVE_CUDF
+ && strcmp(filename, "capi") != 0
+#endif
+#ifdef HAVE_FITS
+ && strcmp(filename, "fits") != 0
+#endif
+#ifdef HAVE_NETCDF
+ && strcmp(filename, "netcdf") != 0
+#endif
+#ifdef HAVE_SHP
+ && strcmp(filename, "shp") != 0
+#endif
+ )
throw(LOADER, "loadLibrary", RUNTIME_LOAD_ERROR " could
not locate library %s (from within file '%s'): %s", s, filename, dlerror());
}
diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c
--- a/sql/server/rel_psm.c
+++ b/sql/server/rel_psm.c
@@ -231,12 +231,11 @@ rel_psm_while_do( sql_query *query, sql_
sql_rel *rel = NULL;
exp_kind ek = {type_value, card_value, FALSE};
- cond = rel_logical_value_exp(query, &rel, n->data.sym, sql_sel
| sql_psm, ek);
+ if (!(cond = rel_logical_value_exp(query, &rel, n->data.sym,
sql_sel | sql_psm, ek)))
+ return NULL;
psm_zero_or_one(cond);
n = n->next;
- whilestmts = sequential_block(query, res, restypelist,
n->data.lval, n->next->data.sval, is_func);
-
- if (sql->session->status || !cond || !whilestmts)
+ if (!(whilestmts = sequential_block(query, res, restypelist,
n->data.lval, n->next->data.sval, is_func)))
return NULL;
return exp_while( sql->sa, cond, whilestmts );
@@ -263,14 +262,15 @@ psm_if_then_else( sql_query *query, sql_
sql_rel *rel = NULL;
exp_kind ek = {type_value, card_value, FALSE};
- cond = rel_logical_value_exp(query, &rel, n->data.sym, sql_sel
| sql_psm, ek);
+ if (!(cond = rel_logical_value_exp(query, &rel, n->data.sym,
sql_sel | sql_psm, ek)))
+ return NULL;
psm_zero_or_one(cond);
n = n->next;
- ifstmts = sequential_block(query, res, restypelist,
n->data.lval, NULL, is_func);
+ if (!(ifstmts = sequential_block(query, res, restypelist,
n->data.lval, NULL, is_func)))
+ return NULL;
n = n->next;
elsestmts = psm_if_then_else( query, res, restypelist, n,
is_func);
-
- if (sql->session->status || !cond || !ifstmts)
+ if (sql->session->status)
return NULL;
return append(sa_list(sql->sa), exp_if( sql->sa, cond, ifstmts,
elsestmts));
@@ -296,13 +296,15 @@ rel_psm_if_then_else( sql_query *query,
sql_rel *rel = NULL;
exp_kind ek = {type_value, card_value, FALSE};
- cond = rel_logical_value_exp(query, &rel, n->data.sym, sql_sel
| sql_psm, ek);
+ if (!(cond = rel_logical_value_exp(query, &rel, n->data.sym,
sql_sel | sql_psm, ek)))
+ return NULL;
psm_zero_or_one(cond);
n = n->next;
- ifstmts = sequential_block(query, res, restypelist,
n->data.lval, NULL, is_func);
+ if (!(ifstmts = sequential_block(query, res, restypelist,
n->data.lval, NULL, is_func)))
+ return NULL;
n = n->next;
elsestmts = psm_if_then_else( query, res, restypelist, n,
is_func);
- if (sql->session->status || !cond || !ifstmts)
+ if (sql->session->status)
return NULL;
return exp_if( sql->sa, cond, ifstmts, elsestmts);
@@ -583,29 +585,6 @@ rel_select_with_into(sql_query *query, s
return rel_psm_block(query->sql->sa, reslist);
}
-static int while_exps_find_one_return(list *l);
-
-static int
-while_exp_find_one_return(sql_exp *e)
-{
- if (e->flag & PSM_RETURN)
- return 1;
- if (e->flag & PSM_WHILE)
- return while_exps_find_one_return(e->r);
- if (e->flag & PSM_IF)
- return while_exps_find_one_return(e->r) || (e->f &&
while_exps_find_one_return(e->f));
- return 0;
-}
-
-static int
-while_exps_find_one_return(list *l)
-{
- int res = 0;
- for (node *n = l->h ; n && !res; n = n->next)
- res |= while_exp_find_one_return(n->data);
- return res;
-}
-
static int has_return( list *l );
static int
@@ -616,8 +595,6 @@ exp_has_return(sql_exp *e)
return 1;
if (e->flag & PSM_IF) /* for if, both sides must exist and both
must have a return */
return has_return(e->r) && e->f && has_return(e->f);
- if (e->flag & PSM_WHILE) /* for while, at least one of the
statements must have a return */
- return while_exps_find_one_return(e->r);
}
return 0;
}
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
@@ -527,6 +527,8 @@ rids_orderby(sql_trans *tr, rids *r, sql
return NULL;
s = BATproject(r->data, b);
bat_destroy(b);
+ if (s == NULL)
+ return NULL;
if (BATsort(NULL, &o, NULL, s, NULL, NULL, false, false, false) !=
GDK_SUCCEED) {
bat_destroy(s);
return NULL;
diff --git a/sql/test/miscellaneous/Tests/simple_selects.test
b/sql/test/miscellaneous/Tests/simple_selects.test
--- a/sql/test/miscellaneous/Tests/simple_selects.test
+++ b/sql/test/miscellaneous/Tests/simple_selects.test
@@ -753,7 +753,7 @@ select ups()
2
statement ok
-create or replace function ups() returns int begin while 1 = 1 do if null is
null then return 1; else return 2; end if; end while; end
+create or replace function ups() returns int begin while 1 = 1 do if null is
null then return 1; else return 2; end if; end while; return 1; end
query I rowsort
select ups()
@@ -761,7 +761,7 @@ select ups()
1
statement ok
-create or replace function ups() returns int begin declare a int; set a = 2;
while a < 2 do if null is null then return 3; else set a = 2; end if; end
while; end
+create or replace function ups() returns int begin declare a int; set a = 2;
while a < 2 do if null is null then return 3; else set a = 2; end if; end
while; return 3; end
query I rowsort
select ups()
@@ -854,3 +854,11 @@ 3
statement ok
rollback
+
+statement error CREATE FUNCTION: missing return statement
+CREATE FUNCTION wrongfunc() RETURNS INT
+BEGIN
+ WHILE (FALSE) DO
+ RETURN 1;
+ END WHILE;
+END
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -48,6 +48,9 @@ initdb = None
single_in_memory = False
restart = False
+# extra mserver5 options
+mserver5_opts = []
+
global_timeout = 0
start_time = time.time()
@@ -1327,7 +1330,7 @@ def PerformDir(env, testdir, testlist, a
return td, elem, max(FdOut, FdErr), interrupted
z.close()
if not oneserver:
- pSrvr =
ServerClass(splitcommand(env['exe']['mserver5'][1]) + ['--dbpath=%s' %
LogDBdir], open(os.devnull, 'w'), open(os.devnull, 'w'), par['TIMEOUT'],
os.path.join(LogDBdir, '.started'))
+ pSrvr =
ServerClass(splitcommand(env['exe']['mserver5'][1]) + ['--dbpath=%s' %
LogDBdir] + mserver5_opts, open(os.devnull, 'w'), open(os.devnull, 'w'),
par['TIMEOUT'], os.path.join(LogDBdir, '.started'))
pSrvr.LaunchIt()
pSrvr.terminate()
if not os.path.exists(TSTTRGDIR):
@@ -1352,10 +1355,10 @@ def PerformDir(env, testdir, testlist, a
inmem = False
break
if inmem:
- cmd = splitcommand(env['exe']['mserver5'][1]) +
['--set', 'gdk_dbname=%s' % TSTDB, '--in-memory'] + options
+ cmd = splitcommand(env['exe']['mserver5'][1]) +
['--set', 'gdk_dbname=%s' % TSTDB, '--in-memory'] + mserver5_opts + options
pollfile = None
else:
- cmd = splitcommand(env['exe']['mserver5'][1]) +
['--dbpath=%s' % LogDBdir] + options
+ cmd = splitcommand(env['exe']['mserver5'][1]) +
['--dbpath=%s' % LogDBdir] + mserver5_opts + options
pollfile = os.path.join(LogDBdir, '.started')
if env.get('MULTIFARM'):
cmd.append('--dbextra=%s' %
os.path.join(env['GDK_DBFARM'], TSTPREF + '_transient'))
@@ -1633,6 +1636,7 @@ def GetBitsAndModsAndThreads(env) :
cmd.append('--dbextra=in-memory')
if procdebug:
print('GetBitsAndModsAndThreads: starting process "%s" (inpipe,
outpipe, errpipe)\n' % '" "'.join(cmd))
+ cmd.extend(mserver5_opts)
setpgrp = True
with process.Popen(cmd, stdin=process.PIPE, stdout=process.PIPE,
stderr=process.PIPE, text=True) as proc:
@@ -2757,6 +2761,7 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
os.makedirs(os.path.join(env['GDK_DBFARM'], TSTPREF +
'_transient'))
elif env.get('TRANS_INMEM'):
Srvr.append('--dbextra=in-memory')
+ Srvr.extens(mserver5_opts)
pSrvr = ServerClass(Srvr, SrvrOut, SrvrErr, TIMEOUT,
os.path.join(dbpath, '.started'))
pSrvr.LaunchIt()
os.environ['MAPIPORT'] = env['MAPIPORT'] = pSrvr.port
@@ -3374,7 +3379,8 @@ def main(argv) :
parser.add_argument('--RUBYCLIENT', action='store', dest='RUBYCLIENT',
metavar='<ruby program>', help='default: %s' % dft['RUBYCLIENT'])
parser.add_argument('--concurrent', action='store_true',
dest='concurrent', help='There are concurrent Mtest runs using the same MonetDB
installation')
parser.add_argument('--dbg', action='store', dest='dbg',
metavar='<debugger/valgrind>', help="debugger to start before each server")
- parser.add_argument('--mserver_set', action='store', dest='mserver_set',
metavar='<mserver5_option>', help="This passes a single set to the server")
+ parser.add_argument('--mserver_set', action='append', dest='mserver_set',
metavar='<mserver5_option>', help="This passes a single set to the server")
+ parser.add_argument('--loadmodule', action='append', dest='loadmodule',
metavar='<module_name>', help="Pass on loadmodule to mserver5")
parser.add_argument('--no-clean', action='store_true', dest='no_clean',
help='Do not clean up before test')
parser.add_argument('--testweb', action='store_true', dest='testweb',
help='Optimize testing for testweb')
parser.add_argument('--releaserun', action='store_true',
dest='releaserun', help='run tests as if for a release test')
@@ -3432,13 +3438,14 @@ def main(argv) :
a = opts.dbg
if a is not None:
env['DBG'] = a
- a = opts.mserver_set
- if a is not None:
- env['MSERVER_SET'] = "--set " + a
- if a == 'sql_debug=128':
- CONDITIONALS['NOWAL'] = True
- else:
- env['MSERVER_SET'] = ""
+ if opts.mserver_set:
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list