Changeset: 6630841f696a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6630841f696a Modified Files: clients/mapiclient/mclient.c gdk/gdk_project.c monetdb5/mal/mal_debugger.c monetdb5/mal/mal_parser.c monetdb5/mal/mal_session.c monetdb5/modules/mal/wlc.c monetdb5/optimizer/opt_jit.c monetdb5/optimizer/opt_macro.c sql/backends/monet5/sql.c sql/backends/monet5/sql_scenario.c sql/backends/monet5/sql_transaction.c sql/backends/monet5/sql_user.c sql/backends/monet5/wlr.c sql/server/sql_mvc.c sql/server/sql_mvc.h sql/test/BugTracker-2009/Tests/rollback_bug.stable.err sql/test/BugTracker-2009/Tests/temporary_table_leftover.SF-2734713.stable.err sql/test/BugTracker/Tests/crash_on_fkey_update2.SF-1703497.stable.err sql/test/bugs/Tests/savepoint_rollback-bug-sf-953553.stable.err Branch: default Log Message:
Merge with Aug2018 branch. diffs (truncated from 926 to 300 lines): diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -404,7 +404,7 @@ utf8strlenmax(char *s, char *e, size_t m * /usr/share/unicode/emoji/emoji-data.txt * and code points marked either F or * W in EastAsianWidth.txt; this list - * is up-to-date with Unicode 9.0 */ + * is up-to-date with Unicode 11.0 */ if ((0x1100 <= c && c <= 0x115F) || (0x231A <= c && c <= 0x231B) || (0x2329 <= c && c <= 0x232A) || @@ -447,7 +447,7 @@ utf8strlenmax(char *s, char *e, size_t m (0x3000 <= c && c <= 0x303E) || (0x3041 <= c && c <= 0x3096) || (0x3099 <= c && c <= 0x30FF) || - (0x3105 <= c && c <= 0x312D) || + (0x3105 <= c && c <= 0x312F) || (0x3131 <= c && c <= 0x318E) || (0x3190 <= c && c <= 0x31BA) || (0x31C0 <= c && c <= 0x31E3) || @@ -466,19 +466,20 @@ utf8strlenmax(char *s, char *e, size_t m (0xFE68 <= c && c <= 0xFE6B) || (0xFF01 <= c && c <= 0xFF60) || (0xFFE0 <= c && c <= 0xFFE6) || - c == 0x16FE0 || - (0x17000 <= c && c <= 0x187EC) || + (0x16FE0 <= c && c <= 0x16FE1) || + (0x17000 <= c && c <= 0x187F1) || (0x18800 <= c && c <= 0x18AF2) || - (0x1B000 <= c && c <= 0x1B001) || + (0x1B000 <= c && c <= 0x1B11E) || + (0x1B170 <= c && c <= 0x1B2FB) || c == 0x1F004 || c == 0x1F0CF || c == 0x1F18E || (0x1F191 <= c && c <= 0x1F19A) || - /* removed 0x1F1E6..0x1F1FF */ (0x1F200 <= c && c <= 0x1F202) || (0x1F210 <= c && c <= 0x1F23B) || (0x1F240 <= c && c <= 0x1F248) || (0x1F250 <= c && c <= 0x1F251) || + (0x1F260 <= c && c <= 0x1F265) || (0x1F300 <= c && c <= 0x1F320) || (0x1F32D <= c && c <= 0x1F335) || (0x1F337 <= c && c <= 0x1F37C) || @@ -501,15 +502,15 @@ utf8strlenmax(char *s, char *e, size_t m c == 0x1F6CC || (0x1F6D0 <= c && c <= 0x1F6D2) || (0x1F6EB <= c && c <= 0x1F6EC) || - (0x1F6F4 <= c && c <= 0x1F6F6) || - (0x1F910 <= c && c <= 0x1F91E) || - (0x1F920 <= c && c <= 0x1F927) || - c == 0x1F930 || - (0x1F933 <= c && c <= 0x1F93E) || - (0x1F940 <= c && c <= 0x1F94B) || - (0x1F950 <= c && c <= 0x1F95E) || - (0x1F980 <= c && c <= 0x1F991) || - c == 0x1F9C0 || + (0x1F6F4 <= c && c <= 0x1F6F9) || + (0x1F910 <= c && c <= 0x1F93E) || + (0x1F940 <= c && c <= 0x1F970) || + (0x1F973 <= c && c <= 0x1F976) || + c == 0x1F97A || + (0x1F97C <= c && c <= 0x1F9A2) || + (0x1F9B0 <= c && c <= 0x1F9B9) || + (0x1F9C0 <= c && c <= 0x1F9C2) || + (0x1F9D0 <= c && c <= 0x1F9FF) || (0x20000 <= c && c <= 0x2FFFD) || (0x30000 <= c && c <= 0x3FFFD)) len++; diff --git a/gdk/gdk_project.c b/gdk/gdk_project.c --- a/gdk/gdk_project.c +++ b/gdk/gdk_project.c @@ -420,6 +420,7 @@ BATprojectchain(BAT **bats) oid hseq, tseq; bool allnil = false, nonil = true; bool stringtrick = false; + bool issorted = true; /* result sorted if all bats sorted */ /* count number of participating BATs and allocate some * temporary work space */ @@ -435,6 +436,7 @@ BATprojectchain(BAT **bats) off = 0; /* this will be the BUN offset into last BAT */ for (i = n = 0; b != NULL; n++, i++) { nonil &= b->tnonil; /* not guaranteed without nils */ + issorted &= b->tsorted; if (!allnil) { if (n > 0 && ba[i-1].vals == NULL) { /* previous BAT was dense-tailed: we will @@ -547,7 +549,8 @@ BATprojectchain(BAT **bats) GDKfree(ba); return bn; } - bn->tnil = bn->tnonil = false; /* we're not paying attention to this */ + bn->tnil = false; /* we're not paying attention to this */ + bn->tnonil = nonil; n = i - 1; /* ba[n] is last BAT */ /* figure out the "other" type, i.e. not compatible with oid */ @@ -724,7 +727,8 @@ BATprojectchain(BAT **bats) bn->theap.dirty = true; BATsetcount(bn, cnt); if (stringtrick) { - bn->tnonil = bn->tnil = false; + bn->tnil = false; + bn->tnonil = nonil; bn->tkey = false; BBPshare(b->tvheap->parentid); bn->tvheap = b->tvheap; @@ -734,6 +738,7 @@ BATprojectchain(BAT **bats) bn->tshift = b->tshift; } bn->tsorted = bn->trevsorted = cnt <= 1; + bn->tsorted |= issorted; bn->tseqbase = oid_nil; GDKfree(ba); return bn; diff --git a/monetdb5/mal/mal_debugger.c b/monetdb5/mal/mal_debugger.c --- a/monetdb5/mal/mal_debugger.c +++ b/monetdb5/mal/mal_debugger.c @@ -427,7 +427,7 @@ mdbCommand(Client cntxt, MalBlkPtr mb, M retryRead: msg = (char *) (*cntxt->phase[MAL_SCENARIO_READER])(cntxt); if (msg != MAL_SUCCEED || cntxt->mode == FINISHCLIENT){ - GDKfree(msg); + freeException(msg); break; } /* SQL patch, it should only react to Smessages, Xclose requests to be ignored */ diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c --- a/monetdb5/mal/mal_parser.c +++ b/monetdb5/mal/mal_parser.c @@ -1468,7 +1468,7 @@ parseEnd(Client cntxt) if(!errors) cntxt->curprg->def->errors = msg; else - GDKfree(msg); + freeException(msg); return 1; } } 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 @@ -51,13 +51,13 @@ malBootstrap(void) mal_exit(); } if ( (msg = defaultScenario(c)) ) { - GDKfree(msg); - fprintf(stderr,"#malBootstrap:Failed to initialise default scenario"); + fprintf(stderr,"#malBootstrap:Failed to initialise default scenario: %s", msg); + freeException(msg); mal_exit(); } if((msg = MSinitClientPrg(c, "user", "main")) != MAL_SUCCEED) { - GDKfree(msg); - fprintf(stderr,"#malBootstrap:Failed to initialise client"); + fprintf(stderr,"#malBootstrap:Failed to initialise client: %s", msg); + freeException(msg); mal_exit(); } if( MCinitClientThread(c) < 0){ diff --git a/monetdb5/modules/mal/wlc.c b/monetdb5/modules/mal/wlc.c --- a/monetdb5/modules/mal/wlc.c +++ b/monetdb5/modules/mal/wlc.c @@ -289,7 +289,7 @@ WLCreset(void) wlc_write[0] =0; MT_lock_unset(&wlc_lock); if(msg) //TODO we have to return a possible error message somehow - GDKfree(msg); + freeException(msg); } /* diff --git a/monetdb5/optimizer/opt_jit.c b/monetdb5/optimizer/opt_jit.c --- a/monetdb5/optimizer/opt_jit.c +++ b/monetdb5/optimizer/opt_jit.c @@ -83,7 +83,7 @@ OPTjitImplementation(Client cntxt, MalBl OPTDEBUGjit( chkTypes(cntxt->usermodule,mb,TRUE); - GDKfree(msg); + freeException(msg); msg = MAL_SUCCEED; fprintf(stderr, "#Optimize JIT done\n"); fprintFunction(stderr, mb, 0, LIST_MAL_DEBUG); diff --git a/monetdb5/optimizer/opt_macro.c b/monetdb5/optimizer/opt_macro.c --- a/monetdb5/optimizer/opt_macro.c +++ b/monetdb5/optimizer/opt_macro.c @@ -500,7 +500,7 @@ str OPTmacro(Client cntxt, MalBlkPtr mb, msg= OPTmacroImplementation(cntxt,mb,stk,p); // similar to OPTmacro if( msg) { - GDKfree(msg); + freeException(msg); msg= MAL_SUCCEED; } 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 @@ -226,7 +226,6 @@ SQLmvc(Client cntxt, MalBlkPtr mb, MalSt str SQLcommit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { - int ret; mvc *sql = NULL; str msg; (void) stk; @@ -239,11 +238,7 @@ SQLcommit(Client cntxt, MalBlkPtr mb, Ma if (sql->session->auto_commit != 0) throw(SQL, "sql.trans", SQLSTATE(2DM30) "COMMIT not allowed in auto commit mode"); - ret = mvc_commit(sql, 0, 0); - if (ret < 0) { - throw(SQL, "sql.trans", SQLSTATE(2D000) "transaction commit failed"); - } - return msg; + return mvc_commit(sql, 0, 0, false); } str @@ -260,7 +255,7 @@ SQLabort(Client cntxt, MalBlkPtr mb, Mal return msg; if (sql->session->active) { - mvc_rollback(sql, 0, NULL); + msg = mvc_rollback(sql, 0, NULL, false); } return msg; } 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 @@ -336,7 +336,7 @@ SQLprepareClient(Client c, int login) str SQLresetClient(Client c) { - str msg = MAL_SUCCEED; + str msg = MAL_SUCCEED, other = MAL_SUCCEED; if (c->sqlcontext == NULL) throw(SQL, "SQLexitClient", SQLSTATE(42000) "MVC catalogue not available"); @@ -346,12 +346,11 @@ SQLresetClient(Client c) assert(m->session); if (m->session->auto_commit && m->session->active) { - if (mvc_status(m) >= 0 && mvc_commit(m, 0, NULL) < 0) - msg = handle_error(m, 0, 0); + if (mvc_status(m) >= 0) + msg = mvc_commit(m, 0, NULL, false); } - if (m->session->active) { - mvc_rollback(m, 0, NULL); - } + if (m->session->active) + other = mvc_rollback(m, 0, NULL, false); res_tables_destroy(m->results); m->results = NULL; @@ -363,6 +362,10 @@ SQLresetClient(Client c) c->sqlcontext = NULL; } c->state[MAL_SCENARIO_READER] = NULL; + if(other && !msg) + msg = other; + else if(other && msg) + GDKfree(other); return msg; } @@ -615,11 +618,15 @@ handle_error(mvc *m, int pstatus, str ms } if( new && msg){ newmsg = GDKzalloc( strlen(msg) + strlen(new) + 64); - strcpy(newmsg, msg); - /* strcat(newmsg,"!"); */ - strcat(newmsg,new); - GDKfree(new); - GDKfree(msg); + if (newmsg == NULL) { + newmsg = createException(SQL, "sql.execute", SQLSTATE(HY001) MAL_MALLOC_FAIL); + } else { + strcpy(newmsg, msg); + /* strcat(newmsg,"!"); */ + strcat(newmsg,new); + } + freeException(new); + freeException(msg); } else if( msg) newmsg = msg; @@ -636,10 +643,9 @@ SQLautocommit(mvc *m) if (m->session->auto_commit && m->session->active) { if (mvc_status(m) < 0) { - mvc_rollback(m, 0, NULL); - } else if (mvc_commit(m, 0, NULL) < 0) { - msg = handle_error(m, 0, 0); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list