diff options
author | Marko Mäkelä <marko.makela@oracle.com> | 2011-10-05 12:01:47 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@oracle.com> | 2011-10-05 12:01:47 +0300 |
commit | 16c919527fbedf373d7cbc34415b87cacea18993 (patch) | |
tree | 55818299126265e6871f92a493ab81aa595e6549 | |
parent | 96c2c18e4f6b484aea7cbce5646c1280661f73a9 (diff) | |
download | mariadb-git-16c919527fbedf373d7cbc34415b87cacea18993.tar.gz |
Add InnoDB UNIV_SYNC_DEBUG assertions to rw-lock code.
rw_lock_x_lock_func(): Assert that the thread is not already holding
the lock in a conflicting mode (RW_LOCK_SHARED).
rw_lock_s_lock_func(): Assert that the thread is not already holding
the lock in a conflicting mode (RW_LOCK_EX).
-rw-r--r-- | storage/innobase/include/sync0rw.ic | 1 | ||||
-rw-r--r-- | storage/innobase/sync/sync0rw.c | 3 | ||||
-rw-r--r-- | storage/innodb_plugin/include/sync0rw.ic | 1 | ||||
-rw-r--r-- | storage/innodb_plugin/sync/sync0rw.c | 3 |
4 files changed, 8 insertions, 0 deletions
diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic index eea639f26f4..2a674f00262 100644 --- a/storage/innobase/include/sync0rw.ic +++ b/storage/innobase/include/sync0rw.ic @@ -238,6 +238,7 @@ rw_lock_s_lock_func( #ifdef UNIV_SYNC_DEBUG ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED)); /* see NOTE above */ + ut_ad(!rw_lock_own(lock, RW_LOCK_EX)); #endif /* UNIV_SYNC_DEBUG */ mutex_enter(rw_lock_get_mutex(lock)); diff --git a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c index d82baaace69..05ea8ff0fe9 100644 --- a/storage/innobase/sync/sync0rw.c +++ b/storage/innobase/sync/sync0rw.c @@ -476,6 +476,9 @@ rw_lock_x_lock_func( ulint i; /* spin round count */ ut_ad(rw_lock_validate(lock)); +#ifdef UNIV_SYNC_DEBUG + ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED)); +#endif /* UNIV_SYNC_DEBUG */ lock_loop: /* Acquire the mutex protecting the rw-lock fields */ diff --git a/storage/innodb_plugin/include/sync0rw.ic b/storage/innodb_plugin/include/sync0rw.ic index 485a63a1b18..5eb3d017eca 100644 --- a/storage/innodb_plugin/include/sync0rw.ic +++ b/storage/innodb_plugin/include/sync0rw.ic @@ -406,6 +406,7 @@ rw_lock_s_lock_func( #ifdef UNIV_SYNC_DEBUG ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED)); /* see NOTE above */ + ut_ad(!rw_lock_own(lock, RW_LOCK_EX)); #endif /* UNIV_SYNC_DEBUG */ /* TODO: study performance of UNIV_LIKELY branch prediction hints. */ diff --git a/storage/innodb_plugin/sync/sync0rw.c b/storage/innodb_plugin/sync/sync0rw.c index 0127c12a5e4..bc060319246 100644 --- a/storage/innodb_plugin/sync/sync0rw.c +++ b/storage/innodb_plugin/sync/sync0rw.c @@ -612,6 +612,9 @@ rw_lock_x_lock_func( ibool spinning = FALSE; ut_ad(rw_lock_validate(lock)); +#ifdef UNIV_SYNC_DEBUG + ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED)); +#endif /* UNIV_SYNC_DEBUG */ i = 0; |