Changeset: 869e5c9af1cc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=869e5c9af1cc
Modified Files:
        MonetDB.spec
        clients/Tests/exports.stable.out
        clients/mapilib/Makefile.ag
        configure.ag
        debian/fix-deb.sh
        debian/rules
        gdk/gdk.h
        gdk/gdk_imprints.c
        gdk/gdk_orderidx.c
        gdk/gdk_system.c
        gdk/gdk_utils.c
        monetdb5/mal/mal_dataflow.c
        monetdb5/modules/kernel/status.c
        monetdb5/modules/mal/tablet.c
        sql/server/sql_mvc.c
Branch: default
Log Message:

Merge with Aug2018 branch.


diffs (truncated from 491 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -951,7 +951,6 @@ fi
        --enable-fits=%{?with_fits:yes}%{!?with_fits:no} \
        --enable-gdk=yes \
        --enable-geom=%{?with_geos:yes}%{!?with_geos:no} \
-       --enable-instrument=no \
        --enable-int128=%{?with_int128:yes}%{!?with_int128:no} \
        --enable-lidar=%{?with_lidar:yes}%{!?with_lidar:no} \
        --enable-mapi=yes \
@@ -959,7 +958,6 @@ fi
        --enable-netcdf=no \
        --enable-odbc=yes \
        --enable-optimize=no \
-       --enable-profile=no \
        
--enable-pyintegration=%{?with_pyintegration:yes}%{!?with_pyintegration:no} \
        
--enable-rintegration=%{?with_rintegration:yes}%{!?with_rintegration:no} \
        --enable-shp=no \
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
@@ -269,7 +269,6 @@ ssize_t GDKstrFromStr(unsigned char *res
 str GDKstrdup(const char *s) __attribute__((__warn_unused_result__));
 str GDKstrndup(const char *s, size_t n) 
__attribute__((__warn_unused_result__));
 void GDKsyserror(_In_z_ _Printf_format_string_ const char *format, ...) 
__attribute__((__format__(__printf__, 1, 2)));
-ThreadRec GDKthreads[THREADS];
 size_t GDKuniqueid(size_t offset);
 gdk_return GDKupgradevarheap(BAT *b, var_t v, int copyall, bool mayshare) 
__attribute__((__warn_unused_result__));
 lng GDKusec(void);
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2351,7 +2351,7 @@ AS_VAR_IF([enable_fits], [no], [], [
        PKG_CHECK_MODULES([cfitsio], [cfitsio],
                [have_fits="yes"; AC_DEFINE([HAVE_FITS], 1, [Define if the fits 
module is to be enabled])],
                [have_fits="no"; why_not_fits="(cfitsio library not found)"
-                AS_VAR_IF([enable_fits], [yes], [AC_MSG_ERROR([cfitsio library 
required for FITS support])]);
+                AS_VAR_IF([enable_fits], [yes], [AC_MSG_ERROR([cfitsio library 
required for FITS support])])
                 enable_fits=no; why_not_fits="(cfitsio library not found)"])])
 AM_CONDITIONAL([HAVE_FITS], [test x"$have_fits" != xno])
 
diff --git a/debian/fix-deb.sh b/debian/fix-deb.sh
--- a/debian/fix-deb.sh
+++ b/debian/fix-deb.sh
@@ -65,8 +65,6 @@ wheezy)
 trusty)
     # the trusty linker produces unresolved references to openSSL functions
     sed -i '/openssl_LIBS/s/WIN32?//' clients/mapilib/Makefile.ag
-    lib=$(grep openssl_LIBS clients/mapilib/Makefile.am)
-    lib="${lib%% *}"
-    sed -i "s/\\\$($lib)/\$(openssl_LIBS)/g" clients/mapilib/Makefile.am 
clients/mapilib/Makefile.in
+    sed -i '/^libmapi_la_LIBADD/s/$/ $(openssl_LIBS)/' 
clients/mapilib/Makefile.am clients/mapilib/Makefile.in
     ;;
 esac
diff --git a/debian/rules b/debian/rules
--- a/debian/rules
+++ b/debian/rules
@@ -22,15 +22,12 @@ override_dh_auto_configure:
        --enable-fits=no \
        --enable-gdk=yes \
        --enable-geom=yes \
