Changeset: 8cb5594361d0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8cb5594361d0
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
gdk/gdk_bat.c
gdk/gdk_bbp.c
gdk/gdk_hash.c
Branch: default
Log Message:
Merged with Jul2021
diffs (truncated from 1466 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
@@ -5752,7 +5752,7 @@ stdout of test 'MAL-signatures` in direc
[ "batcalc", "timestamp", "pattern batcalc.timestamp(X_0:bat[:timestamp],
X_1:bat[:oid], X_2:int):bat[:timestamp] ", "timestamp_2time_timestamp;",
"" ]
[ "batcalc", "uuid", "command batcalc.uuid(X_0:bat[:str],
X_1:bat[:oid]):bat[:uuid] ", "UUIDstr2uuid_bulk;", "" ]
[ "batcalc", "uuid", "command batcalc.uuid(X_0:bat[:uuid],
X_1:bat[:oid]):bat[:uuid] ", "UUIDuuid2uuid_bulk;", "" ]
-[ "batcalc", "wkb", "command batcalc.wkb(X_0:bat[:wkb], X_1:int,
X_2:int):bat[:wkb] ", "geom_2_geom_bat;", "" ]
+[ "batcalc", "wkb", "command batcalc.wkb(X_0:bat[:wkb], X_1:bat[:oid],
X_2:int, X_3:int):bat[:wkb] ", "geom_2_geom_bat;", "" ]
[ "batcalc", "xml", "command batcalc.xml(X_0:bat[:str]):bat[:xml] ",
"BATXMLstr2xml;", "" ]
[ "batcalc", "xor", "pattern batcalc.xor(X_0:bat[:bit],
X_1:bat[:bit]):bat[:bit] ", "CMDbatXOR;", "" ]
[ "batcalc", "xor", "pattern batcalc.xor(X_0:bat[:bit], X_1:bat[:bit],
X_2:bat[:oid], X_3:bat[:oid]):bat[:bit] ", "CMDbatXOR;", "" ]
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
@@ -8276,7 +8276,7 @@ stdout of test 'MAL-signatures` in direc
[ "batcalc", "timestamp", "pattern batcalc.timestamp(X_0:bat[:timestamp],
X_1:bat[:oid], X_2:int):bat[:timestamp] ", "timestamp_2time_timestamp;",
"" ]
[ "batcalc", "uuid", "command batcalc.uuid(X_0:bat[:str],
X_1:bat[:oid]):bat[:uuid] ", "UUIDstr2uuid_bulk;", "" ]
[ "batcalc", "uuid", "command batcalc.uuid(X_0:bat[:uuid],
X_1:bat[:oid]):bat[:uuid] ", "UUIDuuid2uuid_bulk;", "" ]
-[ "batcalc", "wkb", "command batcalc.wkb(X_0:bat[:wkb], X_1:int,
X_2:int):bat[:wkb] ", "geom_2_geom_bat;", "" ]
+[ "batcalc", "wkb", "command batcalc.wkb(X_0:bat[:wkb], X_1:bat[:oid],
X_2:int, X_3:int):bat[:wkb] ", "geom_2_geom_bat;", "" ]
[ "batcalc", "xml", "command batcalc.xml(X_0:bat[:str]):bat[:xml] ",
"BATXMLstr2xml;", "" ]
[ "batcalc", "xor", "pattern batcalc.xor(X_0:bat[:bit],
X_1:bat[:bit]):bat[:bit] ", "CMDbatXOR;", "" ]
[ "batcalc", "xor", "pattern batcalc.xor(X_0:bat[:bit], X_1:bat[:bit],
X_2:bat[:oid], X_3:bat[:oid]):bat[:bit] ", "CMDbatXOR;", "" ]
diff --git a/gdk/gdk_analytic_func.c b/gdk/gdk_analytic_func.c
--- a/gdk/gdk_analytic_func.c
+++ b/gdk/gdk_analytic_func.c
@@ -72,11 +72,13 @@ GDKrebuild_segment_tree(oid ncount, oid
do { \
TPE *restrict rb = (TPE*)Tloc(r, 0); \
if (p) { \
- for (; i < cnt; i++) { \
+ while (i < cnt) { \
if (np[i]) { \
ntile##IMP##TPE: \
NTILE_CALC(TPE, NEXT_VALUE, LNG_HGE,
UPCAST, VALIDATION); \
} \
+ if (!last) \
+ i++; \
} \
} \
if (!last) { \
@@ -1077,11 +1079,13 @@ GDKanalyticallead(BAT *r, BAT *b, BAT *p
do { \
TPE *restrict bp = (TPE*)Tloc(b, 0), *restrict rb =
(TPE*)Tloc(r, 0); \
if (p) { \
- for (; i < cnt; i++) { \
+ while (i < cnt) { \
if (np[i]) { \
minmaxfixed##TPE##IMP: \
ANALYTICAL_MIN_MAX_CALC_FIXED_##IMP(TPE, MIN_MAX); \
} \
+ if (!last) \
+ i++; \
} \
} \
if (!last) { /* hack to reduce code explosion, there's no need
to duplicate the code to iterate each partition */ \
@@ -1124,11 +1128,13 @@ minmaxfixed##TPE##IMP: \
break;
\
default: {
\
if (p) {
\
- for (; i < cnt; i++) { \
- if (np[i]) { \
+ while (i < cnt) { \
+ if (np[i]) { \
minmaxvarsized##IMP: \
-
ANALYTICAL_MIN_MAX_CALC_OTHERS_##IMP(GT_LT); \
- } \
+
ANALYTICAL_MIN_MAX_CALC_OTHERS_##IMP(GT_LT); \
+ } \
+ if (!last) \
+ i++; \
}
\
} \
if (!last) { \
@@ -1420,11 +1426,13 @@ ANALYTICAL_MIN_MAX(max, MAX, <)
do { \
TPE *restrict bp = (TPE*) bheap; \
if (p) { \
- for (; i < cnt; i++) { \
+ while (i < cnt) { \
if (np[i]) { \
count##TPE##IMP: \
ANALYTICAL_COUNT_FIXED_##IMP(TPE); \
} \
+ if (!last) \
+ i++; \
} \
} \
if (!last) { \
@@ -1467,12 +1475,14 @@ count##TPE##IMP: \
break;
\
default: {
\
if (p) {
\
- for (; i < cnt; i++) { \
+ while (i < cnt) { \
if (np[i]) { \
countothers##IMP: \
ANALYTICAL_COUNT_OTHERS_##IMP;
\
} \
- }
\
+ if (!last) \
+ i++; \
+ } \
} \
if (!last) { \
last = true; \
@@ -1667,11 +1677,13 @@ cleanup:
TPE1 *restrict bp = (TPE1*)Tloc(b, 0); \
TPE2 *restrict rb = (TPE2*)Tloc(r, 0); \
if (p) { \
- for (; i < cnt; i++) { \
+ while (i < cnt) { \
if (np[i]) { \
sum##TPE1##TPE2##IMP: \
IMP(TPE1, TPE2); \
} \
+ if (!last) \
+ i++; \
} \
} \
if (!last) { \
@@ -2157,11 +2169,13 @@ nosupport:
TPE1 *restrict bp = (TPE1*)Tloc(b, 0); \
TPE2 *restrict rb = (TPE2*)Tloc(r, 0); \
if (p) { \
- for (; i < cnt; i++) { \
+ while (i < cnt) { \
if (np[i]) { \
prod##TPE1##TPE2##IMP: \
IMP(TPE1, TPE2, TPE3_OR_REAL_IMP);
\
} \
+ if (!last) \
+ i++; \
} \
} \
if (!last) { \
@@ -2643,12 +2657,14 @@ avg_fp_deltas(dbl)
do { \
TPE *restrict bp = (TPE*)Tloc(b, 0); \
if (p) { \
- for (; i < cnt; i++) { \
+ while (i < cnt) { \
if (np[i]) { \
avg##TPE##IMP: \
REAL_IMP(TPE, IMP); \
} \
- } \
+ if (!last) \
+ i++; \
+ } \
} \
if (!last) { \
last = true; \
@@ -2899,11 +2915,13 @@ avg_int_deltas(lng)
do { \
TPE *restrict bp = (TPE*)Tloc(b, 0), *restrict rb = (TPE *)
Tloc(r, 0); \
if (p) { \
- for (; i < cnt; i++) { \
+ while (i < cnt) { \
if (np[i]) { \
avg##TPE##IMP: \
IMP(TPE); \
} \
+ if (!last) \
+ i++; \
} \
} \
if (!last) { \
@@ -3142,12 +3160,14 @@ typedef struct stdev_var_deltas {
#define ANALYTICAL_STATISTICS_PARTITIONS(TPE, SAMPLE, OP, IMP) \
do { \
if (p) { \
- for (; i < cnt; i++) { \
+ while (i < cnt) { \
if (np[i]) { \
statistics##TPE##IMP: \
IMP(TPE, SAMPLE, OP); \
} \
- } \
+ if (!last) \
+ i++; \
+ } \
} \
if (!last) { \
last = true; \
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -2365,7 +2365,6 @@ void
BATassertProps(BAT *b)
{
unsigned bbpstatus;
- BATiter bi = bat_iterator(b);
BUN p, q;
int (*cmpf)(const void *, const void *);
int cmp;
@@ -2386,7 +2385,6 @@ BATassertProps(BAT *b)
((bbpstatus & BBPEXISTING) != 0) +
((bbpstatus & BBPNEW) != 0) <= 1);
- assert(b != NULL);
assert(b->ttype >= TYPE_void);
assert(b->ttype < GDKatomcnt);
assert(b->ttype != TYPE_bat);
@@ -2467,6 +2465,13 @@ BATassertProps(BAT *b)
}
return;
}
+ /* do the rest on a view in case some other thread changes b */
+ BAT *v = VIEWcreate(b->hseqbase, b);
+ if (v == NULL)
+ return;
+ b = v;
+ BATiter bi = bat_iterator(b);
+
if (BATtdense(b)) {
assert(b->tseqbase + b->batCount <= GDK_oid_max);
assert(b->ttype == TYPE_oid);
@@ -2479,6 +2484,7 @@ BATassertProps(BAT *b)
for (p = 1; p < q; p++)
assert(o[p - 1] + 1 == o[p]);
}
+ BBPunfix(b->batCacheid);
return;
}
assert(1 << b->tshift == b->twidth);
@@ -2523,6 +2529,7 @@ BATassertProps(BAT *b)
if (!b->tkey && !b->tsorted && !b->trevsorted &&
!b->tnonil && !b->tnil) {
/* nothing more to prove */
+ BBPunfix(b->batCacheid);
return;
}
@@ -2681,4 +2688,5 @@ BATassertProps(BAT *b)
assert(minval == NULL || seenmin);
assert(!b->tnil || seennil);
}
+ BBPunfix(b->batCacheid);
}
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -2207,6 +2207,8 @@ BBPuncacheit(bat i, bool unloaddesc)
if (BBPcheck(i, "BBPuncacheit")) {
BAT *b = BBP_desc(i);
+ assert(unloaddesc || BBP_refs(i) == 0);
+
if (b) {
if (BBP_cache(i)) {
TRC_DEBUG(BAT_, "uncache %d (%s)\n", (int) i,
BBPname(i));
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -301,6 +301,19 @@ HASHgrowbucket(BAT *b)
TRC_DEBUG_IF(ACCELERATOR) t0 = GDKusec();
+ if (!h->heapbckt.dirty && !h->heaplink.dirty &&
+ ((size_t *) h->heapbckt.base)[0] & ((size_t) 1 << 24)) {
+ ((size_t *) h->heapbckt.base)[0] &= ~((size_t) 1 << 24);
+ if (h->heapbckt.storage != STORE_MEM) {
+ if (!(GDKdebug & NOSYNCMASK) &&
+ MT_msync(h->heapbckt.base, SIZEOF_SIZE_T) < 0) {
+ doHASHdestroy(b, h);
+ b->thash = NULL;
+ return GDK_FAIL;
+ }
+ }
+ }
+
/* only needed to fix hash tables built before this fix was
* introduced */
if (h->width < SIZEOF_BUN &&
@@ -310,15 +323,6 @@ HASHgrowbucket(BAT *b)
h->heapbckt.dirty = true;
h->heaplink.dirty = true;
- if (((size_t *) h->heapbckt.base)[0] & (size_t) 1 << 24) {
- /* persistent hash: remove persistency */
- ((size_t *) h->heapbckt.base)[0] &= ~((size_t) 1 << 24);
- if (h->heapbckt.storage != STORE_MEM) {
- if (!(GDKdebug & NOSYNCMASK) &&
- MT_msync(h->heapbckt.base, SIZEOF_SIZE_T) < 0)
- return GDK_FAIL;
- }
- }
while (h->nunique >= (nbucket = h->nbucket) * 7 / 8) {
BUN new = h->nbucket;
BUN old = new & h->mask1;
@@ -583,6 +587,7 @@ BAThashsave_intern(BAT *b, bool dosync)
hp->dirty = false;
} else {
perror("write hash");
+ ((size_t *) hp->base)[0] &=
~((size_t) 1 << 24);
}
close(fd);
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list