Changeset: 6dda1d2509e0 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6dda1d2509e0 Modified Files: clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures.stable.out.int128 clients/Tests/exports.stable.out clients/mapiclient/tomograph.c gdk/gdk_bat.c gdk/gdk_bbp.c gdk/gdk_imprints.c gdk/gdk_private.h gdk/gdk_search.c monetdb5/ChangeLog monetdb5/mal/Tests/tst1602.mal monetdb5/mal/Tests/tst1602.stable.out monetdb5/mal/mal_client.c monetdb5/modules/kernel/algebra.c monetdb5/modules/kernel/algebra.h monetdb5/modules/kernel/algebra.mal monetdb5/optimizer/Tests/mat00.mal monetdb5/optimizer/Tests/qep00.mal monetdb5/optimizer/Tests/qep01.mal monetdb5/optimizer/Tests/qep02.mal monetdb5/optimizer/opt_costModel.c monetdb5/optimizer/opt_generator.c monetdb5/optimizer/opt_prelude.c monetdb5/optimizer/opt_prelude.h monetdb5/optimizer/opt_pushselect.c monetdb5/optimizer/opt_support.c sql/server/sql_atom.c sql/server/sql_parser.y sql/storage/bat/bat_storage.c sql/storage/bat/bat_table.c sql/storage/sql_storage.h sql/storage/store.c sql/test/leaks/Tests/check0.stable.out sql/test/leaks/Tests/check0.stable.out.int128 sql/test/leaks/Tests/check1.stable.out sql/test/leaks/Tests/check1.stable.out.int128 sql/test/leaks/Tests/check2.stable.out sql/test/leaks/Tests/check2.stable.out.int128 sql/test/leaks/Tests/check3.stable.out sql/test/leaks/Tests/check3.stable.out.int128 sql/test/leaks/Tests/check4.stable.out sql/test/leaks/Tests/check4.stable.out.int128 sql/test/leaks/Tests/check5.stable.out sql/test/leaks/Tests/check5.stable.out.int128 sql/test/leaks/Tests/drop3.stable.out sql/test/leaks/Tests/drop3.stable.out.int128 sql/test/leaks/Tests/select1.stable.out sql/test/leaks/Tests/select1.stable.out.int128 sql/test/leaks/Tests/select2.stable.out sql/test/leaks/Tests/select2.stable.out.int128 sql/test/leaks/Tests/temp1.stable.out sql/test/leaks/Tests/temp1.stable.out.int128 sql/test/leaks/Tests/temp2.stable.out sql/test/leaks/Tests/temp2.stable.out.int128 sql/test/leaks/Tests/temp3.stable.out sql/test/leaks/Tests/temp3.stable.out.int128 testing/Mtest.py.in Branch: embedded Log Message:
merge with default diffs (truncated from 4361 to 300 lines): diff --git a/clients/Tests/MAL-signatures.stable.out b/clients/Tests/MAL-signatures.stable.out --- a/clients/Tests/MAL-signatures.stable.out +++ b/clients/Tests/MAL-signatures.stable.out @@ -2254,10 +2254,6 @@ command aggr.variance(b:bat[:oid,:any_2] address ALGvariance; comment Gives the variance of all tail values -command algebra.antijoin(left:bat[:oid,:any_1],right:bat[:oid,:any_1]) (l:bat[:oid,:oid],r:bat[:oid,:oid]) -address ALGantijoin2; -comment Returns 2 columns with all BUNs, consisting of the head-oids from 'left' and 'right' for which there are BUNs in 'left' and 'right' with equal tails - command algebra.crossproduct(left:bat[:oid,:any_1],right:bat[:oid,:any_2]) (l:bat[:oid,:oid],r:bat[:oid,:oid]) address ALGcrossproduct2; comment Returns 2 columns with all BUNs, consisting of the head-oids from 'left' and 'right' for which there are BUNs in 'left' and 'right' with equal tails @@ -2320,14 +2316,6 @@ command algebra.ilike(s:str,pat:str):bit address PCREilike2; command algebra.ilike(s:str,pat:str,esc:str):bit address PCREilike3; -command algebra.join(left:bat[:oid,:any_2],rl:bat[:oid,:any_2],rh:bat[:oid,:any_2],li:bit,hi:bit) (l:bat[:oid,:oid],r:bat[:oid,:oid]) -address ALGrangejoin2; -comment Deprecated, see algebra.subrangejoin. Range join - -command algebra.join(left:bat[:oid,:any_1],right:bat[:oid,:any_1]) (l:bat[:oid,:oid],r:bat[:oid,:oid]) -address ALGjoin2; -comment Returns 2 columns with all BUNs, consisting of the head-oids from 'left' and 'right' for which there are BUNs in 'left' and 'right' with equal tails - command algebra.likesubjoin(l:bat[:oid,:str],r:bat[:oid,:str],sl:bat[:oid,:oid],sr:bat[:oid,:oid],nil_matches:bit,estimate:lng) (X_7:bat[:oid,:oid],X_8:bat[:oid,:oid]) address LIKEsubjoin1; command algebra.likesubjoin(l:bat[:oid,:str],r:bat[:oid,:str],esc:str,sl:bat[:oid,:oid],sr:bat[:oid,:oid],nil_matches:bit,estimate:lng) (X_8:bat[:oid,:oid],X_9:bat[:oid,:oid]) @@ -2360,7 +2348,7 @@ comment Routine to handle join paths. T command algebra.projection(left:bat[:oid,:oid],right:bat[:oid,:any_3]):bat[:oid,:any_3] address ALGprojection; -comment Hook directly into the left fetch join implementation. +comment Project left input onto right input. pattern algebra.project(b:bat[:oid,:any_1],v:any_3):bat[:oid,:any_3] address ALGprojecttail; diff --git a/clients/Tests/MAL-signatures.stable.out.int128 b/clients/Tests/MAL-signatures.stable.out.int128 --- a/clients/Tests/MAL-signatures.stable.out.int128 +++ b/clients/Tests/MAL-signatures.stable.out.int128 @@ -2765,10 +2765,6 @@ command aggr.variance(b:bat[:oid,:any_2] address ALGvariance; comment Gives the variance of all tail values -command algebra.antijoin(left:bat[:oid,:any_1],right:bat[:oid,:any_1]) (l:bat[:oid,:oid],r:bat[:oid,:oid]) -address ALGantijoin2; -comment Returns 2 columns with all BUNs, consisting of the head-oids from 'left' and 'right' for which there are BUNs in 'left' and 'right' with equal tails - command algebra.crossproduct(left:bat[:oid,:any_1],right:bat[:oid,:any_2]) (l:bat[:oid,:oid],r:bat[:oid,:oid]) address ALGcrossproduct2; comment Returns 2 columns with all BUNs, consisting of the head-oids from 'left' and 'right' for which there are BUNs in 'left' and 'right' with equal tails @@ -2831,14 +2827,6 @@ command algebra.ilike(s:str,pat:str):bit address PCREilike2; command algebra.ilike(s:str,pat:str,esc:str):bit address PCREilike3; -command algebra.join(left:bat[:oid,:any_2],rl:bat[:oid,:any_2],rh:bat[:oid,:any_2],li:bit,hi:bit) (l:bat[:oid,:oid],r:bat[:oid,:oid]) -address ALGrangejoin2; -comment Deprecated, see algebra.subrangejoin. Range join - -command algebra.join(left:bat[:oid,:any_1],right:bat[:oid,:any_1]) (l:bat[:oid,:oid],r:bat[:oid,:oid]) -address ALGjoin2; -comment Returns 2 columns with all BUNs, consisting of the head-oids from 'left' and 'right' for which there are BUNs in 'left' and 'right' with equal tails - command algebra.likesubjoin(l:bat[:oid,:str],r:bat[:oid,:str],sl:bat[:oid,:oid],sr:bat[:oid,:oid],nil_matches:bit,estimate:lng) (X_7:bat[:oid,:oid],X_8:bat[:oid,:oid]) address LIKEsubjoin1; command algebra.likesubjoin(l:bat[:oid,:str],r:bat[:oid,:str],esc:str,sl:bat[:oid,:oid],sr:bat[:oid,:oid],nil_matches:bit,estimate:lng) (X_8:bat[:oid,:oid],X_9:bat[:oid,:oid]) @@ -2871,7 +2859,7 @@ comment Routine to handle join paths. T command algebra.projection(left:bat[:oid,:oid],right:bat[:oid,:any_3]):bat[:oid,:any_3] address ALGprojection; -comment Hook directly into the left fetch join implementation. +comment Project left input onto right input. pattern algebra.project(b:bat[:oid,:any_1],v:any_3):bat[:oid,:any_3] address ALGprojecttail; diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -692,7 +692,6 @@ str ALARMsleep(void *res, int *secs); str ALARMtime(int *res); str ALARMtimers(bat *res, bat *actions); str ALARMusec(lng *ret); -str ALGantijoin2(bat *l, bat *r, const bat *lid, const bat *rid); str ALGcard(lng *result, const bat *bid); str ALGcopy(bat *result, const bat *bid); str ALGcount_bat(wrd *result, const bat *bid); @@ -704,13 +703,11 @@ str ALGfetchoid(ptr ret, const bat *bid, str ALGfind(oid *ret, const bat *bid, ptr val); str ALGfirstn(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str ALGgroupby(bat *res, const bat *gids, const bat *cnts); -str ALGjoin2(bat *l, bat *r, const bat *lid, const bat *rid); str ALGjoinPath(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str ALGmaxany(ptr result, const bat *bid); str ALGminany(ptr result, const bat *bid); str ALGprojection(bat *result, const bat *lid, const bat *rid); str ALGprojecttail(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); -str ALGrangejoin2(bat *l, bat *r, const bat *lid, const bat *rlid, const bat *rhid, const bit *li, const bit *hi); str ALGreuse(bat *ret, const bat *bid); str ALGsample(bat *result, const bat *bid, const int *param); str ALGselectNotNil(bat *result, const bat *bid); @@ -1954,14 +1951,12 @@ str affectedRowsRef; str aggrRef; str alarmRef; str algebraRef; -str antijoinRef; str appendRef; str appendidxRef; str arrayRef; str assertRef; str attachRef; str avgRef; -str bandjoinRef; str basketRef; void batAfterCall(ValPtr v, ValPtr bak); void batBeforeCall(ValPtr v, ValPtr bak); @@ -2222,7 +2217,6 @@ int isUnsafeInstruction(InstrPtr q); int isUpdateInstruction(InstrPtr p); str iteratorRef; str joinPathRef; -str joinRef; str jsonRef; str languageRef; str levenshtein_impl(int *result, str *s, str *t, int *insdel_cost, int *replace_cost, int *transpose_cost); @@ -2541,7 +2535,6 @@ str subuniqueRef; str sumRef; str takeOid(oid id, str *val); str takeRef; -str thetajoinRef; str thetasubselectRef; str tidRef; str timestampRef; diff --git a/clients/mapiclient/tomograph.c b/clients/mapiclient/tomograph.c --- a/clients/mapiclient/tomograph.c +++ b/clients/mapiclient/tomograph.c @@ -281,7 +281,6 @@ base_colors[NUM_COLORS] = { /* 5941 */ { 0, 0, "sql", "bind", 0 }, /* 5664 */ { 0, 0, "mat", "packIncrement", 0 }, /* 4796 */ { 0, 0, "algebra", "subselect", 0 }, -/* 4789 */ { 0, 0, "algebra", "join", 0 }, /* 4789 */ { 0, 0, "algebra", "subjoin", 0 }, /* 2664 */ { 0, 0, "sql", "projectdelta", 0 }, /* 2112 */ { 0, 0, "batcalc", "!=", 0 }, @@ -366,7 +365,6 @@ base_colors[NUM_COLORS] = { /* 2 */ { 0, 0, "calc", "max", 0 }, /* 2 */ { 0, 0, "calc", "bit", 0 }, /* 2 */ { 0, 0, "calc", "*", 0 }, -/* 2 */ { 0, 0, "algebra", "thetajoin", 0 }, /* 2 */ { 0, 0, "algebra", "subthetajoin", 0 }, /* 1 */ { 0, 0, "sql", "dec_round", 0 }, /* 1 */ { 0, 0, "pqueue", "topn_min", 0 }, diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -590,8 +590,8 @@ BATfree(BAT *b) if (b->T->props) PROPdestroy(b->T->props); b->T->props = NULL; - HASHdestroy(b); - IMPSdestroy(b); + HASHfree(b); + IMPSfree(b); if (b->htype) HEAPfree(&b->H->heap, 0); else diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -2339,8 +2339,11 @@ decref(bat i, int logical, int releaseSh } /* we destroy transients asap and unload persistent bats only - * if they have been made cold */ - if (BBP_refs(i) > 0 || (BBP_lrefs(i) > 0 && BBP_lastused(i) != 0)) { + * if they have been made cold or are not dirty */ + if (BBP_refs(i) > 0 || + (BBP_lrefs(i) > 0 && + BBP_lastused(i) != 0 && + (b == NULL || BATdirty(b) || !(BBP_status(i) & BBPPERSISTENT)))) { /* bat cannot be swapped out. renew its last usage * stamp for the BBP LRU policy */ int sec = BBPLASTUSED(BBPstamp()); @@ -3910,19 +3913,22 @@ BBPdiskscan(const char *parent) } else if (strncmp(p + 1, "theap", 5) == 0) { BAT *b = getdesc(bid); delete = (b == NULL || !b->T->vheap || b->batCopiedtodisk == 0); - } else if (strncmp(p + 1, "hhash", 5) == 0) { + } else if (strncmp(p + 1, "hhash", 5) == 0 || + strncmp(p + 1, "thash", 5) == 0) { +#ifdef PERSISTENTHASH BAT *b = getdesc(bid); delete = b == NULL; - } else if (strncmp(p + 1, "thash", 5) == 0) { +#else + delete = TRUE; +#endif + } else if (strncmp(p + 1, "himprints", 9) == 0 || + strncmp(p + 1, "timprints", 9) == 0) { BAT *b = getdesc(bid); delete = b == NULL; - } else if (strncmp(p + 1, "himprints", 9) == 0) { - BAT *b = getdesc(bid); - delete = b == NULL; - } else if (strncmp(p + 1, "timprints", 9) == 0) { - BAT *b = getdesc(bid); - delete = b == NULL; - } else if (strncmp(p + 1, "priv", 4) != 0 && strncmp(p + 1, "new", 3) != 0 && strncmp(p + 1, "head", 4) != 0 && strncmp(p + 1, "tail", 4) != 0) { + } else if (strncmp(p + 1, "priv", 4) != 0 && + strncmp(p + 1, "new", 3) != 0 && + strncmp(p + 1, "head", 4) != 0 && + strncmp(p + 1, "tail", 4) != 0) { ok = FALSE; } if (!ok) { diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c --- a/gdk/gdk_imprints.c +++ b/gdk/gdk_imprints.c @@ -951,8 +951,9 @@ IMPSremove(BAT *b) if ((imprints = b->T->imprints) != NULL) { b->T->imprints = NULL; - if (* (size_t *) imprints->imprints->base & (1 << 16)) - ALGODEBUG fprintf(stderr, "#IMPSremove: removing persisted imprints\n"); + if ((GDKdebug & ALGOMASK) && + * (size_t *) imprints->imprints->base & (1 << 16)) + fprintf(stderr, "#IMPSremove: removing persisted imprints\n"); if (HEAPdelete(imprints->imprints, BBP_physical(b->batCacheid), b->batCacheid > 0 ? "timprints" : "himprints")) IODEBUG fprintf(stderr, "#IMPSremove(%s): imprints heap\n", BATgetId(b)); @@ -968,13 +969,42 @@ void IMPSdestroy(BAT *b) { if (b) { - if (b->T->imprints != NULL && !VIEWtparent(b)) { + if (b->T->imprints != NULL && !VIEWtparent(b)) IMPSremove(b); + else + GDKunlink(BBPselectfarm(b->batRole, b->ttype, imprintsheap), + BATDIR, + BBP_physical(b->batCacheid), + "timprints"); + + if (b->H->imprints != NULL && !VIEWhparent(b)) + IMPSremove(BATmirror(b)); + else + GDKunlink(BBPselectfarm(b->batRole, b->htype, imprintsheap), + BATDIR, + BBP_physical(b->batCacheid), + "himprints"); + } +} + +/* free the memory associated with the imprints, do not remove the + * heap files */ +void +IMPSfree(BAT *b) +{ + Imprints *imprints; + + if (b) { + MT_lock_set(&GDKimprintsLock(abs(b->batCacheid))); + if ((imprints = b->T->imprints) != NULL) { + b->T->imprints = NULL; + if (!VIEWtparent(b)) { + HEAPfree(imprints->imprints, 0); + GDKfree(imprints->imprints); + GDKfree(imprints); + } } - - if (b->H->imprints != NULL && !VIEWhparent(b)) { - IMPSremove(BATmirror(b)); - } + MT_lock_unset(&GDKimprintsLock(abs(b->batCacheid))); } } diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -139,6 +139,8 @@ void BBPdump(void); /* never called: fo __attribute__((__visibility__("hidden"))); __hidden gdk_return GDKunlink(int farmid, const char *dir, const char *nme, const char *extension) __attribute__((__visibility__("hidden"))); +__hidden void HASHfree(BAT *b) + __attribute__((__visibility__("hidden"))); __hidden int HASHgonebad(BAT *b, const void *v) __attribute__((__visibility__("hidden"))); __hidden BUN HASHmask(BUN cnt) @@ -165,6 +167,8 @@ void BBPdump(void); /* never called: fo __attribute__((__visibility__("hidden"))); __hidden void IMPSdestroy(BAT *b) __attribute__((__visibility__("hidden"))); +__hidden void IMPSfree(BAT *b) + __attribute__((__visibility__("hidden"))); __hidden int IMPSgetbin(int tpe, bte bits, const char *restrict bins, const void *restrict v) __attribute__((__visibility__("hidden"))); #ifndef NDEBUG diff --git a/gdk/gdk_search.c b/gdk/gdk_search.c --- a/gdk/gdk_search.c _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list