-       --enable-gsl=yes \
-       --enable-instrument=no \
        --enable-lidar=yes \
        --enable-mapi=yes \
        --enable-monetdb5=yes \
        --enable-netcdf=no \
        --enable-odbc=yes \
        --enable-optimize=yes \
-       --enable-profile=no \
        --enable-pyintegration=yes \
        --enable-rintegration=yes \
        --enable-shp=no \
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -339,10 +339,24 @@
  * attributes completely; if it is known, use it to find out whether
  * specific attributes that we use are known */
 #ifndef __has_attribute
+#ifndef __GNUC__
 #define __has_attribute(attr)  0
 #ifndef __attribute__
 #define __attribute__(attr)    /* empty */
 #endif
+#else
+/* older GCC does have attributes, but not __has_attribute and not all
+ * attributes that we use are known */
+#define __has_attribute__alloc_size__ 1
+#define __has_attribute__cold__ 1
+#define __has_attribute__format__ 1
+#define __has_attribute__malloc__ 1
+#define __has_attribute__noreturn__ 1
+#define __has_attribute__returns_nonnull__ 0
+#define __has_attribute__visibility__ 1
+#define __has_attribute__warn_unused_result__ 1
+#define __has_attribute(attr)  __has_attribute##attr
+#endif
 #endif
 #if !__has_attribute(__warn_unused_result__)
 #define __warn_unused_result__
@@ -2319,19 +2333,20 @@ VALptr(const ValRecord *v)
  * each thread. This speeds up access to tid and file descriptors.
  */
 #define THREADS        1024
-#define THREADDATA     16
+#define THREADDATA     3
 
 typedef struct threadStruct {
-       int tid;                /* logical ID by MonetDB; val == index into 
this array + 1 (0 is invalid) */
-       MT_Id pid;              /* physical thread id (pointer-sized) from the 
OS thread library */
+       int tid;                /* logical ID by MonetDB; val == index
+                                * into this array + 1 (0 is
+                                * invalid) */
+       MT_Id pid;              /* physical thread id (pointer-sized)
+                                * from the OS thread library */
        str name;
-       ptr data[THREADDATA];
+       void *data[THREADDATA];
        uintptr_t sp;
 } ThreadRec, *Thread;
 
 
-gdk_export ThreadRec GDKthreads[THREADS];
-
 gdk_export int THRgettid(void);
 gdk_export Thread THRget(int tid);
 gdk_export Thread THRnew(const char *name);
diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c
--- a/gdk/gdk_imprints.c
+++ b/gdk/gdk_imprints.c
@@ -504,7 +504,8 @@ BATimprints(BAT *b)
                ((size_t *) imprints->imprints.base)[3] = (size_t) BATcount(b);
                imprints->imprints.parentid = b->batCacheid;
                b->timprints = imprints;
