Changeset: ed974500fda7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ed974500fda7
Modified Files:
        gdk/gdk.h
        gdk/gdk_bat.c
        gdk/gdk_batop.c
        gdk/gdk_project.c
        gdk/gdk_string.c
        monetdb5/modules/atoms/str.c
        monetdb5/modules/mal/pcre.c
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 1835 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -822,3 +822,4 @@ 1230526af30f40eeea30fb87c47c3e414920561f
 1230526af30f40eeea30fb87c47c3e414920561f Dec2023_release
 95d8feaa1167b5ba87bd99253c3f4e62ebf528a1 Dec2023_3
 dcc8c702e685a4faf21ccf663028d1bc3d1165d1 Dec2023_5
+dcc8c702e685a4faf21ccf663028d1bc3d1165d1 Dec2023_SP1_release
diff --git a/clients/odbc/driver/README b/clients/odbc/driver/README
--- a/clients/odbc/driver/README
+++ b/clients/odbc/driver/README
@@ -19,12 +19,8 @@ ODBC is chosen to be implemented first b
 - it can be implemented as a C library (same programming language as MonetDB)
 - its driver manager is available on all platforms where MonetDB is ported
   (on UNIX/Linux we use unixODBC as the driver manager)
-- there are JDBC-ODBC bridge drivers available (i.e. Sun) which provide
-  a JDBC driver implementation on top of an ODBC driver. This is not
-  optimal for performance and stability but we don't have to build it
-  ourselves to get this functionality now.
-Update 2016: the JDBC-ODBC bridge driver is no longer needed nor supported in 
JRE.
-We provide a 100% pure (type 4) JDBC driver implementation for MonetDB.
+
+Since 2009 we also provide a 100% pure (type 4) JDBC driver implementation for 
MonetDB.
 See: https://www.monetdb.org/downloads/Java/
 
 Tip:
@@ -40,7 +36,7 @@ For compilation you need the ODBC API in
        sqlext.h        /* ODBC extension (level 1 and 2) API functions */
        sqlucode.h      /* Unicode versions of the ODBC API functions */
 We use the ones distributed with unixODBC.
