From 0c98497f9cdf0f0b426e716aa1d1b749834b8578 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Sun, 9 Nov 2008 21:32:03 +0000 Subject: [PATCH] ebl Remove extra db lock debug git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8023 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/cats/sql.c | 29 ----------------------------- bacula/src/lib/protos.h | 7 ------- bacula/src/lib/signal.c | 16 ---------------- bacula/technotes-2.5 | 2 ++ 4 files changed, 2 insertions(+), 52 deletions(-) diff --git a/bacula/src/cats/sql.c b/bacula/src/cats/sql.c index 99d949b441..052d37af49 100644 --- a/bacula/src/cats/sql.c +++ b/bacula/src/cats/sql.c @@ -311,33 +311,6 @@ char *db_strerror(B_DB *mdb) return mdb->errmsg; } -static void update_lock_dbg(B_DB *mdb) -{ - if (mdb->allow_transactions) { /* batch connection */ - return; - } - if (_db_lock_recurse_count && !pthread_equal(_db_lock_threadid, pthread_self())) { - Dmsg2(1, "ERROR: not the same threadif %p != %p\n", _db_lock_threadid, pthread_self()); - } - _db_lock_recurse_count++; - _db_lock_time = (utime_t) time(NULL); - _db_lock_threadid = pthread_self(); -} - -static void update_unlock_dbg(B_DB *mdb) -{ - if (mdb->allow_transactions) { /* batch connection */ - return; - } - if (!pthread_equal(_db_lock_threadid, pthread_self())) { - Dmsg2(1, "ERROR: not the same threadid %p != %p", _db_lock_threadid, pthread_self()); - } - _db_lock_recurse_count--; - if (!_db_lock_recurse_count) { - memset(&_db_lock_threadid, 0, sizeof(_db_lock_threadid)); - } -} - /* * Lock database, this can be called multiple times by the same * thread without blocking, but must be unlocked the number of @@ -351,7 +324,6 @@ void _db_lock(const char *file, int line, B_DB *mdb) e_msg(file, line, M_FATAL, 0, "rwl_writelock failure. stat=%d: ERR=%s\n", errstat, be.bstrerror(errstat)); } - update_lock_dbg(mdb); } /* @@ -362,7 +334,6 @@ void _db_lock(const char *file, int line, B_DB *mdb) void _db_unlock(const char *file, int line, B_DB *mdb) { int errstat; - update_unlock_dbg(mdb); if ((errstat=rwl_writeunlock(&mdb->lock)) != 0) { berrno be; e_msg(file, line, M_FATAL, 0, "rwl_writeunlock failure. stat=%d: ERR=%s\n", diff --git a/bacula/src/lib/protos.h b/bacula/src/lib/protos.h index 6a424cc514..a9280769dc 100644 --- a/bacula/src/lib/protos.h +++ b/bacula/src/lib/protos.h @@ -252,13 +252,6 @@ int generate_daemon_event(JCR *jcr, const char *event); void init_signals (void terminate(int sig)); void init_stack_dump (void); -/* Used to debug database lock - * which job takes the main DB access - */ -extern DLL_IMP_EXP utime_t _db_lock_time; -extern DLL_IMP_EXP int _db_lock_recurse_count; -extern DLL_IMP_EXP pthread_t _db_lock_threadid; - /* scan.c */ void strip_leading_space (char *str); void strip_trailing_junk (char *str); diff --git a/bacula/src/lib/signal.c b/bacula/src/lib/signal.c index c4d4c913ea..aa97bb4f2d 100644 --- a/bacula/src/lib/signal.c +++ b/bacula/src/lib/signal.c @@ -72,22 +72,6 @@ const char *get_signal_name(int sig) } } -/* - * Global variables to get information about lock/unlock db access - */ -utime_t _db_lock_time = 0; -int _db_lock_recurse_count = 0; -pthread_t _db_lock_threadid; - -static void print_lock_dbg(FILE *fp) -{ - char buf[128]; - bstrutime(buf, sizeof(buf), _db_lock_time); - - fprintf(fp, "lock info: recurse_count=%i threadid=0x%x time=%s\n", - _db_lock_recurse_count, (int)_db_lock_threadid, buf); -} - /* defined in jcr.c */ extern void _print_jcr_dbg(FILE *fp); diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index f362148b5c..e996a0c41e 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -10,6 +10,8 @@ filepattern (restore with regex in bsr) mixed priorities General: +09Nov08 +ebl Remove extra debug for db lock. 07Nov08 kes Apply Riccardo's second patch that cleans up the #include file order + a few Win32 particularities to make bat work -- 2.39.5