~percona-core/percona-server/5.1

« back to all changes in this revision

Viewing changes to patches/innodb_show_lock_name.patch

  • Committer: Stewart Smith
  • Date: 2011-11-24 08:14:40 UTC
  • Revision ID: stewart@flamingspork.com-20111124081440-jffloqgkbgytzgl5
remove now unneeded patches as we're part of a happy bzr tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# name       : innodb_show_lock_name.patch
2
 
# introduced : 11 or before
3
 
# maintainer : Yasufumi
4
 
#
5
 
#!!! notice !!!
6
 
# Any small change to this file in the main branch
7
 
# should be done or reviewed by the maintainer!
8
 
--- a/storage/innodb_plugin/handler/ha_innodb.cc
9
 
+++ b/storage/innodb_plugin/handler/ha_innodb.cc
10
 
@@ -9258,8 +9258,8 @@
11
 
                        rw_lock_wait_time += mutex->lspent_time;
12
 
                }
13
 
 #else /* UNIV_DEBUG */
14
 
-               buf1len= (uint) my_snprintf(buf1, sizeof(buf1), "%s:%lu",
15
 
-                                    mutex->cfile_name, (ulong) mutex->cline);
16
 
+               buf1len= (uint) my_snprintf(buf1, sizeof(buf1), "%s",
17
 
+                                    mutex->cmutex_name);
18
 
                buf2len= (uint) my_snprintf(buf2, sizeof(buf2), "os_waits=%lu",
19
 
                                     (ulong) mutex->count_os_wait);
20
 
 
21
 
@@ -9274,9 +9274,8 @@
22
 
 
23
 
        if (block_mutex) {
24
 
                buf1len = (uint) my_snprintf(buf1, sizeof buf1,
25
 
-                                            "combined %s:%lu",
26
 
-                                            block_mutex->cfile_name,
27
 
-                                            (ulong) block_mutex->cline);
28
 
+                                            "combined %s",
29
 
+                                            block_mutex->cmutex_name);
30
 
                buf2len = (uint) my_snprintf(buf2, sizeof buf2,
31
 
                                             "os_waits=%lu",
32
 
                                             (ulong) block_mutex_oswait_count);
33
 
@@ -9305,8 +9304,8 @@
34
 
                        continue;
35
 
                }
36
 
 
37
 
-               buf1len = my_snprintf(buf1, sizeof buf1, "%s:%lu",
38
 
-                                    lock->cfile_name, (ulong) lock->cline);
39
 
+               buf1len = my_snprintf(buf1, sizeof buf1, "%s",
40
 
+                                    lock->lock_name);
41
 
                buf2len = my_snprintf(buf2, sizeof buf2, "os_waits=%lu",
42
 
                                      (ulong) lock->count_os_wait);
43
 
 
44
 
@@ -9320,9 +9319,8 @@
45
 
 
46
 
        if (block_lock) {
47
 
                buf1len = (uint) my_snprintf(buf1, sizeof buf1,
48
 
-                                            "combined %s:%lu",
49
 
-                                            block_lock->cfile_name,
50
 
-                                            (ulong) block_lock->cline);
51
 
+                                            "combined %s",
52
 
+                                            block_lock->lock_name);
53
 
                buf2len = (uint) my_snprintf(buf2, sizeof buf2,
54
 
                                             "os_waits=%lu",
55
 
                                             (ulong) block_lock_oswait_count);
56
 
--- a/storage/innodb_plugin/handler/innodb_patch_info.h
57
 
+++ b/storage/innodb_plugin/handler/innodb_patch_info.h
58
 
@@ -38,5 +38,6 @@
59
 
 {"innodb_recovery_patches","Bugfixes and adjustments about recovery process","","http://www.percona.com/docs/wiki/percona-xtradb"},
60
 
 {"innodb_purge_thread","Enable to use purge devoted thread","","http://www.percona.com/docs/wiki/percona-xtradb"},
61
 
 {"innodb_admin_command_base","XtraDB specific command interface through i_s","","http://www.percona.com/docs/wiki/percona-xtradb"},
62
 
+{"innodb_show_lock_name","Show mutex/lock name instead of crated file/line","","http://www.percona.com/docs/wiki/percona-xtradb"},
63
 
 {NULL, NULL, NULL, NULL}
64
 
 };
65
 
--- a/storage/innodb_plugin/include/sync0rw.h
66
 
