Changeset: 444fdeb873a7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/444fdeb873a7
Modified Files:
        .bumpversion.cfg
        MonetDB.spec
        clients/mapilib/mapi.rc
        clients/odbc/driver/driver.rc
        clients/odbc/winsetup/setup.rc
        cmake/monetdb-versions.cmake
        gdk/gdk_bbp.c
        gdk/libbat.rc
        monetdb5/mal/mal_interpreter.c
        monetdb5/mal/mal_session.c
        monetdb5/optimizer/opt_pushselect.c
        monetdb5/tools/libmonetdb5.rc
        sql/backends/monet5/sql_gencode.c
        sql/backends/monet5/sql_scenario.c
        sql/test/prepare/Tests/sqlancer_prepare.stable.out
        sql/test/prepare/Tests/sqlancer_prepare.stable.out.int128
Branch: default
Log Message:

merged with Sep2022


diffs (truncated from 642 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -787,6 +787,7 @@ 44e45c9a451f6afd933773094ec25723f713d3be
 44e45c9a451f6afd933773094ec25723f713d3be Jan2022_SP5_release
 43d4a717410d6f6692a16a878640fc7e0f248725 Jan2022_25
 43d4a717410d6f6692a16a878640fc7e0f248725 Jan2022_SP6_release
+700e099bfee85318da09aabcd78ec7ea6e8fb6ef Jul2021_29
 5c50a4071c86d1621e20a885a51cc36f2f23eec4 Sep2022_9
 41ca60d96bd0198ca5d74937630a442a5fbaf1cd Sep2022_11
 41ca60d96bd0198ca5d74937630a442a5fbaf1cd Sep2022_SP1_release
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
@@ -548,12 +548,19 @@ runMALsequence(Client cntxt, MalBlkPtr m
                }
 
                if (stk->status) {
-                       while (stk->status == 'p')
-                               MT_sleep_ms(50);
-                       continue;
+                       /* pause procedure from SYSMON */
+                       if (stk->status == 'p') {
+                               while (stk->status == 'p')
+                                       MT_sleep_ms(50);
+                               continue;
+                       }
+                       /* stop procedure from SYSMON */
                        if (stk->status == 'q') {
                                stkpc = mb->stop;
-                               ret = createException(MAL, "mal.interpreter", 
"Prematurely stopped client");
+                               ret = createException(MAL, "mal.interpreter",
+                                                                         
"Query with tag "OIDFMT" received stop signal",
+                                                                         
mb->tag);
+                               break;
                        }
                }
 
diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -368,7 +368,7 @@ MSscheduleClient(str command, str challe
                        mnstr_printf(c->fdout, "!%s\n", s);
                        mnstr_flush(c->fdout, MNSTR_FLUSH_DATA);
                        GDKfree(s);
-                       c->mode = FINISHCLIENT;
+                       MCcloseClient(c);
                }
                if (!GDKgetenv_isyes(mal_enableflag) &&
                                (strncasecmp("sql", lang, 3) != 0 && uid != 0)) 
{
diff --git a/monetdb5/optimizer/opt_pushselect.c 
b/monetdb5/optimizer/opt_pushselect.c
--- a/monetdb5/optimizer/opt_pushselect.c
+++ b/monetdb5/optimizer/opt_pushselect.c
@@ -869,7 +869,11 @@ OPTpushselectImplementation(Client cntxt
                                getArg(u, 3) = getArg(q,2); /* update ids */
                                //getArg(u, 4) = getArg(s,0);
                                p = pushArgument(mb, u, getArg(s,0)); /* push 
at end */
+                               /* make sure to resolve again */
+                               u->token = ASSIGNsymbol;
                                u->typechk = TYPE_UNKNOWN;
+                       u->fcn = NULL;
+                       u->blk = NULL;
                                pushInstruction(mb,u);
                                oclean[i] = true;
                                continue;
diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -336,8 +336,9 @@ static int
        sqlid table_id = prp->id;
        node *n;
        int i, q, v, res = 0, added_to_cache = 0,  *lret, *rret;
-       size_t len = 1024, nr;
-       char *lname, *buf;
+       size_t len = 1024, nr, pwlen = 0;
+       char *lname = NULL, *buf = NULL, *mal_session_uuid, *err = NULL, 
*pwhash = NULL;
+       str username = NULL, password = NULL, msg = NULL;
        sql_rel *r = rel;
 
        if (table_id == 0) {
@@ -387,17 +388,25 @@ static int
        if( c->curprg == NULL) {
                GDKfree(lname);
                sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
+               c->curprg = backup;
                return -1;
        }
        lname[0] = 'l';
        curBlk = c->curprg->def;
        curInstr = getInstrPtr(curBlk, 0);
 
+       sql_table *rt = sql_trans_find_table(m->session->tr, table_id);
+       const char *uri = mapiuri_uri(rt->query, m->sa);
+       if (!rt) {
+               sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
+               res = -1;
+               goto cleanup;
+       }
        curInstr = relational_func_create_result_part2(curBlk, curInstr, rel2);
        if( curInstr == NULL) {
-               GDKfree(lname);
                sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
-               return -1;
+               res = -1;
+               goto cleanup;
        }
 
        /* ops */
@@ -412,9 +421,9 @@ static int
 
                        sprintf(nbuf, "A%d", i++);
                        if ((varid = newVariable(curBlk, nbuf, strlen(nbuf), 
type)) < 0) {
-                               GDKfree(lname);
                                sql_error(m, 10, SQLSTATE(42000) "Internal 
error while compiling statement: variable id too long");
-                               return -1;
+                               res = -1;
+                               goto cleanup;
                        }
                        curInstr = pushArgument(curBlk, curInstr, varid);
                        setVarType(curBlk, varid, type);
@@ -430,9 +439,9 @@ static int
                        type = newBatType(type);
                        p = newFcnCall(curBlk, batRef, newRef);
                        if (p == NULL) {
-                               GDKfree(lname);
                                sql_error(m, 10, SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
-                               return -1;
+                               res = -1;
+                               goto cleanup;
                        }
                        p = pushType(curBlk, p, getBatType(type));
                        setArgType(curBlk, p, 0, type);
@@ -442,34 +451,30 @@ static int
        }
 
        /* get username / password */
-       sql_table *rt = sql_trans_find_table(m->session->tr, table_id);
-       if (!rt) {
-               sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
-               return -1;
-       }
-       str username = NULL, password = NULL;
-       str msg = remote_get(m, table_id, &username, &password);
+       msg = remote_get(m, table_id, &username, &password);
        if (msg) {
                sql_error(m, 10, "%s", msg);
                GDKfree(msg);
-               return -1;
+               msg = NULL;
+               res = -1;
+               goto cleanup;
        }
        /* q := remote.connect("uri", "username", "password", "msql"); */
        p = newStmt(curBlk, remoteRef, connectRef);
        if (p == NULL) {
-               GDKfree(lname);
                sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
-               return -1;
+               res = -1;
+               goto cleanup;
        }
-       const char *uri = mapiuri_uri(rt->query, m->sa);
        p = pushStr(curBlk, p, uri);
        p = pushStr(curBlk, p, username);
        GDKfree(username);
-       size_t pwlen = strlen(password);
-    char *pwhash = (char*)GDKmalloc(pwlen + 2);
+       pwlen = strlen(password);
+    pwhash = (char*)GDKmalloc(pwlen + 2);
        if (pwhash == NULL) {
                GDKfree(password);
-               return -1;
+               res = -1;
+               goto cleanup;
        }
        snprintf(pwhash, pwlen + 2, "\1%s", password);
        GDKfree(password);
@@ -482,9 +487,9 @@ static int
        /* remote.exec(q, "sql", "register", "mod", "name", "relational_plan", 
"signature"); */
        p = newInstructionArgs(curBlk, remoteRef, execRef, 10);
        if (p == NULL) {
-               GDKfree(lname);
                sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
-               return -1;
+               res = -1;
+               goto cleanup;
        }
        p = pushArgument(curBlk, p, q);
        p = pushStr(curBlk, p, sqlRef);
@@ -492,10 +497,10 @@ static int
 
        o = newFcnCall(curBlk, remoteRef, putRef);
        if (o == NULL) {
-               GDKfree(lname);
                freeInstruction(p);
                sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
-               return -1;
+               res = -1;
+               goto cleanup;
        }
        o = pushArgument(curBlk, o, q);
        o = pushInt(curBlk, o, TYPE_str); /* dummy result type */
@@ -504,10 +509,10 @@ static int
 
        o = newFcnCall(curBlk, remoteRef, putRef);
        if (o == NULL) {
-               GDKfree(lname);
                freeInstruction(p);
                sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
-               return -1;
+               res = -1;
+               goto cleanup;
        }
        o = pushArgument(curBlk, o, q);
        o = pushStr(curBlk, o, mod);
@@ -516,10 +521,10 @@ static int
 
        o = newFcnCall(curBlk, remoteRef, putRef);
        if (o == NULL) {
-               GDKfree(lname);
                freeInstruction(p);
                sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
-               return -1;
+               res = -1;
+               goto cleanup;
        }
        o = pushArgument(curBlk, o, q);
        o = pushStr(curBlk, o, lname);
@@ -527,18 +532,18 @@ static int
        p = pushArgument(curBlk, p, getArg(o,0));
 
        if (!(buf = rel2str(m, rel))) {
-               GDKfree(lname);
                freeInstruction(p);
                sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
-               return -1;
+               res = -1;
+               goto cleanup;
        }
        o = newFcnCall(curBlk, remoteRef, putRef);
        if (o == NULL) {
                free(buf);
-               GDKfree(lname);
                freeInstruction(p);
                sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
-               return -1;
+               res = -1;
+               goto cleanup;
        }
        o = pushArgument(curBlk, o, q);
        o = pushStr(curBlk, o, buf);    /* relational plan */
@@ -547,10 +552,10 @@ static int
        free(buf);
 
        if (!(buf = GDKmalloc(len))) {
-               GDKfree(lname);
                freeInstruction(p);
                sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
-               return -1;
+               res = -1;
+               goto cleanup;
        }
 
        buf[0] = 0;
@@ -571,11 +576,11 @@ static int
                                len = (len + nlen) * 2;
                                char *tmp = GDKrealloc(buf, len);
                                if (tmp == NULL) {
-                                       GDKfree(lname);
                                        GDKfree(buf);
                                        freeInstruction(p);
                                        sql_error(m, 10, SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
-                                       return -1;
+                                       res = -1;
+                                       goto cleanup;
                                }
                                buf = tmp;
                        }
@@ -585,11 +590,11 @@ static int
        }
        o = newFcnCall(curBlk, remoteRef, putRef);
        if (o == NULL) {
-               GDKfree(lname);
                GDKfree(buf);
                freeInstruction(p);
                sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
-               return -1;
+               res = -1;
+               goto cleanup;
        }
        o = pushArgument(curBlk, o, q);
        o = pushStr(curBlk, o, buf);    /* signature */
@@ -605,12 +610,12 @@ static int
                        str next = sql_subtype_string(m->ta, t);
 
                        if (!next) {
-                               GDKfree(lname);
                                GDKfree(buf);
                                freeInstruction(p);
                                sa_reset(m->ta);
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to