Changeset: c7358526cb6b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c7358526cb6b
Modified Files:
gdk/gdk_bat.c
Branch: Jan2022
Log Message:
Don't check data-dependent properties in views.
See the comment.
diffs (88 lines):
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -2461,6 +2461,14 @@ BATmode(BAT *b, bool transient)
* newly created and filled BAT, you may want to first make sure the
* batCount is set correctly (e.g. by calling BATsetcount), then use
* BATtseqbase and BATkey, and finally set the other properties.
+ *
+ * For a view, we cannot check all properties, since it is possible with
+ * the way the SQL layer works, that a parent BAT gets changed, changing
+ * the properties, while there is a view. The view is supposed to look
+ * at only at the non-changing part of the BAT (through candidate
+ * lists), but this means that the properties of the view might not be
+ * correct. For this reason, for views, we skip all property checking
+ * that looks at the BAT content.
*/
void
@@ -2472,6 +2480,7 @@ BATassertProps(BAT *b)
int cmp;
const void *prev = NULL, *valp, *nilp;
char filename[sizeof(b->theap->filename)];
+ bool isview;
/* do the complete check within a lock */
MT_lock_set(&b->theaplock);
@@ -2485,6 +2494,8 @@ BATassertProps(BAT *b)
assert(b->hseqbase <= GDK_oid_max); /* non-nil seqbase */
assert(b->hseqbase + BATcount(b) <= GDK_oid_max);
+ isview = isVIEW(b);
+
bbpstatus = BBP_status(b->batCacheid);
/* only at most one of BBPDELETED, BBPEXISTING, BBPNEW may be set */
assert(((bbpstatus & BBPDELETED) != 0) +
@@ -2494,10 +2505,10 @@ BATassertProps(BAT *b)
assert(b->ttype >= TYPE_void);
assert(b->ttype < GDKatomcnt);
assert(b->ttype != TYPE_bat);
- assert(isVIEW(b) ||
+ assert(isview ||
b->ttype == TYPE_void ||
BBPfarms[b->theap->farmid].roles & (1 << b->batRole));
- assert(isVIEW(b) ||
+ assert(isview ||
b->tvheap == NULL ||
(BBPfarms[b->tvheap->farmid].roles & (1 << b->batRole)));
@@ -2615,7 +2626,8 @@ BATassertProps(BAT *b)
(b->tnosorted > 0 &&
b->tnosorted < b->batCount));
assert(!b->tsorted || b->tnosorted == 0);
- if (!b->tsorted &&
+ if (!isview &&
+ !b->tsorted &&
b->tnosorted > 0 &&
b->tnosorted < b->batCount)
assert(cmpf(BUNtail(bi, b->tnosorted - 1),
@@ -2624,7 +2636,8 @@ BATassertProps(BAT *b)
(b->tnorevsorted > 0 &&
b->tnorevsorted < b->batCount));
assert(!b->trevsorted || b->tnorevsorted == 0);
- if (!b->trevsorted &&
+ if (!isview &&
+ !b->trevsorted &&
b->tnorevsorted > 0 &&
b->tnorevsorted < b->batCount)
assert(cmpf(BUNtail(bi, b->tnorevsorted - 1),
@@ -2632,7 +2645,7 @@ BATassertProps(BAT *b)
}
/* if tkey property set, both tnokey values must be 0 */
assert(!b->tkey || (b->tnokey[0] == 0 && b->tnokey[1] == 0));
- if (!b->tkey && (b->tnokey[0] != 0 || b->tnokey[1] != 0)) {
+ if (!isview && !b->tkey && (b->tnokey[0] != 0 || b->tnokey[1] != 0)) {
/* if tkey not set and tnokey indicates a proof of
* non-key-ness, make sure the tnokey values are in
* range and indeed provide a proof */
@@ -2652,7 +2665,9 @@ BATassertProps(BAT *b)
return;
}
- PROPDEBUG { /* only do a scan if property checking is requested */
+ /* only do a scan if property checking is requested and the bat
+ * is not a view */
+ if (!isview && GDKdebug & PROPMASK) {
const void *maxval = NULL;
const void *minval = NULL;
bool seenmax = false, seenmin = false;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list