Changeset: 664c4a0b0781 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/664c4a0b0781
Modified Files:
        gdk/gdk_bbp.c
        gdk/gdk_tracer.c
        testing/Mtest.py.in
Branch: default
Log Message:

Fix a deadlock.


diffs (90 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -117,7 +117,7 @@ static gdk_return BBPfree(BAT *b);
 static void BBPdestroy(BAT *b);
 static void BBPuncacheit(bat bid, bool unloaddesc);
 static gdk_return BBPprepare(bool subcommit);
-static BAT *getBBPdescriptor(bat i, bool lock);
+static BAT *getBBPdescriptor(bat i, bool lock, bool relock);
 static gdk_return BBPbackup(BAT *b, bool subcommit);
 static gdk_return BBPdir_init(void);
 static void BBPcallbacks(void);
@@ -2856,7 +2856,7 @@ BATdescriptor(bat i)
                        return NULL;
                b = BBP_cache(i);
                if (b == NULL)
-                       b = getBBPdescriptor(i, false);
+                       b = getBBPdescriptor(i, false, true);
                MT_lock_unset(&GDKswapLock(i));
        }
        return b;
@@ -3144,7 +3144,7 @@ BBPreclaim(BAT *b)
  * this.
  */
 static BAT *
-getBBPdescriptor(bat i, bool lock)
+getBBPdescriptor(bat i, bool lock, bool relock)
 {
        bool load = false;
        BAT *b = NULL;
@@ -3160,10 +3160,10 @@ getBBPdescriptor(bat i, bool lock)
        if ((b = BBP_cache(i)) == NULL || BBP_status(i) & BBPWAITING) {
 
                while (BBP_status(i) & BBPWAITING) {    /* wait for bat to be 
loaded by other thread */
-                       if (lock)
+                       if (relock)
                                MT_lock_unset(&GDKswapLock(i));
                        BBPspin(i, __func__, BBPWAITING);
-                       if (lock)
+                       if (relock)
                                MT_lock_set(&GDKswapLock(i));
                }
                if (BBPvalid(i)) {
@@ -3195,7 +3195,7 @@ BBPdescriptor(bat i)
 {
        bool lock = locked_by == 0 || locked_by != MT_getpid();
 
-       return getBBPdescriptor(i, lock);
+       return getBBPdescriptor(i, lock, lock);
 }
 
 /*
diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -523,11 +523,11 @@ GDKtracer_log(const char *file, const ch
        if ((adapter_t) ATOMIC_GET(&cur_adapter) == MBEDDED)
                return;
 
-       if (level <= M_WARNING) {
-               fprintf(stderr, "#%s%s%s: %s: %s%s%s%s\n",
+       if (level <= M_WARNING || (GDKdebug & FORCEMITOMASK)) {
+               fprintf(stderr, "#%s%s%s: %s: %s: %s%s%s\n",
                        add_ts ? ts : "",
                        add_ts ? ": " : "",
-                       MT_thread_getname(), func, level == M_WARNING ? 
GDKWARNING : GDKERROR,
+                       MT_thread_getname(), func, level_str[level] + 2,
                        msg, syserr ? ": " : "",
                        syserr ? syserr : "");
                if (active_tracer == NULL || active_tracer == stderr)
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -1382,6 +1382,16 @@ def PerformDir(env, testdir, testlist, t
                     if pSrvr.port is None:
                         print('\nFailed to start server.\n')
                         break
+                    dbh = pymonetdb.connect(username='monetdb',
+                                            password='monetdb',
+                                            hostname='localhost',
+                                            port=pSrvr.port,
+                                            database=TSTDB,
+                                            autocommit=True)
+                    crs = dbh.cursor()
+                    crs.execute("call logging.setcomplevel('SQL_EXECUTION', 
'INFO')")
+                    crs.close()
+                    dbh.close()
                     os.environ['MAPIPORT'] = env['MAPIPORT'] = pSrvr.port
                     SetExecEnv(env['exe'], pSrvr.port, verbosity > 1)
                 if global_timeout and start_time + global_timeout < 
time.time():
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to