Changeset: 0ab7a2e3483f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0ab7a2e3483f
Modified Files:
monetdb5/mal/mal_import.c
monetdb5/tools/Tests/mserver5--help.stable.err
monetdb5/tools/Tests/mserver5--help.stable.err.Windows
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_statement.c
sql/common/sql_hash.c
sql/common/sql_list.c
sql/server/rel_exp.c
sql/storage/sql_catalog.c
tools/mserver/mserver5.c
Branch: default
Log Message:
Merge with Dec2016 branch.
diffs (truncated from 414 to 300 lines):
diff --git a/monetdb5/mal/mal_import.c b/monetdb5/mal/mal_import.c
--- a/monetdb5/mal/mal_import.c
+++ b/monetdb5/mal/mal_import.c
@@ -222,7 +222,7 @@ malInclude(Client c, str name, int listi
parseMAL(c, c->curprg, 1);
bstream_destroy(c->fdin);
} else {
- GDKfree(s); // not interested in error here
+ freeException(s); // not interested in error
here
s = MAL_SUCCEED;
}
if (p)
diff --git a/monetdb5/tools/Tests/mserver5--help.stable.err
b/monetdb5/tools/Tests/mserver5--help.stable.err
--- a/monetdb5/tools/Tests/mserver5--help.stable.err
+++ b/monetdb5/tools/Tests/mserver5--help.stable.err
@@ -34,7 +34,6 @@ The debug, testing & trace options:
--optimizers
--trace
--forcemito
- --recycler
--debug=<bitmask>
# 10:03:11 >
diff --git a/monetdb5/tools/Tests/mserver5--help.stable.err.Windows
b/monetdb5/tools/Tests/mserver5--help.stable.err.Windows
--- a/monetdb5/tools/Tests/mserver5--help.stable.err.Windows
+++ b/monetdb5/tools/Tests/mserver5--help.stable.err.Windows
@@ -29,7 +29,6 @@ The debug, testing & trace options:
--optimizers
--trace
--forcemito
- --recycler
--debug=<bitmask>
# 10:03:11 >
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
@@ -64,12 +64,19 @@ list_find_column(backend *be, list *l, c
MT_lock_set(&l->ht_lock);
if (!l->ht && list_length(l) > HASH_MIN_SIZE) {
l->ht = hash_new(l->sa, MAX(list_length(l), l->expected_cnt),
(fkeyvalue)&stmt_key);
+ if (l->ht == NULL) {
+ MT_lock_unset(&l->ht_lock);
+ return NULL;
+ }
for (n = l->h; n; n = n->next) {
const char *nme = column_name(be->mvc->sa, n->data);
int key = hash_key(nme);
- hash_add(l->ht, key, n->data);
+ if (hash_add(l->ht, key, n->data) == NULL) {
+ MT_lock_unset(&l->ht_lock);
+ return NULL;
+ }
}
}
if (l->ht) {
diff --git a/sql/backends/monet5/sql_statement.c
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -2863,84 +2863,92 @@ stmt_alias(backend *be, stmt *op1, const
sql_subtype *
tail_type(stmt *st)
{
- switch (st->type) {
- case st_const:
- return tail_type(st->op2);
-
- case st_uselect:
- case st_uselect2:
- case st_limit:
- case st_limit2:
- case st_sample:
- case st_tunion:
- case st_tdiff:
- case st_tinter:
- case st_append:
- case st_alias:
- case st_gen_group:
- case st_order:
- return tail_type(st->op1);
-
- case st_list:
- return tail_type(st->op4.lval->h->data);
-
- case st_bat:
- return &st->op4.cval->type;
- case st_idxbat:
- if (hash_index(st->op4.idxval->type)) {
+ for (;;) {
+ switch (st->type) {
+ case st_const:
+ st = st->op2;
+ continue;
+
+ case st_uselect:
+ case st_uselect2:
+ case st_limit:
+ case st_limit2:
+ case st_sample:
+ case st_tunion:
+ case st_tdiff:
+ case st_tinter:
+ case st_append:
+ case st_alias:
+ case st_gen_group:
+ case st_order:
+ st = st->op1;
+ continue;
+
+ case st_list:
+ st = st->op4.lval->h->data;
+ continue;
+
+ case st_bat:
+ return &st->op4.cval->type;
+ case st_idxbat:
+ if (hash_index(st->op4.idxval->type)) {
+ return sql_bind_localtype("lng");
+ } else if (st->op4.idxval->type == join_idx) {
+ return sql_bind_localtype("oid");
+ }
+ /* fall through */
+ case st_join:
+ case st_join2:
+ case st_joinN:
+ if (st->flag == cmp_project) {
+ st = st->op2;
+ continue;
+ }
+ /* fall through */
+ case st_reorder:
+ case st_group:
+ case st_result:
+ case st_tid:
+ case st_mirror:
+ return sql_bind_localtype("oid");
+ case st_table_clear:
return sql_bind_localtype("lng");
- } else if (st->op4.idxval->type == join_idx) {
- return sql_bind_localtype("oid");
+
+ case st_aggr: {
+ list *res = st->op4.aggrval->res;
+
+ if (res && list_length(res) == 1)
+ return res->h->data;
+
+ return NULL;
}
- /* fall through */
- case st_join:
- case st_join2:
- case st_joinN:
- if (st->flag == cmp_project)
- return tail_type(st->op2);
- /* fall through */
- case st_reorder:
- case st_group:
- case st_result:
- case st_tid:
- case st_mirror:
- return sql_bind_localtype("oid");
- case st_table_clear:
- return sql_bind_localtype("lng");
-
- case st_aggr: {
- list *res = st->op4.aggrval->res;
-
- if (res && list_length(res) == 1)
- return res->h->data;
-
- } break;
- case st_Nop: {
- list *res = st->op4.funcval->res;
-
- if (res && list_length(res) == 1)
- return res->h->data;
- } break;
- case st_atom:
- return atom_type(st->op4.aval);
- case st_convert:
- case st_temp:
- case st_single:
- case st_rs_column:
- return &st->op4.typeval;
- case st_var:
- if (st->op4.typeval.type)
+ case st_Nop: {
+ list *res = st->op4.funcval->res;
+
+ if (res && list_length(res) == 1)
+ return res->h->data;
+ return NULL;
+ }
+ case st_atom:
+ return atom_type(st->op4.aval);
+ case st_convert:
+ case st_temp:
+ case st_single:
+ case st_rs_column:
return &st->op4.typeval;
- /* fall through */
- case st_exception:
- return NULL;
- case st_table:
- return sql_bind_localtype("bat");
- default:
- assert(0);
- return NULL;
+ case st_var:
+ if (st->op4.typeval.type)
+ return &st->op4.typeval;
+ /* fall through */
+ case st_exception:
+ return NULL;
+ case st_table:
+ return sql_bind_localtype("bat");
+ default:
+ assert(0);
+ return NULL;
+ }
}
- return NULL;
}
int
diff --git a/sql/common/sql_hash.c b/sql/common/sql_hash.c
--- a/sql/common/sql_hash.c
+++ b/sql/common/sql_hash.c
@@ -27,6 +27,8 @@ hash_new(sql_allocator *sa, int size, fk
int i;
sql_hash *ht = SA_ZNEW(sa, sql_hash);
+ if (ht == NULL)
+ return NULL;
ht->sa = sa;
ht->size = (1<<log_base2(size-1));
ht->key = key;
@@ -41,6 +43,8 @@ hash_add(sql_hash *h, int key, void *val
{
sql_hash_e *e = SA_ZNEW(h->sa, sql_hash_e);
+ if (e == NULL)
+ return NULL;
e->chain = h->buckets[key&(h->size-1)];
h->buckets[key&(h->size-1)] = e;
e->key = key;
diff --git a/sql/common/sql_list.c b/sql/common/sql_list.c
--- a/sql/common/sql_list.c
+++ b/sql/common/sql_list.c
@@ -15,6 +15,8 @@ node_create(sql_allocator *sa, void *dat
{
node *n = (sa)?SA_NEW(sa, node):MNEW(node);
+ if (n == NULL)
+ return NULL;
n->next = NULL;
n->data = data;
return n;
@@ -130,6 +132,8 @@ list_append(list *l, void *data)
{
node *n = node_create(l->sa, data);
+ if (n == NULL)
+ return NULL;
if (l->cnt) {
l->t->next = n;
} else {
@@ -141,7 +145,10 @@ list_append(list *l, void *data)
if (l->ht) {
int key = l->ht->key(data);
- hash_add(l->ht, key, data);
+ if (hash_add(l->ht, key, data) == NULL) {
+ MT_lock_unset(&l->ht_lock);
+ return NULL;
+ }
}
MT_lock_unset(&l->ht_lock);
return l;
@@ -153,6 +160,8 @@ list_append_before(list *l, node *m, voi
node *p = l->h;
node *n = node_create(l->sa, data);
+ if (n == NULL)
+ return NULL;
n->next = m;
if (p == m){
l->h = n;
@@ -166,7 +175,10 @@ list_append_before(list *l, node *m, voi
if (l->ht) {
int key = l->ht->key(data);
- hash_add(l->ht, key, data);
+ if (hash_add(l->ht, key, data) == NULL) {
+ MT_lock_unset(&l->ht_lock);
+ return NULL;
+ }
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list