Changeset: e7c4d83db1a8 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e7c4d83db1a8 Modified Files: clients/mapiclient/mclient.c clients/mapilib/mapi.c sql/benchmarks/arno_flt/Tests/init.stable.out.Windows Branch: default Log Message:
Merge with Aug2011 branch. diffs (truncated from 31265 to 300 lines): diff --git a/clients/ChangeLog.Aug2011 b/clients/ChangeLog.Aug2011 --- a/clients/ChangeLog.Aug2011 +++ b/clients/ChangeLog.Aug2011 @@ -1,3 +1,7 @@ # ChangeLog file for clients # This file is updated with Maddlog +* Tue Sep 27 2011 Fabian Groffen <[email protected]> +- Fixed a bug in mclient where processing queries from files could result + in ghost empty results to be reported in the output + diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -1509,9 +1509,7 @@ format_result(Mapi mid, MapiHdl hdl, cha break; } } - } while (!mnstr_errnr(toConsole) && - (rc = mapi_needmore(hdl)) == MOK && - (rc = mapi_next_result(hdl)) == 1); + } while (!mnstr_errnr(toConsole) && (rc = mapi_next_result(hdl)) == 1); if (mnstr_errnr(toConsole)) { mnstr_clearerr(toConsole); fprintf(stderr, "write error\n"); diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -4175,7 +4175,7 @@ mapi_query_part(MapiHdl hdl, const char mnstr_flush(mid->tracelog); } check_stream(mid, mid->to, "write error on stream", "mapi_query_part", mid->error); - return MOK; + return mid->error; } MapiMsg diff --git a/gdk/gdk_utils.mx b/gdk/gdk_utils.mx --- a/gdk/gdk_utils.mx +++ b/gdk/gdk_utils.mx @@ -1143,29 +1143,33 @@ GDKmemfail(str s, size_t len, size_t mem #define GLIBC_BUG 0 #endif +/* we allocate extra space and return a pointer offset by this amount */ +#define MALLOC_EXTRA_SPACE (2 * SIZEOF_VOID_P) + #ifndef GDK_MEM_MISALIGN -/* allocate 8 bytes extra (so it stays 8-bytes aligned) and put realsize in front */ +/* allocate 8 bytes extra (so it stays 8-bytes aligned) and put + * realsize in front */ #define GDKmalloc_prefixsize(s,size) { \ - s = (ssize_t *) malloc(size + 8 + GLIBC_BUG); \ + s = (ssize_t *) malloc(size + MALLOC_EXTRA_SPACE + GLIBC_BUG); \ if (s != NULL) { \ assert((((size_t) s)&7) == 0); /* no MISALIGN */ \ - s = (ssize_t*) ((char*) s + 8); \ - s[-1] = (ssize_t) (size + 8); \ + s = (ssize_t*) ((char*) s + MALLOC_EXTRA_SPACE); \ + s[-1] = (ssize_t) (size + MALLOC_EXTRA_SPACE); \ } \ } #else /* work around old stupid libc mallocs that give 4-byte aligned pointers */ #define GDKmalloc_prefixsize(s,size) { \ - s = (ssize_t *) malloc(size+8); \ + s = (ssize_t *) malloc(size + MALLOC_EXTRA_SPACE); \ if (((size_t) s) & 4) { /* misaligned */ \ assert(sizeof(size_t) == 4); /* not on 64-bits */ \ s = (ssize_t*) ((char*) s + 4); \ - s[-1] = (ssize_t) (size + 9); /* 1-bit is a marker */ \ + s[-1] = (ssize_t) (size + MALLOC_EXTRA_SPACE + 1); /* 1-bit is a marker */ \ } else if (s != NULL) { \ - s = (ssize_t*) ((char*) s + 8); \ - s[-1] = (ssize_t) (size + 8); \ + s = (ssize_t*) ((char*) s + MALLOC_EXTRA_SPACE); \ + s[-1] = (ssize_t) (size + MALLOC_EXTRA_SPACE); \ } \ } #endif @@ -1222,7 +1226,7 @@ GDKmallocmax(size_t size, size_t *maxsiz } } *maxsize = size; - @:heapinc(size+8,s)@ + @:heapinc(size+MALLOC_EXTRA_SPACE,s)@ return (void *) s; } @@ -1287,14 +1291,14 @@ GDKfree_(void *blk) * when configured with --enable-assert). * Disable at command line using --debug=33554432 */ - DEADBEEFCHK memset(s, 0xDB, size - (8 + (size & 1))); /* 0xDeadBeef */ + DEADBEEFCHK memset(s, 0xDB, size - (MALLOC_EXTRA_SPACE + (size & 1))); /* 0xDeadBeef */ #endif #ifdef GDK_MEM_MISALIGN if (size & 1) free(((char *) s) - 4); else #endif - free(((char *) s) - 8); + free(((char *) s) - MALLOC_EXTRA_SPACE); @:heapdec(size,s)@ } } @@ -1347,13 +1351,13 @@ GDKreallocmax(void *blk, size_t size, si } #ifndef GDK_MEM_MISALIGN else if (size <= GDK_mem_bigsize) { - size_t newsize = size + 8; + size_t newsize = size + MALLOC_EXTRA_SPACE; CHKMEM(newsize, 0); - blk = realloc(((char *) blk) - 8, newsize + GLIBC_BUG); + blk = realloc(((char *) blk) - MALLOC_EXTRA_SPACE, newsize + GLIBC_BUG); if (blk == NULL) { GDKmemfail("GDKrealloc", newsize, BBPTRIM_ALL, 0); - blk = realloc(((char *) oldblk) - 8, newsize); + blk = realloc(((char *) oldblk) - MALLOC_EXTRA_SPACE, newsize); if (blk == NULL) { if (emergency == 0) { GDKerror("GDKreallocmax: failed for " SZFMT " bytes", newsize); @@ -1366,9 +1370,9 @@ GDKreallocmax(void *blk, size_t size, si } } if (blk != NULL) { - /* place 8 bytes before it */ + /* place MALLOC_EXTRA_SPACE bytes before it */ assert((((size_t) blk) & 4) == 0); - blk = ((char *) blk) + 8; + blk = ((char *) blk) + MALLOC_EXTRA_SPACE; ((ssize_t *) blk)[-1] = (ssize_t) newsize; /* adapt statistics */ @@ -1385,7 +1389,7 @@ GDKreallocmax(void *blk, size_t size, si oldsize = MIN((ssize_t) size, oldsize - 5); else #endif - oldsize = MIN((ssize_t) size, oldsize - 8); + oldsize = MIN((ssize_t) size, oldsize - MALLOC_EXTRA_SPACE); blk = GDKmallocmax(size, maxsize, emergency); if (blk) { memcpy(blk, oldblk, oldsize); diff --git a/sql/benchmarks/arno_flt/Tests/init.stable.out.Windows b/sql/benchmarks/arno_flt/Tests/init.stable.out.Windows deleted file mode 100644 --- a/sql/benchmarks/arno_flt/Tests/init.stable.out.Windows +++ /dev/null @@ -1,31100 +0,0 @@ -stdout of test 'init` in directory 'benchmarks/arno_flt` itself: - - -# 11:21:11 > -# 11:21:11 > Mtimeout -timeout 2460 Mserver "--config=/net/pictor.ins.cwi.nl/export/scratch1/fabian/monet-current/program/etc/MonetDB.conf" --debug=10 --set "monet_mod_path=/net/pictor.ins.cwi.nl/export/scratch1/fabian/monet-current/program/lib/MonetDB" --set "gdk_dbfarm=/net/pictor.ins.cwi.nl/export/scratch1/fabian/monet-current/program/var/MonetDB/dbfarm" --set "sql_logdir=/net/pictor.ins.cwi.nl/export/scratch1/fabian/monet-current/program/var/MonetDB/log" --set mapi_port=45787 --set sql_port=52454 --set monet_prompt= --trace "--dbname=mTests_src_benchmarks_arno_flt" "/net/pictor.ins.cwi.nl/export/scratch1/fabian/monet-current/sql/build/src/backends/monet4/sql_server.mil" init.prologue ; echo ; echo Over.. -# 11:21:11 > - -# Monet Database Server V4.5.0 -# Copyright (c) 1993-2004, CWI. All rights reserved. -# Compiled for i686-redhat-linux-gnu/32bit; dynamically linked. -# Visit http://monetdb.cwi.nl/ for further information. - -# MonetDB server v5.19.0, based on kernel v1.37.0 -# Serving database 'mTests_src_benchmarks_arno_flt', using 4 threads -# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically linked -# Found 7.751 GiB available main-memory. -# Copyright (c) 1993-July 2008 CWI. -# Copyright (c) August 2008-2011 MonetDB B.V., all rights reserved -# Visit http://monetdb.cwi.nl/ for further information -# Listening for connection requests on mapi:monetdb://eir.ins.cwi.nl:31295/ -# MonetDB/SQL module v2.37.0 loaded -function user.main():void; - INT_MAX := 2147483647; - dbgmsk := mdb.getDebug(); - unset := calc.+(8,8388608); - keep := calc.xor(INT_MAX,unset); - set := calc.and(dbgmsk,keep); - mdb.setDebug(set); -end main; - -Ready. - -Over.. - -# 11:21:12 > -# 11:21:12 > Mtimeout -timeout 2220 ./init.SQL init -# 11:21:12 > - - -# 11:21:12 > -# 11:21:12 > Mtimeout -timeout 180 MapiClient --language=sql -u monetdb -P monetdb --host=pictor --port=52454 -# 11:21:12 > - -# 6 # querytype -# 6 # querytype -# 6 # querytype -# 7 # querytype - -# 11:21:12 > -# 11:21:12 > Mtimeout -timeout 180 MapiClient --language=sql -u monetdb -P monetdb --host=pictor --port=52454 -# 11:21:12 > - -# 3 # querytype -# model, model, model, model # table_name -# model_id, is_mutagen, lumo, logp # name -# int, char, double, double # type -# 11, 0, 22, 22 # length -# 0, , , # tuplecount -# 1, , , # id -# 3 # querytype -# atom, atom, atom, atom, atom # table_name -# atom_id, model_id, element, type, charge # name -# varchar, int, char, char, double # type -# 0, 11, 0, 0, 22 # length -# 0, , , , # tuplecount -# 2, , , , # id -# 3 # querytype -# bond, bond, bond, bond, bond # table_name -# bond_id, model_id, atom1, atom2, type # name -# int, int, varchar, varchar, char # type -# 11, 11, 0, 0, 0 # length -# 0, , , , # tuplecount -# 3, , , , # id - -# 11:21:12 > -# 11:21:12 > Mtimeout -timeout 180 MapiClient --language=sql -u monetdb -P monetdb --host=pictor --port=52454 -# 11:21:12 > - -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype -[ 1 ] -# 4 # querytype _______________________________________________ Checkin-list mailing list [email protected] http://mail.monetdb.org/mailman/listinfo/checkin-list