-At CWI these are located in /usr/include/
+On Linux these are located in /usr/include/
 
 
 Files organization (in clients/odbc/driver/*):
@@ -68,8 +64,7 @@ In the implementation section below it i
 For convenience there is also an ODBCUtil.[ch] which contains
  general ODBC specific utility functions.
 
-Of course there is a Makefile. Because we use autoconf and automake
-the source file is Makefile.ag.
+We use CMake, so there is a CMakeLists.txt file.
 
 Lastly there is this README documentation file:
 
@@ -86,10 +81,9 @@ be defined before the ODBC header files 
 In ODBC the API functions can be grouped in several ways:
 a) ODBC 1 or 2 API compliance (Core, extension level 1, extension level 2)
 b) ODBC 3 API compliance (ISO 92, X/Open, ODBC, Deprecated)
-c) handle type (environment, connection, statement, descriptor)
-I chose to use the handle type organization and created new files
-ODBC*[ch] to define the structs and functions for the first three handle
-types. Descriptor handles are currently not supported.
+c) handle type (Environment, Connection, Statement, Descriptor)
+We chose to use the handle type organization and created new files
+ODBC*[ch] to define the structs and functions for the handle types.
 
 In ODBC multiple environments (each application uses its own environment),
  multiple database connections (an application can open multiple database
@@ -193,8 +187,9 @@ The next ODBC API functions always retur
 - SQLPutData()
 - SQLGetCursorName()
 - SQLSetCursorName()
-- SQLSetScrollOptions()
-- SQLSetParam()      It is mapped to SQLBindParameter(..., 
SQL_PARAM_INPUT_OUTPUT, ...).
+- SQLSetScrollOptions()    deprecated in ODBC 3.0 (replaced by SQLSetStmtAttr()
+- SQLSetParam()      It is mapped to SQLBindParameter(..., 
SQL_PARAM_INPUT_OUTPUT, ...)
+                     which will return SQL_ERROR, Output parameters are not 
supported.
 - SQLDrivers()       Note on MS Windows this is implemented by the ODBC Driver 
Manager
 - SQLDataSources()   Note on MS Windows this is implemented by the ODBC Driver 
Manager
 
@@ -228,5 +223,5 @@ Most important are:
 
 TODO 2) No performance analysis or tuning is done yet.
  On the ODBC level not much performance tuning can be done as ODBC is
- a thin wrapper around the Monet SQL frontend API.
+ a thin wrapper around the MonetDB mapi protocol API.
 
diff --git a/gdk/ChangeLog.Dec2023 b/gdk/ChangeLog.Dec2023
--- a/gdk/ChangeLog.Dec2023
+++ b/gdk/ChangeLog.Dec2023
@@ -1,3 +1,7 @@
 # ChangeLog file for GDK
 # This file is updated with Maddlog
 
+* Mon Mar 18 2024 Sjoerd Mullender <sjo...@acm.org>
+- Fixed a couple of deadlock situations, one actually observed, one
+  never observed.
+
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2388,10 +2388,10 @@ gdk_export BAT *BATsample_with_seed(BAT 
 static inline void
 TIMEOUT_ERROR(QryCtx *qc, const char *file, const char *func, int lineno)
 {
-       if (GDKexiting())
+       if (GDKexiting()) {
                GDKtracer_log(file, func, lineno, M_ERROR, GDK, NULL,
                              "%s\n", EXITING_MSG);
-       else {
+       } else if (qc) {
                switch (qc->endtime) {
                case QRY_TIMEOUT:
                        GDKtracer_log(file, func, lineno, M_ERROR, GDK, NULL,
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -208,7 +208,6 @@ dofsum(const void *restrict values, oid 
        volatile flt f;
 
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
        /* we only deal with the two floating point types */
        assert(tp1 == TYPE_flt || tp1 == TYPE_dbl);
@@ -719,7 +718,6 @@ dosum(const void *restrict values, bool 
        unsigned int *restrict seen = NULL; /* bitmask for groups that we've 
seen */
 
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
        switch (tp2) {
        case TYPE_flt:
@@ -1359,7 +1357,6 @@ doprod(const void *restrict values, oid 
        unsigned int *restrict seen; /* bitmask for groups that we've seen */
 
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
        /* allocate bitmap for seen group ids */
        seen = GDKzalloc(((ngrp + 31) / 32) * sizeof(int));
@@ -1818,7 +1815,6 @@ BATgroupavg(BAT **bnp, BAT **cntsp, BAT 
        BATiter bi = {0};
 
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
        TRC_DEBUG_IF(ALGO) t0 = GDKusec();
 
@@ -2008,7 +2004,6 @@ BATgroupavg3(BAT **avgp, BAT **remp, BAT
        oid o;
 
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
        if ((err = BATgroupaggrinit(b, g, e, s, &min, &max, &ngrp, &ci)) != 
NULL) {
                GDKerror("%s\n", err);
@@ -2646,7 +2641,6 @@ BATgroupavg3combine(BAT *avg, BAT *rem, 
        BAT *bn, *rn, *cn;
 
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
        if ((err = BATgroupaggrinit(avg, g, e, NULL, &min, &max, &ngrp, &ci)) 
!= NULL) {
                GDKerror("%s\n", err);
@@ -3003,7 +2997,6 @@ BATcalcavg(BAT *b, BAT *s, dbl *avg, BUN
        const void *restrict src;
 
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
        canditer_init(&ci, b, s);
 
@@ -3090,7 +3083,6 @@ BATgroupcount(BAT *b, BAT *g, BAT *e, BA
        BATiter bi = {0};
 
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
        TRC_DEBUG_IF(ALGO) t0 = GDKusec();
 
@@ -3263,7 +3255,6 @@ do_groupmin(oid *restrict oids, BATiter 
        int (*atomcmp)(const void *, const void *);
 
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
        nils = ngrp;
        TIMEOUT_LOOP_IDX(i, ngrp, qry_ctx)
@@ -3386,7 +3377,6 @@ do_groupmax(oid *restrict oids, BATiter 
        int (*atomcmp)(const void *, const void *);
 
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
        nils = ngrp;
        TIMEOUT_LOOP_IDX(i, ngrp, qry_ctx)
@@ -3984,7 +3974,6 @@ doBATgroupquantile(BAT *b, BAT *g, BAT *
 
        size_t counter = 0;
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
        TRC_DEBUG_IF(ALGO) t0 = GDKusec();
 
@@ -4366,7 +4355,6 @@ calcvariance(dbl *restrict avgp, const v
        dbl delta;
 
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
        switch (tp) {
        case TYPE_bte:
@@ -4493,7 +4481,6 @@ calccovariance(const void *v1, const voi
        dbl mean1 = 0, mean2 = 0, m2 = 0, delta1, delta2;
 
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
 
        switch (tp) {
@@ -4597,7 +4584,6 @@ BATcalccorrelation(BAT *b1, BAT *b2)
        lng t0 = 0;
 
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
        TRC_DEBUG_IF(ALGO) t0 = GDKusec();
 
@@ -4714,7 +4700,6 @@ dogroupstdev(BAT **avgb, BAT *b, BAT *g,
        BATiter bi = {0};
 
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
        TRC_DEBUG_IF(ALGO) t0 = GDKusec();
 
@@ -4952,7 +4937,6 @@ dogroupcovariance(BAT *b1, BAT *b2, BAT 
        BATiter b1i = {0}, b2i = {0};
 
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
 
        TRC_DEBUG_IF(ALGO) t0 = GDKusec();
@@ -5158,7 +5142,6 @@ BATgroupcorrelation(BAT *b1, BAT *b2, BA
        BATiter b1i = {0}, b2i = {0};
 
        QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-       qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
        TRC_DEBUG_IF(ALGO) t0 = GDKusec();
 
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -815,8 +815,7 @@ COLcopy(BAT *b, int tt, bool writable, r
                return NULL;
        }
 
-       MT_lock_set(&b->theaplock);
-       bi = bat_iterator_nolock(b);
+       bi = bat_iterator(b);
 
        /* first try case (1); create a view, possibly with different
         * atom-types */
@@ -824,12 +823,12 @@ COLcopy(BAT *b, int tt, bool writable, r
            role == TRANSIENT &&
            bi.restricted == BAT_READ &&
            ATOMstorage(b->ttype) != TYPE_msk && /* no view on TYPE_msk */
-           (!VIEWtparent(b) ||
-            BBP_desc(VIEWtparent(b))->batRestricted == BAT_READ)) {
-               MT_lock_unset(&b->theaplock);
+           (bi.h == NULL ||
+            bi.h->parentid == b->batCacheid ||
+            BBP_desc(bi.h->parentid)->batRestricted == BAT_READ)) {
                bn = VIEWcreate(b->hseqbase, b);
                if (bn == NULL) {
-                       return NULL;
+                       goto bunins_failed;
                }
                if (tt != bn->ttype) {
                        bn->ttype = tt;
@@ -841,6 +840,7 @@ COLcopy(BAT *b, int tt, bool writable, r
                        }
                        bn->tseqbase = ATOMtype(tt) == TYPE_oid ? bi.tseq : 
oid_nil;
                }
+               bat_iterator_end(&bi);
                return bn;
        } else {
                /* check whether we need case (4); BUN-by-BUN copy (by
@@ -868,8 +868,7 @@ COLcopy(BAT *b, int tt, bool writable, r
 
                bn = COLnew2(b->hseqbase, tt, bi.count, role, bi.width);
                if (bn == NULL) {
-                       MT_lock_unset(&b->theaplock);
-                       return NULL;
+                       goto bunins_failed;
                }
                if (bn->tvheap != NULL && bn->tvheap->base == NULL) {
                        /* this combination can happen since the last
@@ -908,15 +907,16 @@ COLcopy(BAT *b, int tt, bool writable, r
                                bn->batCapacity = 0;
                } else if (BATatoms[tt].atomFix || tt != TYPE_void || 
ATOMextern(tt)) {
                        /* case (4): one-by-one BUN insert (really slow) */
-                       BUN p, q;
+                       QryCtx *qry_ctx = MT_thread_get_qry_ctx();
 
-                       BATloop(b, p, q) {
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to