Changeset: 68a22dfd77f7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/68a22dfd77f7
Modified Files:
        sql/backends/monet5/sql_gencode.c
Branch: simplify_scenario
Log Message:

merged with default


diffs (truncated from 13083 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -82,13 +82,13 @@
 Name: %{name}
 Version: %{version}
 Release: %{release}
-Summary: MonetDB - Monet Database Management System
+Summary: Monet Database Management System
 Vendor: MonetDB BV <i...@monetdb.org>
 
 Group: Applications/Databases
 License: MPL-2.0
 URL: https://www.monetdb.org/
-BugURL: https://bugs.monetdb.org/
+BugURL: https://github.com/MonetDB/MonetDB/issues
 Source: 
https://www.monetdb.org/downloads/sources/Sep2022-SP2/%{name}-%{version}.tar.bz2
 
 # The Fedora packaging document says we need systemd-rpm-macros for
@@ -144,12 +144,12 @@ BuildRequires: texlive-obsolete
 %endif
 %endif
 # optional packages:
-# BuildRequires: pkgconfig(cmocka)     # -DWITH_CMOCKA=ON
-# BuildRequires: pkgconfig(gdal)       # -DSHP=ON
-# BuildRequires: pkgconfig(netcdf)     # -DNETCDF=ON
-# BuildRequires: pkgconfig(proj)       # -DWITH_PROJ=ON
-# BuildRequires: pkgconfig(snappy)     # -DWITH_SNAPPY=ON
-# BuildRequires: pkgconfig(valgrind)   # -DWITH_VALGRIND=ON
+# BuildRequires: pkgconfig(cmocka)      # -DWITH_CMOCKA=ON
+# BuildRequires: pkgconfig(gdal)        # -DSHP=ON
+# BuildRequires: pkgconfig(netcdf)      # -DNETCDF=ON
+# BuildRequires: pkgconfig(proj)        # -DWITH_PROJ=ON
+# BuildRequires: pkgconfig(snappy)      # -DWITH_SNAPPY=ON
+# BuildRequires: pkgconfig(valgrind)    # -DWITH_VALGRIND=ON
 
 %if (0%{?fedora} >= 22)
 Recommends: %{name}-SQL-server5%{?_isa} = %{version}-%{release}
@@ -505,17 +505,17 @@ getent group monetdb >/dev/null || group
 if getent passwd monetdb >/dev/null; then
     case $(getent passwd monetdb | cut -d: -f6) in
     %{_localstatedir}/MonetDB) # old value
-       # change home directory, but not using usermod
-       # usermod requires there to not be any running processes owned by the 
user
-       EDITOR='sed -i 
"/^monetdb:/s|:%{_localstatedir}/MonetDB:|:%{_localstatedir}/lib/monetdb:|"'
-       unset VISUAL
-       export EDITOR
-       /sbin/vipw > /dev/null
-       ;;
+        # change home directory, but not using usermod
+        # usermod requires there to not be any running processes owned by the 
user
+        EDITOR='sed -i 
"/^monetdb:/s|:%{_localstatedir}/MonetDB:|:%{_localstatedir}/lib/monetdb:|"'
+        unset VISUAL
+        export EDITOR
+        /sbin/vipw > /dev/null
+        ;;
     esac
 else
     useradd --system --gid monetdb --home-dir %{_localstatedir}/lib/monetdb \
-       --shell /sbin/nologin --comment "MonetDB Server" monetdb
+        --shell /sbin/nologin --comment "MonetDB Server" monetdb
 fi
 exit 0
 
@@ -782,33 +782,33 @@ fi
 
 %build
 %cmake3 \