+++ b/storage/innodb_plugin/include/sync0rw.h
67
 
@@ -113,14 +113,14 @@
68
 
 #ifdef UNIV_DEBUG
69
 
 # ifdef UNIV_SYNC_DEBUG
70
 
 #  define rw_lock_create(L, level)                                     \
71
 
-       rw_lock_create_func((L), (level), #L, __FILE__, __LINE__)
72
 
+       rw_lock_create_func((L), (level), __FILE__, __LINE__, #L)
73
 
 # else /* UNIV_SYNC_DEBUG */
74
 
 #  define rw_lock_create(L, level)                                     \
75
 
-       rw_lock_create_func((L), #L, __FILE__, __LINE__)
76
 
+       rw_lock_create_func((L), __FILE__, __LINE__, #L)
77
 
 # endif /* UNIV_SYNC_DEBUG */
78
 
 #else /* UNIV_DEBUG */
79
 
 # define rw_lock_create(L, level)                                      \
80
 
-       rw_lock_create_func((L), __FILE__, __LINE__)
81
 
+       rw_lock_create_func((L), #L)
82
 
 #endif /* UNIV_DEBUG */
83
 
 
84
 
 /******************************************************************//**
85
 
@@ -137,10 +137,10 @@
86
 
 # ifdef UNIV_SYNC_DEBUG
87
 
        ulint           level,          /*!< in: level */
88
 
 # endif /* UNIV_SYNC_DEBUG */
89
 
-       const char*     cmutex_name,    /*!< in: mutex name */
90
 
-#endif /* UNIV_DEBUG */
91
 
        const char*     cfile_name,     /*!< in: file name where created */
92
 
-       ulint           cline);         /*!< in: file line where created */
93
 
+       ulint           cline,          /*!< in: file line where created */
94
 
+#endif /* UNIV_DEBUG */
95
 
+       const char*     cmutex_name);   /*!< in: mutex name */
96
 
 /******************************************************************//**
97
 
 Calling this function is obligatory only if the memory buffer containing
98
 
 the rw-lock is freed. Removes an rw-lock object from the global list. The
99
 
@@ -542,7 +542,8 @@
100
 
        ulint   level;          /*!< Level in the global latching order. */
101
 
 #endif /* UNIV_SYNC_DEBUG */
102
 
        ulint count_os_wait;    /*!< Count of os_waits. May not be accurate */
103
 
-       const char*     cfile_name;/*!< File name where lock created */
104
 
+       //const char*   cfile_name;/*!< File name where lock created */
105
 
+       const char*     lock_name;/*!< lock name */
106
 
         /* last s-lock file/line is not guaranteed to be correct */
107
 
        const char*     last_s_file_name;/*!< File name where last s-locked */
108
 
        const char*     last_x_file_name;/*!< File name where last x-locked */
109
 
@@ -553,7 +554,7 @@
110
 
                                are at the start of this struct, thus we can
111
 
                                peek this field without causing much memory
112
 
                                bus traffic */
113
 
-       unsigned        cline:14;       /*!< Line where created */
114
 
+       //unsigned      cline:14;       /*!< Line where created */
115
 
        unsigned        last_s_line:14; /*!< Line number where last time s-locked */
116
 
        unsigned        last_x_line:14; /*!< Line number where last time x-locked */
117
 
 #ifdef UNIV_DEBUG
118
 
--- a/storage/innodb_plugin/include/sync0sync.h
119
 
+++ b/storage/innodb_plugin/include/sync0sync.h
120
 
@@ -73,14 +73,14 @@
121
 
 #ifdef UNIV_DEBUG
122
 
 # ifdef UNIV_SYNC_DEBUG
123
 
 #  define mutex_create(M, level)                                       \
124
 
-       mutex_create_func((M), #M, (level), __FILE__, __LINE__)
125
 
+       mutex_create_func((M), (level), __FILE__, __LINE__, #M)
126
 
 # else
127
 
 #  define mutex_create(M, level)                                       \
128
 
-       mutex_create_func((M), #M, __FILE__, __LINE__)
129
 
+       mutex_create_func((M), __FILE__, __LINE__, #M)
130
 
 # endif
131
 
 #else
132
 
 # define mutex_create(M, level)                                        \
133
 
-       mutex_create_func((M), __FILE__, __LINE__)
134
 
+       mutex_create_func((M), #M)
135
 
 #endif
136
 
 
137
 
 /******************************************************************//**
138
 
@@ -94,13 +94,13 @@
139
 
 /*==============*/
140
 
        mutex_t*        mutex,          /*!< in: pointer to memory */
141
 
 #ifdef UNIV_DEBUG
142
 
-       const char*     cmutex_name,    /*!< in: mutex name */
143
 
 # ifdef UNIV_SYNC_DEBUG
144
 
        ulint           level,          /*!< in: level */
145
 
 # endif /* UNIV_SYNC_DEBUG */
146
 
-#endif /* UNIV_DEBUG */
147
 
        const char*     cfile_name,     /*!< in: file name where created */
148
 
-       ulint           cline);         /*!< in: file line where created */
149
 
+       ulint           cline,          /*!< in: file line where created */
150
 
+#endif /* UNIV_DEBUG */
151
 
+       const char*     cmutex_name);   /*!< in: mutex name */
152
 
 
153
 
 #undef mutex_free                      /* Fix for MacOS X */
154
 
 
155
 
@@ -538,9 +538,9 @@
156
 
        ulint   line;           /*!< Line where the mutex was locked */
157
 
        ulint   level;          /*!< Level in the global latching order */
158
 
 #endif /* UNIV_SYNC_DEBUG */
159
 
+#ifdef UNIV_DEBUG
160
 
        const char*     cfile_name;/*!< File name where mutex created */
161
 
        ulint           cline;  /*!< Line where created */
162
 
-#ifdef UNIV_DEBUG
163
 
        os_thread_id_t thread_id; /*!< The thread id of the thread
164
 
                                which locked the mutex. */
165
 
        ulint           magic_n;        /*!< MUTEX_MAGIC_N */
166
 
@@ -555,9 +555,9 @@
167
 
        ulong           count_os_yield; /*!< count of os_wait */
168
 
        ulonglong       lspent_time;    /*!< mutex os_wait timer msec */
169
 
        ulonglong       lmax_spent_time;/*!< mutex os_wait timer msec */
170
 
-       const char*     cmutex_name;    /*!< mutex name */
171
 
        ulint           mutex_type;     /*!< 0=usual mutex, 1=rw_lock mutex */
172
 
 #endif /* UNIV_DEBUG */
173
 
+       const char*     cmutex_name;    /*!< mutex name */
174
 
 };
175
 
 
176
 
 /** The global array of wait cells for implementation of the databases own
177
 
--- a/storage/innodb_plugin/sync/sync0arr.c
178
 
+++ b/storage/innodb_plugin/sync/sync0arr.c
179
 
@@ -482,12 +482,12 @@
180
 
                mutex = cell->old_wait_mutex;
181
 
 
182
 
                fprintf(file,
183
 
-                       "Mutex at %p created file %s line %lu, lock var %lu\n"
184
 
+                       "Mutex at %p '%s', lock var %lu\n"
185
 
 #ifdef UNIV_SYNC_DEBUG
186
 
                        "Last time reserved in file %s line %lu, "
187
 
 #endif /* UNIV_SYNC_DEBUG */
188
 
                        "waiters flag %lu\n",
189
 
-                       (void*) mutex, mutex->cfile_name, (ulong) mutex->cline,
190
 
+                       (void*) mutex, mutex->cmutex_name,
191
 
                        (ulong) mutex->lock_word,
192
 
 #ifdef UNIV_SYNC_DEBUG
193
 
                        mutex->file_name, (ulong) mutex->line,
194
 
@@ -505,9 +505,8 @@
195
 
                rwlock = cell->old_wait_rw_lock;
196
 
 
197
 
                fprintf(file,
198
 
-                       " RW-latch at %p created in file %s line %lu\n",
199
 
-                       (void*) rwlock, rwlock->cfile_name,
200
 
-                       (ulong) rwlock->cline);
201
 
+                       " RW-latch at %p '%s'\n",
202
 
+                       (void*) rwlock, rwlock->lock_name);
203
 
                writer = rw_lock_get_writer(rwlock);
204
 
                if (writer != RW_LOCK_NOT_LOCKED) {
205
 
                        fprintf(file,
206
 
--- a/storage/innodb_plugin/sync/sync0rw.c
207
 
+++ b/storage/innodb_plugin/sync/sync0rw.c
208
 
@@ -231,10 +231,10 @@
209
 
 # ifdef UNIV_SYNC_DEBUG
210
 
        ulint           level,          /*!< in: level */
211
 
 # endif /* UNIV_SYNC_DEBUG */
212
 
-       const char*     cmutex_name,    /*!< in: mutex name */
213
 
-#endif /* UNIV_DEBUG */
214
 
        const char*     cfile_name,     /*!< in: file name where created */
215
 
-       ulint           cline)          /*!< in: file line where created */
216
 
+       ulint           cline,          /*!< in: file line where created */
217
 
+#endif /* UNIV_DEBUG */
218
 
+       const char*     cmutex_name)    /*!< in: mutex name */
219
 
 {
220
 
        /* If this is the very first time a synchronization object is
221
 
        created, then the following call initializes the sync system. */
222
 
@@ -242,14 +242,15 @@
223
 
 #ifndef INNODB_RW_LOCKS_USE_ATOMICS
224
 
        mutex_create(rw_lock_get_mutex(lock), SYNC_NO_ORDER_CHECK);
225
 
 
226
 
-       lock->mutex.cfile_name = cfile_name;
227
 
-       lock->mutex.cline = cline;
228
 
+       ut_d(lock->mutex.cfile_name = cfile_name);
229
 
+       ut_d(lock->mutex.cline = cline);
230
 
 
231
 
-       ut_d(lock->mutex.cmutex_name = cmutex_name);
232
 
+       lock->mutex.cmutex_name = cmutex_name;
233
 
        ut_d(lock->mutex.mutex_type = 1);
234
 
 #else /* INNODB_RW_LOCKS_USE_ATOMICS */
235
 
 # ifdef UNIV_DEBUG
236
 
-       UT_NOT_USED(cmutex_name);
237
 
+       UT_NOT_USED(cfile_name);
238
 
+       UT_NOT_USED(cline);
239
 
 # endif
240
 
 #endif /* INNODB_RW_LOCKS_USE_ATOMICS */
241
 
 
242
 
@@ -272,8 +273,7 @@
243
 
 
244
 
        ut_d(lock->magic_n = RW_LOCK_MAGIC_N);
245
 
 
246
 
-       lock->cfile_name = cfile_name;
247
 
-       lock->cline = (unsigned int) cline;
248
 
+       lock->lock_name = cmutex_name;
249
 
 
250
 
        lock->count_os_wait = 0;
251
 
        lock->last_s_file_name = "not yet reserved";
252
 
@@ -393,10 +393,10 @@
253
 
        if (srv_print_latch_waits) {
254
 
                fprintf(stderr,
255
 
                        "Thread %lu spin wait rw-s-lock at %p"
256
 
-                       " cfile %s cline %lu rnds %lu\n",
257
 
+                       " '%s' rnds %lu\n",
258
 
                        (ulong) os_thread_pf(os_thread_get_curr_id()),
259
 
                        (void*) lock,
260
 
-                       lock->cfile_name, (ulong) lock->cline, (ulong) i);
261
 
+                       lock->lock_name, (ulong) i);
262
 
        }
263
 
 
264
 
        /* We try once again to obtain the lock */
265
 
@@ -429,10 +429,9 @@
266
 
                if (srv_print_latch_waits) {
267
 
                        fprintf(stderr,
268
 
                                "Thread %lu OS wait rw-s-lock at %p"
269
 
-                               " cfile %s cline %lu\n",
270
 
+                               " '%s'\n",
271
 
                                os_thread_pf(os_thread_get_curr_id()),
272
 
-                               (void*) lock, lock->cfile_name,
273
 
-                               (ulong) lock->cline);
274
 
+                               (void*) lock, lock->lock_name);
275
 
                }
276
 
 
277
 
                /* these stats may not be accurate */
278
 
@@ -651,9 +650,9 @@
279
 
        if (srv_print_latch_waits) {
280
 
                fprintf(stderr,
281
 
                        "Thread %lu spin wait rw-x-lock at %p"
282
 
-                       " cfile %s cline %lu rnds %lu\n",
283
 
+                       " '%s' rnds %lu\n",
284
 
                        os_thread_pf(os_thread_get_curr_id()), (void*) lock,
285
 
-                       lock->cfile_name, (ulong) lock->cline, (ulong) i);
286
 
+                       lock->lock_name, (ulong) i);
287
 
        }
288
 
 
289
 
        sync_array_reserve_cell(sync_primary_wait_array,
290
 
@@ -674,9 +673,9 @@
291
 
        if (srv_print_latch_waits) {
292
 
                fprintf(stderr,
293
 
                        "Thread %lu OS wait for rw-x-lock at %p"
294
 
-                       " cfile %s cline %lu\n",
295
 
+                       " '%s'\n",
296
 
                        os_thread_pf(os_thread_get_curr_id()), (void*) lock,
297
 
-                       lock->cfile_name, (ulong) lock->cline);
298
 
+                       lock->lock_name);
299
 
        }
300
 
 
301
 
        /* these stats may not be accurate */
302
 
--- a/storage/innodb_plugin/sync/sync0sync.c
303
 
+++ b/storage/innodb_plugin/sync/sync0sync.c
304
 
@@ -239,13 +239,13 @@
305
 
 /*==============*/
306
 
        mutex_t*        mutex,          /*!< in: pointer to memory */
307
 
 #ifdef UNIV_DEBUG
308
 
-       const char*     cmutex_name,    /*!< in: mutex name */
309
 
 # ifdef UNIV_SYNC_DEBUG
310
 
        ulint           level,          /*!< in: level */
311
 
 # endif /* UNIV_SYNC_DEBUG */
312
 
-#endif /* UNIV_DEBUG */
313
 
        const char*     cfile_name,     /*!< in: file name where created */
314
 
-       ulint           cline)          /*!< in: file line where created */
315
 
+       ulint           cline,          /*!< in: file line where created */
316
 
+#endif /* UNIV_DEBUG */
317
 
+       const char*     cmutex_name)    /*!< in: mutex name */
318
 
 {
319
 
 #if defined(HAVE_ATOMIC_BUILTINS)
320
 
        mutex_reset_lock_word(mutex);
321
 
@@ -263,11 +263,13 @@
322
 
        mutex->file_name = "not yet reserved";
323
 
        mutex->level = level;
324
 
 #endif /* UNIV_SYNC_DEBUG */
325
 
+#ifdef UNIV_DEBUG
326
 
        mutex->cfile_name = cfile_name;
327
 
        mutex->cline = cline;
328
 
+#endif /* UNIV_DEBUG */
329
 
        mutex->count_os_wait = 0;
330
 
-#ifdef UNIV_DEBUG
331
 
        mutex->cmutex_name=       cmutex_name;
332
 
+#ifdef UNIV_DEBUG
333
 
        mutex->count_using=       0;
334
 
        mutex->mutex_type=        0;
335
 
        mutex->lspent_time=       0;
336
 
@@ -520,9 +522,9 @@
337
 
 #ifdef UNIV_SRV_PRINT_LATCH_WAITS
338
 
        fprintf(stderr,
339
 
                "Thread %lu spin wait mutex at %p"
340
 
-               " cfile %s cline %lu rnds %lu\n",
341
 
+               " '%s' rnds %lu\n",
342
 
                (ulong) os_thread_pf(os_thread_get_curr_id()), (void*) mutex,
343
 
-               mutex->cfile_name, (ulong) mutex->cline, (ulong) i);
344
 
+               mutex->cmutex_name, (ulong) i);
345
 
 #endif
