Changeset: 63300fb65e60 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/63300fb65e60 Modified Files: gdk/gdk.h gdk/gdk_aggr.c gdk/gdk_analytic_bounds.c gdk/gdk_bat.c gdk/gdk_calc.c gdk/gdk_storage.c Branch: Jan2022 Log Message:
A bunch of smallish fixes, most important: fix some bat_iterator_end calls. diffs (truncated from 974 to 300 lines): diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -914,10 +914,10 @@ gdk_export void HEAPincref(Heap *h); * The BAT iterator provides a number of fields that can (and often * should) be used to access information about the BAT. For string * BATs, if a parallel threads adds values, the offset heap (theap) may - * get replaced by a one that is wider. This involves changing the - * twidth and tshift values in the BAT structure. These changed values - * should not be used to access the data in the iterator. Instead, use - * the width and shift values in the iterator itself. + * get replaced by one that is wider. This involves changing the twidth + * and tshift values in the BAT structure. These changed values should + * not be used to access the data in the iterator. Instead, use the + * width and shift values in the iterator itself. */ typedef struct BATiter { BAT *b; diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -1910,25 +1910,25 @@ BATgroupavg(BAT **bnp, BAT **cntsp, BAT #endif rems = GDKzalloc(ngrp * sizeof(lng)); if (rems == NULL) - goto bailout; + goto bailout1; break; default: break; } if (cntsp) { if ((cn = COLnew(min, TYPE_lng, ngrp, TRANSIENT)) == NULL) - goto bailout; + goto bailout1; cnts = (lng *) Tloc(cn, 0); memset(cnts, 0, ngrp * sizeof(lng)); } else { cnts = GDKzalloc(ngrp * sizeof(lng)); if (cnts == NULL) - goto bailout; + goto bailout1; } bn = COLnew(min, TYPE_dbl, ngrp, TRANSIENT); if (bn == NULL) - goto bailout; + goto bailout1; dbls = (dbl *) Tloc(bn, 0); if (BATtdense(g)) @@ -2001,6 +2001,7 @@ BATgroupavg(BAT **bnp, BAT **cntsp, BAT return GDK_SUCCEED; bailout: bat_iterator_end(&bi); + bailout1: if (bn) BBPunfix(bn->batCacheid); GDKfree(rems); @@ -3196,8 +3197,7 @@ BATgroupcount(BAT *b, BAT *g, BAT *e, BA AGGR_COUNT(dbl); break; default: - while (ncand > 0) { - ncand--; + TIMEOUT_LOOP(ncand, timeoffset) { i = canditer_next(&ci) - b->hseqbase; if (gids == NULL || (gids[i] >= min && gids[i] <= max)) { @@ -3210,6 +3210,8 @@ BATgroupcount(BAT *b, BAT *g, BAT *e, BA } } } + TIMEOUT_CHECK(timeoffset, + GOTO_LABEL_TIMEOUT_HANDLER(bailout)); break; } bat_iterator_end(&bi); @@ -4120,7 +4122,7 @@ doBATgroupquantile(BAT *b, BAT *g, BAT * if (g) { g = BATproject(s, g); if (g == NULL) - goto bunins_failed; + goto bailout; } } @@ -4147,14 +4149,14 @@ doBATgroupquantile(BAT *b, BAT *g, BAT * return bn; } if (BATsort(&t1, &t2, NULL, g, NULL, NULL, false, false, false) != GDK_SUCCEED) - goto bunins_failed; + goto bailout; if (g != origg) BBPunfix(g->batCacheid); g = t1; if (BATsort(&t1, NULL, NULL, b, t2, g, false, false, false) != GDK_SUCCEED) { BBPunfix(t2->batCacheid); - goto bunins_failed; + goto bailout; } if (b != origb) BBPunfix(b->batCacheid); @@ -4166,7 +4168,7 @@ doBATgroupquantile(BAT *b, BAT *g, BAT * else bn = COLnew(min, tp, ngrp, TRANSIENT); if (bn == NULL) - goto bunins_failed; + goto bailout; bi = bat_iterator(b); @@ -4239,7 +4241,7 @@ doBATgroupquantile(BAT *b, BAT *g, BAT * nils += ngrp - BATcount(bn); while (BATcount(bn) < ngrp) { if (bunfastapp_nocheck(bn, dnil) != GDK_SUCCEED) - goto bunins_failed; + goto bailout; } bn->theap->dirty = true; BBPunfix(g->batCacheid); @@ -4251,7 +4253,7 @@ doBATgroupquantile(BAT *b, BAT *g, BAT * bn = COLnew(0, average ? TYPE_dbl : tp, 1, TRANSIENT); if (bn == NULL) - goto bunins_failed; + goto bailout; t1 = NULL; @@ -4283,7 +4285,7 @@ doBATgroupquantile(BAT *b, BAT *g, BAT * ords = (const oid *) oidxh->base + ORDERIDXOFF; } else { if (BATsort(NULL, &t1, NULL, b, NULL, g, false, false, false) != GDK_SUCCEED) - goto bunins_failed; + goto bailout; if (BATtdense(t1)) ords = NULL; else @@ -4355,7 +4357,7 @@ doBATgroupquantile(BAT *b, BAT *g, BAT * gdk_return rc = BUNappend(bn, v, false); bat_iterator_end(&bi); if (rc != GDK_SUCCEED) - goto bunins_failed; + goto bailout; } if (b != origb) @@ -4377,6 +4379,7 @@ doBATgroupquantile(BAT *b, BAT *g, BAT * bunins_failed: bat_iterator_end(&bi); + bailout: if (b && b != origb) BBPunfix(b->batCacheid); if (g && g != origg) @@ -4760,7 +4763,7 @@ BATcalccorrelation(BAT *b1, BAT *b2) } \ } \ TIMEOUT_CHECK(timeoffset, \ - GOTO_LABEL_TIMEOUT_HANDLER(alloc_fail)); \ + GOTO_LABEL_TIMEOUT_HANDLER(bailout)); \ for (i = 0; i < ngrp; i++) { \ if (cnts[i] == 0 || cnts[i] == BUN_NONE) { \ dbls[i] = dbl_nil; \ @@ -4905,7 +4908,7 @@ dogroupstdev(BAT **avgb, BAT *b, BAT *g, default: GDKerror("%s: type (%s) not supported.\n", func, ATOMname(b->ttype)); - goto alloc_fail; + goto bailout; } bat_iterator_end(&bi); if (an) { @@ -4944,8 +4947,9 @@ dogroupstdev(BAT **avgb, BAT *b, BAT *g, return bn; overflow: GDKerror("22003!overflow in calculation.\n"); + bailout: + bat_iterator_end(&bi); alloc_fail: - bat_iterator_end(&bi); if (an) BBPreclaim(an); else @@ -5019,7 +5023,7 @@ BATgroupvariance_population(BAT *b, BAT } \ } \ TIMEOUT_CHECK(timeoffset, \ - GOTO_LABEL_TIMEOUT_HANDLER(alloc_fail)); \ + GOTO_LABEL_TIMEOUT_HANDLER(bailout)); \ for (i = 0; i < ngrp; i++) { \ if (cnts[i] == 0 || cnts[i] == BUN_NONE) { \ dbls[i] = dbl_nil; \ @@ -5141,7 +5145,7 @@ dogroupcovariance(BAT *b1, BAT *b2, BAT break; default: GDKerror("%s: type (%s) not supported.\n", func, ATOMname(b1->ttype)); - goto alloc_fail; + goto bailout; } bat_iterator_end(&b1i); bat_iterator_end(&b2i); @@ -5174,9 +5178,10 @@ dogroupcovariance(BAT *b1, BAT *b2, BAT return bn; overflow: GDKerror("22003!overflow in calculation.\n"); - alloc_fail: + bailout: bat_iterator_end(&b1i); bat_iterator_end(&b2i); + alloc_fail: BBPreclaim(bn); GDKfree(mean1); GDKfree(mean2); @@ -5232,7 +5237,7 @@ BATgroupcovariance_population(BAT *b1, B } \ } \ TIMEOUT_CHECK(timeoffset, \ - GOTO_LABEL_TIMEOUT_HANDLER(alloc_fail)); \ + GOTO_LABEL_TIMEOUT_HANDLER(bailout)); \ for (i = 0; i < ngrp; i++) { \ if (cnts[i] <= 1 || cnts[i] == BUN_NONE || down1[i] == 0 || down2[i] == 0) { \ dbls[i] = dbl_nil; \ @@ -5352,7 +5357,7 @@ BATgroupcorrelation(BAT *b1, BAT *b2, BA break; default: GDKerror("type (%s) not supported.\n", ATOMname(b1->ttype)); - goto alloc_fail; + goto bailout; } bat_iterator_end(&b1i); bat_iterator_end(&b2i); @@ -5383,9 +5388,10 @@ BATgroupcorrelation(BAT *b1, BAT *b2, BA return bn; overflow: GDKerror("22003!overflow in calculation.\n"); - alloc_fail: + bailout: bat_iterator_end(&b1i); bat_iterator_end(&b2i); + alloc_fail: BBPreclaim(bn); GDKfree(mean1); GDKfree(mean2); diff --git a/gdk/gdk_analytic_bounds.c b/gdk/gdk_analytic_bounds.c --- a/gdk/gdk_analytic_bounds.c +++ b/gdk/gdk_analytic_bounds.c @@ -1096,11 +1096,13 @@ GDKanalyticalrangebounds(BAT *r, BAT *b, if (ll == GDK_bte_max) { /* UNBOUNDED PRECEDING and UNBOUNDED FOLLOWING cases, avoid overflow */ bat_iterator_end(&pi); bat_iterator_end(&bi); + bat_iterator_end(&li); return GDKanalyticalallbounds(r, b, p, preceding); } if (ll == 0) { bat_iterator_end(&pi); bat_iterator_end(&bi); + bat_iterator_end(&li); return GDKanalyticalpeers(r, b, p, preceding); } limit = is_bte_nil(ll) ? lng_nil : (lng) ll; @@ -1111,11 +1113,13 @@ GDKanalyticalrangebounds(BAT *r, BAT *b, if (ll == GDK_sht_max) { bat_iterator_end(&pi); bat_iterator_end(&bi); + bat_iterator_end(&li); return GDKanalyticalallbounds(r, b, p, preceding); } if (ll == 0) { bat_iterator_end(&pi); bat_iterator_end(&bi); + bat_iterator_end(&li); return GDKanalyticalpeers(r, b, p, preceding); } limit = is_sht_nil(ll) ? lng_nil : (lng) ll; @@ -1126,11 +1130,13 @@ GDKanalyticalrangebounds(BAT *r, BAT *b, if (int_limit == GDK_int_max) { bat_iterator_end(&pi); bat_iterator_end(&bi); + bat_iterator_end(&li); return GDKanalyticalallbounds(r, b, p, preceding); } if (int_limit == 0) { bat_iterator_end(&pi); bat_iterator_end(&bi); + bat_iterator_end(&li); return GDKanalyticalpeers(r, b, p, preceding); } limit = is_int_nil(int_limit) ? lng_nil : (lng) int_limit; @@ -1141,11 +1147,13 @@ GDKanalyticalrangebounds(BAT *r, BAT *b, if (limit == GDK_lng_max) { bat_iterator_end(&pi); bat_iterator_end(&bi); + bat_iterator_end(&li); return GDKanalyticalallbounds(r, b, p, preceding); } if (limit == 0) { bat_iterator_end(&pi); _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org