Changeset: a5307d752c32 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a5307d752c32
Modified Files:
sql/backends/monet5/sql_upgrades.c
sql/storage/bat/bat_storage.c
Branch: unlogged
Log Message:
Merge with default.
diffs (truncated from 5861 to 300 lines):
diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -762,3 +762,4 @@ cab90a348501b045e19cee5cebcc44f3800bd0a8
cab90a348501b045e19cee5cebcc44f3800bd0a8 Jul2021_SP5_release
5872f047d97c98d3a848514438b8f97fa446855d Jan2022_11
025239a5a6f122042798c0f1132a2c6298514e06 Jan2022_13
+025239a5a6f122042798c0f1132a2c6298514e06 Jan2022_SP2_release
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
@@ -775,7 +775,6 @@ void MSresetInstructions(MalBlkPtr mb, i
void MSresetStack(Client cntxt, MalBlkPtr mb, MalStkPtr glb);
void MSresetVariables(MalBlkPtr mb);
void MSscheduleClient(str command, str challenge, bstream *fin, stream *fout,
protocol_version protocol, size_t blocksize);
-str MSserveClient(Client cntxt);
str OIDXcreateImplementation(Client cntxt, int tpe, BAT *b, int pieces);
str OIDXdropImplementation(Client cntxt, BAT *b);
str QLOGcalls(BAT **r);
diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake
--- a/cmake/monetdb-defines.cmake
+++ b/cmake/monetdb-defines.cmake
@@ -246,19 +246,33 @@ macro(monetdb_configure_sizes)
check_type_size(socklen_t HAVE_SOCKLEN_T LANGUAGE C)
cmake_pop_check_state()
+ cmake_push_check_state()
+ check_type_size(__int128 SIZEOF___INT128 LANGUAGE C)
+ check_type_size(__int128_t SIZEOF___INT128_T LANGUAGE C)
+ check_type_size(__uint128_t SIZEOF___UINT128_T LANGUAGE C)
if(INT128)
- cmake_push_check_state()
- check_type_size(__int128 SIZEOF___INT128 LANGUAGE C)
- check_type_size(__int128_t SIZEOF___INT128_T LANGUAGE C)
- check_type_size(__uint128_t SIZEOF___UINT128_T LANGUAGE C)
- if(HAVE_SIZEOF___INT128 OR HAVE_SIZEOF___INT128_T OR
HAVE_SIZEOF___UINT128_T)
+ if(HAVE_SIZEOF___INT128)
set(HAVE_HGE TRUE)
message(STATUS "Huge integers are available")
else()
- message(STATUS "128-bit integers not supported by this compiler")
+ if(HAVE_SIZEOF___INT128_T AND HAVE_SIZEOF___UINT128_T)
+ set(HAVE_HGE TRUE)
+ message(STATUS "Huge integers are available")
+ else()
+ message(STATUS "128-bit integers not supported by this compiler")
+ endif()
endif()
- cmake_pop_check_state()
+ endif()
+ if(HAVE_SIZEOF___INT128)
+ set(HAVE___INT128 TRUE)
endif()
+ if(HAVE_SIZEOF___INT128_T)
+ set(HAVE___INT128_T TRUE)
+ endif()
+ if(HAVE_SIZEOF___UINT128_T)
+ set(HAVE___UINT128_T TRUE)
+ endif()
+ cmake_pop_check_state()
if(ODBC_FOUND)
cmake_push_check_state()
diff --git a/common/stream/stream.h b/common/stream/stream.h
--- a/common/stream/stream.h
+++ b/common/stream/stream.h
@@ -39,17 +39,6 @@
#else
# define stream_export extern
#endif
-#ifndef HAVE_HGE
-# ifdef HAVE___INT128
-# define HAVE_HGE 1
-typedef __int128 hge;
-# else
-# ifdef HAVE___INT128_T
-# define HAVE_HGE 1
-typedef __int128_t hge;
-# endif
-# endif
-#endif
/* Defines to help the compiler check printf-style format arguments.
* These defines are also in our config.h, but we repeat them here so
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -778,6 +778,7 @@ typedef enum {
* tsorted, trevsorted, twidth, tshift, tnonil, tnil, tnokey, tnosorted,
* tnorevsorted, tminpos, tmaxpos, and tunique_est; in addition, the
* value should be set if the BBP field BBP_logical(bid) is changed.
+ * This corresponds with any field that gets saved in the BBP.dir file.
*
* theaplock: this lock should be held when reading or writing any of
* the fields mentioned above for batDirtydesc, and also when reading or
@@ -797,8 +798,9 @@ typedef struct BAT {
bool
batTransient:1, /* should the BAT persist on disk? */
batCopiedtodisk:1, /* once written */
- batDirtyflushed:1, /* was dirty before commit started? */
batDirtydesc:1; /* bat descriptor dirty marker */
+ /* not part of bitfields since not in BATiter */
+ bool batDirtyflushed; /* was dirty before commit started? */
uint16_t selcnt; /* how often used in equi select without hash */
uint16_t unused; /* value=0 for now (sneakily used by mat.c) */
int batSharecnt; /* incoming view count */
@@ -962,6 +964,8 @@ typedef struct BATiter {
int8_t type;
oid tseq;
BUN hfree, vhfree;
+ BUN nokey[2];
+ BUN nosorted, norevsorted;
BUN minpos, maxpos;
double unique_est;
bool key:1,
@@ -1008,6 +1012,10 @@ bat_iterator_nolock(BAT *b)
(size_t) b->batCount << b->tshift :
0,
.vhfree = b->tvheap ? b->tvheap->free : 0,
+ .nokey[0] = b->tnokey[0],
+ .nokey[1] = b->tnokey[1],
+ .nosorted = b->tnosorted,
+ .norevsorted = b->tnorevsorted,
.minpos = isview ? BUN_NONE : b->tminpos,
.maxpos = isview ? BUN_NONE : b->tmaxpos,
.unique_est = b->tunique_est,
@@ -1297,17 +1305,15 @@ gdk_export BAT *BATsetaccess(BAT *b, res
gdk_export restrict_t BATgetaccess(BAT *b);
-#define BATdirty(b) (!(b)->batCopiedtodisk || \
- (b)->batDirtydesc || \
+#define BATdirtydata(b) (!(b)->batCopiedtodisk ||
\
(b)->theap->dirty || \
((b)->tvheap != NULL && (b)->tvheap->dirty))
+#define BATdirty(b) (BATdirtydata(b) || \
+ (b)->batDirtydesc)
#define BATdirtybi(bi) (!(bi).copiedtodisk || \
(bi).dirtydesc || \
(bi).hdirty || \
(bi).vhdirty)
-#define BATdirtydata(b) (!(b)->batCopiedtodisk ||
\
- (b)->theap->dirty || \
- ((b)->tvheap != NULL && (b)->tvheap->dirty))
#define BATcapacity(b) (b)->batCapacity
/*
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -1976,7 +1976,7 @@ BATgroupavg(BAT **bnp, BAT **cntsp, BAT
dbl fac = pow(10.0, (double) scale);
for (i = 0; i < ngrp; i++) {
if (!is_dbl_nil(dbls[i]))
- dbls[i] *= fac;
+ dbls[i] /= fac;
}
}
BATsetcount(bn, ngrp);
@@ -3048,7 +3048,7 @@ BATcalcavg(BAT *b, BAT *s, dbl *avg, BUN
}
bat_iterator_end(&bi);
if (scale != 0 && !is_dbl_nil(*avg))
- *avg *= pow(10.0, (double) scale);
+ *avg /= pow(10.0, (double) scale);
if (vals)
*vals = (BUN) n;
return GDK_SUCCEED;
@@ -3816,13 +3816,15 @@ BATmin_skipnil(BAT *b, void *aggr, bit s
if (bi.count == BATcount(b) && bi.h == b->theap)
b->tminpos = bi.minpos;
bat pbid = VIEWtparent(b);
+ MT_lock_unset(&b->theaplock);
if (pbid) {
BAT *pb = BBP_cache(pbid);
+ MT_lock_set(&pb->theaplock);
if (bi.count == BATcount(pb) &&
bi.h == pb->theap)
pb->tminpos = bi.minpos;
+ MT_lock_unset(&pb->theaplock);
}
- MT_lock_unset(&b->theaplock);
}
}
if (aggr == NULL) {
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -263,7 +263,6 @@ BATmaterialize(BAT *b, BUN cap)
b->tunique_est = is_oid_nil(t) ? 1.0 : (double) b->batCount;
b->ttype = TYPE_oid;
BATsetdims(b, 0);
- b->batDirtydesc = true;
BATsetcount(b, b->batCount);
BATsetcapacity(b, cap);
MT_lock_unset(&b->theaplock);
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -641,8 +641,7 @@ BATclear(BAT *b, bool force)
}
}
- if (force)
- b->batInserted = 0;
+ b->batInserted = 0;
b->batCount = 0;
if (b->ttype == TYPE_void)
b->batCapacity = 0;
@@ -941,14 +940,14 @@ COLcopy(BAT *b, int tt, bool writable, r
bn->tsorted = bi.sorted;
bn->trevsorted = bi.revsorted;
bn->batDirtydesc = true;
- bn->tnorevsorted = b->tnorevsorted;
- if (b->tnokey[0] != b->tnokey[1]) {
- bn->tnokey[0] = b->tnokey[0];
- bn->tnokey[1] = b->tnokey[1];
+ bn->tnorevsorted = bi.norevsorted;
+ if (bi.nokey[0] != bi.nokey[1]) {
+ bn->tnokey[0] = bi.nokey[0];
+ bn->tnokey[1] = bi.nokey[1];
} else {
bn->tnokey[0] = bn->tnokey[1] = 0;
}
- bn->tnosorted = b->tnosorted;
+ bn->tnosorted = bi.nosorted;
bn->tnonil = bi.nonil;
bn->tnil = bi.nil;
bn->tminpos = bi.minpos;
@@ -963,19 +962,19 @@ COLcopy(BAT *b, int tt, bool writable, r
BATkey(bn, true);
bn->tnonil = bi.nonil;
bn->tnil = bi.nil;
- if (b->tnosorted > 0 && b->tnosorted < h)
- bn->tnosorted = b->tnosorted;
+ if (bi.nosorted > 0 && bi.nosorted < h)
+ bn->tnosorted = bi.nosorted;
else
bn->tnosorted = 0;
- if (b->tnorevsorted > 0 && b->tnorevsorted < h)
- bn->tnorevsorted = b->tnorevsorted;
+ if (bi.norevsorted > 0 && bi.norevsorted < h)
+ bn->tnorevsorted = bi.norevsorted;
else
bn->tnorevsorted = 0;
- if (b->tnokey[0] < h &&
- b->tnokey[1] < h &&
- b->tnokey[0] != b->tnokey[1]) {
- bn->tnokey[0] = b->tnokey[0];
- bn->tnokey[1] = b->tnokey[1];
+ if (bi.nokey[0] < h &&
+ bi.nokey[1] < h &&
+ bi.nokey[0] != bi.nokey[1]) {
+ bn->tnokey[0] = bi.nokey[0];
+ bn->tnokey[1] = bi.nokey[1];
} else {
bn->tnokey[0] = bn->tnokey[1] = 0;
}
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -90,7 +90,6 @@ insert_string_bat(BAT *b, BATiter *ni, s
HEAPdecref(b->tvheap, b->tvheap->parentid == b->batCacheid);
HEAPincref(ni->vh);
b->tvheap = ni->vh;
- b->batDirtydesc = true;
MT_lock_unset(&b->theaplock);
BBPshare(ni->vh->parentid);
toff = 0;
@@ -359,7 +358,6 @@ append_varsized_bat(BAT *b, BATiter *ni,
HEAPdecref(b->tvheap, true);
HEAPincref(ni->vh);
b->tvheap = ni->vh;
- b->batDirtydesc = true;
MT_lock_unset(&b->theaplock);
}
if (b->tvheap == ni->vh) {
@@ -434,12 +432,12 @@ append_varsized_bat(BAT *b, BATiter *ni,
b->tnil = ni->nil;
b->tnonil = ni->nonil;
b->tsorted = ni->sorted;
- b->tnosorted = ni->b->tnosorted;
+ b->tnosorted = ni->nosorted;
b->trevsorted = ni->revsorted;
- b->tnorevsorted = ni->b->tnorevsorted;
+ b->tnorevsorted = ni->norevsorted;
b->tkey = ni->key;
- b->tnokey[0] = ni->b->tnokey[0];
- b->tnokey[1] = ni->b->tnokey[1];
+ b->tnokey[0] = ni->nokey[0];
+ b->tnokey[1] = ni->nokey[1];
b->tminpos = ni->minpos;
b->tmaxpos = ni->maxpos;
b->tunique_est = ni->unique_est;
@@ -774,8 +772,8 @@ BATappend2(BAT *b, BAT *n, BAT *s, bool
b->tnonil = ni.nonil;
b->tnil = ni.nil && ci.ncand == BATcount(n);
if (ci.tpe == cand_dense) {
- b->tnosorted = ci.seq - hseq <= n->tnosorted &&
n->tnosorted < ci.seq + ci.ncand - hseq ? n->tnosorted + hseq - ci.seq : 0;
- b->tnorevsorted = ci.seq - hseq <= n->tnorevsorted &&
n->tnorevsorted < ci.seq + ci.ncand - hseq ? n->tnorevsorted + hseq - ci.seq :
0;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]