Changeset: e50e785e0e9b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e50e785e0e9b Modified Files: gdk/gdk_bbp.c monetdb5/optimizer/opt_mergetable.c sql/storage/bat/bat_storage.c Branch: Oct2020 Log Message:
Merge with Jun2020 branch. diffs (140 lines): diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -3616,6 +3616,10 @@ BBPdiskscan(const char *parent, size_t b /* older versions used .thash which we * can simply ignore */ delete = true; + } else if (strncmp(p + 1, "thsh", 4) == 0) { + /* temporary hash files which we can + * simply ignore */ + delete = true; } else if (strncmp(p + 1, "timprints", 9) == 0) { BAT *b = getdesc(bid); delete = b == NULL; diff --git a/monetdb5/optimizer/opt_mergetable.c b/monetdb5/optimizer/opt_mergetable.c --- a/monetdb5/optimizer/opt_mergetable.c +++ b/monetdb5/optimizer/opt_mergetable.c @@ -59,15 +59,6 @@ is_a_mat(int idx, matlist_t *ml) } static int -was_a_mat(int idx, matlist_t *ml){ - int i; - for(i =0; i<ml->top; i++) - if (ml->v[i].mv == idx) - return i; - return -1; -} - -static int nr_of_mats(InstrPtr p, matlist_t *ml) { int j,cnt=0; @@ -82,7 +73,7 @@ nr_of_bats(MalBlkPtr mb, InstrPtr p) { int j,cnt=0; for(j=p->retc; j<p->argc; j++) - if (isaBatType(getArgType(mb,p,j))) + if (isaBatType(getArgType(mb,p,j)) && !isVarConstant(mb, getArg(p,j))) cnt++; return cnt; } @@ -92,7 +83,7 @@ nr_of_nilbats(MalBlkPtr mb, InstrPtr p) { int j,cnt=0; for(j=p->retc; j<p->argc; j++) - if (getArgType(mb,p,j) == TYPE_bat) + if (getArgType(mb,p,j) == TYPE_bat || (isaBatType(getArgType(mb, p, j)) && isVarConstant(mb, getArg(p,j)) && getVarConstant(mb, getArg(p,j)).val.bval == bat_nil)) cnt++; return cnt; } @@ -1954,7 +1945,7 @@ OPTmergetableImplementation(Client cntxt InstrPtr *old; matlist_t ml; int oldtop, fm, fn, fo, fe, i, k, m, n, o, e, slimit, bailout = 0; - int size=0, match, actions=0, distinct_topn = 0, /*topn_res = 0,*/ groupdone = 0, *vars; + int size=0, match, actions=0, distinct_topn = 0, /*topn_res = 0,*/ groupdone = 0, *vars, maxvars; char buf[256], *group_input; lng usec = GDKusec(); str msg = MAL_SUCCEED; @@ -1965,6 +1956,7 @@ OPTmergetableImplementation(Client cntxt oldtop= mb->stop; vars = (int*) GDKmalloc(sizeof(int)* mb->vtop); + maxvars = mb->vtop; group_input = (char*) GDKzalloc(sizeof(char)* mb->vtop); if (vars == NULL || group_input == NULL){ if (vars) @@ -2036,7 +2028,6 @@ OPTmergetableImplementation(Client cntxt /* not idea how to detect this yet */ //distinct_topn = 1; } - GDKfree(vars); GDKfree(group_input); ml.horigin = 0; @@ -2367,11 +2358,10 @@ OPTmergetableImplementation(Client cntxt } /* select on insert, should use last tid only */ - if (/* DISABLES CODE */ (0)) if (match == 1 && fm == 2 && isSelect(p) && p->retc == 1 && (m=is_a_mat(getArg(p,fm), &ml)) >= 0 && !ml.v[m].packed && /* not packed yet */ - was_a_mat(getArg(p,fm-1), &ml) < 0){ /* not previously packed */ + (getArg(p,fm-1) > maxvars || getModuleId(old[vars[getArg(p,fm-1)]]) == sqlRef)){ if((r = copyInstruction(p)) == NULL) { msg = createException(MAL,"optimizer.mergetable",SQLSTATE(HY013) MAL_MALLOC_FAIL); goto cleanup; @@ -2488,6 +2478,7 @@ OPTmergetableImplementation(Client cntxt freeInstruction(ml.v[i].mi); } cleanup: + if (vars) GDKfree(vars); if (ml.v) GDKfree(ml.v); if (ml.horigin) GDKfree(ml.horigin); if (ml.torigin) GDKfree(ml.torigin); diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c --- a/sql/storage/bat/bat_storage.c +++ b/sql/storage/bat/bat_storage.c @@ -905,6 +905,7 @@ delta_delete_bat( sql_dbat *bat, BAT *i return LOG_ERR; if (isEbat(b)) { + assert(ATOMtype(b->ttype) == TYPE_oid); temp_destroy(bat->dbid); bat->dbid = temp_copy(b->batCacheid, FALSE); if (bat->dbid == BID_NIL) @@ -935,6 +936,7 @@ delta_delete_val( sql_dbat *bat, oid rid if (isEbat(b)) { temp_destroy(bat->dbid); + assert(ATOMtype(b->ttype) == TYPE_oid); bat->dbid = temp_copy(b->batCacheid, FALSE); if (bat->dbid == BID_NIL) return LOG_ERR; @@ -1663,6 +1665,7 @@ load_dbat(sql_dbat *bat, int bid) { BAT *b = quick_descriptor(bid); if(b) { + assert(ATOMtype(b->ttype) == TYPE_oid); bat->dbid = temp_create(b); bat->cnt = BATcount(b); return LOG_OK; @@ -2188,6 +2191,7 @@ gtr_update_dbat(sql_trans *tr, sql_dbat cdb = temp_descriptor(dbid); if(cdb) { (*changes)++; + assert(ATOMtype(cdb->ttype) == TYPE_oid); assert(!isEbat(cdb)); if (d->cleared) { bat_clear(cdb); @@ -2624,6 +2628,7 @@ tr_update_dbat(sql_trans *tr, sql_dbat * if (tdb->cnt < BATcount(db) || fdb->cleared) { BAT *odb = temp_descriptor(tdb->dbid); if(odb) { + assert(ATOMtype(odb->ttype) == TYPE_oid); if (isEbat(odb)){ temp_destroy(tdb->dbid); tdb->dbid = temp_copy(odb->batCacheid, false); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list