Changeset: 8791ed287ec4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8791ed287ec4
Added Files:
        common/utils/mprompt.h
        common/utils/prompt.c
Removed Files:
        clients/mapiclient/mprompt.h
        clients/mapiclient/prompt.c
Modified Files:
        clients/R/Tests/deps-test.timeout
        clients/mapiclient/Makefile.ag
        clients/python2/monetdb/mapi.py
        clients/python3/monetdb/mapi.py
        common/utils/Makefile.ag
        gdk/gdk_heap.c
        gdk/gdk_private.h
        gdk/gdk_storage.c
        gdk/gdk_utils.c
        monetdb5/optimizer/opt_mergetable.c
        sql/test/BugTracker-2013/Tests/All
Branch: embedded
Log Message:

merge with default


diffs (truncated from 305 to 300 lines):

diff --git a/clients/R/Tests/deps-test.timeout 
b/clients/R/Tests/deps-test.timeout
--- a/clients/R/Tests/deps-test.timeout
+++ b/clients/R/Tests/deps-test.timeout
@@ -1,1 +1,1 @@
-300
+5
diff --git a/clients/mapiclient/Makefile.ag b/clients/mapiclient/Makefile.ag
--- a/clients/mapiclient/Makefile.ag
+++ b/clients/mapiclient/Makefile.ag
@@ -9,21 +9,23 @@ INCLUDES = ../mapilib ../../common/optio
 
 lib_mcutil = {
        NOINST
-       SOURCES = dump.c prompt.c dotmonetdb.c eventparser.c eventparser.h
+       SOURCES = dump.c dotmonetdb.c dotmonetdb.h eventparser.c eventparser.h
 }
 
 bin_mclient = {
        SOURCES = mclient.c ReadlineTools.c ReadlineTools.h
        LIBS = libmcutil ../mapilib/libmapi \
                ../../common/stream/libstream \
+               ../../common/utils/libmutils \
                $(READLINE_LIBS) \
                $(curl_LIBS) $(LTLIBICONV) $(PTHREAD_LIBS) $(MATH_LIBS) 
$(SOCKET_LIBS)
 }
 
 bin_msqldump = {
-       SOURCES = msqldump.c
+       SOURCES = msqldump.c msqldump.h
        LIBS = libmcutil ../mapilib/libmapi \
                ../../common/stream/libstream \
+               ../../common/utils/libmutils \
                $(curl_LIBS)
 }
 
@@ -31,6 +33,7 @@ bin_stethoscope = {
        SOURCES = stethoscope.c
        LIBS = libmcutil ../mapilib/libmapi \
                ../../common/stream/libstream \
+               ../../common/utils/libmutils \
                $(curl_LIBS) $(MALLOC_LIBS) $(PTHREAD_LIBS) $(SOCKET_LIBS)
 }
 
@@ -38,6 +41,7 @@ bin_tachograph = {
        SOURCES = tachograph.c
        LIBS = libmcutil ../mapilib/libmapi \
                ../../common/stream/libstream \
+               ../../common/utils/libmutils \
                $(curl_LIBS) $(MALLOC_LIBS) $(PTHREAD_LIBS) $(SOCKET_LIBS)
 }
 
@@ -45,6 +49,7 @@ bin_tomograph = {
        SOURCES = tomograph.c
        LIBS = libmcutil ../mapilib/libmapi \
                ../../common/stream/libstream \
+               ../../common/utils/libmutils \
                $(curl_LIBS) $(MALLOC_LIBS) $(PTHREAD_LIBS) $(SOCKET_LIBS)
 }
 