-       -DCMAKE_INSTALL_RUNSTATEDIR=/run \
-       -DRELEASE_VERSION=ON \
-       -DASSERT=OFF \
-       -DCINTEGRATION=%{?with_cintegration:ON}%{!?with_cintegration:OFF} \
-       -DFITS=%{?with_fits:ON}%{!?with_fits:OFF} \
-       -DGEOM=%{?with_geos:ON}%{!?with_geos:OFF} \
-       -DINT128=%{?with_hugeint:ON}%{!?with_hugeint:OFF} \
-       -DNETCDF=OFF \
-       -DODBC=ON \
-       -DPY3INTEGRATION=%{?with_py3integration:ON}%{!?with_py3integration:OFF} 
\
-       -DRINTEGRATION=%{?with_rintegration:ON}%{!?with_rintegration:OFF} \
-       -DSANITIZER=OFF \
-       -DSHP=OFF \
-       -DSTRICT=OFF \
-       -DTESTING=ON \
-       -DWITH_BZ2=ON \
-       -DWITH_CMOCKA=OFF \
-       -DWITH_CURL=ON \
-       -DWITH_LZ4=ON \
-       -DWITH_LZMA=ON \
-       -DWITH_PCRE=ON \
-       -DWITH_PROJ=OFF \
-       -DWITH_READLINE=ON \
-       -DWITH_SNAPPY=OFF \
-       -DWITH_VALGRIND=OFF \
-       -DWITH_XML2=ON \
-       -DWITH_ZLIB=ON
+        -DCMAKE_INSTALL_RUNSTATEDIR=/run \
+        -DRELEASE_VERSION=ON \
+        -DASSERT=OFF \
+        -DCINTEGRATION=%{?with_cintegration:ON}%{!?with_cintegration:OFF} \
+        -DFITS=%{?with_fits:ON}%{!?with_fits:OFF} \
+        -DGEOM=%{?with_geos:ON}%{!?with_geos:OFF} \
+        -DINT128=%{?with_hugeint:ON}%{!?with_hugeint:OFF} \
+        -DNETCDF=OFF \
+        -DODBC=ON \
+        
-DPY3INTEGRATION=%{?with_py3integration:ON}%{!?with_py3integration:OFF} \
+        -DRINTEGRATION=%{?with_rintegration:ON}%{!?with_rintegration:OFF} \
+        -DSANITIZER=OFF \
+        -DSHP=OFF \
+        -DSTRICT=OFF \
+        -DTESTING=ON \
+        -DWITH_BZ2=ON \
+        -DWITH_CMOCKA=OFF \
+        -DWITH_CURL=ON \
+        -DWITH_LZ4=ON \
+        -DWITH_LZMA=ON \
+        -DWITH_PCRE=ON \
+        -DWITH_PROJ=OFF \
+        -DWITH_READLINE=ON \
+        -DWITH_SNAPPY=OFF \
+        -DWITH_VALGRIND=OFF \
+        -DWITH_XML2=ON \
+        -DWITH_ZLIB=ON
 
 %cmake3_build
 
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1929,6 +1929,8 @@ typedef struct threadStruct {
                                 * into this array + 1 (0 is
                                 * invalid) */
        ATOMIC_TYPE pid;        /* thread id, 0 = unallocated */
+       bat freebats;           /* linked list of free bats */
+       uint32_t nfreebats;     /* number of free bats in .freebats */
        char name[MT_NAME_LEN];
        void *data[THREADDATA];
        uintptr_t sp;
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -113,10 +113,12 @@ struct BBPfarm_t BBPfarms[MAXFARMS];
  * 'next' field in the BBPrec records.
  */
 static MT_Lock BBPnameLock = MT_LOCK_INITIALIZER(BBPnameLock);
-static bat *BBP_hash = NULL;           /* BBP logical name hash buckets */
-static bat BBP_mask = 0;               /* number of buckets = & mask */
+#define BBP_mask       1023            /* number of buckets = & mask */
+static bat BBP_hash[BBP_mask+1];       /* BBP logical name hash buckets */
 static MT_Lock GDKcacheLock = MT_LOCK_INITIALIZER(GDKcacheLock);
 static bat BBP_free;
+#define BBP_FREE_LOWATER       10
+#define BBP_FREE_HIWATER       50
 
 static gdk_return BBPfree(BAT *b);
 static void BBPdestroy(BAT *b);
@@ -155,11 +157,10 @@ BBP_insert(bat i)
 static void
 BBP_delete(bat i)
 {
-       bat *h = BBP_hash;
        const char *s = BBP_logical(i);
        bat idx = (bat) (strHash(s) & BBP_mask);
 
-       for (h += idx; (i = *h) != 0; h = &BBP_next(i)) {
+       for (bat *h = &BBP_hash[idx]; (i = *h) != 0; h = &BBP_next(i)) {
                if (strcmp(BBP_logical(i), s) == 0) {
                        *h = BBP_next(i);
                        break;
@@ -335,32 +336,6 @@ BBPunlock(void)
        BBPtmunlock();
 }
 
-static gdk_return
-BBPinithash(bat size)
-{
-       for (BBP_mask = 1; (BBP_mask << 1) <= BBPlimit; BBP_mask <<= 1)
-               ;
-       BBP_hash = (bat *) GDKzalloc(BBP_mask * sizeof(bat));
-       if (BBP_hash == NULL) {
-               return GDK_FAIL;
-       }
-       BBP_mask--;
-
-       while (--size > 0) {
-               const char *s = BBP_logical(size);
-
-               if (s) {
-                       if (*s != '.' && !BBPtmpcheck(s)) {
-                               BBP_insert(size);
-                       }
-               } else {
-                       BBP_next(size) = BBP_free;
-                       BBP_free = size;
-               }
-       }
-       return GDK_SUCCEED;
-}
-
 int
 BBPselectfarm(role_t role, int type, enum heaptype hptype)
 {
@@ -389,7 +364,7 @@ BBPselectfarm(role_t role, int type, enu
 }
 
 static gdk_return
-BBPextend(bool buildhash, bat newsize)
+BBPextend(bat newsize)
 {
        if (newsize >= N_BBPINIT * BBPINIT) {
                GDKerror("trying to extend BAT pool beyond the "
@@ -413,13 +388,6 @@ BBPextend(bool buildhash, bat newsize)
                BBPlimit += BBPINIT;
        }
 
-       if (buildhash) {
-               GDKfree(BBP_hash);
-               BBP_hash = NULL;
-               BBP_free = 0;
-               if (BBPinithash(newsize) != GDK_SUCCEED)
-                       return GDK_FAIL;
-       }
        return GDK_SUCCEED;
 }
 
@@ -779,6 +747,7 @@ BBPreadEntries(FILE *fp, unsigned bbpver
 
        /* read the BBP.dir and insert the BATs into the BBP */
        return_options = true;
+       MT_lock_set(&BBPnameLock);
        for (;;) {
                BAT b;
                Heap h;
@@ -810,6 +779,7 @@ BBPreadEntries(FILE *fp, unsigned bbpver
                        *nhashbats = nhbats;
 #endif
                        return_options = false;
+                       MT_lock_unset(&BBPnameLock);
                        return GDK_SUCCEED;
                case 1:
                        /* successfully read an entry */
@@ -827,7 +797,7 @@ BBPreadEntries(FILE *fp, unsigned bbpver
 
                if (b.batCacheid >= (bat) ATOMIC_GET(&BBPsize)) {
                        if ((bat) ATOMIC_GET(&BBPsize) + 1 >= BBPlimit &&
-                           BBPextend(false, b.batCacheid + 1) != GDK_SUCCEED) {
+                           BBPextend(b.batCacheid + 1) != GDK_SUCCEED) {
                                GDKfree(options);
                                goto bailout;
                        }
@@ -927,9 +897,12 @@ BBPreadEntries(FILE *fp, unsigned bbpver
                BBP_desc(b.batCacheid) = bn;
                BBP_pid(b.batCacheid) = 0;
                BBP_status_set(b.batCacheid, BBPEXISTING);      /* do we need 
other status bits? */
+               if (BBPnamecheck(BBP_logical(b.batCacheid)) == 0)
+                       BBP_insert(b.batCacheid);
        }
 
   bailout:
+       MT_lock_unset(&BBPnameLock);
        return_options = false;
 #ifdef GDKLIBRARY_HASHASH
        GDKfree(hbats);
@@ -1736,7 +1709,7 @@ BBPinit(void)
        }
 
        /* allocate BBP records */
-       if (BBPextend(false, bbpsize) != GDK_SUCCEED) {
+       if (BBPextend(bbpsize) != GDK_SUCCEED) {
                GDKdebug = dbg;
                return GDK_FAIL;
        }
@@ -1754,18 +1727,6 @@ BBPinit(void)
                fclose(fp);
        }
 
-       MT_lock_set(&BBPnameLock);
-       if (BBPinithash((bat) ATOMIC_GET(&BBPsize)) != GDK_SUCCEED) {
-               TRC_CRITICAL(GDK, "BBPinithash failed");
-               MT_lock_unset(&BBPnameLock);
-#ifdef GDKLIBRARY_HASHASH
-               GDKfree(hashbats);
-#endif
-               GDKdebug = dbg;
-               return GDK_FAIL;
-       }
-       MT_lock_unset(&BBPnameLock);
-
        /* will call BBPrecover if needed */
        if (!GDKinmemory(0)) {
                BBPtmlock();
@@ -1952,9 +1913,8 @@ BBPexit(void)
                        }
                }
        } while (skipped);
-       GDKfree(BBP_hash);
-       BBP_hash = NULL;
        /* these need to be NULL, otherwise no new ones get created */
+       memset(BBP_hash, 0, sizeof(BBP_hash));
        backup_files = 0;
        backup_dir = 0;
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to