Changeset: 56807a497a5b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=56807a497a5b
Added Files:
sql/test/BugTracker-2012/Tests/name_resolution_in_proc.Bug-3074.sql
sql/test/BugTracker-2012/Tests/name_resolution_in_proc.Bug-3074.stable.err
sql/test/BugTracker-2012/Tests/name_resolution_in_proc.Bug-3074.stable.out
sql/test/Tests/systemfunctions.sql
sql/test/Tests/systemfunctions.stable.err
sql/test/Tests/systemfunctions.stable.out
Modified Files:
NT/monetdb_config.h.in
common/stream/stream.c
configure.ag
gdk/ChangeLog.Apr2012
gdk/gdk_align.c
gdk/gdk_atoms.c
gdk/gdk_bat.c
gdk/gdk_bbp.mx
gdk/gdk_heap.c
gdk/gdk_posix.c
gdk/gdk_posix.h
gdk/gdk_private.h
gdk/gdk_search.mx
gdk/gdk_utils.c
monetdb5/modules/kernel/batmtime.mx
sql/backends/monet5/sql_scenario.c
sql/server/rel_optimizer.c
sql/server/rel_psm.c
sql/server/rel_select.c
sql/test/BugTracker-2012/Tests/All
sql/test/BugTracker-2012/Tests/multiple-arithmetic-operations.Bug-3048.stable.err
sql/test/BugTracker-2012/Tests/multiple-arithmetic-operations.Bug-3048.stable.out
sql/test/BugTracker-2012/Tests/parent-table-alias.Bug-3047.stable.err
sql/test/BugTracker-2012/Tests/parent-table-alias.Bug-3047.stable.out
sql/test/BugTracker-2012/Tests/set_operation.Bug-3059.stable.err
sql/test/BugTracker-2012/Tests/set_operation.Bug-3059.stable.out
sql/test/Tests/All
testing/Mtest.py.in
Branch: default
Log Message:
Merge with Apr2012 branch.
diffs (truncated from 1578 to 300 lines):
diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -168,6 +168,9 @@
/* Define to 1 if you have the `getopt_long' function. */
/* #undef HAVE_GETOPT_LONG */
+/* Define to 1 if you have the `GetProcessMemoryInfo' function. */
+#define HAVE_GETPROCESSMEMORYINFO 1
+
/* Define to 1 if you have the `getrlimit' function. */
/* #undef HAVE_GETRLIMIT */
diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -656,7 +656,7 @@ dupFileStream(stream *s)
static ssize_t
stream_gzread(stream *s, void *buf, size_t elmsize, size_t cnt)
{
- gzFile *fp = (gzFile *) s->stream_data.p;
+ gzFile fp = (gzFile) s->stream_data.p;
int size = (int) (elmsize * cnt);
if (!gzeof(fp)) {
@@ -673,7 +673,7 @@ stream_gzwrite(stream *s, const void *bu
int size = (int) (elmsize * cnt);
if (size) {
- size = gzwrite((gzFile *) s->stream_data.p, buf, size);
+ size = gzwrite((gzFile) s->stream_data.p, buf, size);
return (ssize_t) (size / elmsize);
}
return (ssize_t) cnt;
@@ -683,7 +683,7 @@ static void
stream_gzclose(stream *s)
{
if (s->stream_data.p)
- gzclose((gzFile *) s->stream_data.p);
+ gzclose((gzFile) s->stream_data.p);
s->stream_data.p = NULL;
}
@@ -691,7 +691,7 @@ static int
stream_gzflush(stream *s)
{
if (s->access == ST_WRITE)
- gzflush((gzFile *) s->stream_data.p, Z_SYNC_FLUSH);
+ gzflush((gzFile) s->stream_data.p, Z_SYNC_FLUSH);
return 0;
}
@@ -699,7 +699,7 @@ static stream *
open_gzstream(const char *filename, const char *flags)
{
stream *s;
- gzFile *fp;
+ gzFile fp;
if ((s = create_stream(filename)) == NULL)
return NULL;
@@ -722,7 +722,7 @@ open_gzrstream(const char *filename)
return NULL;
s->type = ST_BIN;
if (s->errnr == MNSTR_NO__ERROR &&
- gzread((gzFile *) s->stream_data.p, (void *) &s->byteorder,
sizeof(s->byteorder)) < (int) sizeof(s->byteorder)) {
+ gzread((gzFile) s->stream_data.p, (void *) &s->byteorder,
sizeof(s->byteorder)) < (int) sizeof(s->byteorder)) {
stream_gzclose(s);
s->errnr = MNSTR_OPEN_ERROR;
}
@@ -739,7 +739,7 @@ open_gzwstream_(const char *filename, co
s->access = ST_WRITE;
s->type = ST_BIN;
if (s->errnr == MNSTR_NO__ERROR)
- gzwrite((gzFile *) s->stream_data.p, (void *) &s->byteorder,
sizeof(s->byteorder));
+ gzwrite((gzFile) s->stream_data.p, (void *) &s->byteorder,
sizeof(s->byteorder));
return s;
}
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -365,7 +365,7 @@ dnl we try where UNIX domain sockets als
dnl following simple implementation for now.
case $host in
*-solaris*)
- dnl Solaris needs this to get msg_control and msg_controllen
+ dnl Solaris needs this to get msg_control and msg_controllen
dnl it disables, however, the availability of madvise, which is
dnl in use use by GDK, so we cannot just AC_DEFINE this, but
dnl rather have to enable it where it is necessary
@@ -2359,6 +2359,8 @@ AC_CHECK_HEADERS([crypt.h \
limits.h \
locale.h \
mach-o/dyld.h \
+ mach/mach_init.h \
+ mach/task.h \
malloc.h \
netdb.h \
netinet/in.h \
@@ -2641,6 +2643,8 @@ AC_CHECK_FUNCS([\
strtoll \
strtoull \
sysconf \
+ task_for_pid \
+ task_info \
times \
trunc \
uname \
diff --git a/gdk/ChangeLog.Apr2012 b/gdk/ChangeLog.Apr2012
--- a/gdk/ChangeLog.Apr2012
+++ b/gdk/ChangeLog.Apr2012
@@ -1,3 +1,7 @@
# ChangeLog file for MonetDB
# This file is updated with Maddlog
+* Fri Apr 27 2012 Fabian Groffen <[email protected]>
+- Implemented MT_getrss for Mac OS X systems, this allows the server to
+ know about how much memory is currently in use.
+
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -471,7 +471,7 @@ BATmaterializeh(BAT *b)
HASHdestroy(b);
b->H->heap.filename = NULL;
- if (HEAPalloc(&b->H->heap, cnt, sizeof(oid)) < 0) {
+ if (HEAPalloc(&b->H->heap, cnt, sizeof(oid), b->batPersistence ==
PERSISTENT) < 0) {
b->H->heap = head;
return NULL;
}
@@ -619,7 +619,7 @@ VIEWreset(BAT *b)
if (head.filename == NULL)
goto bailout;
snprintf(head.filename, nmelen + 12, "%s.head", nme);
- if (n->htype && HEAPalloc(&head, cnt, Hsize(n)) < 0)
+ if (n->htype && HEAPalloc(&head, cnt, Hsize(n),
b->batPersistence == PERSISTENT) < 0)
goto bailout;
}
if (n->ttype) {
@@ -627,7 +627,7 @@ VIEWreset(BAT *b)
if (tail.filename == NULL)
goto bailout;
snprintf(tail.filename, nmelen + 12, "%s.tail", nme);
- if (n->ttype && HEAPalloc(&tail, cnt, Tsize(n)) < 0)
+ if (n->ttype && HEAPalloc(&tail, cnt, Tsize(n),
b->batPersistence == PERSISTENT) < 0)
goto bailout;
}
if (n->H->vheap) {
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -1077,7 +1077,7 @@ strHeap(Heap *d, size_t cap)
cap = MAX(cap, BATTINY);
size = GDK_STRHASHTABLE * sizeof(stridx_t) + MIN(GDK_ELIMLIMIT, cap *
GDK_VARALIGN);
- if (HEAPalloc(d, size, 1) >= 0) {
+ if (HEAPalloc(d, size, 1, 0) >= 0) {
d->free = GDK_STRHASHTABLE * sizeof(stridx_t);
memset(d->base, 0, d->free);
d->hashash = 1; /* new string heaps get the hash value (and
length) stored */
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -255,10 +255,10 @@ BATnewstorage(int ht, int tt, BUN cap)
bn->U->capacity = cap;
/* alloc the main heaps */
- if (ht && HEAPalloc(&bn->H->heap, cap, bn->H->width) < 0) {
+ if (ht && HEAPalloc(&bn->H->heap, cap, bn->H->width, 0) < 0) {
return NULL;
}
- if (tt && HEAPalloc(&bn->T->heap, cap, bn->T->width) < 0) {
+ if (tt && HEAPalloc(&bn->T->heap, cap, bn->T->width, 0) < 0) {
if (ht)
HEAPfree(&bn->H->heap);
return NULL;
@@ -3051,7 +3051,7 @@ BATassertHeadProps(BAT *b)
"%s.hash" SZFMT, nme, MT_getpid());
ext = GDKstrdup(hp->filename + nmelen + 1);
if ((hs = HASHnew(hp, b->htype, BUNlast(b),
- HASHmask(b->batCount))) == NULL) {
+ HASHmask(b->batCount), 0)) == NULL) {
GDKfree(ext);
GDKfree(hp->filename);
GDKfree(hp);
@@ -3214,7 +3214,7 @@ BATderiveHeadProps(BAT *b, int expensive
"%s.hash" SZFMT, nme, MT_getpid()) < 0 ||
(ext = GDKstrdup(hp->filename + nmelen + 1)) == NULL ||
(hs = HASHnew(hp, b->htype, BUNlast(b),
- HASHmask(b->batCount))) == NULL) {
+ HASHmask(b->batCount), 0)) == NULL) {
if (hp) {
if (hp->filename)
GDKfree(hp->filename);
diff --git a/gdk/gdk_bbp.mx b/gdk/gdk_bbp.mx
--- a/gdk/gdk_bbp.mx
+++ b/gdk/gdk_bbp.mx
@@ -591,7 +591,7 @@ fixoidheapcolumn(BAT *b, const char *src
w = b->H->width; /* remember old width */
b->H->width = 1;
b->H->shift = 0;
- if (HEAPalloc(&b->H->heap, b->U->capacity, SIZEOF_OID) < 0)
+ if (HEAPalloc(&b->H->heap, b->U->capacity, SIZEOF_OID, 1) < 0)
GDKfatal("fixoidheap: allocating new %s heap "
"for BAT %d failed\n", headtail, bid);
@@ -654,7 +654,7 @@ fixoidheapcolumn(BAT *b, const char *src
b->H->width = SIZEOF_OID;
b->H->shift = 3;
assert(b->H->width == (1 << b->H->shift));
- if (HEAPalloc(&b->H->heap, b->U->capacity, SIZEOF_OID) < 0)
+ if (HEAPalloc(&b->H->heap, b->U->capacity, SIZEOF_OID, 1) < 0)
GDKfatal("fixoidheap: allocating new %s heap "
"for BAT %d failed\n", headtail, bid);
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -249,9 +249,10 @@ HEAPmargin(size_t maxsize)
/* in 64-bits space, use very large margins to accommodate reallocations */
int
-HEAPalloc(Heap *h, size_t nitems, size_t itemsize)
+HEAPalloc(Heap *h, size_t nitems, size_t itemsize, int persistent)
{
char nme[PATHLENGTH], *ext = NULL;
+ size_t minsize = persistent ? REMAP_PAGE_SIZE : GDK_mmap_minsize;
if (h->filename) {
strcpy(nme, h->filename);
@@ -268,7 +269,7 @@ HEAPalloc(Heap *h, size_t nitems, size_t
if (itemsize && nitems > (h->size / itemsize))
return -1;
- if (h->filename == NULL || (h->size < GDK_mmap_minsize)) {
+ if (h->filename == NULL || (h->size < minsize)) {
h->storage = STORE_MEM;
h->base = (char *) GDKmallocmax(h->size, &h->maxsize, 0);
ALLOCDEBUG fprintf(stderr, "#HEAPalloc " SZFMT " " SZFMT " "
PTRFMT "\n", h->size, h->maxsize, PTRFMTCAST h->base);
@@ -531,7 +532,7 @@ GDKupgradevarheap(COLrec *c, var_t v, in
int
HEAPcopy(Heap *dst, Heap *src)
{
- if (HEAPalloc(dst, src->size, 1) == 0) {
+ if (HEAPalloc(dst, src->size, 1, 0) == 0) {
dst->free = src->free;
memcpy(dst->base, src->base, src->free);
dst->hashash = src->hashash;
@@ -938,7 +939,7 @@ HEAP_initialize(Heap *heap, size_t nbyte
size_t total = 100 + nbytes + nprivate + sizeof(HEADER) +
sizeof(CHUNK);
total = roundup_8(total);
- if (HEAPalloc(heap, total, 1) < 0)
+ if (HEAPalloc(heap, total, 1, 0) < 0)
return;
heap->free = heap->size;
}
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -47,6 +47,12 @@ extern char *sbrk(int);
#ifdef HAVE_PROCFS_H
# include <procfs.h>
#endif
+#ifdef HAVE_MACH_TASK_H
+# include <mach/task.h>
+#endif
+#ifdef HAVE_MACH_MACH_INIT_H
+# include <mach/mach_init.h>
+#endif
#if defined(DEBUG_ALLOC) && SIZEOF_VOID_P > 4
#undef DEBUG_ALLOC
@@ -502,6 +508,9 @@ MT_mmap_save_tile(int i, size_t tile, st
int t, ret;
size_t len = MIN((size_t) MT_MMAP_TILE, MT_mmap_tab[i].len - tile);
+ if (len == 0)
+ return 0; /* nothing to do */
+
/* save to disk an 128MB tile, and observe how long this takes */
if (err) {
mnstr_printf(err,
@@ -631,9 +640,14 @@ done:
/* first run, walk backwards
until we hit an unsaved
tile */
- for (off = MT_mmap_tab[i].len; off >=
MT_MMAP_TILE; off -= MT_MMAP_TILE)
+ off = MT_mmap_tab[i].len &
~(MT_MMAP_TILE - 1);
+ for (;;) {
if (MT_mmap_save_tile(i, off,
err))
goto bailout;
+ if (off < MT_MMAP_TILE)
+ break;
+ off -= MT_MMAP_TILE;
+ }
} else {
/* save the next tile */
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list