Changeset: e3a488c861f0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e3a488c861f0
Modified Files:
MonetDB.spec
gdk/gdk_bat.c
gdk/gdk_bbp.c
gdk/gdk_private.h
gdk/gdk_tracer.c
gdk/gdk_utils.c
Branch: Jun2023
Log Message:
Merge with Sep2022 branch.
diffs (147 lines):
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -432,6 +432,7 @@ install it.
Summary: Integration of MonetDB and Python, allowing use of Python from within
SQL
Group: Applications/Databases
Requires: MonetDB5-server%{?_isa} = %{version}-%{release}
+Requires: python3-numpy
%description python3
MonetDB is a database management system that is developed from a
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -268,40 +268,6 @@ static volatile MT_Id locked_by = 0;
static int BBPunloadCnt = 0;
static MT_Lock GDKunloadLock = MT_LOCK_INITIALIZER(GDKunloadLock);
-/* GDKtmLock protects all accesses and changes to BAKDIR and SUBDIR
- * must use BBPtmlock()/BBPtmunlock() to set/unset the lock */
-static MT_Lock GDKtmLock = MT_LOCK_INITIALIZER(GDKtmLock);
-static char *lockfile;
-static int lockfd;
-
-void
-BBPtmlock(void)
-{
- MT_lock_set(&GDKtmLock);
- if (GDKinmemory(0))
- return;
- /* also use an external lock file to synchronize with external
- * programs */
- if (lockfile == NULL) {
- lockfile = GDKfilepath(0, NULL, ".tm_lock", NULL);
- if (lockfile == NULL)
- return;
- }
- lockfd = MT_lockf(lockfile, F_LOCK);
-}
-
-void
-BBPtmunlock(void)
-{
- if (lockfile && lockfd >= 0) {
- assert(!GDKinmemory(0));
- MT_lockf(lockfile, F_ULOCK);
- close(lockfd);
- lockfd = -1;
- }
- MT_lock_unset(&GDKtmLock);
-}
-
void
BBPlock(void)
{
@@ -1510,7 +1476,7 @@ BBPtrim(bool aggressive)
flag |= BBPHOT;
for (bat bid = 1, nbat = (bat) ATOMIC_GET(&BBPsize); bid < nbat; bid++)
{
/* don't do this during a (sub)commit */
- MT_lock_set(&GDKtmLock);
+ BBPtmlock();
MT_lock_set(&GDKswapLock(bid));
BAT *b = NULL;
bool swap = false;
@@ -1536,7 +1502,7 @@ BBPtrim(bool aggressive)
GDKerror("unload failed for bat %d", bid);
n++;
}
- MT_lock_unset(&GDKtmLock);
+ BBPtmunlock();
}
TRC_DEBUG(BAT_, "unloaded %d bats%s\n", n, aggressive ? " (also hot)" :
"");
}
@@ -4532,3 +4498,40 @@ BBPcallbacks(void)
}
MT_lock_unset(&GDKCallbackListLock);
}
+
+/* GDKtmLock protects all accesses and changes to BAKDIR and SUBDIR.
+ * MUST use BBPtmlock()/BBPtmunlock() to set/unset the lock.
+ *
+ * This is at the end of the file on purpose: we don't want people to
+ * accidentally use GDKtmLock directly. */
+static MT_Lock GDKtmLock = MT_LOCK_INITIALIZER(GDKtmLock);
+static char *lockfile;
+static int lockfd;
+
+void
+BBPtmlock(void)
+{
+ MT_lock_set(&GDKtmLock);
+ if (GDKinmemory(0))
+ return;
+ /* also use an external lock file to synchronize with external
+ * programs */
+ if (lockfile == NULL) {
+ lockfile = GDKfilepath(0, NULL, ".tm_lock", NULL);
+ if (lockfile == NULL)
+ return;
+ }
+ lockfd = MT_lockf(lockfile, F_LOCK);
+}
+
+void
+BBPtmunlock(void)
+{
+ if (lockfile && lockfd >= 0) {
+ assert(!GDKinmemory(0));
+ MT_lockf(lockfile, F_ULOCK);
+ close(lockfd);
+ lockfd = -1;
+ }
+ MT_lock_unset(&GDKtmLock);
+}
diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -291,10 +291,19 @@ find_component(const char *comp)
* API CALLS
*
*/
+static volatile sig_atomic_t interrupted = 0;
+
void
GDKtracer_reinit_basic(int sig)
{
(void) sig;
+ interrupted = 1;
+}
+
+static void
+reinit(void)
+{
+ interrupted = 0;
// GDKtracer needs to reopen the file only in
// case the adapter is BASIC
@@ -508,6 +517,9 @@ GDKtracer_log(const char *file, const ch
static char file_prefix[] = __FILE__;
static size_t prefix_length = (size_t) -1;
+ if (interrupted)
+ reinit();
+
if (prefix_length == (size_t) -1) {
/* first time, calculate prefix of file name */
msg = strstr(file_prefix, "gdk" DIR_SEP_STR "gdk_tracer.c");
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]