3492 Marko Mäkelä 2010-06-01
Document Bug #48197 fix
modified:
storage/innodb_plugin/ChangeLog
3491 Marko Mäkelä 2010-06-01
Bug#48197: Concurrent rw_lock_free may cause assertion failure
rw_lock_t: Remove magic_n unless UNIV_DEBUG is defined.
rw_lock_free(): Invalidate magic_n only after removing from rw_lock_list.
modified:
storage/innodb_plugin/include/sync0rw.h
storage/innodb_plugin/sync/sync0rw.c
3490 Marko Mäkelä 2010-06-01
Minor cleanup.
lock_rec_unlock(): Cache first_lock and rewrite while() loops as for().
btr_cur_optimistic_update(): Use common error handling return.
row_create_prebuilt(): Add Valgrind instrumentation.
modified:
storage/innodb_plugin/btr/btr0cur.c
storage/innodb_plugin/lock/lock0lock.c
storage/innodb_plugin/row/row0mysql.c
=== modified file 'storage/innodb_plugin/ChangeLog'
--- a/storage/innodb_plugin/ChangeLog revid:marko.makela@stripped751-1uq7bbta5n7ts0qr
+++ b/storage/innodb_plugin/ChangeLog revid:marko.makela@stripped9ura8g
@@ -1,5 +1,10 @@
2010-06-01 The InnoDB Team
+ * include/sync0rw.h, sync/sync0rw.c:
+ Fix Bug#48197 Concurrent rw_lock_free may cause assertion failure
+
+2010-06-01 The InnoDB Team
+
* row/row0umod.c:
Fix Bug#53812 assert row/row0umod.c line 660 in txn rollback
after crash recovery
=== modified file 'storage/innodb_plugin/include/sync0rw.h'
--- a/storage/innodb_plugin/include/sync0rw.h revid:marko.makela@strippedbta5n7ts0qr
+++ b/storage/innodb_plugin/include/sync0rw.h revid:marko.makela@strippedura8g
@@ -555,11 +555,12 @@ struct rw_lock_struct {
unsigned cline:14; /*!< Line where created */
unsigned last_s_line:14; /*!< Line number where last time s-locked */
unsigned last_x_line:14; /*!< Line number where last time x-locked */
+#ifdef UNIV_DEBUG
ulint magic_n; /*!< RW_LOCK_MAGIC_N */
-};
-
/** Value of rw_lock_struct::magic_n */
#define RW_LOCK_MAGIC_N 22643
+#endif /* UNIV_DEBUG */
+};
#ifdef UNIV_SYNC_DEBUG
/** The structure for storing debug info of an rw-lock */
=== modified file 'storage/innodb_plugin/sync/sync0rw.c'
--- a/storage/innodb_plugin/sync/sync0rw.c revid:marko.makela@stripped20100601120751-1uq7bbta5n7ts0qr
+++ b/storage/innodb_plugin/sync/sync0rw.c revid:marko.makela@stripped35802-hgplcpr8089ura8g
@@ -267,7 +267,7 @@ rw_lock_create_func(
lock->level = level;
#endif /* UNIV_SYNC_DEBUG */
- lock->magic_n = RW_LOCK_MAGIC_N;
+ ut_d(lock->magic_n = RW_LOCK_MAGIC_N);
lock->cfile_name = cfile_name;
lock->cline = (unsigned int) cline;
@@ -282,10 +282,8 @@ rw_lock_create_func(
mutex_enter(&rw_lock_list_mutex);
- if (UT_LIST_GET_LEN(rw_lock_list) > 0) {
- ut_a(UT_LIST_GET_FIRST(rw_lock_list)->magic_n
- == RW_LOCK_MAGIC_N);
- }
+ ut_ad(UT_LIST_GET_FIRST(rw_lock_list) == NULL
+ || UT_LIST_GET_FIRST(rw_lock_list)->magic_n == RW_LOCK_MAGIC_N);
UT_LIST_ADD_FIRST(list, rw_lock_list, lock);
@@ -305,8 +303,6 @@ rw_lock_free(
ut_ad(rw_lock_validate(lock));
ut_a(lock->lock_word == X_LOCK_DECR);
- lock->magic_n = 0;
-
#ifndef INNODB_RW_LOCKS_USE_ATOMICS
mutex_free(rw_lock_get_mutex(lock));
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
@@ -316,16 +312,16 @@ rw_lock_free(
os_event_free(lock->wait_ex_event);
- if (UT_LIST_GET_PREV(list, lock)) {
- ut_a(UT_LIST_GET_PREV(list, lock)->magic_n == RW_LOCK_MAGIC_N);
- }
- if (UT_LIST_GET_NEXT(list, lock)) {
- ut_a(UT_LIST_GET_NEXT(list, lock)->magic_n == RW_LOCK_MAGIC_N);
- }
+ ut_ad(UT_LIST_GET_PREV(list, lock) == NULL
+ || UT_LIST_GET_PREV(list, lock)->magic_n == RW_LOCK_MAGIC_N);
+ ut_ad(UT_LIST_GET_NEXT(list, lock) == NULL
+ || UT_LIST_GET_NEXT(list, lock)->magic_n == RW_LOCK_MAGIC_N);
UT_LIST_REMOVE(list, rw_lock_list, lock);
mutex_exit(&rw_lock_list_mutex);
+
+ ut_d(lock->magic_n = 0);
}
#ifdef UNIV_DEBUG
@@ -344,7 +340,7 @@ rw_lock_validate(
ulint waiters = rw_lock_get_waiters(lock);
lint lock_word = lock->lock_word;
- ut_a(lock->magic_n == RW_LOCK_MAGIC_N);
+ ut_ad(lock->magic_n == RW_LOCK_MAGIC_N);
ut_a(waiters == 0 || waiters == 1);
ut_a(lock_word > -X_LOCK_DECR ||(-lock_word) % X_LOCK_DECR == 0);
Attachment: [text/bzr-bundle] bzr/marko.makela@oracle.com-20100601135802-hgplcpr8089ura8g.bundle
| Thread |
|---|
| • bzr push into mysql-5.1-innodb branch (marko.makela:3490 to 3492) Bug#48197 | marko.makela | 1 Jun |