Changeset: 5ef2fdd05705 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5ef2fdd05705 Branch: extract_types Log Message:
Merge with default. diffs (truncated from 428 to 300 lines): diff --git a/clients/ChangeLog.Sep2022 b/clients/ChangeLog.Sep2022 --- a/clients/ChangeLog.Sep2022 +++ b/clients/ChangeLog.Sep2022 @@ -1,3 +1,6 @@ # ChangeLog file for clients # This file is updated with Maddlog +* Wed Nov 9 2022 Sjoerd Mullender <[email protected]> +- Also dump the new options of CREATE USER. + diff --git a/gdk/ChangeLog.Sep2022 b/gdk/ChangeLog.Sep2022 --- a/gdk/ChangeLog.Sep2022 +++ b/gdk/ChangeLog.Sep2022 @@ -1,6 +1,13 @@ # ChangeLog file for GDK # This file is updated with Maddlog +* Wed Nov 9 2022 Sjoerd Mullender <[email protected]> +- On Windows, use the wide-character interface of system calls when + dealing with the environment (i.e. file names and getenv()). +- Memory leaks have been fixed. +- Improved maintenance of the estimated number of distinct values in BATs. + The estimate helps in deciding which low-level algorithm to use. + * Mon Oct 10 2022 Sjoerd Mullender <[email protected]> - Offset heaps (.tailN files) were growing too fast and unnecessarily under certain conditions. This has been fixed. Also, when such too diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -607,6 +607,8 @@ BATclear(BAT *b, bool force) } *th = (Heap) { .farmid = b->tvheap->farmid, + .parentid = b->tvheap->parentid, + .dirty = true, }; strcpy_len(th->filename, b->tvheap->filename, sizeof(th->filename)); if (ATOMheap(b->ttype, th, 0) != GDK_SUCCEED) { @@ -614,8 +616,6 @@ BATclear(BAT *b, bool force) return GDK_FAIL; } ATOMIC_INIT(&th->refs, 1); - th->parentid = b->tvheap->parentid; - th->dirty = true; HEAPdecref(b->tvheap, false); b->tvheap = th; } @@ -2547,6 +2547,8 @@ BATassertProps(BAT *b) /* general BAT sanity */ assert(b != NULL); assert(b->batCacheid > 0); + assert(b->batCacheid < getBBPsize()); + assert(b == BBP_cache(b->batCacheid)); assert(b->batCount >= b->batInserted); /* headless */ diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -815,8 +815,8 @@ BBPreadEntries(FILE *fp, unsigned bbpver BAT *bn; Heap *hn; - if ((bn = GDKzalloc(sizeof(BAT))) == NULL || - (hn = GDKzalloc(sizeof(Heap))) == NULL) { + if ((bn = GDKmalloc(sizeof(BAT))) == NULL || + (hn = GDKmalloc(sizeof(Heap))) == NULL) { GDKfree(bn); TRC_CRITICAL(GDK, "cannot allocate memory for BAT."); goto bailout; diff --git a/gdk/gdk_cand.c b/gdk/gdk_cand.c --- a/gdk/gdk_cand.c +++ b/gdk/gdk_cand.c @@ -1300,17 +1300,20 @@ BATnegcands(BUN nr, BAT *odels) return bn; nme = BBP_physical(bn->batCacheid); - if ((dels = (Heap*)GDKzalloc(sizeof(Heap))) == NULL || - (dels->farmid = BBPselectfarm(bn->batRole, bn->ttype, varheap)) < 0){ - GDKfree(dels); + if ((dels = GDKmalloc(sizeof(Heap))) == NULL){ BBPreclaim(bn); return NULL; } + *dels = (Heap) { + .farmid = BBPselectfarm(bn->batRole, bn->ttype, varheap), + .parentid = bn->batCacheid, + .dirty = true, + }; strconcat_len(dels->filename, sizeof(dels->filename), nme, ".theap", NULL); - dels->parentid = bn->batCacheid; - if (HEAPalloc(dels, hi - lo + (sizeof(ccand_t)/sizeof(oid)), sizeof(oid)) != GDK_SUCCEED) { + if (dels->farmid < 0 || + HEAPalloc(dels, hi - lo + (sizeof(ccand_t)/sizeof(oid)), sizeof(oid)) != GDK_SUCCEED) { GDKfree(dels); BBPreclaim(bn); return NULL; @@ -1321,7 +1324,6 @@ BATnegcands(BUN nr, BAT *odels) .type = CAND_NEGOID, }; dels->free = sizeof(ccand_t) + sizeof(oid) * (hi - lo); - dels->dirty = true; BATiter bi = bat_iterator(odels); if (bi.type == TYPE_void) { oid *r = (oid *) (dels->base + sizeof(ccand_t)); @@ -1366,18 +1368,21 @@ BATmaskedcands(oid hseq, BUN nr, BAT *ma return bn; nme = BBP_physical(bn->batCacheid); - if ((msks = (Heap*)GDKzalloc(sizeof(Heap))) == NULL || - (msks->farmid = BBPselectfarm(bn->batRole, bn->ttype, varheap)) < 0){ - GDKfree(msks); + if ((msks = GDKmalloc(sizeof(Heap))) == NULL){ BBPreclaim(bn); return NULL; } + *msks = (Heap) { + .farmid = BBPselectfarm(bn->batRole, bn->ttype, varheap), + .parentid = bn->batCacheid, + .dirty = true, + }; strconcat_len(msks->filename, sizeof(msks->filename), nme, ".theap", NULL); - msks->parentid = bn->batCacheid; nmask = (nr + 31) / 32; - if (HEAPalloc(msks, nmask + (sizeof(ccand_t)/sizeof(uint32_t)), sizeof(uint32_t)) != GDK_SUCCEED) { + if (msks->farmid < 0 || + HEAPalloc(msks, nmask + (sizeof(ccand_t)/sizeof(uint32_t)), sizeof(uint32_t)) != GDK_SUCCEED) { GDKfree(msks); BBPreclaim(bn); return NULL; @@ -1388,7 +1393,6 @@ BATmaskedcands(oid hseq, BUN nr, BAT *ma // .mask = true, }; msks->free = sizeof(ccand_t) + nmask * sizeof(uint32_t); - msks->dirty = true; uint32_t *r = (uint32_t*)(msks->base + sizeof(ccand_t)); BATiter bi = bat_iterator(masked); if (selected) { @@ -1479,17 +1483,21 @@ BATunmask(BAT *b) return NULL; } Heap *dels; - if ((dels = GDKzalloc(sizeof(Heap))) == NULL || - strconcat_len(dels->filename, sizeof(dels->filename), - BBP_physical(bn->batCacheid), ".theap", - NULL) >= sizeof(dels->filename) || - (dels->parentid = bn->batCacheid) <= 0 || - (dels->farmid = BBPselectfarm(TRANSIENT, TYPE_void, - varheap)) == -1 || - HEAPalloc(dels, - cnt * 32 - bi.count - + sizeof(ccand_t) / sizeof(oid), - sizeof(oid)) != GDK_SUCCEED) { + if ((dels = GDKmalloc(sizeof(Heap))) == NULL) { + BBPreclaim(bn); + return NULL; + } + *dels = (Heap) { + .farmid = BBPselectfarm(TRANSIENT, TYPE_void, varheap), + .parentid = bn->batCacheid, + .dirty = true, + }; + strconcat_len(dels->filename, sizeof(dels->filename), + BBP_physical(bn->batCacheid), ".theap", NULL); + + if (dels->farmid < 0 || + HEAPalloc(dels, cnt * 32 - bi.count + + sizeof(ccand_t) / sizeof(oid), sizeof(oid)) != GDK_SUCCEED) { GDKfree(dels); BBPreclaim(bn); bat_iterator_end(&bi); diff --git a/gdk/gdk_orderidx.c b/gdk/gdk_orderidx.c --- a/gdk/gdk_orderidx.c +++ b/gdk/gdk_orderidx.c @@ -139,18 +139,21 @@ createOIDXheap(BAT *b, bool stable) Heap *m; oid *restrict mv; - if ((m = GDKzalloc(sizeof(Heap))) == NULL || - (m->farmid = BBPselectfarm(b->batRole, b->ttype, orderidxheap)) < 0 || - (m->parentid = b->batCacheid) <= 0 || - strconcat_len(m->filename, sizeof(m->filename), - BBP_physical(b->batCacheid), ".torderidx", - NULL) >= sizeof(m->filename) || + if ((m = GDKmalloc(sizeof(Heap))) == NULL) + return NULL; + *m = (Heap) { + .farmid = BBPselectfarm(b->batRole, b->ttype, orderidxheap), + .parentid = b->batCacheid, + .dirty = true, + }; + strconcat_len(m->filename, sizeof(m->filename), + BBP_physical(b->batCacheid), ".torderidx", NULL); + if (m->farmid < 0 || HEAPalloc(m, BATcount(b) + ORDERIDXOFF, SIZEOF_OID) != GDK_SUCCEED) { GDKfree(m); return NULL; } m->free = (BATcount(b) + ORDERIDXOFF) * SIZEOF_OID; - m->dirty = true; mv = (oid *) m->base; *mv++ = ORDERIDX_VERSION; @@ -368,11 +371,19 @@ GDKmergeidx(BAT *b, BAT**a, int n_ar) bat_iterator_end(&bi); return GDK_SUCCEED; } - if ((m = GDKzalloc(sizeof(Heap))) == NULL || - (m->farmid = BBPselectfarm(b->batRole, bi.type, orderidxheap)) < 0 || - (m->parentid = b->batCacheid) <= 0 || - strconcat_len(m->filename, sizeof(m->filename), - nme, ".torderidx", NULL) >= sizeof(m->filename) || + if ((m = GDKmalloc(sizeof(Heap))) == NULL) { + MT_lock_unset(&b->batIdxLock); + bat_iterator_end(&bi); + return GDK_FAIL; + } + *m = (Heap) { + .farmid = BBPselectfarm(b->batRole, bi.type, orderidxheap), + .parentid = b->batCacheid, + .dirty = true, + }; + strconcat_len(m->filename, sizeof(m->filename), + nme, ".torderidx", NULL); + if (m->farmid < 0 || HEAPalloc(m, BATcount(b) + ORDERIDXOFF, SIZEOF_OID) != GDK_SUCCEED) { GDKfree(m); MT_lock_unset(&b->batIdxLock); @@ -380,7 +391,6 @@ GDKmergeidx(BAT *b, BAT**a, int n_ar) return GDK_FAIL; } m->free = (BATcount(b) + ORDERIDXOFF) * SIZEOF_OID; - m->dirty = true; mv = (oid *) m->base; *mv++ = ORDERIDX_VERSION; diff --git a/monetdb5/ChangeLog.Sep2022 b/monetdb5/ChangeLog.Sep2022 --- a/monetdb5/ChangeLog.Sep2022 +++ b/monetdb5/ChangeLog.Sep2022 @@ -1,6 +1,12 @@ # ChangeLog file for MonetDB5 # This file is updated with Maddlog +* Wed Nov 9 2022 Sjoerd Mullender <[email protected]> +- Fixed a crash when the server runs out of client contexts (i.e. more + concurrent clients than the server is configured to handle). +- A race condition in the SHA hash code was fixed which resulted in + occasional failed connection attempts when they occurred concurrently. + * Wed Oct 19 2022 Sjoerd Mullender <[email protected]> - Fix a bug where the MAL optimizer would use the starttime of the previous query to determine whether a query timeout occurred. diff --git a/monetdb5/modules/kernel/batstr.c b/monetdb5/modules/kernel/batstr.c --- a/monetdb5/modules/kernel/batstr.c +++ b/monetdb5/modules/kernel/batstr.c @@ -3039,7 +3039,7 @@ bailout: static str STRbatSubstitutecst(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { - const bit *rep = getArgReference_bit(stk, pci, 0); + const bit *rep = getArgReference_bit(stk, pci, 4); return STRbatSubstitutecst_imp(cntxt, mb, stk, pci, 6, rep); } diff --git a/sql/ChangeLog.Sep2022 b/sql/ChangeLog.Sep2022 --- a/sql/ChangeLog.Sep2022 +++ b/sql/ChangeLog.Sep2022 @@ -1,3 +1,7 @@ # ChangeLog file for sql # This file is updated with Maddlog +* Wed Nov 9 2022 Sjoerd Mullender <[email protected]> +- Improved the handling of the "idle" value in the sys.sessions function + and view. + diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -3494,10 +3494,19 @@ static sql_exp * else groupby = subquery = gl; } - if (!exp_subtype(e)) { /* we also do not expect parameters here */ + sql_subtype *t = exp_subtype(e); + if (!t) { /* we also do not expect parameters here */ char *uaname = SA_NEW_ARRAY(sql->ta, char, strlen(aname) + 1); return sql_error(sql, 02, SQLSTATE(42000) "%s: parameters not allowed as arguments to aggregate functions", toUpperCopy(uaname, aname)); } + if (!t->type->localtype) { + if (e->type == e_atom && !e->f) { + t = sql_bind_localtype("bte"); + e->tpe = *t; + if (e->l) + e->l = atom_set_type(sql->sa, e->l, t); + } _______________________________________________ checkin-list mailing list -- [email protected] To unsubscribe send an email to [email protected]