-               if (BBP_status(b->batCacheid) & BBPEXISTING) {
+               if (BBP_status(b->batCacheid) & BBPEXISTING &&
+                   !b->theap.dirty) {
                        MT_Id tid;
                        BBPfix(b->batCacheid);
                        if (MT_create_thread(&tid, BATimpsync, b, 
MT_THR_DETACHED) < 0)
diff --git a/gdk/gdk_orderidx.c b/gdk/gdk_orderidx.c
--- a/gdk/gdk_orderidx.c
+++ b/gdk/gdk_orderidx.c
@@ -142,7 +142,8 @@ persistOIDX(BAT *b)
 {
 #ifdef PERSISTENTIDX
        if ((BBP_status(b->batCacheid) & BBPEXISTING) &&
-           b->batInserted == b->batCount) {
+           b->batInserted == b->batCount &&
+           !b->theap.dirty) {
                MT_Id tid;
                BBPfix(b->batCacheid);
                if (MT_create_thread(&tid, BATidxsync, b, MT_THR_DETACHED) < 0)
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -153,12 +153,12 @@ static struct winthread {
 #define DETACHED       2
 #define WAITING                4
 static CRITICAL_SECTION winthread_cs;
-static int winthread_cs_init = 0;
+static bool winthread_cs_init = false;
 
 void
 gdk_system_reset(void)
 {
-       winthread_cs_init = 0;
+       winthread_cs_init = false;
 }
 
 static struct winthread *
@@ -202,10 +202,10 @@ static void
 join_threads(void)
 {
        struct winthread *w;
-       int waited;
+       bool waited;
 
        do {
-               waited = 0;
+               waited = false;
                EnterCriticalSection(&winthread_cs);
                for (w = winthreads; w; w = w->next) {
                        if ((w->flags & (EXITED | DETACHED | WAITING)) == 
(EXITED | DETACHED)) {
@@ -214,7 +214,7 @@ join_threads(void)
                                WaitForSingleObject(w->hdl, INFINITE);
                                CloseHandle(w->hdl);
                                rm_winthread(w);
-                               waited = 1;
+                               waited = true;
                                EnterCriticalSection(&winthread_cs);
                                break;
                        }
@@ -227,10 +227,10 @@ void
 join_detached_threads(void)
 {
        struct winthread *w;
-       int waited;
+       bool waited;
 
        do {
-               waited = 0;
+               waited = false;
                EnterCriticalSection(&winthread_cs);
                for (w = winthreads; w; w = w->next) {
                        if ((w->flags & (DETACHED | WAITING)) == DETACHED) {
@@ -239,7 +239,7 @@ join_detached_threads(void)
                                WaitForSingleObject(w->hdl, INFINITE);
                                CloseHandle(w->hdl);
                                rm_winthread(w);
-                               waited = 1;
+                               waited = true;
                                EnterCriticalSection(&winthread_cs);
                                break;
                        }
@@ -256,12 +256,12 @@ MT_create_thread(MT_Id *t, void (*f) (vo
        if (w == NULL)
                return -1;
 
-       if (winthread_cs_init == 0) {
+       if (!winthread_cs_init) {
                /* we only get here before any threads are created,
                 * and this is the only time that winthread_cs_init is
                 * ever changed */
                InitializeCriticalSection(&winthread_cs);
-               winthread_cs_init = 1;
+               winthread_cs_init = true;
        }
        join_threads();
        w->func = f;
@@ -504,12 +504,12 @@ static void
 join_threads(void)
 {
        struct posthread *p;
-       int waited;
+       bool waited;
        pthread_t tid;
 
        pthread_mutex_lock(&posthread_lock);
        do {
-               waited = 0;
+               waited = false;
                for (p = posthreads; p; p = p->next) {
                        if (p->exited) {
                                tid = p->tid;
@@ -518,7 +518,7 @@ join_threads(void)
                                pthread_mutex_unlock(&posthread_lock);
                                pthread_join(tid, NULL);
                                pthread_mutex_lock(&posthread_lock);
-                               waited = 1;
+                               waited = true;
                                break;
                        }
                }
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -641,6 +641,7 @@ GDKinit(opt *set, int setlen)
 
 int GDKnr_threads = 0;
 static int GDKnrofthreads;
+static ThreadRec GDKthreads[THREADS];
 
 int
 GDKexiting(void)
@@ -1286,7 +1287,6 @@ GDKms(void)
  * descriptors are the same as for the server and should be
  * subsequently reset.
  */
-ThreadRec GDKthreads[THREADS];
 void *THRdata[THREADDATA] = { 0 };
 
 Thread
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -82,6 +82,7 @@ static struct worker {
        enum {IDLE, RUNNING, JOINING, EXITED} flag;
        Client cntxt;                           /* client we do work for (NULL 
-> any) */
        MT_Sema s;
+       MT_Sema startup;
 } workers[THREADS];
 
 static Queue *todo = 0;        /* pending instructions */
@@ -331,6 +332,12 @@ DFLOWworker(void *T)
        InstrPtr p;
 
        thr = THRnew("DFLOWworker");
+       if (thr == NULL) {
+               t->flag = IDLE;
+               MT_sema_up(&t->startup);
+               return;
+       }
+       MT_sema_up(&t->startup);
 
 #ifdef _MSC_VER
        srand((unsigned int) GDKusec());
@@ -508,8 +515,10 @@ DFLOWinitialize(void)
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to