@@ -59,6 +64,6 @@ bin_tomograph = {
 
 man_MANS = mclient.1 msqldump.1
 
-EXTRA_DIST = msqldump.h mprompt.h dotmonetdb.h $(man_MANS)
+EXTRA_DIST = $(man_MANS)
 
 EXTRA_DIST_DIR = Tests
diff --git a/clients/python2/monetdb/mapi.py b/clients/python2/monetdb/mapi.py
--- a/clients/python2/monetdb/mapi.py
+++ b/clients/python2/monetdb/mapi.py
@@ -73,7 +73,7 @@ class Connection(object):
             hostname = None
         if not unix_socket and os.path.exists("/tmp/.s.monetdb.%i" % port):
             unix_socket = "/tmp/.s.monetdb.%i" % port
-        elif not hostname:
+        elif not unix_socket and not hostname:
             hostname = 'localhost'
 
         self.hostname = hostname
diff --git a/clients/python3/monetdb/mapi.py b/clients/python3/monetdb/mapi.py
--- a/clients/python3/monetdb/mapi.py
+++ b/clients/python3/monetdb/mapi.py
@@ -74,7 +74,7 @@ class Connection(object):
             hostname = None
         if not unix_socket and os.path.exists("/tmp/.s.monetdb.%i" % port):
             unix_socket = "/tmp/.s.monetdb.%i" % port
-        elif not hostname:
+        elif not unix_socket and not hostname:
             hostname = 'localhost'
 
         self.hostname = hostname
diff --git a/common/utils/Makefile.ag b/common/utils/Makefile.ag
--- a/common/utils/Makefile.ag
+++ b/common/utils/Makefile.ag
@@ -12,7 +12,7 @@ INCLUDES = $(openssl_CFLAGS)
 
 lib_mutils  =  {
        NOINST
-       SOURCES = mutils.h mutils.c
+       SOURCES = mutils.h mutils.c prompt.c mprompt.h
 }
 
 lib_mcrypt = {
diff --git a/clients/mapiclient/mprompt.h b/common/utils/mprompt.h
rename from clients/mapiclient/mprompt.h
rename to common/utils/mprompt.h
diff --git a/clients/mapiclient/prompt.c b/common/utils/prompt.c
rename from clients/mapiclient/prompt.c
rename to common/utils/prompt.c
--- a/clients/mapiclient/prompt.c
+++ b/common/utils/prompt.c
@@ -7,8 +7,6 @@
  */
 
 #include "monetdb_config.h"
-#include <monet_options.h>
-#include "mapi.h"
 #include <unistd.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -39,12 +37,12 @@ prompt_getlogin(void)
         *  The correct procedure for determining the login name is to call
         *  cuserid(3C), or to call getlogin() and if  it fails to call
         *  getpwuid(3C). */
-       return(cuserid(NULL));
+       return cuserid(NULL);
 # else
-       return(getlogin());
+       return getlogin();
 # endif
 #else
-       return(defaultlogin);
+       return defaultlogin;
 #endif
 }
 
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -190,7 +190,7 @@ HEAPextend(Heap *h, size_t size, int may
                if (size == 0)
                        size = GDK_mmap_pagesize;
 
-               p = MT_mremap(path,
+               p = GDKmremap(path,
                              h->storage == STORE_PRIV ?
                                MMAP_COPY | MMAP_READ | MMAP_WRITE :
                                MMAP_READ | MMAP_WRITE,
@@ -201,7 +201,7 @@ HEAPextend(Heap *h, size_t size, int may
                        h->base = p;
                        return GDK_SUCCEED; /* success */
                }
-               failure = "MT_mremap() failed";
+               failure = "GDKmremap() failed";
        } else {
                /* extend a malloced heap, possibly switching over to
                 * file-mapped storage */
@@ -343,7 +343,7 @@ HEAPshrink(Heap *h, size_t size)
                        return GDK_SUCCEED;
                }
                path = GDKfilepath(h->farmid, BATDIR, nme, ext);
-               p = MT_mremap(path,
+               p = GDKmremap(path,
                              h->storage == STORE_PRIV ?
                                MMAP_COPY | MMAP_READ | MMAP_WRITE :
                                MMAP_READ | MMAP_WRITE,
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -119,6 +119,8 @@ void BBPdump(void);         /* never called: fo
        __attribute__((__visibility__("hidden")));
 __hidden gdk_return GDKmove(int farmid, const char *dir1, const char *nme1, 
const char *ext1, const char *dir2, const char *nme2, const char *ext2)
        __attribute__((__visibility__("hidden")));
+__hidden void *GDKmremap(const char *path, int mode, void *old_address, size_t 
old_size, size_t *new_size)
+       __attribute__((__visibility__("hidden")));
 __hidden gdk_return GDKmunmap(void *addr, size_t len)
        __attribute__((__visibility__("hidden")));
 __hidden void *GDKreallocmax(void *pold, size_t size, size_t *maxsize, int 
emergency)
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -645,10 +645,15 @@ DESCclean(BAT *b)
 #define MSYNC_BACKGROUND
 
 #ifndef DISABLE_MSYNC
+struct msync {
+       bat id;
+       Heap *h;
+};
+
 static void
 BATmsyncImplementation(void *arg)
 {
-       Heap *h = arg;
+       Heap *h = ((struct msync *) arg)->h;
        char *adr;
        size_t len;
        size_t offset;
@@ -660,6 +665,8 @@ BATmsyncImplementation(void *arg)
                adr -= MT_pagesize() - offset;
        if (len)
                (void) MT_msync(adr, len);
+       BBPunfix(((struct msync *) arg)->id);
+       GDKfree(arg);
 }
 #endif
 
@@ -670,21 +677,30 @@ BATmsync(BAT *b)
 #ifdef MSYNC_BACKGROUND
        MT_Id tid;
 #endif
+       struct msync *arg;
 
        assert(b->batPersistence == PERSISTENT);
-       if (b->T->heap.storage == STORE_MMAP) {
+       if (b->T->heap.storage == STORE_MMAP &&
+           (arg = GDKmalloc(sizeof(*arg))) != NULL) {
+               arg->id = b->batCacheid;
+               arg->h = &b->T->heap;
+               BBPfix(b->batCacheid);
 #ifdef MSYNC_BACKGROUND
-               MT_create_thread(&tid, BATmsyncImplementation, (void *) 
&b->T->heap, MT_THR_DETACHED);
+               MT_create_thread(&tid, BATmsyncImplementation, arg, 
MT_THR_DETACHED);
 #else
-               BATmsyncImplementation((void*) &b->T->heap);
+               BATmsyncImplementation(arg);
 #endif
        }
 
-       if (b->T->vheap && b->T->vheap->storage == STORE_MMAP) {
+       if (b->T->vheap && b->T->vheap->storage == STORE_MMAP &&
+           (arg = GDKmalloc(sizeof(*arg))) != NULL) {
+               arg->id = b->batCacheid;
+               arg->h = b->T->vheap;
+               BBPfix(b->batCacheid);
 #ifdef MSYNC_BACKGROUND
-               MT_create_thread(&tid, BATmsyncImplementation, (void *) 
b->T->vheap, MT_THR_DETACHED);
+               MT_create_thread(&tid, BATmsyncImplementation, arg, 
MT_THR_DETACHED);
 #else
-               BATmsyncImplementation((void*) b->T->vheap);
+               BATmsyncImplementation(arg);
 #endif
        }
 #else
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -588,7 +588,7 @@ GDKmemdump(void)
  * applied: for all mallocs > 1MB.
  */
 static void
-GDKmemfail(str s, size_t len)
+GDKmemfail(const char *s, size_t len)
 {
        int bak = GDKdebug;
 
@@ -943,6 +943,25 @@ GDKmunmap(void *addr, size_t size)
        return ret == 0 ? GDK_SUCCEED : GDK_FAIL;
 }
 
+#undef GDKmremap
+void *
+GDKmremap(const char *path, int mode, void *old_address, size_t old_size, 
size_t *new_size)
+{
+       void *ret;
+
+       ret = MT_mremap(path, mode, old_address, old_size, new_size);
+       if (ret == NULL) {
+               GDKmemfail("GDKmremap", *new_size);
+               ret = MT_mremap(path, mode, old_address, old_size, new_size);
+               if (ret != NULL)
+                       fprintf(stderr, "#GDKmremap: recovery ok. 
Continuing..\n");
+       }
+       if (ret != NULL) {
+               memdec(old_size, "GDKmremap");
+               meminc(*new_size, "GDKmremap");
+       }
+       return ret;
+}
 
 /*
  * @+ Session Initialization
diff --git a/monetdb5/optimizer/opt_mergetable.c 
b/monetdb5/optimizer/opt_mergetable.c
--- a/monetdb5/optimizer/opt_mergetable.c
+++ b/monetdb5/optimizer/opt_mergetable.c
@@ -1401,7 +1401,6 @@ mat_topn(MalBlkPtr mb, InstrPtr p, matli
                        pushInstruction(mb,q);
                }
 
-               ml->v[piv].pushed = 1;
                ml->v[piv].packed = 1;
                ml->v[piv].type = mat_slc;
        }
diff --git a/sql/test/BugTracker-2013/Tests/All 
b/sql/test/BugTracker-2013/Tests/All
--- a/sql/test/BugTracker-2013/Tests/All
+++ b/sql/test/BugTracker-2013/Tests/All
@@ -5,7 +5,7 @@ HAVE_PHP?php-size-limit-bug
 select-around-zero.Bug-3220
 segfault_in_aggregation.Bug-3225
 subtract-one-year.Bug-3215
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to