Changeset: 42dd1d7e6c75 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=42dd1d7e6c75
Added Files:
        clients/R/Tests/dbi.reqtests
        clients/R/Tests/dplyr.reqtests
        clients/R/Tests/survey.reqtests
Modified Files:
        clients/Tests/MAL-signatures_all.stable.out
        clients/Tests/MAL-signatures_fits_geom.stable.out
        clients/Tests/MAL-signatures_geom.stable.out
        clients/Tests/MAL-signatures_none.stable.out
        configure.ag
        gdk/gdk.h
        gdk/gdk_bat.c
        gdk/gdk_bbp.c
        gdk/gdk_select.c
        monetdb5/modules/mal/01_batcalc.mal
        monetdb5/modules/mal/01_batcalc.mal.sh
        sql/test/leaks/Tests/check3_bam.stable.out
        sql/test/leaks/Tests/check4_bam.stable.out
        sql/test/leaks/Tests/check5_bam.stable.out
        sql/test/leaks/Tests/select1_bam.stable.out
        sql/test/leaks/Tests/select2_bam.stable.out
Branch: transaction-replication
Log Message:

Merge with default branch


diffs (truncated from 327 to 300 lines):

diff --git a/clients/R/Tests/dbi.reqtests b/clients/R/Tests/dbi.reqtests
new file mode 100644
--- /dev/null
+++ b/clients/R/Tests/dbi.reqtests
@@ -0,0 +1,1 @@
+install
diff --git a/clients/R/Tests/dplyr.reqtests b/clients/R/Tests/dplyr.reqtests
new file mode 100644
--- /dev/null
+++ b/clients/R/Tests/dplyr.reqtests
@@ -0,0 +1,1 @@
+install
diff --git a/clients/R/Tests/survey.reqtests b/clients/R/Tests/survey.reqtests
new file mode 100644
--- /dev/null
+++ b/clients/R/Tests/survey.reqtests
@@ -0,0 +1,1 @@
+install
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -1885,11 +1885,11 @@ if test "x$have_pthread" != xno; then
        save_LIBS="$LIBS"
        save_CPPFLAGS="$CPPFLAGS"
        case $GCC-$have_pthread-$CC_ver in
-               yes-auto-clang-5.*|yes-yes-clang-5.*)
-                       # clang 5.* (at least on Mac OSX Mavericks) does not
+               
yes-auto-clang-5.*|yes-yes-clang-5.*|yes-auto-clang-6.*|yes-yes-clang-6.*)
+                       # clang 5.*/6.* (Xcode 6.0) does not
                        # seem to have / require -pthread as compiler
-                       # option; on Mac OSX Mavericks, "Apple LLVM version
-                       # 5.0 (clang-500.2.79) (based on LLVM 3.3svn)"
+                       # option; on Mac OS X Yosamite, "Apple LLVM 
+                       # version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)"
                        # complains about "error: argument unused during
                        # compilation: '-pthread'".
                        # However, disabling -pthread completely might be
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -969,9 +969,6 @@ typedef struct {
 /* assert that atom width is power of 2, i.e., width == 1<<shift */
 #define assert_shift_width(shift,width) assert(((shift) == 0 && (width) == 0) 
|| ((unsigned)1<<(shift)) == (unsigned)(width))
 
-#define GDKLIBRARY_PRE_VARWIDTH 061023  /* backward compatible version */
-#define GDKLIBRARY_CHR         061024  /* version that still had chr type */
-#define GDKLIBRARY_SORTED_BYTE 061025  /* version that still had byte-sized 
sorted flag */
 #define GDKLIBRARY_64_BIT_INT  061026  /* version that had no 128-bit integer 
option, yet */
 #define GDKLIBRARY             061027
 
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -601,6 +601,8 @@ BATclear(BAT *b, int force)
        else
                b->batFirst = b->batInserted;
        BATsetcount(b,0);
+       BATseqbase(b, 0);
+       BATseqbase(BATmirror(b), 0);
        b->batDirty = TRUE;
        BATsettrivprop(b);
        return b;
@@ -2122,6 +2124,10 @@ BATsetcount(BAT *b, BUN cnt)
        b->T->heap.free = tailsize(b, BUNfirst(b) + cnt);
        if (b->H->type == TYPE_void && b->T->type == TYPE_void)
                b->batCapacity = cnt;
