diff options
author | unknown <monty@mashka.mysql.fi> | 2003-01-18 03:13:37 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2003-01-18 03:13:37 +0200 |
commit | 76c8b9becec0438562882f591529190564a2d82f (patch) | |
tree | b24bce166fd5affbcc506bbc7d70c2c7ef00f561 /innobase | |
parent | 0ee64eb3d2daccd29478832ef9ce86f0ea086e9d (diff) | |
parent | aec8aeaab869e8553123ad1aefd8a5ab2c5f3ea7 (diff) | |
download | mariadb-git-76c8b9becec0438562882f591529190564a2d82f.tar.gz |
Merge with 4.0.9
BitKeeper/etc/ignore:
auto-union
client/mysqltest.c:
Auto merged
configure.in:
Auto merged
BitKeeper/deleted/.del-mutex.h~d3ae7a2977a68137:
Auto merged
BitKeeper/deleted/.del-mutex.m4~a13383cde18a64e1:
Auto merged
innobase/btr/btr0cur.c:
Auto merged
innobase/btr/btr0pcur.c:
Auto merged
innobase/log/log0log.c:
Auto merged
innobase/srv/srv0srv.c:
Auto merged
innobase/trx/trx0trx.c:
Auto merged
myisam/mi_create.c:
Auto merged
myisam/mi_unique.c:
Auto merged
myisam/myisamchk.c:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
mysql-test/r/group_by.result:
Auto merged
mysql-test/r/merge.result:
Auto merged
mysql-test/r/null.result:
Auto merged
mysql-test/t/group_by.test:
Auto merged
mysql-test/t/merge.test:
Auto merged
mysql-test/t/null.test:
Auto merged
scripts/mysql_fix_privilege_tables.sh:
Auto merged
sql/field_conv.cc:
Auto merged
sql/ha_myisammrg.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/net_serv.cc:
Auto merged
sql/opt_sum.cc:
Auto merged
sql/protocol.cc:
Auto merged
sql/sql_db.cc:
Auto merged
sql/sql_load.cc:
Auto merged
sql/sql_table.cc:
Auto merged
strings/Makefile.am:
Auto merged
libmysql/Makefile.shared:
merge
libmysql/libmysql.def:
merge
sql/ha_innodb.cc:
merge
sql/item_cmpfunc.cc:
merge
sql/log_event.cc:
merge
sql/sql_handler.cc:
merge
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/btr/btr0btr.c | 7 | ||||
-rw-r--r-- | innobase/btr/btr0cur.c | 10 | ||||
-rw-r--r-- | innobase/include/btr0btr.h | 9 | ||||
-rw-r--r-- | innobase/include/btr0cur.h | 8 | ||||
-rw-r--r-- | innobase/page/page0cur.c | 6 | ||||
-rw-r--r-- | innobase/row/row0purge.c | 11 | ||||
-rw-r--r-- | innobase/srv/srv0srv.c | 15 | ||||
-rw-r--r-- | innobase/trx/trx0trx.c | 20 |
8 files changed, 73 insertions, 13 deletions
diff --git a/innobase/btr/btr0btr.c b/innobase/btr/btr0btr.c index a1665aefab7..51c164b7cef 100644 --- a/innobase/btr/btr0btr.c +++ b/innobase/btr/btr0btr.c @@ -135,7 +135,7 @@ btr_page_insert_fits( /****************************************************************** Gets the root node of a tree and x-latches it. */ -static + page_t* btr_root_get( /*=========*/ @@ -146,9 +146,6 @@ btr_root_get( ulint space; ulint root_page_no; page_t* root; - - ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree), MTR_MEMO_X_LOCK) - || mtr_memo_contains(mtr, dict_tree_get_lock(tree), MTR_MEMO_S_LOCK)); space = dict_tree_get_space(tree); root_page_no = dict_tree_get_page(tree); @@ -334,8 +331,6 @@ btr_page_alloc( page_t* new_page; ulint new_page_no; - ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree), - MTR_MEMO_X_LOCK)); if (tree->type & DICT_IBUF) { return(btr_page_alloc_for_ibuf(tree, mtr)); diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c index e1d12c9adc4..2416149c3a8 100644 --- a/innobase/btr/btr0cur.c +++ b/innobase/btr/btr0cur.c @@ -3183,7 +3183,7 @@ btr_store_big_rec_extern_fields( ut_ad(mtr_memo_contains(local_mtr, dict_tree_get_lock(index->tree), MTR_MEMO_X_LOCK)); - ut_ad(mtr_memo_contains(local_mtr, buf_block_align(data), + ut_ad(mtr_memo_contains(local_mtr, buf_block_align(rec), MTR_MEMO_PAGE_X_FIX)); ut_a(index->type & DICT_CLUSTERED); @@ -3318,7 +3318,13 @@ void btr_free_externally_stored_field( /*=============================*/ dict_index_t* index, /* in: index of the data, the index - tree MUST be X-latched */ + tree MUST be X-latched; if the tree + height is 1, then also the root page + must be X-latched! (this is relevant + in the case this function is called + from purge where 'data' is located on + an undo log page, not an index + page) */ byte* data, /* in: internally stored data + reference to the externally stored part */ diff --git a/innobase/include/btr0btr.h b/innobase/include/btr0btr.h index 3cd44ab5175..8606fcd2a5c 100644 --- a/innobase/include/btr0btr.h +++ b/innobase/include/btr0btr.h @@ -56,6 +56,15 @@ insert buffer to speed up inserts */ #define BTR_IGNORE_SEC_UNIQUE 2048 /****************************************************************** +Gets the root node of a tree and x-latches it. */ + +page_t* +btr_root_get( +/*=========*/ + /* out: root page, x-latched */ + dict_tree_t* tree, /* in: index tree */ + mtr_t* mtr); /* in: mtr */ +/****************************************************************** Gets a buffer page and declares its latching order level. */ UNIV_INLINE page_t* diff --git a/innobase/include/btr0cur.h b/innobase/include/btr0cur.h index 7039ceba245..1d17c0e952d 100644 --- a/innobase/include/btr0cur.h +++ b/innobase/include/btr0cur.h @@ -507,7 +507,13 @@ void btr_free_externally_stored_field( /*=============================*/ dict_index_t* index, /* in: index of the data, the index - tree MUST be X-latched */ + tree MUST be X-latched; if the tree + height is 1, then also the root page + must be X-latched! (this is relevant + in the case this function is called + from purge where 'data' is located on + an undo log page, not an index + page) */ byte* data, /* in: internally stored data + reference to the externally stored part */ diff --git a/innobase/page/page0cur.c b/innobase/page/page0cur.c index bb49e9080ce..1ea6e3e3018 100644 --- a/innobase/page/page0cur.c +++ b/innobase/page/page0cur.c @@ -253,7 +253,8 @@ page_cur_search_with_match( up_matched_bytes = cur_matched_bytes; } - } else if ((mode == PAGE_CUR_G) || (mode == PAGE_CUR_LE)) { + } else if (mode == PAGE_CUR_G || mode == PAGE_CUR_LE + || mode == PAGE_CUR_LE_OR_EXTENDS) { low = mid; low_matched_fields = cur_matched_fields; low_matched_bytes = cur_matched_bytes; @@ -308,7 +309,8 @@ page_cur_search_with_match( up_matched_fields = cur_matched_fields; up_matched_bytes = cur_matched_bytes; } - } else if ((mode == PAGE_CUR_G) || (mode == PAGE_CUR_LE)) { + } else if (mode == PAGE_CUR_G || mode == PAGE_CUR_LE + || mode == PAGE_CUR_LE_OR_EXTENDS) { low_rec = mid_rec; low_matched_fields = cur_matched_fields; low_matched_bytes = cur_matched_bytes; diff --git a/innobase/row/row0purge.c b/innobase/row/row0purge.c index b64003f22d4..104d71eda2d 100644 --- a/innobase/row/row0purge.c +++ b/innobase/row/row0purge.c @@ -429,7 +429,18 @@ skip_secondaries: index = dict_table_get_first_index(node->table); mtr_x_lock(dict_tree_get_lock(index->tree), &mtr); + + /* NOTE: we must also acquire an X-latch to the + root page of the tree. We will need it when we + free pages from the tree. If the tree is of height 1, + the tree X-latch does NOT protect the root page, + because it is also a leaf page. Since we will have a + latch on an undo log page, we would break the + latching order if we would only later latch the + root page of such a tree! */ + btr_root_get(index->tree, &mtr); + /* We assume in purge of externally stored fields that the space id of the undo log record is 0! */ diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index 6612b2006eb..2bdcbe29758 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -1727,6 +1727,7 @@ srv_conc_enter_innodb( ibool has_slept = FALSE; srv_conc_slot_t* slot; ulint i; + char err_buf[1000]; if (srv_thread_concurrency >= 500) { /* Disable the concurrency check */ @@ -1745,6 +1746,16 @@ srv_conc_enter_innodb( retry: os_fast_mutex_lock(&srv_conc_mutex); + if (trx->declared_to_be_inside_innodb) { + ut_print_timestamp(stderr); + + trx_print(err_buf, trx); + + fprintf(stderr, +" InnoDB: Error: trying to declare trx to enter InnoDB, but\n" +"InnoDB: it already is declared.\n%s\n", err_buf); + } + if (srv_conc_n_threads < (lint)srv_thread_concurrency) { srv_conc_n_threads++; @@ -1815,8 +1826,12 @@ retry: /* Go to wait for the event; when a thread leaves InnoDB it will release this thread */ + trx->op_info = "waiting in InnoDB queue"; + os_event_wait(slot->event); + trx->op_info = ""; + os_fast_mutex_lock(&srv_conc_mutex); srv_conc_n_waiting_threads--; diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c index f0077f941de..5ac49397c90 100644 --- a/innobase/trx/trx0trx.c +++ b/innobase/trx/trx0trx.c @@ -233,8 +233,19 @@ trx_free( /*=====*/ trx_t* trx) /* in, own: trx object */ { + char err_buf[1000]; + ut_ad(mutex_own(&kernel_mutex)); + if (trx->declared_to_be_inside_innodb) { + ut_print_timestamp(stderr); + trx_print(err_buf, trx); + + fprintf(stderr, +" InnoDB: Error: Freeing a trx which is declared to be processing\n" +"InnoDB: inside InnoDB.\n%s\n", err_buf); + } + ut_a(trx->magic_n == TRX_MAGIC_N); trx->magic_n = 11112222; @@ -1506,10 +1517,10 @@ trx_print( #ifdef UNIV_LINUX buf += sprintf(buf, ", process no %lu", trx->mysql_process_no); -#else +#endif buf += sprintf(buf, ", OS thread id %lu", os_thread_pf(trx->mysql_thread_id)); -#endif + if (ut_strlen(trx->op_info) > 0) { buf += sprintf(buf, " %s", trx->op_info); } @@ -1518,6 +1529,11 @@ trx_print( buf += sprintf(buf, " purge trx"); } + if (trx->declared_to_be_inside_innodb) { + buf += sprintf(buf, ", thread declared inside InnoDB %lu", + trx->n_tickets_to_enter_innodb); + } + buf += sprintf(buf, "\n"); start_of_line = buf; |