Changeset: 13b56a283f33 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=13b56a283f33
Added Files:
geom/sql/pg_regression/Tests/removeTmpFiles.SQL.py
Removed Files:
geom/sql/pg_regression/Tests/removeTmpFiles.SQL.py.in
Modified Files:
clients/Tests/exports.stable.out
clients/mapilib/mapi.c
clients/mapilib/mapi.h
clients/odbc/driver/SQLConnect.c
gdk/gdk.h
gdk/gdk_bbp.c
monetdb5/NT/M5server.bat
monetdb5/modules/mal/sysmon.c
sql/backends/monet5/sql_upgrades.c
sql/common/sql_types.c
sql/common/sql_types.h
sql/server/sql_mvc.c
sql/server/sql_mvc.h
sql/storage/bat/bat_logger.c
sql/test/Tests/systemfunctions.stable.out
sql/test/Tests/systemfunctions.stable.out.int128
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128
sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade/Tests/upgrade.stable.out
sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit
sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade/Tests/upgrade.stable.out
sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit
sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade/Tests/upgrade.stable.out.powerpc64.int128
testing/Mfilter.py
testing/Mtest.py.in
Branch: default
Log Message:
Merge with Apr2019 branch.
diffs (truncated from 41891 to 300 lines):
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
@@ -574,7 +574,7 @@ int64_t mapi_rows_affected(MapiHdl hdl);
MapiMsg mapi_seek_row(MapiHdl hdl, int64_t rowne, int whence);
MapiHdl mapi_send(Mapi mid, const char *cmd);
MapiMsg mapi_setAutocommit(Mapi mid, bool autocommit);
-MapiMsg mapi_set_size_header(Mapi mid, int value);
+MapiMsg mapi_set_size_header(Mapi mid, bool value);
void mapi_setfilecallback(Mapi mid, char *(*getfunc)(void *priv, const char
*filename, bool binary, uint64_t offset, size_t *size), char *(*putfunc)(void
*priv, const char *filename, const void *data, size_t size), void *priv);
int mapi_split_line(MapiHdl hdl);
MapiMsg mapi_start_talking(Mapi mid);
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -3568,7 +3568,7 @@ mapi_setAutocommit(Mapi mid, bool autoco
}
MapiMsg
-mapi_set_size_header(Mapi mid, int value)
+mapi_set_size_header(Mapi mid, bool value)
{
if (mid->languageId != LANG_SQL) {
mapi_setError(mid, "size header only supported in SQL",
"mapi_set_size_header", MERROR);
diff --git a/clients/mapilib/mapi.h b/clients/mapilib/mapi.h
--- a/clients/mapilib/mapi.h
+++ b/clients/mapilib/mapi.h
@@ -148,7 +148,7 @@ mapi_export bool mapi_get_trace(Mapi mid
mapi_export bool mapi_get_autocommit(Mapi mid);
mapi_export MapiMsg mapi_log(Mapi mid, const char *nme);
mapi_export MapiMsg mapi_setAutocommit(Mapi mid, bool autocommit);
-mapi_export MapiMsg mapi_set_size_header(Mapi mid, int value);
+mapi_export MapiMsg mapi_set_size_header(Mapi mid, bool value);
mapi_export MapiMsg mapi_release_id(Mapi mid, int id);
mapi_export const char *mapi_result_error(MapiHdl hdl);
mapi_export const char *mapi_result_errorcode(MapiHdl hdl);
diff --git a/clients/odbc/driver/SQLConnect.c b/clients/odbc/driver/SQLConnect.c
--- a/clients/odbc/driver/SQLConnect.c
+++ b/clients/odbc/driver/SQLConnect.c
@@ -261,7 +261,7 @@ MNDBConnect(ODBCDbc *dbc,
mapi_setAutocommit(mid, dbc->sql_attr_autocommit ==
SQL_AUTOCOMMIT_ON);
set_timezone(mid);
get_serverinfo(dbc);
- mapi_set_size_header(mid, 1);
+ mapi_set_size_header(mid, true);
/* set timeout after we're connected */
mapi_timeout(mid, dbc->sql_attr_connection_timeout * 1000);
}
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -767,9 +767,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_HEADED 061033U /* head properties are stored */
-#define GDKLIBRARY_NOKEY 061034U /* nokey values can't be trusted */
-#define GDKLIBRARY_BADEMPTY 061035U /* possibility of duplicate empty str */
#define GDKLIBRARY_TALIGN 061036U /* talign field in BBP.dir */
#define GDKLIBRARY_NIL_NAN 061037U /* flt/dbl NIL not represented by NaN */
#define GDKLIBRARY 061040U
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -394,285 +394,6 @@ static gdk_return BBPrecover(int farmid)
static gdk_return BBPrecover_subdir(void);
static bool BBPdiskscan(const char *, size_t);
-#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 bool
-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;
- bool nofix = true;
-
- 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", false) != 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, false);
-
- if ((bnme = strrchr(nme, DIR_SEP)) != NULL)
- bnme++;
- else
- bnme = nme;
- sprintf(filename, "BACKUP%c%s", DIR_SEP, bnme);
-
- width = b->twidth;
- h2.dirty = false;
- 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);
- stpconcat(h2.filename, nme, ".theap", NULL);
- 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;
- stpconcat(h1.filename, filename, ".theap", NULL);
- h1.base = NULL;
- h1.dirty = false;
- if (HEAPload(&h1, filename, "theap", false) != GDK_SUCCEED)
- GDKfatal("fixstroffheap: loading old tail heap "
- "for BAT %d failed\n", b->batCacheid);
- memcpy(h2.base, h1.base, h2.free);
- HEAPfree(&h1, false);
- h2.dirty = true;
- 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;
- stpconcat(h1.filename, filename, ".tail", NULL);
- h1.base = NULL;
- h1.dirty = false;
- if (HEAPload(&h1, filename, "tail", false) != GDK_SUCCEED)
- GDKfatal("fixstroffheap: loading old tail heap "
- "for BAT %d failed\n", b->batCacheid);
-
- /* create new offset heap */
- h3 = b->theap;
- stpconcat(h3.filename, nme, ".tail", NULL);
- if (HEAPalloc(&h3, b->batCapacity, width) != GDK_SUCCEED)
- GDKfatal("fixstroffheap: allocating new tail heap "
- "for BAT %d failed\n", b->batCacheid);
- h3.dirty = true;
- h3.free = h1.free;
-
- switch (b->twidth) {
- case 1:
- for (i = 0; i < b->batCount; i++) {
- pos = (var_t) ((unsigned char *) h1.base)[i] +
GDK_VAROFFSET;
- if (!offsearch(offsets, noffsets, (int) pos)) {
- pos = emptyoff;
- nofix = false;
- }
- if (width == 1)
- ((unsigned char *) h3.base)[i] = (unsigned
char) (pos - GDK_VAROFFSET);
- else
- ((unsigned short *) h3.base)[i] = (unsigned
short) (pos - GDK_VAROFFSET);
- }
- break;
- case 2:
- for (i = 0; i < b->batCount; i++) {
- pos = (var_t) ((unsigned short *) h1.base)[i] +
GDK_VAROFFSET;
- if (!offsearch(offsets, noffsets, (int) pos)) {
- pos = emptyoff;
- nofix = false;
- }
- if (width == 2)
- ((unsigned short *) h3.base)[i] = (unsigned
short) (pos - GDK_VAROFFSET);
- else
- ((unsigned int *) h3.base)[i] = (unsigned int)
(pos - GDK_VAROFFSET);
- }
- break;
- case 4:
- for (i = 0; i < b->batCount; i++) {
- pos = (var_t) ((unsigned int *) h1.base)[i];
- if (!offsearch(offsets, noffsets, (int) pos)) {
- pos = emptyoff;
- nofix = false;
- }
- ((unsigned int *) h3.base)[i] = (unsigned int) pos;
- }
- break;
-#if SIZEOF_VAR_T == 8
- case 8:
- for (i = 0; i < b->batCount; i++) {
- pos = (var_t) ((ulng *) h1.base)[i];
- if (!offsearch(offsets, noffsets, (int) pos)) {
- pos = emptyoff;
- nofix = false;
- }
- ((ulng *) h3.base)[i] = (ulng) pos;
- }
- break;
-#endif
- default:
- /* cannot happen */
- assert(0);
- }
-
- /* cleanup */
- HEAPfree(&h1, false);
- if (nofix) {
- /* didn't fix anything, move backups back */
- if (h2.dirty) {
- HEAPfree(&h2, true);
- if (GDKmove(b->tvheap->farmid, BAKDIR, bnme, "theap",
srcdir, bnme, "theap") != GDK_SUCCEED)
- GDKfatal("fixstroffheap: cannot restore backup
of %s.theap\n", nme);
- }
- HEAPfree(&h3, true);
- if (GDKmove(b->theap.farmid, BAKDIR, bnme, "tail", srcdir,
bnme, "tail") != GDK_SUCCEED)
- GDKfatal("fixstroffheap: cannot restore backup of
%s.tail\n", nme);
- } else {
- /* offset heap was fixed */
- b->twidth = width;
- b->batDirtydesc = true;
- if (h2.dirty) {
- /* in addition, we added an empty string to
- * the string heap */
- if (HEAPsave(&h2, nme, "theap") != GDK_SUCCEED)
- GDKfatal("fixstroffheap: saving heap failed\n");
- HEAPfree(&h2, false);
- *b->tvheap = h2;
- }
- if (HEAPsave(&h3, nme, "tail") != GDK_SUCCEED)
- GDKfatal("fixstroffheap: saving heap failed\n");
- HEAPfree(&h3, false);
- b->theap = h3;
- }
- GDKfree(srcdir);
-}
-
-static void
-fixstrbats(void)
-{
- bat bid;
- BAT *b;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list