Changeset: f6d7fcd36c70 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f6d7fcd36c70 Modified Files: gdk/ChangeLog gdk/gdk.h gdk/gdk_align.c gdk/gdk_bat.c gdk/gdk_bbp.c gdk/gdk_delta.c gdk/gdk_private.h gdk/gdk_storage.c monetdb5/mal/Tests/tst275.stable.out monetdb5/modules/kernel/bat5.c Branch: default Log Message:
Cleanup: remove talign field from BAT descriptor. diffs (288 lines): diff --git a/gdk/ChangeLog b/gdk/ChangeLog --- a/gdk/ChangeLog +++ b/gdk/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog file for MonetDB # This file is updated with Maddlog +* Tue Dec 13 2016 Sjoerd Mullender <sjo...@acm.org> +- Removed talign field from BAT descriptor. + * Mon Dec 5 2016 Sjoerd Mullender <sjo...@acm.org> - BATappend now takes an optional (NULL if not used) candidate list for the to-be-appended BAT. diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -768,7 +768,6 @@ gdk_export int VALisnil(const ValRecord * bit tnonil; // tail has no nils * bit tsorted; // are tail values currently ordered? * bit tvarsized; // for speed: tail type is varsized? - * oid talign; // alignment OID for head. * // Tail storage * int tloc; // byte-offset in BUN for tail elements * Heap *theap; // heap for varsized tail values @@ -831,7 +830,6 @@ typedef struct { nil:1, /* there is a nil in the column */ sorted:1, /* column is sorted in ascending order */ revsorted:1; /* column is sorted in descending order */ - oid align; /* OID for sync alignment */ BUN nokey[2]; /* positions that prove key==FALSE */ BUN nosorted; /* position that proves sorted==FALSE */ BUN norevsorted; /* position that proves revsorted==FALSE */ @@ -898,7 +896,6 @@ typedef struct BATiter { #define trevsorted T.revsorted #define tdense T.dense #define tident T.id -#define talign T.align #define torderidx T.orderidx #define twidth T.width #define tshift T.shift @@ -2679,10 +2676,8 @@ gdk_export void VIEWbounds(BAT *b, BAT * gdk_export void ALIGNsetH(BAT *b1, BAT *b2); gdk_export void ALIGNsetT(BAT *b1, BAT *b2); -#define ALIGNins(x,y,f,e) do {if (!(f)) VIEWchk(x,y,BAT_READ,e);(x)->talign=0; } while (0) -#define ALIGNdel(x,y,f,e) do {if (!(f)) VIEWchk(x,y,BAT_READ|BAT_APPEND,e);(x)->talign=0; } while (0) -#define ALIGNinp(x,y,f,e) do {if (!(f)) VIEWchk(x,y,BAT_READ|BAT_APPEND,e);(x)->talign=0; } while (0) -#define ALIGNapp(x,y,f,e) do {if (!(f)) VIEWchk(x,y,BAT_READ,e);(x)->talign=0; } while (0) +#define ALIGNinp(x,y,f,e) do {if (!(f)) VIEWchk(x,y,BAT_READ|BAT_APPEND,e); } while (0) +#define ALIGNapp(x,y,f,e) do {if (!(f)) VIEWchk(x,y,BAT_READ,e); } while (0) #define BAThrestricted(b) ((b)->batRestricted) #define BATtrestricted(b) (VIEWtparent(b) ? BBP_cache(VIEWtparent(b))->batRestricted : (b)->batRestricted) diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c --- a/gdk/gdk_align.c +++ b/gdk/gdk_align.c @@ -44,44 +44,12 @@ * Alignment statuses must be kept consistent under database commits * and aborts. * @end itemize - * - * As for performance, the most important observation to make is that - * operations that do not need alignment, will suffer most from - * overheads introduced in the BUN update mechanism. For this reason, - * the alignment-delete operation has to be very cheap. It is captured - * by the @emph{ALIGNdel} macro, and just zaps one character field in - * the @emph{BAT} record. - * - * @+ Alignment Implementation - * The @emph{BAT} record is equipped with an @emph{batAlign} field - * that keeps both information about the head and tail column. The - * leftmost 4 bits are for the head, the rightmost 4 for the - * tail. This has been done to make the zap ultra-cheap. - * - * Columns contain an OID in the @emph{talign} field to mark their - * alignment group. All BATs with the same OID in this field (and the - * ALIGN_SYNCED bit on) are guaranteed by the system to have equal - * head columns. As an exception, they might also have TYPE_void head - * columns (a virtual column). In such a case, the tail values - * correspond to the head values that would have been there in a - * non-virtual column, continuing the same head-sequence as the other - * BATs in the sync group. */ #include "monetdb_config.h" #include "gdk.h" #include "gdk_private.h" void -ALIGNcommit(BAT *b) -{ - if (b == NULL) - return; - if (!b->talign) { - b->talign = OIDnew(1); - } -} - -void ALIGNsetH(BAT *b1, BAT *b2) { if (b1 == NULL || b2 == NULL) @@ -98,10 +66,6 @@ ALIGNsetT(BAT *b1, BAT *b2) if (b1 == NULL || b2 == NULL) return; - if (b2->talign == 0) { - b2->talign = OIDnew(1); - b2->batDirtydesc = TRUE; - } if (BATtvoid(b2)) { /* b2 is either dense or has a void(nil) tail */ if (b1->ttype != TYPE_void) @@ -119,7 +83,6 @@ ALIGNsetT(BAT *b1, BAT *b2) BATkey(b1, BATtkey(b2)); b1->tsorted = BATtordered(b2); b1->trevsorted = BATtrevordered(b2); - b1->talign = b2->talign; b1->batDirtydesc = TRUE; b1->tnorevsorted = b2->tnorevsorted; if (b2->tnokey[0] != b2->tnokey[1]) { diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -93,7 +93,6 @@ BATcreatedesc(oid hseq, int tt, int heap bn->tnil = FALSE; bn->tsorted = bn->trevsorted = ATOMlinear(tt) != 0; bn->tident = BATstring_t; - bn->talign = OIDnew(1); bn->tseqbase = (tt == TYPE_void) ? oid_nil : 0; bn->tprops = NULL; @@ -1462,8 +1461,7 @@ BATkey(BAT *b, int flag) ATOMtype(BATttype(b)) == ATOMtype(BATttype(bp)) && !BATtkey(bp) && ((BATtvoid(b) && BATtvoid(bp) && b->tseqbase == bp->tseqbase) || - BATcount(b) == 0 || - (b->talign && b->talign == bp->talign))) + BATcount(b) == 0)) return BATkey(bp, TRUE); } return GDK_SUCCEED; @@ -1494,10 +1492,6 @@ BATtseqbase(BAT *b, oid o) if (ATOMtype(b->ttype) == TYPE_oid) { if (b->tseqbase != o) { b->batDirtydesc = TRUE; - /* zap alignment if column is changed by new - * seqbase */ - if (b->ttype == TYPE_void) - b->talign = 0; } b->tseqbase = o; if (b->ttype == TYPE_oid && o == oid_nil) { diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -987,7 +987,6 @@ heapinit(BAT *b, const char *buf, int *h b->tnosorted = (BUN) nosorted; b->tnorevsorted = (BUN) norevsorted; b->tseqbase = base < 0 ? oid_nil : (oid) base; - b->talign = (oid) align; b->theap.free = (size_t) free; b->theap.size = (size_t) size; b->theap.base = NULL; @@ -1512,7 +1511,7 @@ heap_entry(FILE *fp, BAT *b) b->tnosorted, b->tnorevsorted, b->tseqbase, - b->talign, + (oid) 0, /* formerly b->talign */ b->theap.free, b->theap.size, (int) b->theap.newstorage); @@ -2086,6 +2085,8 @@ BBPinsert(BAT *bn) BATDEBUG fprintf(stderr, "#%d = new %s(%s)\n", (int) i, BBPname(i), ATOMname(bn->ttype)); } + BBPdirty(1); + return i; } diff --git a/gdk/gdk_delta.c b/gdk/gdk_delta.c --- a/gdk/gdk_delta.c +++ b/gdk/gdk_delta.c @@ -40,7 +40,6 @@ BATcommit(BAT *b) b->theap.free, b->batInserted, PTRFMTCAST b->theap.base); - ALIGNcommit(b); if (!BATdirty(b)) { b->batDirtyflushed = 0; } diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -26,8 +26,6 @@ enum heaptype { orderidxheap }; -__hidden void ALIGNcommit(BAT *b) - __attribute__((__visibility__("hidden"))); __hidden gdk_return ATOMheap(int id, Heap *hp, size_t cap) __attribute__((__visibility__("hidden"))); __hidden int ATOMisdescendant(int id, int parentid) diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c --- a/gdk/gdk_storage.c +++ b/gdk/gdk_storage.c @@ -729,10 +729,6 @@ BATsave(BAT *bd) if (!BATdirty(b)) { return GDK_SUCCEED; } - if (!DELTAdirty(b)) - ALIGNcommit(b); - if (!b->talign) - b->talign = OIDnew(1); /* copy the descriptor to a local variable in order to let our * messing in the BAT descriptor not affect other threads that @@ -819,10 +815,6 @@ BATload_intern(bat bid, int lock) /* load succeeded; register it in BBP */ BBPcacheit(b, lock); - if (!DELTAdirty(b)) { - ALIGNcommit(b); - } - if ((b->batRestricted == BAT_WRITE && (GDKdebug & CHECKMASK)) || (GDKdebug & PROPMASK)) { ++b->batSharecnt; diff --git a/monetdb5/mal/Tests/tst275.stable.out b/monetdb5/mal/Tests/tst275.stable.out --- a/monetdb5/mal/Tests/tst275.stable.out +++ b/monetdb5/mal/Tests/tst275.stable.out @@ -55,25 +55,24 @@ Ready. [ 18@0, "trevsorted", "1" ] [ 19@0, "tkey", "1" ] [ 20@0, "tvarsized", "0" ] -[ 21@0, "talign", "20000000" ] -[ 22@0, "tnosorted", "0" ] -[ 23@0, "tnorevsorted", "0" ] -[ 24@0, "tnodense", "0" ] -[ 25@0, "tnokey[0]", "0" ] -[ 26@0, "tnokey[1]", "0" ] -[ 27@0, "tnonil", "1" ] -[ 28@0, "tnil", "0" ] -[ 29@0, "batInserted", "0" ] -[ 30@0, "ttop", "0" ] -[ 31@0, "batCopiedtodisk", "0" ] -[ 32@0, "batDirtydesc", "dirty" ] -[ 33@0, "T->heap.dirty", "clean" ] -[ 34@0, "tail.free", "0" ] -[ 35@0, "tail.size", "1024" ] -[ 36@0, "tail.storage", "malloced" ] -[ 37@0, "tail.newstorage", "malloced" ] -[ 38@0, "tail.filename", "22.tail" ] -[ 39@0, "T->vheap->dirty", "clean" ] +[ 21@0, "tnosorted", "0" ] +[ 22@0, "tnorevsorted", "0" ] +[ 23@0, "tnodense", "0" ] +[ 24@0, "tnokey[0]", "0" ] +[ 25@0, "tnokey[1]", "0" ] +[ 26@0, "tnonil", "1" ] +[ 27@0, "tnil", "0" ] +[ 28@0, "batInserted", "0" ] +[ 29@0, "ttop", "0" ] +[ 30@0, "batCopiedtodisk", "0" ] +[ 31@0, "batDirtydesc", "dirty" ] +[ 32@0, "T->heap.dirty", "clean" ] +[ 33@0, "tail.free", "0" ] +[ 34@0, "tail.size", "1024" ] +[ 35@0, "tail.storage", "malloced" ] +[ 36@0, "tail.newstorage", "malloced" ] +[ 37@0, "tail.filename", "22.tail" ] +[ 38@0, "T->vheap->dirty", "clean" ] #~EndVariableOutput~# #--------------------------# # h t # name diff --git a/monetdb5/modules/kernel/bat5.c b/monetdb5/modules/kernel/bat5.c --- a/monetdb5/modules/kernel/bat5.c +++ b/monetdb5/modules/kernel/bat5.c @@ -750,8 +750,6 @@ BKCinfo(bat *ret1, bat *ret2, const bat BUNappend(bv, local_itoa((ssize_t)(b->tkey)), FALSE) != GDK_SUCCEED || BUNappend(bk, "tvarsized", FALSE) != GDK_SUCCEED || BUNappend(bv, local_itoa((ssize_t)(b->tvarsized)), FALSE) != GDK_SUCCEED || - BUNappend(bk, "talign", FALSE) != GDK_SUCCEED || - BUNappend(bv, local_utoa(b->talign), FALSE) != GDK_SUCCEED || BUNappend(bk, "tnosorted", FALSE) != GDK_SUCCEED || BUNappend(bv, local_utoa(b->tnosorted), FALSE) != GDK_SUCCEED || BUNappend(bk, "tnorevsorted", FALSE) != GDK_SUCCEED || _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list