+       if (cnt <= 1) {
+               b->hsorted = b->hrevsorted = BATatoms[b->htype].linear != 0;
+               b->tsorted = b->trevsorted = BATatoms[b->ttype].linear != 0;
+       }
        assert(b->batCapacity >= cnt);
 }
 
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -713,18 +713,10 @@ heapinit(COLrec *col, const char *buf, i
        int n;
 
        (void) oidsize;         /* only used when SIZEOF_OID==8 */
+       (void) bbpversion;      /* could be used to implement compatibility */
 
        norevsorted = 0; /* default for first case */
-       if (bbpversion <= GDKLIBRARY_SORTED_BYTE ?
-           sscanf(buf,
-                  " %10s %hu %hu %hu %lld %lld %lld %lld %lld %lld %lld %hu"
-                  "%n",
-                  type, &width, &var, &properties, &nokey0,
-                  &nokey1, &nosorted, &base, &align, &free,
-                  &size, &storage,
-                  &n) < 12
-           :
-           sscanf(buf,
+       if (sscanf(buf,
                   " %10s %hu %hu %hu %lld %lld %lld %lld %lld %lld %lld %lld 
%hu"
                   "%n",
                   type, &width, &var, &properties, &nokey0,
@@ -733,6 +725,8 @@ heapinit(COLrec *col, const char *buf, i
                   &n) < 13)
                GDKfatal("BBPinit: invalid format for BBP.dir\n%s", buf);
 
+       if (properties & ~0x0F81)
+               GDKfatal("BBPinit: unknown properties are set: incompatible 
database\n");
        *hashash = var & 2;
        var &= ~2;
        /* silently convert chr columns to bte */
@@ -963,10 +957,7 @@ BBPheader(FILE *fp, oid *BBPoid, int *OI
                exit(1);
        }
        if (bbpversion != GDKLIBRARY &&
-           bbpversion != GDKLIBRARY_64_BIT_INT &&
-           bbpversion != GDKLIBRARY_SORTED_BYTE &&
-           bbpversion != GDKLIBRARY_CHR &&
-           bbpversion != GDKLIBRARY_PRE_VARWIDTH) {
+           bbpversion != GDKLIBRARY_64_BIT_INT) {
                GDKfatal("BBPinit: incompatible BBP version: expected 0%o, got 
0%o.", GDKLIBRARY, bbpversion);
        }
        if (fgets(buf, sizeof(buf), fp) == NULL) {
@@ -1231,10 +1222,33 @@ BBPexit(void)
  * reclaimed as well.
  */
 static int
+heap_entry(stream *s, COLrec *col)
+{
+       int t;
+
+       t = col->type;
+       if (mnstr_printf(s, " %s %u %u %u " BUNFMT " " BUNFMT " " BUNFMT " "
+                        BUNFMT " " OIDFMT " " OIDFMT " " SZFMT " " SZFMT " %d",
+                         t >= 0 ? BATatoms[t].name : ATOMunknown_name(t),
+                         col->width,
+                         col->varsized | (col->vheap ? col->vheap->hashash << 
1 : 0),
+                        (unsigned short) col->sorted | ((unsigned short) 
col->revsorted << 7) | (((unsigned short) col->key & 0x01) << 8) | ((unsigned 
short) col->dense << 9) | ((unsigned short) col->nonil << 10) | ((unsigned 
short) col->nil << 11),
+                         col->nokey[0],
+                         col->nokey[1],
+                         col->nosorted,
+                         col->norevsorted,
+                         col->seq,
+                         col->align,
+                         col->heap.free,
+                         col->heap.size,
+                         (int) col->heap.newstorage) < 0)
+               return -1;
+       return 0;
+}
+
+static int
 new_bbpentry(stream *s, bat i)
 {
-       int t;
-
 #ifndef NDEBUG
        assert(i > 0);
        assert(i < (bat) ATOMIC_GET(BBPsize, BBPsizeLock, "new_bbpentry"));
@@ -1272,39 +1286,9 @@ new_bbpentry(stream *s, bat i)
                          (unsigned char) BBP_desc(i)->S.map_hheap,
                          (unsigned char) BBP_desc(i)->S.map_theap) < 0)
                return -1;
-       t = BBP_desc(i)->H.type;
-       if (mnstr_printf(s, " %s %u %u %u " BUNFMT " " BUNFMT " " BUNFMT " "
-                        BUNFMT " " OIDFMT " " OIDFMT " " SZFMT " " SZFMT " %d",
-                         t >= 0 ? BATatoms[t].name : ATOMunknown_name(t),
-                         BBP_desc(i)->H.width,
-                         BBP_desc(i)->H.varsized | (BBP_desc(i)->H.vheap ? 
BBP_desc(i)->H.vheap->hashash << 1 : 0),
-                        ((unsigned short) BBP_desc(i)->H.sorted & 0x01) | 
(((unsigned short) BBP_desc(i)->H.revsorted & 0x01) << 7) | (((unsigned short) 
BBP_desc(i)->H.key & 0x01) << 8) | (((unsigned short) BBP_desc(i)->H.dense & 
0x01) << 9) | (((unsigned short) BBP_desc(i)->H.nonil & 0x01) << 10) | 
(((unsigned short) BBP_desc(i)->H.nil & 0x01) << 11),
-                         BBP_desc(i)->H.nokey[0],
-                         BBP_desc(i)->H.nokey[1],
-                         BBP_desc(i)->H.nosorted,
-                         BBP_desc(i)->H.norevsorted,
-                         BBP_desc(i)->H.seq,
-                         BBP_desc(i)->H.align,
-                         BBP_desc(i)->H.heap.free,
-                         BBP_desc(i)->H.heap.size,
-                         (int) BBP_desc(i)->H.heap.newstorage) < 0)
+       if (heap_entry(s, &BBP_desc(i)->H) < 0)
                return -1;
-       t = BBP_desc(i)->T.type;
-       if (mnstr_printf(s, " %s %u %u %u " BUNFMT " " BUNFMT " " BUNFMT " "
-                        BUNFMT " " OIDFMT " " OIDFMT " " SZFMT " " SZFMT " %d",
-                         t >= 0 ? BATatoms[t].name : ATOMunknown_name(t),
-                         BBP_desc(i)->T.width,
-                         BBP_desc(i)->T.varsized | (BBP_desc(i)->T.vheap ? 
BBP_desc(i)->T.vheap->hashash << 1 : 0),
-                        ((unsigned short) BBP_desc(i)->T.sorted & 0x01) | 
(((unsigned short) BBP_desc(i)->T.revsorted & 0x01) << 7) | (((unsigned short) 
BBP_desc(i)->T.key & 0x01) << 8) | (((unsigned short) BBP_desc(i)->T.dense & 
0x01) << 9) | (((unsigned short) BBP_desc(i)->T.nonil & 0x01) << 10) | 
(((unsigned short) BBP_desc(i)->T.nil & 0x01) << 11),
-                         BBP_desc(i)->T.nokey[0],
-                         BBP_desc(i)->T.nokey[1],
-                         BBP_desc(i)->T.nosorted,
-                         BBP_desc(i)->T.norevsorted,
-                         BBP_desc(i)->T.seq,
-                         BBP_desc(i)->T.align,
-                         BBP_desc(i)->T.heap.free,
-                         BBP_desc(i)->T.heap.size,
-                         (int) BBP_desc(i)->T.heap.newstorage) < 0)
+       if (heap_entry(s, &BBP_desc(i)->T) < 0)
                return -1;
 
        if (BBP_desc(i)->H.vheap &&
diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -294,6 +294,12 @@ do {                                                       
                \
        }                                                               \
 } while (0)
 
+#define quickins(dst, cnt, o, bn)                      \
+       do{                                             \
+               assert((cnt) < BATcapacity(bn));        \
+               dst[cnt] = (o);                         \
+       } while(0)
+
 /* construct the mask */
 #define impsmask(CAND,TEST,B)                                          \
 do {                                                                   \
@@ -329,7 +335,7 @@ do {                                                        
                \
                                          * (dbl) (q-p) * 1.1 + 1024),  \
                                   BATcapacity(bn) + q - p, BUN_NONE)); \
        } else {                                                        \
-               impsloop(CAND, TEST, dst[cnt] = o);                     \
+               impsloop(CAND, TEST, quickins(dst, cnt, o, bn));        \
        }                                                               \
 } while (0)
 
@@ -367,7 +373,7 @@ do {                                                        
                \
                while (p < q) {                                         \
                        CAND;                                           \
                        v = src[o-off];                                 \
-                       buninsfix(bn, dst, cnt, (oid)(o),               \
+                       buninsfix(bn, dst, cnt, o,                      \
                                  (BUN) ((dbl) cnt / (dbl) (p-r)        \
                                         * (dbl) (q-p) * 1.1 + 1024),   \
                                  BATcapacity(bn) + q - p, BUN_NONE);   \
@@ -378,7 +384,8 @@ do {                                                        
                \
                while (p < q) {                                         \
                        CAND;                                           \
                        v = src[o-off];                                 \
-                       dst[cnt] = (oid)(o);                            \
+                       assert(cnt < BATcapacity(bn));                  \
+                       dst[cnt] = o;                                   \
                        cnt += (TEST);                                  \
                        p++;                                            \
                }                                                       \
@@ -675,7 +682,7 @@ fullscan_any(BAT *b, BAT *s, BAT *bn, co
        scanfunc_hge(NAME, CAND, END)
 
 /* scan/imprints select with candidates */
-scan_sel(candscan, o = (oid) (*candlist++), w = (BUN) ((*(oid *) Tloc(s,q?(q - 
1):0)) + 1))
+scan_sel(candscan, o = *candlist++, w = (BUN) ((*(oid *) Tloc(s,q?(q - 1):0)) 
+ 1))
 /* scan/imprints select without candidates */
 scan_sel(fullscan, o = (oid) (p+off), w = (BUN) (q+off))
 
diff --git a/sql/test/leaks/Tests/check3_bam.stable.out 
b/sql/test/leaks/Tests/check3_bam.stable.out
--- a/sql/test/leaks/Tests/check3_bam.stable.out
+++ b/sql/test/leaks/Tests/check3_bam.stable.out
@@ -254,7 +254,7 @@ Ready.
 % L1,  L2 # name
 % char,        wrd # type
 % 9,   3 # length
-[ "transient", 191     ]
+[ "transient", 173     ]
 #select 'persistent', count(*) from bbp() as bbp where kind like 'pers%';
 % .L1, .L2 # table_name
 % L1,  L2 # name
diff --git a/sql/test/leaks/Tests/check4_bam.stable.out 
b/sql/test/leaks/Tests/check4_bam.stable.out
--- a/sql/test/leaks/Tests/check4_bam.stable.out
+++ b/sql/test/leaks/Tests/check4_bam.stable.out
@@ -254,7 +254,7 @@ Ready.
 % L1,  L2 # name
 % char,        wrd # type
 % 9,   3 # length
-[ "transient", 191     ]
+[ "transient", 173     ]
 #select 'persistent', count(*) from bbp() as bbp where kind like 'pers%';
 % .L1, .L2 # table_name
 % L1,  L2 # name
diff --git a/sql/test/leaks/Tests/check5_bam.stable.out 
b/sql/test/leaks/Tests/check5_bam.stable.out
--- a/sql/test/leaks/Tests/check5_bam.stable.out
+++ b/sql/test/leaks/Tests/check5_bam.stable.out
@@ -254,7 +254,7 @@ Ready.
 % L1,  L2 # name
 % char,        wrd # type
 % 9,   3 # length
-[ "transient", 191     ]
+[ "transient", 173     ]
 #select 'persistent', count(*) from bbp() as bbp where kind like 'pers%';
 % .L1, .L2 # table_name
 % L1,  L2 # name
diff --git a/sql/test/leaks/Tests/select1_bam.stable.out 
b/sql/test/leaks/Tests/select1_bam.stable.out
--- a/sql/test/leaks/Tests/select1_bam.stable.out
+++ b/sql/test/leaks/Tests/select1_bam.stable.out
@@ -37,7 +37,7 @@ Ready.
 % L1 # name
 % wrd # type
 % 3 # length
-[ 407  ]
+[ 389  ]
 #select 1; 
 % .L # table_name
 % single_value # name
@@ -49,7 +49,7 @@ Ready.
 % L1 # name
 % wrd # type
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to