346
 
 
347
 
        mutex_spin_round_count += i;
348
 
@@ -597,9 +599,9 @@
349
 
 
350
 
 #ifdef UNIV_SRV_PRINT_LATCH_WAITS
351
 
        fprintf(stderr,
352
 
-               "Thread %lu OS wait mutex at %p cfile %s cline %lu rnds %lu\n",
353
 
+               "Thread %lu OS wait mutex at %p '%s' rnds %lu\n",
354
 
                (ulong) os_thread_pf(os_thread_get_curr_id()), (void*) mutex,
355
 
-               mutex->cfile_name, (ulong) mutex->cline, (ulong) i);
356
 
+               mutex->cmutex_name, (ulong) i);
357
 
 #endif
358
 
 
359
 
        mutex_os_wait_count++;
360
 
@@ -901,9 +903,8 @@
361
 
 
362
 
                                if (mutex->magic_n == MUTEX_MAGIC_N) {
363
 
                                        fprintf(stderr,
364
 
-                                               "Mutex created at %s %lu\n",
365
 
-                                               mutex->cfile_name,
366
 
-                                               (ulong) mutex->cline);
367
 
+                                               "Mutex '%s'\n",
368
 
+                                               mutex->cmutex_name);
369
 
 
370
 
                                        if (mutex_get_lock_word(mutex) != 0) {
371
 
                                                const char*     file_name;