diff options
author | ingo@mysql.com <> | 2005-11-15 21:57:02 +0100 |
---|---|---|
committer | ingo@mysql.com <> | 2005-11-15 21:57:02 +0100 |
commit | 74781d6559a04b346e828bbae3d03ba1530712ae (patch) | |
tree | 119cf106bff33787b0aad32bfaf568b654dd7115 /include/my_pthread.h | |
parent | 15df2c22987ad5a8b2504903a5cd2072d3f8bc72 (diff) | |
download | mariadb-git-74781d6559a04b346e828bbae3d03ba1530712ae.tar.gz |
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Version for 5.0.
It fixes three problems:
1. The cause of the bug was that we did not check the table version for
the HANDLER ... READ commands. We did not notice when a table was
replaced by a new one. This can happen during ALTER TABLE, REPAIR
TABLE, and OPTIMIZE TABLE (there might be more cases). I call the fix
for this problem "the primary bug fix".
2. mysql_ha_flush() was not always called with a locked LOCK_open.
Though the function comment clearly said it must.
I changed the code so that the locking is done when required. I call
the fix for this problem "the secondary fix".
3. In 5.0 (not in 4.1 or 4.0) DROP TABLE had a possible deadlock flaw in
concur with FLUSH TABLES WITH READ LOCK. I call the fix for this
problem "the 5.0 addendum fix".
Diffstat (limited to 'include/my_pthread.h')
-rw-r--r-- | include/my_pthread.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h index ee2c801ff6e..6f60a6df2c1 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -536,9 +536,15 @@ void safe_mutex_end(FILE *file); #define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__) #define pthread_mutex_trylock(A) pthread_mutex_lock(A) #define pthread_mutex_t safe_mutex_t -#define safe_mutex_assert_owner(mp) DBUG_ASSERT((mp)->count > 0 && pthread_equal(pthread_self(),(mp)->thread)) +#define safe_mutex_assert_owner(mp) \ + DBUG_ASSERT((mp)->count > 0 && \ + pthread_equal(pthread_self(), (mp)->thread)) +#define safe_mutex_assert_not_owner(mp) \ + DBUG_ASSERT(! (mp)->count || \ + ! pthread_equal(pthread_self(), (mp)->thread)) #else #define safe_mutex_assert_owner(mp) +#define safe_mutex_assert_not_owner(mp) #endif /* SAFE_MUTEX */ /* READ-WRITE thread locking */ |