Changeset: 3cb408452974 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3cb408452974
Modified Files:
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/sql_statement.c
        sql/backends/monet5/sql_upgrades.c
Branch: default
Log Message:

Merge with Jun2023 branch.


diffs (truncated from 1001 to 300 lines):

diff --git a/gdk/gdk_tm.c b/gdk/gdk_tm.c
--- a/gdk/gdk_tm.c
+++ b/gdk/gdk_tm.c
@@ -207,6 +207,10 @@ TMsubcommit_list(bat *restrict subcommit
        }
        /* lock just prevents other global (sub-)commits */
        BBPtmlock();
+       if (logno < 0)
+               logno = getBBPlogno();
+       if (transid < 0)
+               transid = getBBPtransid();
        if (BBPsync(cnt, subcommit, sizes, logno, transid) == GDK_SUCCEED) { /* 
write BBP.dir (++) */
                epilogue(cnt, subcommit, false);
                ret = GDK_SUCCEED;
@@ -239,7 +243,7 @@ TMsubcommit(BAT *b)
        }
        bat_iterator_end(&bi);
 
-       ret = TMsubcommit_list(subcommit, NULL, cnt, getBBPlogno(), 
getBBPtransid());
+       ret = TMsubcommit_list(subcommit, NULL, cnt, -1, -1);
        GDKfree(subcommit);
        return ret;
 }
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
@@ -456,17 +456,7 @@ newInstructionArgs(MalBlkPtr mb, const c
 
        p = GDKzalloc(args * sizeof(p->argv[0]) + offsetof(InstrRecord, argv));
        if (p == NULL) {
-#if 0
-               /* We are facing an hard problem.
-                * The upper layers of the code base assume that this routine 
will always produce a structure.
-                * Furthermore, failure to allocate such a small data structure 
indicates we are in serious trouble.
-                * The only way out is declare it a fatal error, terminate the 
system to avoid crashes in all kind of places.
-                */
-               GDKfatal(SQLSTATE(HY013) MAL_MALLOC_FAIL);
-               exit(1);
-#else
                return NULL;
-#endif
        }
        p->maxarg = args;
        p->typechk = TYPE_UNKNOWN;
diff --git a/monetdb5/modules/mal/querylog.c b/monetdb5/modules/mal/querylog.c
--- a/monetdb5/modules/mal/querylog.c
+++ b/monetdb5/modules/mal/querylog.c
@@ -256,7 +256,7 @@ static str
        }
 
        QLOG_init = true;
-       if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), 
getBBPtransid()) != GDK_SUCCEED)
+       if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != 
GDK_SUCCEED)
                throw(MAL, "querylog.init", GDK_EXCEPTION);
        return MAL_SUCCEED;
 }
@@ -344,7 +344,7 @@ QLOGempty(void *ret)
        BATclear(QLOG_calls_cpuload,true);
        BATclear(QLOG_calls_iowait,true);
 
-       if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), 
getBBPtransid()) != GDK_SUCCEED)
+       if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != 
GDK_SUCCEED)
                msg = createException(MAL, "querylog.empty", GDK_EXCEPTION);
        MT_lock_unset(&QLOGlock);
        return MAL_SUCCEED;
@@ -384,7 +384,7 @@ QLOGappend(Client cntxt, MalBlkPtr mb, M
                        throw(MAL, "querylog.append", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
                }
        }
-       if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), 
getBBPtransid()) != GDK_SUCCEED)
+       if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != 
GDK_SUCCEED)
                msg = createException(MAL, "querylog", GDK_EXCEPTION);
        MT_lock_unset(&QLOGlock);
        return msg;
@@ -446,7 +446,7 @@ QLOGcall(Client cntxt, MalBlkPtr mb, Mal
                MT_lock_unset(&QLOGlock);
                throw(MAL, "querylog.call", SQLSTATE(HY013) MAL_MALLOC_FAIL);
        }
