Changeset: 046549891b58 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=046549891b58
Added Files:
        monetdb5/modules/atoms/Tests/strappend.malC
        monetdb5/modules/atoms/Tests/strappend.stable.err
        monetdb5/modules/atoms/Tests/strappend.stable.out
        monetdb5/optimizer/Tests/tst4006.malC
        monetdb5/optimizer/Tests/tst4006.stable.err
        monetdb5/optimizer/Tests/tst4006.stable.out
        sql/test/BugTracker-2017/Tests/sqlsmith.Bug-6219.sql
        sql/test/BugTracker-2017/Tests/sqlsmith.Bug-6219.stable.err
        sql/test/BugTracker-2017/Tests/sqlsmith.Bug-6219.stable.out
Modified Files:
        .hgtags
        MonetDB.spec
        NT/installer32/MonetDB-ODBC-Installer.vdproj
        NT/installer32/MonetDB5-Geom-Module.vdproj
        NT/installer32/MonetDB5-SQL-Installer.vdproj
        NT/installer64/MonetDB-ODBC-Installer.vdproj
        NT/installer64/MonetDB5-Geom-Module.vdproj
        NT/installer64/MonetDB5-SQL-Installer.vdproj
        NT/monetdb_config.h.in
        NT/rules.msc
        clients/mapilib/mapi.rc
        clients/odbc/driver/driver.rc
        clients/odbc/winsetup/setup.rc
        configure.ag
        debian/changelog
        gdk/ChangeLog.Dec2016
        gdk/gdk.h
        gdk/gdk_atoms.c
        gdk/gdk_batop.c
        gdk/gdk_bbp.c
        gdk/gdk_join.c
        gdk/libbat.rc
        geom/sql/functions/Tests/ST_NumInteriorRings.stable.out
        monetdb5/mal/Tests/performanceTests/performanceLog
        monetdb5/mal/mal.h
        monetdb5/mal/mal_client.c
        monetdb5/mal/mal_debugger.c
        monetdb5/mal/mal_function.c
        monetdb5/mal/mal_instruction.c
        monetdb5/mal/mal_instruction.h
        monetdb5/modules/atoms/Tests/All
        monetdb5/modules/mal/mal_io.c
        monetdb5/modules/mal/manifold.c
        monetdb5/optimizer/Tests/All
        monetdb5/optimizer/Tests/GCexample01.stable.out
        monetdb5/optimizer/opt_dataflow.c
        monetdb5/optimizer/opt_emptybind.c
        monetdb5/optimizer/opt_garbageCollector.c
        monetdb5/optimizer/opt_pipes.c
        monetdb5/tools/libmonetdb5.rc
        sql/backends/monet5/sql_statistics.c
        sql/backends/monet5/vaults/bam/Tests/sam_export.stable.out
        sql/server/rel_rel.c
        
sql/test/BugTracker-2010/Tests/ORDER_BY_over_UNION_EXCEPT_INTERSECT.Bug-2606.stable.out
        sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out
        sql/test/BugTracker-2016/Tests/rename_exps.Bug-3974.stable.out
        sql/test/BugTracker-2017/Tests/All
        sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out
        sql/test/remote/Tests/partition_elim.stable.out
        vertoo.data
Branch: mosaic
Log Message:

merge with default


