]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/testing/debug_lock.patch
ebl Too many external segfault in this way
[bacula/bacula] / bacula / patches / testing / debug_lock.patch
1 Index: src/cats/sql.c
2 ===================================================================
3 --- src/cats/sql.c      (révision 8008)
4 +++ src/cats/sql.c      (copie de travail)
5 @@ -311,33 +311,6 @@
6     return mdb->errmsg;
7  }
8  
9 -static void update_lock_dbg(B_DB *mdb) 
10 -{
11 -   if (mdb->allow_transactions) { /* batch connection */
12 -      return;
13 -   }
14 -   if (_db_lock_recurse_count && !pthread_equal(_db_lock_threadid, pthread_self())) {
15 -      Dmsg2(1, "ERROR: not the same threadif %p != %p\n", _db_lock_threadid, pthread_self());
16 -   }
17 -   _db_lock_recurse_count++;
18 -   _db_lock_time = (utime_t) time(NULL);
19 -   _db_lock_threadid = pthread_self();
20 -}
21 -
22 -static void update_unlock_dbg(B_DB *mdb) 
23 -{
24 -   if (mdb->allow_transactions) { /* batch connection */
25 -      return;
26 -   }
27 -   if (!pthread_equal(_db_lock_threadid, pthread_self())) {
28 -      Dmsg2(1, "ERROR: not the same threadid %p != %p", _db_lock_threadid, pthread_self());
29 -   }
30 -   _db_lock_recurse_count--;
31 -   if (!_db_lock_recurse_count) {
32 -      memset(&_db_lock_threadid, 0, sizeof(_db_lock_threadid));
33 -   }
34 -}
35 -
36  /*
37   * Lock database, this can be called multiple times by the same
38   *   thread without blocking, but must be unlocked the number of
39 @@ -351,7 +324,6 @@
40        e_msg(file, line, M_FATAL, 0, "rwl_writelock failure. stat=%d: ERR=%s\n",
41             errstat, be.bstrerror(errstat));
42     }
43 -   update_lock_dbg(mdb);
44  }
45  
46  /*
47 @@ -362,7 +334,6 @@
48  void _db_unlock(const char *file, int line, B_DB *mdb)
49  {
50     int errstat;
51 -   update_unlock_dbg(mdb);
52     if ((errstat=rwl_writeunlock(&mdb->lock)) != 0) {
53        berrno be;
54        e_msg(file, line, M_FATAL, 0, "rwl_writeunlock failure. stat=%d: ERR=%s\n",
55 Index: src/lib/protos.h
56 ===================================================================
57 --- src/lib/protos.h    (révision 8005)
58 +++ src/lib/protos.h    (copie de travail)
59 @@ -252,13 +252,6 @@
60  void             init_signals             (void terminate(int sig));
61  void             init_stack_dump          (void);
62  
63 -/* Used to debug database lock 
64 - * which job takes the main DB access 
65 - */
66 -extern DLL_IMP_EXP utime_t      _db_lock_time;
67 -extern DLL_IMP_EXP int          _db_lock_recurse_count;
68 -extern DLL_IMP_EXP pthread_t    _db_lock_threadid;
69 -
70  /* scan.c */
71  void             strip_leading_space     (char *str);
72  void             strip_trailing_junk     (char *str);
73 Index: src/lib/signal.c
74 ===================================================================
75 --- src/lib/signal.c    (révision 8005)
76 +++ src/lib/signal.c    (copie de travail)
77 @@ -72,22 +72,6 @@
78     }
79  }
80  
81 -/*
82 - * Global variables to get information about lock/unlock db access
83 - */
84 -utime_t _db_lock_time = 0;
85 -int _db_lock_recurse_count = 0;
86 -pthread_t _db_lock_threadid;
87 -
88 -static void print_lock_dbg(FILE *fp)
89 -{
90 -   char buf[128];
91 -   bstrutime(buf, sizeof(buf), _db_lock_time);
92 -
93 -   fprintf(fp, "lock info: recurse_count=%i threadid=0x%x time=%s\n",
94 -           _db_lock_recurse_count, (int)_db_lock_threadid, buf);
95 -}
96 -
97  /* defined in jcr.c */
98  extern void _print_jcr_dbg(FILE *fp);
99