Changeset: 886a0a612108 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/886a0a612108 Modified Files: common/stream/Tests/urlstream.py gdk/gdk_bat.c gdk/gdk_hash.c gdk/gdk_private.h gdk/gdk_utils.c Branch: default Log Message:
Merge with Jan2022 branch. diffs (97 lines): diff --git a/common/options/monet_options.c b/common/options/monet_options.c --- a/common/options/monet_options.c +++ b/common/options/monet_options.c @@ -205,7 +205,6 @@ mo_system_config(opt **Set, int setlen) if (!cfg) return setlen; setlen = mo_config_file(Set, setlen, cfg); - free(cfg); return setlen; } diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -1357,11 +1357,10 @@ BUNdelete(BAT *b, oid o) return GDK_FAIL; if (ATOMstorage(b->ttype) == TYPE_msk) { msk mval = mskGetVal(b, BUNlast(b) - 1); - HASHdelete(b, BUNlast(b) - 1, &mval); + assert(b->thash == NULL); mskSetVal(b, p, mval); /* don't leave garbage */ mskClr(b, BUNlast(b) - 1); - HASHinsert(b, p, &mval); } else { val = Tloc(b, BUNlast(b) - 1); HASHdelete(b, BUNlast(b) - 1, val); diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c --- a/gdk/gdk_hash.c +++ b/gdk/gdk_hash.c @@ -746,6 +746,7 @@ BAThash_impl(BAT *restrict b, struct can } assert(strcmp(ext, "thash") != 0 || !hascand); + assert(b->ttype != TYPE_msk); MT_thread_setalgorithm(hascand ? "create hash with candidates" : "create hash"); TRC_DEBUG_IF(ACCELERATOR) t0 = GDKusec(); @@ -1304,6 +1305,7 @@ HASHdelete_locked(BAT *b, BUN p, const v return; } bool seen = false; + BUN links = 0; for (;;) { if (!seen) seen = atomcmp(v, BUNtail(bi, hb)) == 0; @@ -1318,6 +1320,12 @@ HASHdelete_locked(BAT *b, BUN p, const v break; } hb = hb2; + if (++links > HASH_DESTROY_CHAIN_LENGTH) { + b->thash = NULL; + doHASHdestroy(b, h); + GDKclrerr(); + return; + } } h->heaplink.dirty = true; HASHputlink(h, hb, HASHgetlink(h, p)); diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -478,6 +478,9 @@ extern BUN HASH_DESTROY_UNIQUES_FRACTION /* if the estimated number of unique values is less than 1 in this * number, don't build a hash table to do a hashselect */ extern dbl NO_HASH_SELECT_FRACTION; /* same here */ +/* if the hash chain is longer than this number, we delete the hash + * rather than maintaining it in HASHdelete */ +extern BUN HASH_DESTROY_CHAIN_LENGTH; #if !defined(NDEBUG) && !defined(__COVERITY__) /* see comment in gdk.h */ diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -66,6 +66,9 @@ BUN HASH_DESTROY_UNIQUES_FRACTION = 1000 /* if the estimated number of unique values is less than 1 in this * number, don't build a hash table to do a hashselect */ dbl NO_HASH_SELECT_FRACTION = 1000; /* same here */ +/* if the hash chain is longer than this number, we delete the hash + * rather than maintaining it in HASHdelete */ +BUN HASH_DESTROY_CHAIN_LENGTH = 1000; /* * @+ Monet configuration file @@ -1169,6 +1172,11 @@ GDKinit(opt *set, int setlen, bool embed NO_HASH_SELECT_FRACTION = (dbl) strtoll(p, NULL, 10); if (NO_HASH_SELECT_FRACTION == 0) NO_HASH_SELECT_FRACTION = (dbl) GDK_UNIQUE_ESTIMATE_KEEP_FRACTION; + HASH_DESTROY_CHAIN_LENGTH = 0; + if ((p = GDKgetenv("hash_destroy_chain_length")) != NULL) + HASH_DESTROY_CHAIN_LENGTH = (BUN) strtoll(p, NULL, 10); + if (HASH_DESTROY_CHAIN_LENGTH == 0) + HASH_DESTROY_CHAIN_LENGTH = 1000; return GDK_SUCCEED; } _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org