diffs (truncated from 1976 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -651,3 +651,6 @@ bf4b58d202645774b75c7f508c84b30e3be78a49
 bf4b58d202645774b75c7f508c84b30e3be78a49 Dec2016_SP1_release
 3968ed7fb6dab04a2530c6c3e1a5ffd6d649298b Dec2016_7
 3968ed7fb6dab04a2530c6c3e1a5ffd6d649298b Dec2016_SP2_release
+615229dc6f3c7dc89bbd9cc5923ad307b4c93cb1 Dec2016_9
+3968ed7fb6dab04a2530c6c3e1a5ffd6d649298b Dec2016_SP2_release
+615229dc6f3c7dc89bbd9cc5923ad307b4c93cb1 Dec2016_SP2_release
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -944,6 +944,13 @@ rm -f %{buildroot}%{_bindir}/Maddlog
 %postun -p /sbin/ldconfig
 
 %changelog
+* Mon Feb 27 2017 Panagiotis Koutsourakis <kutsu...@monetdbsolutions.com> - 
11.25.9-20170227
+- Rebuilt.
+- BZ#6217: Segfault in rel_optimizer (sqlsmith)
+- BZ#6218: grouped quantiles with all null group causes following groups
+  to return null
+- BZ#6224: mal_parser: cannot refer to types containing an underscore
+
 * Thu Feb 16 2017 Panagiotis Koutsourakis <kutsu...@monetdbsolutions.com> - 
11.25.7-20170216
 - Rebuilt.
 - BZ#4034: argnames array in rapi.c has fixed length (that was too short)
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -128,6 +128,7 @@ AS_CASE([$CC],
                        [10.*], [CC="$CC -no-gcc"],
                        [11.*], [CC="$CC -no-gcc"],
                        [15.*], [CC="$CC -no-gcc"],
+                       [17.*], [CC="$CC -no-gcc"],
                        [AC_MSG_WARN([icc ($CC) $icc_ver not handled, yet])])])
 
 AS_IF([test -f "$srcdir"/vertoo.data],
@@ -683,6 +684,7 @@ AS_VAR_IF([enable_strict], [yes], [
                        [10.*], [],
                        [11.*], [],
                        [15.*], [],
+                       [17.*], [],
                        [CFLAGS="$CFLAGS -ansi"])
                # Be picky; "-Werror" seems to be too rigid for autoconf...
                CFLAGS="$CFLAGS -Wall -w2 -Wcheck"
@@ -704,7 +706,8 @@ AS_VAR_IF([enable_strict], [yes], [
                # constants like short s = 1234, which is too much
                AS_CASE([$icc_ver],
                        [11.*], [X_CFLAGS="$X_CFLAGS,2259"],
-                       [15.*], [X_CFLAGS="$X_CFLAGS,2259"])
+                       [15.*], [X_CFLAGS="$X_CFLAGS,2259"],
+                       [17.*], [X_CFLAGS="$X_CFLAGS,2259"])
                AS_CASE([$icc_ver],
                        [8.[[1-9]]*], [X_CFLAGS="$X_CFLAGS,1572"],
                        [9.[[1-9]]*], [X_CFLAGS="$X_CFLAGS,1572,1599"],
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+monetdb (11.25.9) unstable; urgency=low
+
+  * Rebuilt.
+  * BZ#6217: Segfault in rel_optimizer (sqlsmith)
+  * BZ#6218: grouped quantiles with all null group causes following groups
+    to return null
+  * BZ#6224: mal_parser: cannot refer to types containing an underscore
+
+ -- Panagiotis Koutsourakis <kutsu...@monetdbsolutions.com>  Mon, 27 Feb 2017 
11:15:08 +0100
+
 monetdb (11.25.7) unstable; urgency=low
 
   * Rebuilt.
diff --git a/gdk/ChangeLog.Dec2016 b/gdk/ChangeLog.Dec2016
--- a/gdk/ChangeLog.Dec2016
+++ b/gdk/ChangeLog.Dec2016
@@ -1,3 +1,12 @@
 # ChangeLog file for MonetDB
 # This file is updated with Maddlog
 
+* Tue Feb 28 2017 Sjoerd Mullender <sjo...@acm.org>
+- Fixed a bug when appending string bats that are fully duplicate
+  eliminated.  It could happend that the to-be-appended bat had an empty
+  string at an offset and at that same offset in the to-be-appended-to bat
+  there happened to be a (sequence of) NULL(s).  Then this offset would be
+  used, even though it might nog be the right offset for the empty string
+  in the to-be-appended-to bat.  This would result in multiple offsets for
+  the empty string, breaking the promise of being duplicate eliminated.
+
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -856,8 +856,9 @@ typedef struct {
 #define GDKLIBRARY_INSERTED    061032  /* inserted and deleted in BBP.dir */
 #define GDKLIBRARY_HEADED      061033  /* head properties are stored */
 #define GDKLIBRARY_NOKEY       061034  /* nokey values can't be trusted */
-#define GDKLIBRARY_TALIGN      061035  /* talign field in BBP.dir */
-#define GDKLIBRARY             061036
+#define GDKLIBRARY_BADEMPTY    061035  /* possibility of duplicate empty str */
+#define GDKLIBRARY_TALIGN      061036  /* talign field in BBP.dir */
+#define GDKLIBRARY             061037
 
 typedef struct BAT {
        /* static bat properties */
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -1108,7 +1108,7 @@ strHeap(Heap *d, size_t cap)
                d->free = GDK_STRHASHTABLE * sizeof(stridx_t);
                d->dirty = 1;
                memset(d->base, 0, d->free);
-               d->hashash = 1; /* new string heaps get the hash value (and 
length) stored */
+               d->hashash = 0;
 #ifndef NDEBUG
                /* fill should solve initialization problems within valgrind */
                memset(d->base + d->free, 0, d->size - d->free);
@@ -1243,13 +1243,15 @@ strPut(Heap *h, var_t *dst, const char *
                        /* if not, pad more */
                        pad += GDK_VARALIGN;
                }
-       } else if (*bucket) {
+       } else {
                /* large string heap (>=64KB) --
                 * opportunistic/probabilistic double elimination */
-               pos = elimbase + *bucket + extralen;
-               if (GDK_STRCMP(v, h->base + pos) == 0) {
-                       /* already in heap; do not insert! */
-                       return *dst = (var_t) (pos >> GDK_VARSHIFT);
+               if (*bucket) {
+                       pos = elimbase + *bucket + extralen;
+                       if (GDK_STRCMP(v, h->base + pos) == 0) {
+                               /* already in heap; do not insert! */
+                               return *dst = (var_t) (pos >> GDK_VARSHIFT);
+                       }
                }
 #if SIZEOF_VAR_T >= SIZEOF_VOID_P /* in fact SIZEOF_VAR_T == SIZEOF_VOID_P */
                if (extralen == 0)
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -301,10 +301,13 @@ insert_string_bat(BAT *b, BAT *n, BAT *s
                        }
                        bunfastapp(b, tp);
                }
-       } else if (b->tvheap->free < n->tvheap->free / 2) {
+       } else if (b->tvheap->free < n->tvheap->free / 2 ||
+                  GDK_ELIMDOUBLES(b->tvheap)) {
                /* if b's string heap is much smaller than n's string
                 * heap, don't bother checking whether n's string
-                * values occur in b's string heap */
+                * values occur in b's string heap; also, if b is
+                * (still) fully double eliminated, we must continue
+                * to use the double elimination mechanism */
                r = BUNlast(b);
                if (cand) {
                        oid hseq = n->hseqbase;
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -629,6 +629,287 @@ fixwkbheap(void)
 }
 #endif
 
+#ifdef GDKLIBRARY_BADEMPTY
+/* There was a bug (fixed in changeset 1f5498568a24) which could
+ * result in empty strings not being double-eliminated.  This code
+ * fixes the affected bats.
+ * Note that we only fix BATs whose string heap is still fully double
+ * eliminated. */
+static inline int
+offsearch(const int *restrict offsets, int noffsets, int val)
+{
+       /* binary search on offsets for val, return whether present */
+       int lo = 0, hi = noffsets - 1, mid;
+
+       while (hi > lo) {
+               mid = (lo + hi) / 2;
+               if (offsets[mid] == val)
+                       return 1;
+               if (offsets[mid] < val)
+                       lo = mid + 1;
+               else
+                       hi = mid - 1;
+       }
+       return offsets[lo] == val;
+}
+
+static void
+fixstroffheap(BAT *b, int *restrict offsets)
+{
+       long_str filename;
+       Heap h1;                /* old offset heap */
+       Heap h2;                /* new string heap */
+       Heap h3;                /* new offset heap */
+       Heap *h;                /* string heap */
+       int noffsets = 0;
+       const size_t extralen = b->tvheap->hashash ? EXTRALEN : 0;
+       size_t pos;
+       var_t emptyoff = 0;
+       const char *nme, *bnme;
+       char *srcdir;
+       BUN i;
+       int width;
+       int nofix = 1;
+
+       assert(GDK_ELIMDOUBLES(b->tvheap));
+
+       nme = BBP_physical(b->batCacheid);
+       srcdir = GDKfilepath(NOFARM, BATDIR, nme, NULL);
+       if (srcdir == NULL)
+               GDKfatal("fixstroffheap: GDKmalloc failed\n");
+       *strrchr(srcdir, DIR_SEP) = 0;
+
+       /* load string heap */
+       if (HEAPload(b->tvheap, nme, "theap", 0) != GDK_SUCCEED)
+               GDKfatal("fixstroffheap: loading string (theap) heap "
+                        "for BAT %d failed\n", b->batCacheid);
+       h = b->tvheap;          /* abbreviation */
+       /* collect valid offsets */
+       pos = GDK_STRHASHSIZE;
+       while (pos < h->free) {
+               const char *s;
+               size_t pad;
+
+               pad = GDK_VARALIGN - (pos & (GDK_VARALIGN - 1));
+               if (pad < sizeof(stridx_t))
+                       pad += GDK_VARALIGN;
+               pos += pad + extralen;
+               s = h->base + pos;
+               if (*s == '\0')
+                       emptyoff = (var_t) pos;
+               offsets[noffsets++] = (int) pos; /* < 65536, i.e. fits */
+               pos += GDK_STRLEN(s);
+       }
+       HEAPfree(b->tvheap, 0);
+
+       if ((bnme = strrchr(nme, DIR_SEP)) != NULL)
+               bnme++;
+       else
+               bnme = nme;
+       sprintf(filename, "BACKUP%c%s", DIR_SEP, bnme);
+
+       width = b->twidth;
+       h2.dirty = 0;
+       if (emptyoff == 0) {
+               /* no legitimate empty string in the string heap; we
+                * now make a backup of the old string heap and create
+                * a new one to which we add an empty string */
+               h2 = *b->tvheap;
+               if (GDKmove(h2.farmid, srcdir, bnme, "theap", BAKDIR, bnme, 
"theap") != GDK_SUCCEED)
+                       GDKfatal("fixstroffheap: cannot make backup of 
%s.theap\n", nme);
+               h2.filename = GDKfilepath(NOFARM, NULL, nme, "theap");
+               if (h2.filename == NULL)
+                       GDKfatal("fixstroffheap: GDKmalloc failed\n");
+               h2.base = NULL;
+               if (HEAPalloc(&h2, h2.size, 1) != GDK_SUCCEED)
+                       GDKfatal("fixstroffheap: allocating new string heap "
+                                "for BAT %d failed\n", b->batCacheid);
+               h2.cleanhash = b->tvheap->cleanhash;
+               h2.hashash = b->tvheap->hashash;
+               h2.free = b->tvheap->free;
+               /* load old offset heap and copy contents to new heap */
+               h1 = *b->tvheap;
+               h1.filename = NULL;
+               h1.base = NULL;
+               h1.dirty = 0;
+               if (HEAPload(&h1, filename, "theap", 0) != GDK_SUCCEED)
+                       GDKfatal("fixstroffheap: loading old tail heap "
+                                "for BAT %d failed\n", b->batCacheid);
+               memcpy(h2.base, h1.base, h2.free);
+               HEAPfree(&h1, 0);
+               h2.dirty = 1;
+               if ((*BATatoms[TYPE_str].atomPut)(&h2, &emptyoff, "") == 0)
+                       GDKfatal("fixstroffheap: cannot insert empty string "
+                                "in BAT %d failed\n", b->batCacheid);
+               /* if the offset of the new empty string doesn't fit
+                * in the offset heap (too many bits for the current
+                * width), we will also make the new offset heap
+                * wider */
+               if ((width <= 2 ? emptyoff - GDK_VAROFFSET : emptyoff) >= 
(var_t) (1 << (width * 8))) {
+                       width <<= 1;
+                       assert((width <= 2 ? emptyoff - GDK_VAROFFSET : 
emptyoff) < (var_t) (1 << (width * 8)));
+               }
+       }
+
+       /* make backup of offset heap */
+       if (GDKmove(b->theap.farmid, srcdir, bnme, "tail", BAKDIR, bnme, 
"tail") != GDK_SUCCEED)
+               GDKfatal("fixstroffheap: cannot make backup of %s.tail\n", nme);
+       /* load old offset heap */
+       h1 = b->theap;
+       h1.filename = NULL;
+       h1.base = NULL;
+       h1.dirty = 0;
+       if (HEAPload(&h1, filename, "tail", 0) != GDK_SUCCEED)
+               GDKfatal("fixstroffheap: loading old tail heap "
+                        "for BAT %d failed\n", b->batCacheid);
+
+       /* create new offset heap */
+       h3 = b->theap;
+       h3.filename = GDKfilepath(NOFARM, NULL, nme, "tail");
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to