-       if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), 
getBBPtransid()) != GDK_SUCCEED)
+       if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != 
GDK_SUCCEED)
                msg = createException(MAL, "querylog", GDK_EXCEPTION);
        MT_lock_unset(&QLOGlock);
        return msg;
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
@@ -2399,6 +2399,10 @@ rel2bin_table(backend *be, sql_rel *rel,
                                        q = pushStr(be->mb, q, mod);
                                        q = pushStr(be->mb, q, fcn);
                                        psub = stmt_direct_func(be, q);
+                                       if (psub == NULL) {
+                                               freeInstruction(q);
+                                               return NULL;
+                                       }
 
                                        if (ids) /* push input rowids column */
                                                q = pushArgument(be->mb, q, 
ids->nr);
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
@@ -215,7 +215,6 @@ stmt_group(backend *be, stmt *s, stmt *g
        q = pushArgument(mb, q, s->nr);
        if (grp)
                q = pushArgument(mb, q, grp->nr);
-       pushInstruction(mb, q);
        if (q) {
                stmt *ns = stmt_create(be->mvc->sa, st_group);
                if (ns == NULL) {
@@ -234,6 +233,7 @@ stmt_group(backend *be, stmt *s, stmt *g
                ns->key = 0;
                ns->q = q;
                ns->nr = getDestVar(q);
+               pushInstruction(mb, q);
                return ns;
        }
        return NULL;
@@ -254,7 +254,6 @@ stmt_unique(backend *be, stmt *s)
 
        q = pushArgument(mb, q, s->nr);
        q = pushNil(mb, q, TYPE_bat); /* candidate list */
-       pushInstruction(mb, q);
        if (q) {
                stmt *ns = stmt_create(be->mvc->sa, st_unique);
                if (ns == NULL) {
@@ -267,6 +266,7 @@ stmt_unique(backend *be, stmt *s)
                ns->key = 1;
                ns->q = q;
                ns->nr = getDestVar(q);
+               pushInstruction(mb, q);
                return ns;
        }
        return NULL;
@@ -332,7 +332,6 @@ stmt_var(backend *be, const char *sname,
                if (q == NULL)
                        return NULL;
                setVarType(mb, getArg(q, 0), tt);
-               pushInstruction(mb, q);
        } else if (!declare) {
                char levelstr[16];
 
@@ -344,7 +343,6 @@ stmt_var(backend *be, const char *sname,
                stpcpy(stpcpy(stpcpy(stpcpy(buf, "A"), levelstr), "%"), 
varname); /* mangle variable name */
                q = newAssignment(mb);
                q = pushArgumentId(mb, q, buf);
-               pushInstruction(mb, q);
        } else {
                int tt = t->type->localtype;
                char levelstr[16];
@@ -363,7 +361,6 @@ stmt_var(backend *be, const char *sname,
                q->argc = q->retc = 0;
                q = pushArgumentId(mb, q, buf);
                q = pushNil(mb, q, tt);
-               pushInstruction(mb, q);
                if (q == NULL)
                        return NULL;
                q->retc++;
@@ -383,6 +380,7 @@ stmt_var(backend *be, const char *sname,
                s->key = 1;
                s->q = q;
                s->nr = getDestVar(q);
+               pushInstruction(mb, q);
                return s;
        }
        return NULL;
@@ -392,7 +390,6 @@ stmt *
 stmt_vars(backend *be, const char *varname, sql_table *t, int declare, int 
level)
 {
        MalBlkPtr mb = be->mb;
-       InstrPtr q = NULL;
        int *l;
 
        (void)varname;
@@ -401,7 +398,6 @@ stmt_vars(backend *be, const char *varna
                stmt *s = stmt_create(be->mvc->sa, st_var);
 
                if (s == NULL) {
-                       freeInstruction(q);
                        return NULL;
                }
 
@@ -430,7 +426,6 @@ stmt_varnr(backend *be, int nr, sql_subt
 
        (void) snprintf(buf, sizeof(buf), "A%d", nr);
        q = pushArgumentId(mb, q, buf);
-       pushInstruction(mb, q);
        if (q) {
                stmt *s = stmt_create(be->mvc->sa, st_var);
                if (s == NULL) {
@@ -447,6 +442,7 @@ stmt_varnr(backend *be, int nr, sql_subt
                s->key = 1;
                s->q = q;
                s->nr = getDestVar(q);
+               pushInstruction(mb, q);
                return s;
        }
        return NULL;
@@ -491,7 +487,6 @@ stmt_temp(backend *be, sql_subtype *t)
                return NULL;
        setVarType(mb, getArg(q, 0), newBatType(tt));
        q = pushType(mb, q, tt);
-       pushInstruction(mb, q);
        if (q) {
                stmt *s = stmt_create(be->mvc->sa, st_temp);
 
@@ -503,6 +498,7 @@ stmt_temp(backend *be, sql_subtype *t)
                s->nrcols = 1;
                s->q = q;
                s->nr = getDestVar(q);
+               pushInstruction(mb, q);
                return s;
        }
        return NULL;
@@ -555,7 +551,6 @@ stmt_tid(backend *be, sql_table *t, int 
        q = pushStr(mb, q, t->base.name);
        if (q == NULL)
                return NULL;
-       pushInstruction(mb, q);
        if (t && isTable(t) && partition) {
                sql_trans *tr = be->mvc->session->tr;
                sqlstore *store = tr->store;
@@ -574,6 +569,7 @@ stmt_tid(backend *be, sql_table *t, int 
        s->nrcols = 1;
        s->nr = getDestVar(q);
        s->q = q;
+       pushInstruction(mb, q);
        return s;
 }
 
@@ -644,7 +640,6 @@ stmt_bat(backend *be, sql_column *c, int
        q = pushArgument(mb, q, getIntConstant(mb,access));
        if (q == NULL)
                return NULL;
-       pushInstruction(mb, q);
 
        if (access == RD_UPD_ID) {
                setVarType(mb, getArg(q, 1), newBatType(tt));
@@ -673,6 +668,7 @@ stmt_bat(backend *be, sql_column *c, int
        s->q = q;
        s->tname = c->t->base.name;
        s->cname = c->base.name;
+       pushInstruction(mb, q);
        return s;
 }
 
@@ -699,7 +695,6 @@ stmt_idxbat(backend *be, sql_idx *i, int
        q = pushArgument(mb, q, getIntConstant(mb, access));
        if (q == NULL)
                return NULL;
-       pushInstruction(mb, q);
 
        if (access == RD_UPD_ID) {
                setVarType(mb, getArg(q, 1), newBatType(tt));
@@ -728,6 +723,7 @@ stmt_idxbat(backend *be, sql_idx *i, int
        s->q = q;
        s->tname = i->t->base.name;
        s->cname = i->base.name;
+       pushInstruction(mb, q);
        return s;
 }
 
@@ -757,7 +753,6 @@ stmt_append_col(backend *be, sql_column 
                q = pushBit(mb, q, TRUE);
                if (q)
                        getArg(q,0) = l[c->colnr+1];
-               pushInstruction(mb, q);
        } else if (!fake) {     /* fake append */
                if (offset == NULL || offset->nr < 0)
                        return NULL;
@@ -781,7 +776,6 @@ stmt_append_col(backend *be, sql_column 
                        return NULL;
                if (mvc_var_update != NULL)
                        *mvc_var_update = getDestVar(q);
-               pushInstruction(mb, q);
        } else {
                return b;
        }
@@ -797,6 +791,7 @@ stmt_append_col(backend *be, sql_column 
                s->op4.cval = c;
                s->q = q;
                s->nr = getDestVar(q);
+               pushInstruction(mb, q);
                return s;
        }
        return NULL;
@@ -827,7 +822,6 @@ stmt_append_idx(backend *be, sql_idx *i,
        if (q == NULL)
                return NULL;
        be->mvc_var = getDestVar(q);
-       pushInstruction(mb, q);
 
        stmt *s = stmt_create(be->mvc->sa, st_append_idx);
        if (s == NULL) {
@@ -840,6 +834,7 @@ stmt_append_idx(backend *be, sql_idx *i,
        s->op4.idxval = i;
        s->q = q;
        s->nr = getDestVar(q);
+       pushInstruction(mb, q);
        return s;
 }
 
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to