summaryrefslogtreecommitdiff
path: root/sql/sql_test.cc
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2009-04-14 14:05:32 +0200
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2009-04-14 14:05:32 +0200
commitb27261a6f710850636ccac4616e2cbd15bc55442 (patch)
tree8b775a077015f9204e2fcc4d506b502bc21eba09 /sql/sql_test.cc
parentf739349994f1e49f62c93e971f553c4a774d5842 (diff)
downloadmariadb-git-b27261a6f710850636ccac4616e2cbd15bc55442.tar.gz
Bug#44164: TL_WRITE has no description in lock_descriptions[]
The problem was that new lock types were being added without a corresponding description. Since the lock types (enum values) are used as indices to the description array, the descriptions could be shifted depending on the lock type. The solution is to ensure that every lock type has a correspondent description. include/thr_lock.h: Add warning. sql/sql_test.cc: Update lock descriptions.
Diffstat (limited to 'sql/sql_test.cc')
-rw-r--r--sql/sql_test.cc28
1 files changed, 16 insertions, 12 deletions
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index 78932396efe..eeb9a21b6f5 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -33,18 +33,20 @@
static const char *lock_descriptions[] =
{
- "No lock",
- "Low priority read lock",
- "Shared Read lock",
- "High priority read lock",
- "Read lock without concurrent inserts",
- "Write lock that allows other writers",
- "Write lock, but allow reading",
- "Concurrent insert lock",
- "Lock Used by delayed insert",
- "Low priority write lock",
- "High priority write lock",
- "Highest priority write lock"
+ /* TL_UNLOCK */ "No lock",
+ /* TL_READ_DEFAULT */ NULL,
+ /* TL_READ */ "Low priority read lock",
+ /* TL_READ_WITH_SHARED_LOCKS */ "Shared read lock",
+ /* TL_READ_HIGH_PRIORITY */ "High priority read lock",
+ /* TL_READ_NO_INSERT */ "Read lock without concurrent inserts",
+ /* TL_WRITE_ALLOW_WRITE */ "Write lock that allows other writers",
+ /* TL_WRITE_ALLOW_READ */ "Write lock, but allow reading",
+ /* TL_WRITE_CONCURRENT_INSERT */ "Concurrent insert lock",
+ /* TL_WRITE_DELAYED */ "Lock used by delayed insert",
+ /* TL_WRITE_DEFAULT */ NULL,
+ /* TL_WRITE_LOW_PRIORITY */ "Low priority write lock",
+ /* TL_WRITE */ "High priority write lock",
+ /* TL_WRITE_ONLY */ "Highest priority write lock"
};
@@ -75,6 +77,8 @@ void print_cached_tables(void)
uint idx,count,unused;
TABLE *start_link,*lnk;
+ compile_time_assert(TL_WRITE_ONLY+1 == array_elements(lock_descriptions));
+
/* purecov: begin tested */
VOID(pthread_mutex_lock(&LOCK_open));
puts("DB Table Version Thread Open Lock");