Commit 2db64514 authored by marko's avatar marko

branches/innodb+: Merge revisions 6504:6560 from branches/zip:

  ------------------------------------------------------------------------
  r6521 | marko | 2010-01-27 10:49:01 +0200 (Wed, 27 Jan 2010) | 17 lines

  branches/zip: Drop temporary tables at startup.
  This addresses the third aspect of Bug #41609.

  row_mysql_drop_temp_tables(): New function, to drop all temporary
  tables. These can be distinguished by the least significant bit of
  MIX_LEN. However, we will skip ROW_FORMAT=REDUNDANT tables, because in
  the records for those tables, that bit may be garbage.

  recv_recovery_from_checkpoint_finish(): Invoke
  row_mysql_drop_temp_tables().  Normally, if the .frm files for the
  temporary tables exist at startup, MySQL will ask InnoDB to drop the
  temporary tables.  However, if the files are deleted, for instance, by
  the boot scripts of the operating system, the tables would remain in
  the InnoDB data dictionary unless someone digs them up by
  innodb_table_monitor and creates .frm files for dropping the tables.

  rb://221 approved by Sunny Bains.
  ------------------------------------------------------------------------
  r6525 | marko | 2010-01-28 16:23:15 +0200 (Thu, 28 Jan 2010) | 11 lines

  branches/zip: buf_LRU_invalidate_tablespace(): Do not unnecessarily
  acquire the block_mutex for every block in the LRU list. Only acquire
  it when holding buf_pool_mutex is not sufficient. This should speed up
  the function and considerably reduce traffic on the memory bus and
  caches.

  I noticed this deficiency when working on Issue #157.
  This deficiency popped up again in Issue #449 (Bug #35077),
  which this fix does not fully address.

  rb://78 revision 1 approved by Heikki Tuuri.
  ------------------------------------------------------------------------
  r6526 | jyang | 2010-01-28 18:12:40 +0200 (Thu, 28 Jan 2010) | 8 lines

  branches/zip: Add index translation table to map mysql index
  number to InnoDB index structure directly. Fix Bug #47622:
  "the new index is added before the existing ones in MySQL,
  but after one in SE".

  rb://215, approved by Marko
  ------------------------------------------------------------------------
  r6527 | vasil | 2010-01-29 14:39:48 +0200 (Fri, 29 Jan 2010) | 6 lines

  branches/zip:

  Extend the comment about row_mysql_handle_errors().

  Suggested by:	Heikki
  ------------------------------------------------------------------------
  r6533 | calvin | 2010-01-29 23:31:59 +0200 (Fri, 29 Jan 2010) | 4 lines

  branches/zip: remove duplicated copyright and license info.
  ------------------------------------------------------------------------
  r6534 | sunny | 2010-01-29 23:42:49 +0200 (Fri, 29 Jan 2010) | 15 lines

  branches/zip: Two changes to fix the problem:

  1. First scan the joining transaction's locks and check if no other
  transaction is waiting for a lock held by the joining transaction.
  If no other transaction is waiting then  no deadlock an occur and
  we avoid doing an exhaustive search.

  2. Change the direction of the lock traversal from backward to forward.
  Previously we traversed backward from the lock that has to wait, the function
  to that fetched the previous node was very inefficient resulting in O(n^2)
  access to the rec lock list.

  Fix Bug #49047 InnoDB deadlock detection is CPU intensive with many locks on a single row.

  rb://218
  ------------------------------------------------------------------------
  r6539 | marko | 2010-02-01 11:31:12 +0200 (Mon, 01 Feb 2010) | 75 lines

  branches/zip: Merge revisions 6471:6538 from branches/5.1:

    ------------------------------------------------------------------------
    r6488 | sunny | 2010-01-21 02:55:08 +0200 (Thu, 21 Jan 2010) | 2 lines
    Changed paths:
       M /branches/5.1/mysql-test/innodb-autoinc.result
       M /branches/5.1/mysql-test/innodb-autoinc.test

    branches/5.1: Factor out test for bug#44030 from innodb-autoinc.test
    into a separate test/result files.
    ------------------------------------------------------------------------
    r6489 | sunny | 2010-01-21 02:57:50 +0200 (Thu, 21 Jan 2010) | 2 lines
    Changed paths:
       A /branches/5.1/mysql-test/innodb-autoinc-44030.result
       A /branches/5.1/mysql-test/innodb-autoinc-44030.test

    branches/5.1: Factor out test for bug#44030 from innodb-autoinc.test
    into a separate test/result files.
    ------------------------------------------------------------------------
    r6492 | sunny | 2010-01-21 09:38:35 +0200 (Thu, 21 Jan 2010) | 1 line
    Changed paths:
       M /branches/5.1/mysql-test/innodb-autoinc-44030.test

    branches/5.1: Add reference to bug#47621 in the comment.
    ------------------------------------------------------------------------
    r6535 | sunny | 2010-01-30 00:08:40 +0200 (Sat, 30 Jan 2010) | 11 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc

    branches/5.1: Undo the change from r6424. We need to return DB_SUCCESS even
    if we were unable to initialize the tabe autoinc value. This is required for
    the open to succeed. The only condition we currently treat as a hard error
    is if the autoinc field instance passed in by MySQL is NULL.

    Previously if the table autoinc value was 0 and the next value was requested
    we had an assertion that would fail. Change that assertion and treat a value
    of 0 to mean that the autoinc system is unavailable. Generation of next
    value will now return failure.

    rb://237
    ------------------------------------------------------------------------
    r6536 | sunny | 2010-01-30 00:13:42 +0200 (Sat, 30 Jan 2010) | 6 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
       M /branches/5.1/mysql-test/innodb-autoinc.result
       M /branches/5.1/mysql-test/innodb-autoinc.test

    branches/5.1: Check *first_value everytime against the column max
    value and  set *first_value to next autoinc if it's > col max value.
    ie.  not rely on what is passed in from MySQL.

    [49497] Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value
    rb://236
    ------------------------------------------------------------------------
    r6537 | sunny | 2010-01-30 00:35:00 +0200 (Sat, 30 Jan 2010) | 2 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
       M /branches/5.1/mysql-test/innodb-autoinc.result
       M /branches/5.1/mysql-test/innodb-autoinc.test

    branches/5.1: Undo r6536.
    ------------------------------------------------------------------------
    r6538 | sunny | 2010-01-30 00:43:06 +0200 (Sat, 30 Jan 2010) | 6 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
       M /branches/5.1/mysql-test/innodb-autoinc.result
       M /branches/5.1/mysql-test/innodb-autoinc.test

    branches/5.1: Check *first_value every time against the column max
    value and  set *first_value to next autoinc if it's > col max value.
    ie.  not rely on what is passed in from MySQL.

    [49497] Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value
    rb://236
    ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r6540 | marko | 2010-02-01 11:35:13 +0200 (Mon, 01 Feb 2010) | 1 line

  branches/zip: ChangeLog: Document the merge of 6471:6538 from branches/5.1.
  ------------------------------------------------------------------------
  r6546 | jyang | 2010-02-03 11:05:24 +0200 (Wed, 03 Feb 2010) | 9 lines

  branches/zip: Relax assertion on the number of index defined
  in InnoDB must be comparable with that of MySQL to tolerate
  possible dictionary inconsistency. Fix Mantis issue #455,
  "UNIV_DEBUG+ assert ha_innodb.cc:3152 ib_num_index >=
  mysql_num_index".

  rb://248 Approved by Marko.
  ------------------------------------------------------------------------
  r6547 | marko | 2010-02-03 14:43:38 +0200 (Wed, 03 Feb 2010) | 14 lines

  branches/zip: Clean up CHECK TABLE error handling. (Issue #220)

  ha_innobase::change_active_index(): Clean up code formatting.

  ha_innobase::check(): Incorporate the code from
  row_check_table_for_mysql().  Report errors to the client connection
  instead of writing them to the error log.

  row_check_table_for_mysql(): Remove.

  row_check_index_for_mysql(): Renamed from row_scan_and_check_index().
  Let the caller initialize prebuilt, and assume that the index is usable.

  rb://178 approved by Sunny Bains
  ------------------------------------------------------------------------
  r6548 | marko | 2010-02-03 15:01:39 +0200 (Wed, 03 Feb 2010) | 11 lines

  branches/zip: buf_LRU_invalidate_tablespace(): Ensure that prev_bpage
  is not relocated when freeing a compressed block.  This avoids the
  costly rescan of the LRU list.  (Bug #35077, Issue #449)

  At most one buffer-fix will be active at a time, affecting two blocks:
  the buf_page_t and the compressed page frame. This should not block
  the memory defragmentation in buf0buddy.c too much.  In fact, it may
  avoid unnecessary copying if also prev_bpage belongs to the tablespace
  that is being invalidated.

  rb://240
  ------------------------------------------------------------------------
  r6559 | marko | 2010-02-04 13:21:18 +0200 (Thu, 04 Feb 2010) | 14 lines

  branches/zip: Pass the file name and line number of the caller of the
  b-tree cursor functions to the buffer pool requests, in order to make
  the latch diagnostics more accurate.

  buf_page_optimistic_get_func(): Renamed to buf_page_optimistic_get().

  btr_page_get_father_node_ptr(), btr_insert_on_non_leaf_level(),
  btr_pcur_open(), btr_pcur_open_with_no_init(), btr_pcur_open_on_user_rec(),
  btr_pcur_open_at_rnd_pos(), btr_pcur_restore_position(),
  btr_cur_open_at_index_side(), btr_cur_open_at_rnd_pos():
  Rename the function to _func and add the parameters file, line.
  Define wrapper macros with __FILE__, __LINE__.

  btr_cur_search_to_nth_level(): Add the parameters file, line.
  ------------------------------------------------------------------------
  r6560 | sunny | 2010-02-04 16:11:23 +0200 (Thu, 04 Feb 2010) | 7 lines

  branches/zip: Remove the additional check introduced in r6534 which tries
  to check if the joining transaction has any other transactions waiting on
  its locks. This optimization results in excessive deadlocks when running
  Sysbench with a large number of threads. The function seems to return
  FALSE positives.

  rb://250
  ------------------------------------------------------------------------
parent a7316cba
2010-02-04 The InnoDB Team
* btr/btr0btr.c, btr/btr0cur.c, btr/btr0pcur.c, buf/buf0buf.c,
include/btr0btr.h, include/btr0cur.h, include/btr0pcur.h,
include/btr0pcur.ic, include/buf0buf.h, row/row0ins.c, row/row0sel.c:
Pass the file name and line number of the caller of the
b-tree cursor functions to the buffer pool requests, in order
to make the latch diagnostics more accurate.
2010-02-03 The InnoDB Team
* buf/buf0lru.c:
Fix Bug#35077 Very slow DROP TABLE (ALTER TABLE, OPTIMIZE TABLE)
on compressed tables
2010-02-03 The InnoDB Team
* handler/ha_innodb.cc, include/row0mysql.h, row/row0mysql.c:
Clean up CHECK TABLE error handling.
2010-02-01 The InnoDB Team
* handler/ha_innodb.cc, mysql-test/innodb-autoinc.test,
mysql-test/innodb-autoinc.result,
mysql-test/innodb-autoinc-44030.test,
mysql-test/innodb-autoinc-44030.result:
Fix Bug#49497 Error 1467 (ER_AUTOINC_READ_FAILED) on inserting
a negative value
2010-01-27 The InnoDB Team
* include/row0mysql.h, log/log0recv.c, row/row0mysql.c:
Drop temporary tables at startup.
This addresses the third aspect of
Bug#41609 Crash recovery does not work for InnoDB temporary tables.
2010-01-21 The InnoDB Team 2010-01-21 The InnoDB Team
* buf/buf0buf.c: * buf/buf0buf.c:
......
...@@ -592,13 +592,15 @@ an x-latch on the tree. ...@@ -592,13 +592,15 @@ an x-latch on the tree.
@return rec_get_offsets() of the node pointer record */ @return rec_get_offsets() of the node pointer record */
static static
ulint* ulint*
btr_page_get_father_node_ptr( btr_page_get_father_node_ptr_func(
/*=========================*/ /*==============================*/
ulint* offsets,/*!< in: work area for the return value */ ulint* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */ mem_heap_t* heap, /*!< in: memory heap to use */
btr_cur_t* cursor, /*!< in: cursor pointing to user record, btr_cur_t* cursor, /*!< in: cursor pointing to user record,
out: cursor on node pointer record, out: cursor on node pointer record,
its page x-latched */ its page x-latched */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
{ {
page_t* page; page_t* page;
...@@ -625,7 +627,8 @@ btr_page_get_father_node_ptr( ...@@ -625,7 +627,8 @@ btr_page_get_father_node_ptr(
tuple = dict_index_build_node_ptr(index, user_rec, 0, heap, level); tuple = dict_index_build_node_ptr(index, user_rec, 0, heap, level);
btr_cur_search_to_nth_level(index, level + 1, tuple, PAGE_CUR_LE, btr_cur_search_to_nth_level(index, level + 1, tuple, PAGE_CUR_LE,
BTR_CONT_MODIFY_TREE, cursor, 0, mtr); BTR_CONT_MODIFY_TREE, cursor, 0,
file, line, mtr);
node_ptr = btr_cur_get_rec(cursor); node_ptr = btr_cur_get_rec(cursor);
ut_ad(!page_rec_is_comp(node_ptr) ut_ad(!page_rec_is_comp(node_ptr)
...@@ -673,6 +676,9 @@ btr_page_get_father_node_ptr( ...@@ -673,6 +676,9 @@ btr_page_get_father_node_ptr(
return(offsets); return(offsets);
} }
#define btr_page_get_father_node_ptr(of,heap,cur,mtr) \
btr_page_get_father_node_ptr_func(of,heap,cur,__FILE__,__LINE__,mtr)
/************************************************************//** /************************************************************//**
Returns the upper level node pointer to a page. It is assumed that mtr holds Returns the upper level node pointer to a page. It is assumed that mtr holds
an x-latch on the tree. an x-latch on the tree.
...@@ -1665,11 +1671,13 @@ Inserts a data tuple to a tree on a non-leaf level. It is assumed ...@@ -1665,11 +1671,13 @@ Inserts a data tuple to a tree on a non-leaf level. It is assumed
that mtr holds an x-latch on the tree. */ that mtr holds an x-latch on the tree. */
UNIV_INTERN UNIV_INTERN
void void
btr_insert_on_non_leaf_level( btr_insert_on_non_leaf_level_func(
/*=========================*/ /*==============================*/
dict_index_t* index, /*!< in: index */ dict_index_t* index, /*!< in: index */
ulint level, /*!< in: level, must be > 0 */ ulint level, /*!< in: level, must be > 0 */
dtuple_t* tuple, /*!< in: the record to be inserted */ dtuple_t* tuple, /*!< in: the record to be inserted */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
{ {
big_rec_t* dummy_big_rec; big_rec_t* dummy_big_rec;
...@@ -1681,7 +1689,7 @@ btr_insert_on_non_leaf_level( ...@@ -1681,7 +1689,7 @@ btr_insert_on_non_leaf_level(
btr_cur_search_to_nth_level(index, level, tuple, PAGE_CUR_LE, btr_cur_search_to_nth_level(index, level, tuple, PAGE_CUR_LE,
BTR_CONT_MODIFY_TREE, BTR_CONT_MODIFY_TREE,
&cursor, 0, mtr); &cursor, 0, file, line, mtr);
err = btr_cur_pessimistic_insert(BTR_NO_LOCKING_FLAG err = btr_cur_pessimistic_insert(BTR_NO_LOCKING_FLAG
| BTR_KEEP_SYS_FLAG | BTR_KEEP_SYS_FLAG
......
...@@ -352,6 +352,8 @@ btr_cur_search_to_nth_level( ...@@ -352,6 +352,8 @@ btr_cur_search_to_nth_level(
ulint has_search_latch,/*!< in: info on the latch mode the ulint has_search_latch,/*!< in: info on the latch mode the
caller currently has on btr_search_latch: caller currently has on btr_search_latch:
RW_S_LATCH, or 0 */ RW_S_LATCH, or 0 */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
{ {
page_t* page; page_t* page;
...@@ -589,7 +591,7 @@ search_loop: ...@@ -589,7 +591,7 @@ search_loop:
retry_page_get: retry_page_get:
block = buf_page_get_gen( block = buf_page_get_gen(
space, zip_size, page_no, rw_latch, guess, buf_mode, space, zip_size, page_no, rw_latch, guess, buf_mode,
__FILE__, __LINE__, mtr); file, line, mtr);
if (block == NULL) { if (block == NULL) {
/* This must be a search to perform an insert/delete /* This must be a search to perform an insert/delete
...@@ -818,13 +820,15 @@ func_exit: ...@@ -818,13 +820,15 @@ func_exit:
Opens a cursor at either end of an index. */ Opens a cursor at either end of an index. */
UNIV_INTERN UNIV_INTERN
void void
btr_cur_open_at_index_side( btr_cur_open_at_index_side_func(
/*=======================*/ /*============================*/
ibool from_left, /*!< in: TRUE if open to the low end, ibool from_left, /*!< in: TRUE if open to the low end,
FALSE if to the high end */ FALSE if to the high end */
dict_index_t* index, /*!< in: index */ dict_index_t* index, /*!< in: index */
ulint latch_mode, /*!< in: latch mode */ ulint latch_mode, /*!< in: latch mode */
btr_cur_t* cursor, /*!< in: cursor */ btr_cur_t* cursor, /*!< in: cursor */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
{ {
page_cur_t* page_cursor; page_cur_t* page_cursor;
...@@ -869,7 +873,7 @@ btr_cur_open_at_index_side( ...@@ -869,7 +873,7 @@ btr_cur_open_at_index_side(
page_t* page; page_t* page;
block = buf_page_get_gen(space, zip_size, page_no, block = buf_page_get_gen(space, zip_size, page_no,
RW_NO_LATCH, NULL, BUF_GET, RW_NO_LATCH, NULL, BUF_GET,
__FILE__, __LINE__, mtr); file, line, mtr);
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
ut_ad(0 == ut_dulint_cmp(index->id, ut_ad(0 == ut_dulint_cmp(index->id,
btr_page_get_index_id(page))); btr_page_get_index_id(page)));
...@@ -949,11 +953,13 @@ btr_cur_open_at_index_side( ...@@ -949,11 +953,13 @@ btr_cur_open_at_index_side(
Positions a cursor at a randomly chosen position within a B-tree. */ Positions a cursor at a randomly chosen position within a B-tree. */
UNIV_INTERN UNIV_INTERN
void void
btr_cur_open_at_rnd_pos( btr_cur_open_at_rnd_pos_func(
/*====================*/ /*=========================*/
dict_index_t* index, /*!< in: index */ dict_index_t* index, /*!< in: index */
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_cur_t* cursor, /*!< in/out: B-tree cursor */ btr_cur_t* cursor, /*!< in/out: B-tree cursor */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
{ {
page_cur_t* page_cursor; page_cur_t* page_cursor;
...@@ -988,7 +994,7 @@ btr_cur_open_at_rnd_pos( ...@@ -988,7 +994,7 @@ btr_cur_open_at_rnd_pos(
block = buf_page_get_gen(space, zip_size, page_no, block = buf_page_get_gen(space, zip_size, page_no,
RW_NO_LATCH, NULL, BUF_GET, RW_NO_LATCH, NULL, BUF_GET,
__FILE__, __LINE__, mtr); file, line, mtr);
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
ut_ad(0 == ut_dulint_cmp(index->id, ut_ad(0 == ut_dulint_cmp(index->id,
btr_page_get_index_id(page))); btr_page_get_index_id(page)));
...@@ -3242,7 +3248,8 @@ btr_estimate_n_rows_in_range( ...@@ -3242,7 +3248,8 @@ btr_estimate_n_rows_in_range(
btr_cur_search_to_nth_level(index, 0, tuple1, mode1, btr_cur_search_to_nth_level(index, 0, tuple1, mode1,
BTR_SEARCH_LEAF | BTR_ESTIMATE, BTR_SEARCH_LEAF | BTR_ESTIMATE,
&cursor, 0, &mtr); &cursor, 0,
__FILE__, __LINE__, &mtr);
} else { } else {
btr_cur_open_at_index_side(TRUE, index, btr_cur_open_at_index_side(TRUE, index,
BTR_SEARCH_LEAF | BTR_ESTIMATE, BTR_SEARCH_LEAF | BTR_ESTIMATE,
...@@ -3259,7 +3266,8 @@ btr_estimate_n_rows_in_range( ...@@ -3259,7 +3266,8 @@ btr_estimate_n_rows_in_range(
btr_cur_search_to_nth_level(index, 0, tuple2, mode2, btr_cur_search_to_nth_level(index, 0, tuple2, mode2,
BTR_SEARCH_LEAF | BTR_ESTIMATE, BTR_SEARCH_LEAF | BTR_ESTIMATE,
&cursor, 0, &mtr); &cursor, 0,
__FILE__, __LINE__, &mtr);
} else { } else {
btr_cur_open_at_index_side(FALSE, index, btr_cur_open_at_index_side(FALSE, index,
BTR_SEARCH_LEAF | BTR_ESTIMATE, BTR_SEARCH_LEAF | BTR_ESTIMATE,
......
...@@ -205,10 +205,12 @@ record and it can be restored on a user record whose ordering fields ...@@ -205,10 +205,12 @@ record and it can be restored on a user record whose ordering fields
are identical to the ones of the original user record */ are identical to the ones of the original user record */
UNIV_INTERN UNIV_INTERN
ibool ibool
btr_pcur_restore_position( btr_pcur_restore_position_func(
/*======================*/ /*===========================*/
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in: detached persistent cursor */ btr_pcur_t* cursor, /*!< in: detached persistent cursor */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
{ {
dict_index_t* index; dict_index_t* index;
...@@ -257,7 +259,8 @@ btr_pcur_restore_position( ...@@ -257,7 +259,8 @@ btr_pcur_restore_position(
if (UNIV_LIKELY(buf_page_optimistic_get( if (UNIV_LIKELY(buf_page_optimistic_get(
latch_mode, latch_mode,
cursor->block_when_stored, cursor->block_when_stored,
cursor->modify_clock, mtr))) { cursor->modify_clock,
file, line, mtr))) {
cursor->pos_state = BTR_PCUR_IS_POSITIONED; cursor->pos_state = BTR_PCUR_IS_POSITIONED;
buf_block_dbg_add_level(btr_pcur_get_block(cursor), buf_block_dbg_add_level(btr_pcur_get_block(cursor),
...@@ -312,8 +315,8 @@ btr_pcur_restore_position( ...@@ -312,8 +315,8 @@ btr_pcur_restore_position(
mode = PAGE_CUR_L; mode = PAGE_CUR_L;
} }
btr_pcur_open_with_no_init(index, tuple, mode, latch_mode, btr_pcur_open_with_no_init_func(index, tuple, mode, latch_mode,
cursor, 0, mtr); cursor, 0, file, line, mtr);
/* Restore the old search mode */ /* Restore the old search mode */
cursor->search_mode = old_mode; cursor->search_mode = old_mode;
...@@ -553,8 +556,8 @@ before first in tree. The latching mode must be BTR_SEARCH_LEAF or ...@@ -553,8 +556,8 @@ before first in tree. The latching mode must be BTR_SEARCH_LEAF or
BTR_MODIFY_LEAF. */ BTR_MODIFY_LEAF. */
UNIV_INTERN UNIV_INTERN
void void
btr_pcur_open_on_user_rec( btr_pcur_open_on_user_rec_func(
/*======================*/ /*===========================*/
dict_index_t* index, /*!< in: index */ dict_index_t* index, /*!< in: index */
const dtuple_t* tuple, /*!< in: tuple on which search done */ const dtuple_t* tuple, /*!< in: tuple on which search done */
ulint mode, /*!< in: PAGE_CUR_L, ... */ ulint mode, /*!< in: PAGE_CUR_L, ... */
...@@ -562,9 +565,12 @@ btr_pcur_open_on_user_rec( ...@@ -562,9 +565,12 @@ btr_pcur_open_on_user_rec(
BTR_MODIFY_LEAF */ BTR_MODIFY_LEAF */
btr_pcur_t* cursor, /*!< in: memory buffer for persistent btr_pcur_t* cursor, /*!< in: memory buffer for persistent
cursor */ cursor */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
{ {
btr_pcur_open(index, tuple, mode, latch_mode, cursor, mtr); btr_pcur_open_func(index, tuple, mode, latch_mode, cursor,
file, line, mtr);
if ((mode == PAGE_CUR_GE) || (mode == PAGE_CUR_G)) { if ((mode == PAGE_CUR_GE) || (mode == PAGE_CUR_G)) {
......
...@@ -2430,8 +2430,8 @@ page. ...@@ -2430,8 +2430,8 @@ page.
@return TRUE if success */ @return TRUE if success */
UNIV_INTERN UNIV_INTERN
ibool ibool
buf_page_optimistic_get_func( buf_page_optimistic_get(
/*=========================*/ /*====================*/
ulint rw_latch,/*!< in: RW_S_LATCH, RW_X_LATCH */ ulint rw_latch,/*!< in: RW_S_LATCH, RW_X_LATCH */
buf_block_t* block, /*!< in: guessed buffer block */ buf_block_t* block, /*!< in: guessed buffer block */
ib_uint64_t modify_clock,/*!< in: modify clock value if mode is ib_uint64_t modify_clock,/*!< in: modify clock value if mode is
......
...@@ -350,17 +350,31 @@ scan_again: ...@@ -350,17 +350,31 @@ scan_again:
bpage = UT_LIST_GET_LAST(buf_pool->LRU); bpage = UT_LIST_GET_LAST(buf_pool->LRU);
while (bpage != NULL) { while (bpage != NULL) {
mutex_t* block_mutex = buf_page_get_mutex(bpage);
buf_page_t* prev_bpage; buf_page_t* prev_bpage;
ibool prev_bpage_buf_fix = FALSE;
ut_a(buf_page_in_file(bpage)); ut_a(buf_page_in_file(bpage));
mutex_enter(block_mutex);
prev_bpage = UT_LIST_GET_PREV(LRU, bpage); prev_bpage = UT_LIST_GET_PREV(LRU, bpage);
if (buf_page_get_space(bpage) == id) { /* bpage->space and bpage->io_fix are protected by
if (bpage->buf_fix_count > 0 buf_pool_mutex and block_mutex. It is safe to check
|| buf_page_get_io_fix(bpage) != BUF_IO_NONE) { them while holding buf_pool_mutex only. */
if (buf_page_get_space(bpage) != id) {
/* Skip this block, as it does not belong to
the space that is being invalidated. */
} else if (buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
/* We cannot remove this page during this scan
yet; maybe the system is currently reading it
in, or flushing the modifications to the file */
all_freed = FALSE;
} else {
mutex_t* block_mutex = buf_page_get_mutex(bpage);
mutex_enter(block_mutex);
if (bpage->buf_fix_count > 0) {
/* We cannot remove this page during /* We cannot remove this page during
this scan yet; maybe the system is this scan yet; maybe the system is
...@@ -380,8 +394,40 @@ scan_again: ...@@ -380,8 +394,40 @@ scan_again:
(ulong) buf_page_get_page_no(bpage)); (ulong) buf_page_get_page_no(bpage));
} }
#endif #endif
if (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE if (buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE) {
&& ((buf_block_t*) bpage)->is_hashed) { /* This is a compressed-only block
descriptor. Ensure that prev_bpage
cannot be relocated when bpage is freed. */
if (UNIV_LIKELY(prev_bpage != NULL)) {
switch (buf_page_get_state(
prev_bpage)) {
case BUF_BLOCK_FILE_PAGE:
/* Descriptors of uncompressed
blocks will not be relocated,
because we are holding the
buf_pool_mutex. */
break;
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
/* Descriptors of compressed-
only blocks can be relocated,
unless they are buffer-fixed.
Because both bpage and
prev_bpage are protected by
buf_pool_zip_mutex, it is
not necessary to acquire
further mutexes. */
ut_ad(&buf_pool_zip_mutex
== block_mutex);
ut_ad(mutex_own(block_mutex));
prev_bpage_buf_fix = TRUE;
prev_bpage->buf_fix_count++;
break;
default:
ut_error;
}
}
} else if (((buf_block_t*) bpage)->is_hashed) {
ulint page_no; ulint page_no;
ulint zip_size; ulint zip_size;
...@@ -405,7 +451,8 @@ scan_again: ...@@ -405,7 +451,8 @@ scan_again:
buf_flush_remove(bpage); buf_flush_remove(bpage);
} }
/* Remove from the LRU list */ /* Remove from the LRU list. */
if (buf_LRU_block_remove_hashed_page(bpage, TRUE) if (buf_LRU_block_remove_hashed_page(bpage, TRUE)
!= BUF_BLOCK_ZIP_FREE) { != BUF_BLOCK_ZIP_FREE) {
buf_LRU_block_free_hashed_page((buf_block_t*) buf_LRU_block_free_hashed_page((buf_block_t*)
...@@ -417,18 +464,27 @@ scan_again: ...@@ -417,18 +464,27 @@ scan_again:
ut_ad(block_mutex == &buf_pool_zip_mutex); ut_ad(block_mutex == &buf_pool_zip_mutex);
ut_ad(!mutex_own(block_mutex)); ut_ad(!mutex_own(block_mutex));
/* The compressed block descriptor if (prev_bpage_buf_fix) {
(bpage) has been deallocated and /* We temporarily buffer-fixed
block_mutex released. Also, prev_bpage, so that
buf_buddy_free() may have relocated buf_buddy_free() could not
prev_bpage. Rescan the LRU list. */ relocate it, in case it was a
compressed-only block
descriptor. */
bpage = UT_LIST_GET_LAST(buf_pool->LRU); mutex_enter(block_mutex);
continue; ut_ad(prev_bpage->buf_fix_count > 0);
prev_bpage->buf_fix_count--;
mutex_exit(block_mutex);
} }
goto next_page_no_mutex;
} }
next_page: next_page:
mutex_exit(block_mutex); mutex_exit(block_mutex);
}
next_page_no_mutex:
bpage = prev_bpage; bpage = prev_bpage;
} }
......
This diff is collapsed.
...@@ -27,6 +27,18 @@ Place, Suite 330, Boston, MA 02111-1307 USA ...@@ -27,6 +27,18 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
/* Structure defines translation table between mysql index and innodb
index structures */
typedef struct innodb_idx_translate_struct {
ulint index_count; /*!< number of valid index entries
in the index_mapping array */
ulint array_size; /*!< array size of index_mapping */
dict_index_t** index_mapping; /*!< index pointer array directly
maps to index in Innodb from MySQL
array index */
} innodb_idx_translate_t;
/** InnoDB table share */ /** InnoDB table share */
typedef struct st_innobase_share { typedef struct st_innobase_share {
THR_LOCK lock; /*!< MySQL lock protecting THR_LOCK lock; /*!< MySQL lock protecting
...@@ -34,8 +46,12 @@ typedef struct st_innobase_share { ...@@ -34,8 +46,12 @@ typedef struct st_innobase_share {
const char* table_name; /*!< InnoDB table name */ const char* table_name; /*!< InnoDB table name */
uint use_count; /*!< reference count, uint use_count; /*!< reference count,
incremented in get_share() incremented in get_share()
and decremented in free_share() */ and decremented in
free_share() */
void* table_name_hash;/*!< hash table chain node */ void* table_name_hash;/*!< hash table chain node */
innodb_idx_translate_t idx_trans_tbl; /*!< index translation
table between MySQL and
Innodb */
} INNOBASE_SHARE; } INNOBASE_SHARE;
......
...@@ -764,6 +764,10 @@ err_exit: ...@@ -764,6 +764,10 @@ err_exit:
ut_ad(error == DB_SUCCESS); ut_ad(error == DB_SUCCESS);
/* We will need to rebuild index translation table. Set
valid index entry count in the translation table to zero */
share->idx_trans_tbl.index_count = 0;
/* Commit the data dictionary transaction in order to release /* Commit the data dictionary transaction in order to release
the table locks on the system tables. This means that if the table locks on the system tables. This means that if
MySQL crashes while creating a new primary key inside MySQL crashes while creating a new primary key inside
...@@ -1198,6 +1202,10 @@ ha_innobase::final_drop_index( ...@@ -1198,6 +1202,10 @@ ha_innobase::final_drop_index(
ut_a(!index->to_be_dropped); ut_a(!index->to_be_dropped);
} }
/* We will need to rebuild index translation table. Set
valid index entry count in the translation table to zero */
share->idx_trans_tbl.index_count = 0;
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
dict_table_check_for_dup_indexes(prebuilt->table); dict_table_check_for_dup_indexes(prebuilt->table);
#endif #endif
......
...@@ -327,12 +327,16 @@ Inserts a data tuple to a tree on a non-leaf level. It is assumed ...@@ -327,12 +327,16 @@ Inserts a data tuple to a tree on a non-leaf level. It is assumed
that mtr holds an x-latch on the tree. */ that mtr holds an x-latch on the tree. */
UNIV_INTERN UNIV_INTERN
void void
btr_insert_on_non_leaf_level( btr_insert_on_non_leaf_level_func(
/*=========================*/ /*==============================*/
dict_index_t* index, /*!< in: index */ dict_index_t* index, /*!< in: index */
ulint level, /*!< in: level, must be > 0 */ ulint level, /*!< in: level, must be > 0 */
dtuple_t* tuple, /*!< in: the record to be inserted */ dtuple_t* tuple, /*!< in: the record to be inserted */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */ mtr_t* mtr); /*!< in: mtr */
# define btr_insert_on_non_leaf_level(i,l,t,m) \
btr_insert_on_non_leaf_level_func(i,l,t,__FILE__,__LINE__,m)
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
/****************************************************************//** /****************************************************************//**
Sets a record as the predefined minimum record. */ Sets a record as the predefined minimum record. */
......
...@@ -152,29 +152,39 @@ btr_cur_search_to_nth_level( ...@@ -152,29 +152,39 @@ btr_cur_search_to_nth_level(
ulint has_search_latch,/*!< in: latch mode the caller ulint has_search_latch,/*!< in: latch mode the caller
currently has on btr_search_latch: currently has on btr_search_latch:
RW_S_LATCH, or 0 */ RW_S_LATCH, or 0 */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */ mtr_t* mtr); /*!< in: mtr */
/*****************************************************************//** /*****************************************************************//**
Opens a cursor at either end of an index. */ Opens a cursor at either end of an index. */
UNIV_INTERN UNIV_INTERN
void void
btr_cur_open_at_index_side( btr_cur_open_at_index_side_func(
/*=======================*/ /*============================*/
ibool from_left, /*!< in: TRUE if open to the low end, ibool from_left, /*!< in: TRUE if open to the low end,
FALSE if to the high end */ FALSE if to the high end */
dict_index_t* index, /*!< in: index */ dict_index_t* index, /*!< in: index */
ulint latch_mode, /*!< in: latch mode */ ulint latch_mode, /*!< in: latch mode */
btr_cur_t* cursor, /*!< in: cursor */ btr_cur_t* cursor, /*!< in: cursor */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */ mtr_t* mtr); /*!< in: mtr */
#define btr_cur_open_at_index_side(f,i,l,c,m) \
btr_cur_open_at_index_side_func(f,i,l,c,__FILE__,__LINE__,m)
/**********************************************************************//** /**********************************************************************//**
Positions a cursor at a randomly chosen position within a B-tree. */ Positions a cursor at a randomly chosen position within a B-tree. */
UNIV_INTERN UNIV_INTERN
void void
btr_cur_open_at_rnd_pos( btr_cur_open_at_rnd_pos_func(
/*====================*/ /*=========================*/
dict_index_t* index, /*!< in: index */ dict_index_t* index, /*!< in: index */
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_cur_t* cursor, /*!< in/out: B-tree cursor */ btr_cur_t* cursor, /*!< in/out: B-tree cursor */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */ mtr_t* mtr); /*!< in: mtr */
#define btr_cur_open_at_rnd_pos(i,l,c,m) \
btr_cur_open_at_rnd_pos_func(i,l,c,__FILE__,__LINE__,m)
/*************************************************************//** /*************************************************************//**
Tries to perform an insert to a page in an index tree, next to cursor. Tries to perform an insert to a page in an index tree, next to cursor.
It is assumed that mtr holds an x-latch on the page. The operation does It is assumed that mtr holds an x-latch on the page. The operation does
......
...@@ -82,8 +82,8 @@ Initializes and opens a persistent cursor to an index tree. It should be ...@@ -82,8 +82,8 @@ Initializes and opens a persistent cursor to an index tree. It should be
closed with btr_pcur_close. */ closed with btr_pcur_close. */
UNIV_INLINE UNIV_INLINE
void void
btr_pcur_open( btr_pcur_open_func(
/*==========*/ /*===============*/
dict_index_t* index, /*!< in: index */ dict_index_t* index, /*!< in: index */
const dtuple_t* tuple, /*!< in: tuple on which search done */ const dtuple_t* tuple, /*!< in: tuple on which search done */
ulint mode, /*!< in: PAGE_CUR_L, ...; ulint mode, /*!< in: PAGE_CUR_L, ...;
...@@ -94,14 +94,18 @@ btr_pcur_open( ...@@ -94,14 +94,18 @@ btr_pcur_open(
record! */ record! */
ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */ ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */ mtr_t* mtr); /*!< in: mtr */
#define btr_pcur_open(i,t,md,l,c,m) \
btr_pcur_open_func(i,t,md,l,c,__FILE__,__LINE__,m)
/**************************************************************//** /**************************************************************//**
Opens an persistent cursor to an index tree without initializing the Opens an persistent cursor to an index tree without initializing the
cursor. */ cursor. */
UNIV_INLINE UNIV_INLINE
void void
btr_pcur_open_with_no_init( btr_pcur_open_with_no_init_func(
/*=======================*/ /*============================*/
dict_index_t* index, /*!< in: index */ dict_index_t* index, /*!< in: index */
const dtuple_t* tuple, /*!< in: tuple on which search done */ const dtuple_t* tuple, /*!< in: tuple on which search done */
ulint mode, /*!< in: PAGE_CUR_L, ...; ulint mode, /*!< in: PAGE_CUR_L, ...;
...@@ -119,7 +123,12 @@ btr_pcur_open_with_no_init( ...@@ -119,7 +123,12 @@ btr_pcur_open_with_no_init(
ulint has_search_latch,/*!< in: latch mode the caller ulint has_search_latch,/*!< in: latch mode the caller
currently has on btr_search_latch: currently has on btr_search_latch:
RW_S_LATCH, or 0 */ RW_S_LATCH, or 0 */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */ mtr_t* mtr); /*!< in: mtr */
#define btr_pcur_open_with_no_init(ix,t,md,l,cur,has,m) \
btr_pcur_open_with_no_init_func(ix,t,md,l,cur,has,__FILE__,__LINE__,m)
/*****************************************************************//** /*****************************************************************//**
Opens a persistent cursor at either end of an index. */ Opens a persistent cursor at either end of an index. */
UNIV_INLINE UNIV_INLINE
...@@ -160,8 +169,8 @@ before first in tree. The latching mode must be BTR_SEARCH_LEAF or ...@@ -160,8 +169,8 @@ before first in tree. The latching mode must be BTR_SEARCH_LEAF or
BTR_MODIFY_LEAF. */ BTR_MODIFY_LEAF. */
UNIV_INTERN UNIV_INTERN
void void
btr_pcur_open_on_user_rec( btr_pcur_open_on_user_rec_func(
/*======================*/ /*===========================*/
dict_index_t* index, /*!< in: index */ dict_index_t* index, /*!< in: index */
const dtuple_t* tuple, /*!< in: tuple on which search done */ const dtuple_t* tuple, /*!< in: tuple on which search done */
ulint mode, /*!< in: PAGE_CUR_L, ... */ ulint mode, /*!< in: PAGE_CUR_L, ... */
...@@ -169,17 +178,25 @@ btr_pcur_open_on_user_rec( ...@@ -169,17 +178,25 @@ btr_pcur_open_on_user_rec(
BTR_MODIFY_LEAF */ BTR_MODIFY_LEAF */
btr_pcur_t* cursor, /*!< in: memory buffer for persistent btr_pcur_t* cursor, /*!< in: memory buffer for persistent
cursor */ cursor */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */ mtr_t* mtr); /*!< in: mtr */
#define btr_pcur_open_on_user_rec(i,t,md,l,c,m) \
btr_pcur_open_on_user_rec_func(i,t,md,l,c,__FILE__,__LINE__,m)
/**********************************************************************//** /**********************************************************************//**
Positions a cursor at a randomly chosen position within a B-tree. */ Positions a cursor at a randomly chosen position within a B-tree. */
UNIV_INLINE UNIV_INLINE
void void
btr_pcur_open_at_rnd_pos( btr_pcur_open_at_rnd_pos_func(
/*=====================*/ /*==========================*/
dict_index_t* index, /*!< in: index */ dict_index_t* index, /*!< in: index */
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in/out: B-tree pcur */ btr_pcur_t* cursor, /*!< in/out: B-tree pcur */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */ mtr_t* mtr); /*!< in: mtr */
#define btr_pcur_open_at_rnd_pos(i,l,c,m) \
btr_pcur_open_at_rnd_pos_func(i,l,c,__FILE__,__LINE__,m)
/**************************************************************//** /**************************************************************//**
Frees the possible old_rec_buf buffer of a persistent cursor and sets the Frees the possible old_rec_buf buffer of a persistent cursor and sets the
latch mode of the persistent cursor to BTR_NO_LATCHES. */ latch mode of the persistent cursor to BTR_NO_LATCHES. */
...@@ -218,11 +235,15 @@ record and it can be restored on a user record whose ordering fields ...@@ -218,11 +235,15 @@ record and it can be restored on a user record whose ordering fields
are identical to the ones of the original user record */ are identical to the ones of the original user record */
UNIV_INTERN UNIV_INTERN
ibool ibool
btr_pcur_restore_position( btr_pcur_restore_position_func(
/*======================*/ /*===========================*/
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in: detached persistent cursor */ btr_pcur_t* cursor, /*!< in: detached persistent cursor */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */ mtr_t* mtr); /*!< in: mtr */
#define btr_pcur_restore_position(l,cur,mtr) \
btr_pcur_restore_position_func(l,cur,__FILE__,__LINE__,mtr)
/**************************************************************//** /**************************************************************//**
If the latch mode of the cursor is BTR_LEAF_SEARCH or BTR_LEAF_MODIFY, If the latch mode of the cursor is BTR_LEAF_SEARCH or BTR_LEAF_MODIFY,
releases the page latch and bufferfix reserved by the cursor. releases the page latch and bufferfix reserved by the cursor.
......
...@@ -483,8 +483,8 @@ Initializes and opens a persistent cursor to an index tree. It should be ...@@ -483,8 +483,8 @@ Initializes and opens a persistent cursor to an index tree. It should be
closed with btr_pcur_close. */ closed with btr_pcur_close. */
UNIV_INLINE UNIV_INLINE
void void
btr_pcur_open( btr_pcur_open_func(
/*==========*/ /*===============*/
dict_index_t* index, /*!< in: index */ dict_index_t* index, /*!< in: index */
const dtuple_t* tuple, /*!< in: tuple on which search done */ const dtuple_t* tuple, /*!< in: tuple on which search done */
ulint mode, /*!< in: PAGE_CUR_L, ...; ulint mode, /*!< in: PAGE_CUR_L, ...;
...@@ -495,6 +495,8 @@ btr_pcur_open( ...@@ -495,6 +495,8 @@ btr_pcur_open(
record! */ record! */
ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */ ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
{ {
btr_cur_t* btr_cursor; btr_cur_t* btr_cursor;
...@@ -511,7 +513,7 @@ btr_pcur_open( ...@@ -511,7 +513,7 @@ btr_pcur_open(
btr_cursor = btr_pcur_get_btr_cur(cursor); btr_cursor = btr_pcur_get_btr_cur(cursor);
btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode, btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
btr_cursor, 0, mtr); btr_cursor, 0, file, line, mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED; cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->trx_if_known = NULL; cursor->trx_if_known = NULL;
...@@ -522,8 +524,8 @@ Opens an persistent cursor to an index tree without initializing the ...@@ -522,8 +524,8 @@ Opens an persistent cursor to an index tree without initializing the
cursor. */ cursor. */
UNIV_INLINE UNIV_INLINE
void void
btr_pcur_open_with_no_init( btr_pcur_open_with_no_init_func(
/*=======================*/ /*============================*/
dict_index_t* index, /*!< in: index */ dict_index_t* index, /*!< in: index */
const dtuple_t* tuple, /*!< in: tuple on which search done */ const dtuple_t* tuple, /*!< in: tuple on which search done */
ulint mode, /*!< in: PAGE_CUR_L, ...; ulint mode, /*!< in: PAGE_CUR_L, ...;
...@@ -541,6 +543,8 @@ btr_pcur_open_with_no_init( ...@@ -541,6 +543,8 @@ btr_pcur_open_with_no_init(
ulint has_search_latch,/*!< in: latch mode the caller ulint has_search_latch,/*!< in: latch mode the caller
currently has on btr_search_latch: currently has on btr_search_latch:
RW_S_LATCH, or 0 */ RW_S_LATCH, or 0 */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
{ {
btr_cur_t* btr_cursor; btr_cur_t* btr_cursor;
...@@ -553,7 +557,8 @@ btr_pcur_open_with_no_init( ...@@ -553,7 +557,8 @@ btr_pcur_open_with_no_init(
btr_cursor = btr_pcur_get_btr_cur(cursor); btr_cursor = btr_pcur_get_btr_cur(cursor);
btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode, btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
btr_cursor, has_search_latch, mtr); btr_cursor, has_search_latch,
file, line, mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED; cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED; cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
...@@ -600,11 +605,13 @@ btr_pcur_open_at_index_side( ...@@ -600,11 +605,13 @@ btr_pcur_open_at_index_side(
Positions a cursor at a randomly chosen position within a B-tree. */ Positions a cursor at a randomly chosen position within a B-tree. */
UNIV_INLINE UNIV_INLINE
void void
btr_pcur_open_at_rnd_pos( btr_pcur_open_at_rnd_pos_func(
/*=====================*/ /*==========================*/
dict_index_t* index, /*!< in: index */ dict_index_t* index, /*!< in: index */
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in/out: B-tree pcur */ btr_pcur_t* cursor, /*!< in/out: B-tree pcur */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
{ {
/* Initialize the cursor */ /* Initialize the cursor */
...@@ -614,8 +621,9 @@ btr_pcur_open_at_rnd_pos( ...@@ -614,8 +621,9 @@ btr_pcur_open_at_rnd_pos(
btr_pcur_init(cursor); btr_pcur_init(cursor);
btr_cur_open_at_rnd_pos(index, latch_mode, btr_cur_open_at_rnd_pos_func(index, latch_mode,
btr_pcur_get_btr_cur(cursor), mtr); btr_pcur_get_btr_cur(cursor),
file, line, mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED; cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED; cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
......
...@@ -207,20 +207,14 @@ with care. */ ...@@ -207,20 +207,14 @@ with care. */
#define buf_page_get_with_no_latch(SP, ZS, OF, MTR) buf_page_get_gen(\ #define buf_page_get_with_no_latch(SP, ZS, OF, MTR) buf_page_get_gen(\
SP, ZS, OF, RW_NO_LATCH, NULL,\ SP, ZS, OF, RW_NO_LATCH, NULL,\
BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR) BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR)
/**************************************************************//**
NOTE! The following macros should be used instead of
buf_page_optimistic_get_func, to improve debugging. Only values RW_S_LATCH and
RW_X_LATCH are allowed as LA! */
#define buf_page_optimistic_get(LA, BL, MC, MTR) \
buf_page_optimistic_get_func(LA, BL, MC, __FILE__, __LINE__, MTR)
/********************************************************************//** /********************************************************************//**
This is the general function used to get optimistic access to a database This is the general function used to get optimistic access to a database
page. page.
@return TRUE if success */ @return TRUE if success */
UNIV_INTERN UNIV_INTERN
ibool ibool
buf_page_optimistic_get_func( buf_page_optimistic_get(
/*=========================*/ /*====================*/
ulint rw_latch,/*!< in: RW_S_LATCH, RW_X_LATCH */ ulint rw_latch,/*!< in: RW_S_LATCH, RW_X_LATCH */
buf_block_t* block, /*!< in: guessed block */ buf_block_t* block, /*!< in: guessed block */
ib_uint64_t modify_clock,/*!< in: modify clock value if mode is ib_uint64_t modify_clock,/*!< in: modify clock value if mode is
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/*****************************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 2009, Google Inc. Copyright (c) 2009, Google Inc.
......
/*****************************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/*********************************************************************** /***********************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
......
...@@ -451,6 +451,12 @@ row_drop_table_for_mysql( ...@@ -451,6 +451,12 @@ row_drop_table_for_mysql(
const char* name, /*!< in: table name */ const char* name, /*!< in: table name */
trx_t* trx, /*!< in: transaction handle */ trx_t* trx, /*!< in: transaction handle */
ibool drop_db);/*!< in: TRUE=dropping whole database */ ibool drop_db);/*!< in: TRUE=dropping whole database */
/*********************************************************************//**
Drop all temporary tables during crash recovery. */
UNIV_INTERN
void
row_mysql_drop_temp_tables(void);
/*============================*/
/*********************************************************************//** /*********************************************************************//**
Discards the tablespace of a table which stored in an .ibd file. Discarding Discards the tablespace of a table which stored in an .ibd file. Discarding
...@@ -494,14 +500,19 @@ row_rename_table_for_mysql( ...@@ -494,14 +500,19 @@ row_rename_table_for_mysql(
trx_t* trx, /*!< in: transaction handle */ trx_t* trx, /*!< in: transaction handle */
ibool commit); /*!< in: if TRUE then commit trx */ ibool commit); /*!< in: if TRUE then commit trx */
/*********************************************************************//** /*********************************************************************//**
Checks a table for corruption. Checks that the index contains entries in an ascending order, unique
@return DB_ERROR or DB_SUCCESS */ constraint is not broken, and calculates the number of index entries
in the read view of the current transaction.
@return DB_SUCCESS if ok */
UNIV_INTERN UNIV_INTERN
ulint ulint
row_check_table_for_mysql( row_check_index_for_mysql(
/*======================*/ /*======================*/
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in MySQL row_prebuilt_t* prebuilt, /*!< in: prebuilt struct
handle */ in MySQL handle */
const dict_index_t* index, /*!< in: index */
ulint* n_rows); /*!< out: number of entries
seen in the consistent read */
/*********************************************************************//** /*********************************************************************//**
Determines if a table is a magic monitor table. Determines if a table is a magic monitor table.
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, 2009, Google Inc. Copyright (c) 2008, 2009, Google Inc.
Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
...@@ -9,6 +10,13 @@ briefly in the InnoDB documentation. The contributions by Google are ...@@ -9,6 +10,13 @@ briefly in the InnoDB documentation. The contributions by Google are
incorporated with their permission, and subject to the conditions contained in incorporated with their permission, and subject to the conditions contained in
the file COPYING.Google. the file COPYING.Google.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
gratefully acknowledged and are described briefly in the InnoDB
documentation. The contributions by Percona Inc. are incorporated with
their permission, and subject to the conditions contained in the file
COPYING.Percona.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License. Foundation; version 2 of the License.
...@@ -22,32 +30,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple ...@@ -22,32 +30,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/ *****************************************************************************/
/***********************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
gratefully acknowledged and are described briefly in the InnoDB
documentation. The contributions by Percona Inc. are incorporated with
their permission, and subject to the conditions contained in the file
COPYING.Percona.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
/**************************************************//** /**************************************************//**
@file include/srv0srv.h @file include/srv0srv.h
......
...@@ -526,6 +526,9 @@ struct trx_struct{ ...@@ -526,6 +526,9 @@ struct trx_struct{
/* 0, RW_S_LATCH, or RW_X_LATCH: /* 0, RW_S_LATCH, or RW_X_LATCH:
the latch mode trx currently holds the latch mode trx currently holds
on dict_operation_lock */ on dict_operation_lock */
unsigned deadlock_mark:1;/*!< a mark field used in deadlock
checking algorithm. Always protected
by the kernel_mutex. */
time_t start_time; /*!< time the trx object was created time_t start_time; /*!< time the trx object was created
or the state last time became or the state last time became
TRX_ACTIVE */ TRX_ACTIVE */
...@@ -640,11 +643,6 @@ struct trx_struct{ ...@@ -640,11 +643,6 @@ struct trx_struct{
wait_thrs; /*!< query threads belonging to this wait_thrs; /*!< query threads belonging to this
trx that are in the QUE_THR_LOCK_WAIT trx that are in the QUE_THR_LOCK_WAIT
state */ state */
ulint deadlock_mark; /*!< a mark field used in deadlock
checking algorithm. This must be
in its own machine word, because
it can be changed by other
threads while holding kernel_mutex. */
/*------------------------------*/ /*------------------------------*/
mem_heap_t* lock_heap; /*!< memory heap for the locks of the mem_heap_t* lock_heap; /*!< memory heap for the locks of the
transaction */ transaction */
......
...@@ -401,7 +401,7 @@ lock_deadlock_recursive( ...@@ -401,7 +401,7 @@ lock_deadlock_recursive(
/*====================*/ /*====================*/
trx_t* start, /*!< in: recursion starting point */ trx_t* start, /*!< in: recursion starting point */
trx_t* trx, /*!< in: a transaction waiting for a lock */ trx_t* trx, /*!< in: a transaction waiting for a lock */
lock_t* wait_lock, /*!< in: the lock trx is waiting to be granted */ lock_t* wait_lock, /*!< in: lock that is waiting to be granted */
ulint* cost, /*!< in/out: number of calculation steps thus ulint* cost, /*!< in/out: number of calculation steps thus
far: if this exceeds LOCK_MAX_N_STEPS_... far: if this exceeds LOCK_MAX_N_STEPS_...
we return LOCK_VICTIM_IS_START */ we return LOCK_VICTIM_IS_START */
...@@ -411,7 +411,7 @@ lock_deadlock_recursive( ...@@ -411,7 +411,7 @@ lock_deadlock_recursive(
/*********************************************************************//** /*********************************************************************//**
Gets the nth bit of a record lock. Gets the nth bit of a record lock.
@return TRUE if bit set */ @return TRUE if bit set also if i == ULINT_UNDEFINED return FALSE*/
UNIV_INLINE UNIV_INLINE
ibool ibool
lock_rec_get_nth_bit( lock_rec_get_nth_bit(
...@@ -1222,7 +1222,7 @@ lock_rec_get_first_on_page( ...@@ -1222,7 +1222,7 @@ lock_rec_get_first_on_page(
/*********************************************************************//** /*********************************************************************//**
Gets the next explicit lock request on a record. Gets the next explicit lock request on a record.
@return next lock, NULL if none exists */ @return next lock, NULL if none exists or if heap_no == ULINT_UNDEFINED */
UNIV_INLINE UNIV_INLINE
lock_t* lock_t*
lock_rec_get_next( lock_rec_get_next(
...@@ -3324,7 +3324,7 @@ lock_deadlock_recursive( ...@@ -3324,7 +3324,7 @@ lock_deadlock_recursive(
/*====================*/ /*====================*/
trx_t* start, /*!< in: recursion starting point */ trx_t* start, /*!< in: recursion starting point */
trx_t* trx, /*!< in: a transaction waiting for a lock */ trx_t* trx, /*!< in: a transaction waiting for a lock */
lock_t* wait_lock, /*!< in: the lock trx is waiting to be granted */ lock_t* wait_lock, /*!< in: lock that is waiting to be granted */
ulint* cost, /*!< in/out: number of calculation steps thus ulint* cost, /*!< in/out: number of calculation steps thus
far: if this exceeds LOCK_MAX_N_STEPS_... far: if this exceeds LOCK_MAX_N_STEPS_...
we return LOCK_VICTIM_IS_START */ we return LOCK_VICTIM_IS_START */
...@@ -3332,10 +3332,10 @@ lock_deadlock_recursive( ...@@ -3332,10 +3332,10 @@ lock_deadlock_recursive(
LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we
return LOCK_VICTIM_IS_START */ return LOCK_VICTIM_IS_START */
{ {
ulint ret;
lock_t* lock; lock_t* lock;
ulint bit_no = ULINT_UNDEFINED;
trx_t* lock_trx; trx_t* lock_trx;
ulint ret; ulint heap_no = ULINT_UNDEFINED;
ut_a(trx); ut_a(trx);
ut_a(start); ut_a(start);
...@@ -3351,27 +3351,44 @@ lock_deadlock_recursive( ...@@ -3351,27 +3351,44 @@ lock_deadlock_recursive(
*cost = *cost + 1; *cost = *cost + 1;
lock = wait_lock;
if (lock_get_type_low(wait_lock) == LOCK_REC) { if (lock_get_type_low(wait_lock) == LOCK_REC) {
ulint space;
ulint page_no;
heap_no = lock_rec_find_set_bit(wait_lock);
ut_a(heap_no != ULINT_UNDEFINED);
bit_no = lock_rec_find_set_bit(wait_lock); space = wait_lock->un_member.rec_lock.space;
page_no = wait_lock->un_member.rec_lock.page_no;
lock = lock_rec_get_first_on_page_addr(space, page_no);
/* Position the iterator on the first matching record lock. */
while (lock != NULL
&& lock != wait_lock
&& !lock_rec_get_nth_bit(lock, heap_no)) {
ut_a(bit_no != ULINT_UNDEFINED); lock = lock_rec_get_next_on_page(lock);
} }
/* Look at the locks ahead of wait_lock in the lock queue */ if (lock == wait_lock) {
lock = NULL;
}
for (;;) { ut_ad(lock == NULL || lock_rec_get_nth_bit(lock, heap_no));
if (lock_get_type_low(lock) & LOCK_TABLE) {
lock = UT_LIST_GET_PREV(un_member.tab_lock.locks,
lock);
} else { } else {
ut_ad(lock_get_type_low(lock) == LOCK_REC); lock = wait_lock;
ut_a(bit_no != ULINT_UNDEFINED); }
/* Look at the locks ahead of wait_lock in the lock queue */
for (;;) {
/* Get previous table lock. */
if (heap_no == ULINT_UNDEFINED) {
lock = (lock_t*) lock_rec_get_prev(lock, bit_no); lock = UT_LIST_GET_PREV(
un_member.tab_lock.locks, lock);
} }
if (lock == NULL) { if (lock == NULL) {
...@@ -3493,12 +3510,28 @@ lock_deadlock_recursive( ...@@ -3493,12 +3510,28 @@ lock_deadlock_recursive(
ret = lock_deadlock_recursive( ret = lock_deadlock_recursive(
start, lock_trx, start, lock_trx,
lock_trx->wait_lock, cost, depth + 1); lock_trx->wait_lock, cost, depth + 1);
if (ret != 0) { if (ret != 0) {
return(ret); return(ret);
} }
} }
} }
/* Get the next record lock to check. */
if (heap_no != ULINT_UNDEFINED) {
ut_a(lock != NULL);
do {
lock = lock_rec_get_next_on_page(lock);
} while (lock != NULL
&& lock != wait_lock
&& !lock_rec_get_nth_bit(lock, heap_no));
if (lock == wait_lock) {
lock = NULL;
}
}
}/* end of the 'for (;;)'-loop */ }/* end of the 'for (;;)'-loop */
} }
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/*****************************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 2009, Google Inc. Copyright (c) 2009, Google Inc.
......
...@@ -3283,6 +3283,8 @@ recv_recovery_from_checkpoint_finish(void) ...@@ -3283,6 +3283,8 @@ recv_recovery_from_checkpoint_finish(void)
/* Drop partially created indexes. */ /* Drop partially created indexes. */
row_merge_drop_temp_indexes(); row_merge_drop_temp_indexes();
/* Drop temporary tables. */
row_mysql_drop_temp_tables();
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
/* Wait for a while so that created threads have time to suspend /* Wait for a while so that created threads have time to suspend
......
drop table if exists t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null);
ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
SELECT * FROM t1;
d1
1
2
SELECT * FROM t1;
d1
1
2
INSERT INTO t1 VALUES(null);
Got one of the listed errors
ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`d1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
d1
1
2
3
DROP TABLE t1;
-- source include/have_innodb.inc
# embedded server ignores 'delayed', so skip this
-- source include/not_embedded.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
# the index (PRIMARY)
# This test requires a restart of the server
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null);
ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
SELECT * FROM t1;
# Restart the server
-- source include/restart_mysqld.inc
# The MySQL and InnoDB data dictionaries should now be out of sync.
# The select should print message to the error log
SELECT * FROM t1;
# MySQL have made a change (http://lists.mysql.com/commits/75268) that no
# longer results in the two data dictionaries being out of sync. If they
# revert their changes then this check for ER_AUTOINC_READ_FAILED will need
# to be enabled. Also, see http://bugs.mysql.com/bug.php?id=47621.
-- error ER_AUTOINC_READ_FAILED,1467
INSERT INTO t1 VALUES(null);
ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
DROP TABLE t1;
...@@ -868,35 +868,6 @@ Got one of the listed errors ...@@ -868,35 +868,6 @@ Got one of the listed errors
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null);
ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
SELECT * FROM t1;
d1
1
2
SELECT * FROM t1;
d1
1
2
INSERT INTO t1 VALUES(null);
Got one of the listed errors
ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`d1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
d1
1
2
3
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SHOW VARIABLES LIKE "%auto_inc%"; SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value Variable_name Value
auto_increment_increment 1 auto_increment_increment 1
...@@ -1190,3 +1161,86 @@ t1 CREATE TABLE `t1` ( ...@@ -1190,3 +1161,86 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`) PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL);
SELECT * FROM t1;
c1
-685113344
1
2
3
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL);
SELECT * FROM t1;
c1
-685113344
2
3
4
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL);
INSERT INTO t1 VALUES (4), (5), (6), (NULL);
SELECT * FROM t1;
c1
-685113344
1
2
3
4
5
6
7
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5);
SELECT * FROM t1;
c1
-685113344
1
2
5
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL);
SELECT * FROM t1;
c1
-685113344
1
2
3
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
DROP TABLE t1;
...@@ -478,28 +478,6 @@ INSERT INTO t2 SELECT c1 FROM t1; ...@@ -478,28 +478,6 @@ INSERT INTO t2 SELECT c1 FROM t1;
INSERT INTO t2 SELECT NULL FROM t1; INSERT INTO t2 SELECT NULL FROM t1;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
#
# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
# the index (PRIMARY)
# This test requires a restart of the server
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null);
ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
SELECT * FROM t1;
# Restart the server
-- source include/restart_mysqld.inc
# The MySQL and InnoDB data dictionaries should now be out of sync.
# The select should print message to the error log
SELECT * FROM t1;
-- error ER_AUTOINC_READ_FAILED,1467
INSERT INTO t1 VALUES(null);
ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
DROP TABLE t1;
# If the user has specified negative values for an AUTOINC column then # If the user has specified negative values for an AUTOINC column then
# InnoDB should ignore those values when setting the table's max value. # InnoDB should ignore those values when setting the table's max value.
...@@ -653,3 +631,34 @@ REPLACE INTO t1 VALUES (-1); ...@@ -653,3 +631,34 @@ REPLACE INTO t1 VALUES (-1);
SELECT * FROM t1; SELECT * FROM t1;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
##
# 49497: Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL);
INSERT INTO t1 VALUES (4), (5), (6), (NULL);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE bug47622(
`rule_key` int(11) NOT NULL DEFAULT '0',
`seq` smallint(6) NOT NULL DEFAULT '0',
`action` smallint(6) NOT NULL DEFAULT '0',
`arg_id` smallint(6) DEFAULT NULL,
`else_ind` TINYINT NOT NULL,
KEY IDX_A (`arg_id`)
) ENGINE=InnoDB;
ALTER TABLE bug47622 ADD UNIQUE IDX_B (rule_key,else_ind,seq,action,arg_id);
drop index IDX_B on bug47622;
create index idx on bug47622(seq, arg_id);
ALTER TABLE bug47622 ADD UNIQUE IDX_X (rule_key,else_ind,seq,action);
drop table bug47622;
CREATE TABLE bug47622 (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`d` varchar(20) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `b` (`b`)
) ENGINE=InnoDB;
alter table bug47622 add unique index (c), add index (d);
drop table bug47622;
# This is the test for bug 47622. There could be index
# metadata sequence mismatch between MySQL and Innodb
# after creating index through FIC interfaces.
# We resolve the problem by sync the index sequence
# up when opening the table.
--source include/have_innodb.inc
connect (a,localhost,root,,);
connect (b,localhost,root,,);
# Create a table with a non-unique index
CREATE TABLE bug47622(
`rule_key` int(11) NOT NULL DEFAULT '0',
`seq` smallint(6) NOT NULL DEFAULT '0',
`action` smallint(6) NOT NULL DEFAULT '0',
`arg_id` smallint(6) DEFAULT NULL,
`else_ind` TINYINT NOT NULL,
KEY IDX_A (`arg_id`)
) ENGINE=InnoDB;
connection a;
# A subsequent creating unique index should not trigger
# any error message. Unique index would be ranked ahead
# of regular index.
ALTER TABLE bug47622 ADD UNIQUE IDX_B (rule_key,else_ind,seq,action,arg_id);
drop index IDX_B on bug47622;
# In another connection, create additional set of normal
# index and unique index. Again, unique index would be ranked
# ahead of regular index.
connection b;
create index idx on bug47622(seq, arg_id);
ALTER TABLE bug47622 ADD UNIQUE IDX_X (rule_key,else_ind,seq,action);
drop table bug47622;
# Create a table with one Primary key and a non-unique key
CREATE TABLE bug47622 (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`d` varchar(20) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `b` (`b`)
) ENGINE=InnoDB;
# Add two index with one unique and one non-unique.
# Index sequence is "PRIMARY", "c", "b" and "d"
alter table bug47622 add unique index (c), add index (d);
drop table bug47622;
/*****************************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/*********************************************************************** /***********************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
......
...@@ -1994,7 +1994,8 @@ row_ins_index_entry_low( ...@@ -1994,7 +1994,8 @@ row_ins_index_entry_low(
} }
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE, btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
search_mode, &cursor, 0, &mtr); search_mode,
&cursor, 0, __FILE__, __LINE__, &mtr);
if (cursor.flag == BTR_CUR_INSERT_TO_IBUF) { if (cursor.flag == BTR_CUR_INSERT_TO_IBUF) {
/* The insertion was made to the insert buffer already during /* The insertion was made to the insert buffer already during
...@@ -2053,7 +2054,8 @@ row_ins_index_entry_low( ...@@ -2053,7 +2054,8 @@ row_ins_index_entry_low(
btr_cur_search_to_nth_level(index, 0, entry, btr_cur_search_to_nth_level(index, 0, entry,
PAGE_CUR_LE, PAGE_CUR_LE,
mode | BTR_INSERT, mode | BTR_INSERT,
&cursor, 0, &mtr); &cursor, 0,
__FILE__, __LINE__, &mtr);
} }
} }
...@@ -2108,7 +2110,8 @@ function_exit: ...@@ -2108,7 +2110,8 @@ function_exit:
mtr_start(&mtr); mtr_start(&mtr);
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE, btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
BTR_MODIFY_TREE, &cursor, 0, &mtr); BTR_MODIFY_TREE, &cursor, 0,
__FILE__, __LINE__, &mtr);
rec = btr_cur_get_rec(&cursor); rec = btr_cur_get_rec(&cursor);
offsets = rec_get_offsets(rec, index, NULL, offsets = rec_get_offsets(rec, index, NULL,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
......
...@@ -485,7 +485,7 @@ next_column: ...@@ -485,7 +485,7 @@ next_column:
/****************************************************************//** /****************************************************************//**
Handles user errors and lock waits detected by the database engine. Handles user errors and lock waits detected by the database engine.
@return TRUE if it was a lock wait and we should continue running the @return TRUE if it was a lock wait and we should continue running the
query thread */ query thread and in that case the thr is ALREADY in the running state. */
UNIV_INTERN UNIV_INTERN
ibool ibool
row_mysql_handle_errors( row_mysql_handle_errors(
...@@ -3363,6 +3363,99 @@ funct_exit: ...@@ -3363,6 +3363,99 @@ funct_exit:
return((int) err); return((int) err);
} }
/*********************************************************************//**
Drop all temporary tables during crash recovery. */
UNIV_INTERN
void
row_mysql_drop_temp_tables(void)
/*============================*/
{
trx_t* trx;
ulint err;
trx = trx_allocate_for_background();
trx->op_info = "dropping temporary tables";
row_mysql_lock_data_dictionary(trx);
err = que_eval_sql(
NULL,
"PROCEDURE DROP_TEMP_TABLES_PROC () IS\n"
"table_name CHAR;\n"
"table_id CHAR;\n"
"foreign_id CHAR;\n"
"index_id CHAR;\n"
"DECLARE CURSOR c IS SELECT NAME,ID FROM SYS_TABLES\n"
"WHERE N_COLS > 2147483647\n"
/* N_COLS>>31 is set unless ROW_FORMAT=REDUNDANT,
and MIX_LEN may be garbage for those tables */
"AND MIX_LEN=(MIX_LEN/2*2+1);\n"
/* MIX_LEN & 1 is set for temporary tables */
#if DICT_TF2_TEMPORARY != 1
# error "DICT_TF2_TEMPORARY != 1"
#endif
"BEGIN\n"
"OPEN c;\n"
"WHILE 1=1 LOOP\n"
" FETCH c INTO table_name, table_id;\n"
" IF (SQL % NOTFOUND) THEN\n"
" EXIT;\n"
" END IF;\n"
" WHILE 1=1 LOOP\n"
" SELECT ID INTO index_id\n"
" FROM SYS_INDEXES\n"
" WHERE TABLE_ID = table_id\n"
" LOCK IN SHARE MODE;\n"
" IF (SQL % NOTFOUND) THEN\n"
" EXIT;\n"
" END IF;\n"
/* Do not drop tables for which there exist
foreign key constraints. */
" SELECT ID INTO foreign_id\n"
" FROM SYS_FOREIGN\n"
" WHERE FOR_NAME = table_name\n"
" AND TO_BINARY(FOR_NAME)\n"
" = TO_BINARY(table_name)\n;"
" IF NOT (SQL % NOTFOUND) THEN\n"
" EXIT;\n"
" END IF;\n"
" SELECT ID INTO foreign_id\n"
" FROM SYS_FOREIGN\n"
" WHERE REF_NAME = table_name\n"
" AND TO_BINARY(REF_NAME)\n"
" = TO_BINARY(table_name)\n;"
" IF NOT (SQL % NOTFOUND) THEN\n"
" EXIT;\n"
" END IF;\n"
" DELETE FROM SYS_FIELDS\n"
" WHERE INDEX_ID = index_id;\n"
" DELETE FROM SYS_INDEXES\n"
" WHERE ID = index_id\n"
" AND TABLE_ID = table_id;\n"
" END LOOP;\n"
" DELETE FROM SYS_COLUMNS\n"
" WHERE TABLE_ID = table_id;\n"
" DELETE FROM SYS_TABLES\n"
" WHERE ID = table_id;\n"
"END LOOP;\n"
"COMMIT WORK;\n"
"END;\n"
, FALSE, trx);
if (err != DB_SUCCESS) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Failed to drop temporary tables:"
" error %lu occurred\n",
(ulong) err);
}
row_mysql_unlock_data_dictionary(trx);
trx_free_for_background(trx);
}
/*******************************************************************//** /*******************************************************************//**
Drop all foreign keys in a database, see Bug#18942. Drop all foreign keys in a database, see Bug#18942.
Called at the end of row_drop_database_for_mysql(). Called at the end of row_drop_database_for_mysql().
...@@ -3914,14 +4007,15 @@ Checks that the index contains entries in an ascending order, unique ...@@ -3914,14 +4007,15 @@ Checks that the index contains entries in an ascending order, unique
constraint is not broken, and calculates the number of index entries constraint is not broken, and calculates the number of index entries
in the read view of the current transaction. in the read view of the current transaction.
@return TRUE if ok */ @return TRUE if ok */
static UNIV_INTERN
ibool ibool
row_scan_and_check_index( row_check_index_for_mysql(
/*=====================*/ /*======================*/
row_prebuilt_t* prebuilt, /*!< in: prebuilt struct in MySQL */ row_prebuilt_t* prebuilt, /*!< in: prebuilt struct
dict_index_t* index, /*!< in: index */ in MySQL handle */
ulint* n_rows) /*!< out: number of entries seen in the const dict_index_t* index, /*!< in: index */
current consistent read */ ulint* n_rows) /*!< out: number of entries
seen in the consistent read */
{ {
dtuple_t* prev_entry = NULL; dtuple_t* prev_entry = NULL;
ulint matched_fields; ulint matched_fields;
...@@ -3942,31 +4036,9 @@ row_scan_and_check_index( ...@@ -3942,31 +4036,9 @@ row_scan_and_check_index(
*n_rows = 0; *n_rows = 0;
if (!row_merge_is_index_usable(prebuilt->trx, index)) {
/* A newly created index may lack some delete-marked
records that may exist in the read view of
prebuilt->trx. Thus, such indexes must not be
accessed by consistent read. */
return(is_ok);
}
buf = mem_alloc(UNIV_PAGE_SIZE); buf = mem_alloc(UNIV_PAGE_SIZE);
heap = mem_heap_create(100); heap = mem_heap_create(100);
/* Make a dummy template in prebuilt, which we will use
in scanning the index entries */
prebuilt->index = index;
/* row_merge_is_index_usable() was already checked above. */
prebuilt->index_usable = TRUE;
prebuilt->sql_stat_start = TRUE;
prebuilt->template_type = ROW_MYSQL_DUMMY_TEMPLATE;
prebuilt->n_template = 0;
prebuilt->need_to_access_clustered = FALSE;
dtuple_set_n_fields(prebuilt->search_tuple, 0);
prebuilt->select_lock_type = LOCK_NONE;
cnt = 1000; cnt = 1000;
ret = row_search_for_mysql(buf, PAGE_CUR_G, prebuilt, 0, 0); ret = row_search_for_mysql(buf, PAGE_CUR_G, prebuilt, 0, 0);
...@@ -4084,119 +4156,6 @@ not_ok: ...@@ -4084,119 +4156,6 @@ not_ok:
goto loop; goto loop;
} }
/*********************************************************************//**
Checks a table for corruption.
@return DB_ERROR or DB_SUCCESS */
UNIV_INTERN
ulint
row_check_table_for_mysql(
/*======================*/
row_prebuilt_t* prebuilt) /*!< in: prebuilt struct in MySQL
handle */
{
dict_table_t* table = prebuilt->table;
dict_index_t* index;
ulint n_rows;
ulint n_rows_in_table = ULINT_UNDEFINED;
ulint ret = DB_SUCCESS;
ulint old_isolation_level;
if (table->ibd_file_missing) {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Error:\n"
"InnoDB: MySQL is trying to use a table handle"
" but the .ibd file for\n"
"InnoDB: table %s does not exist.\n"
"InnoDB: Have you deleted the .ibd file"
" from the database directory under\n"
"InnoDB: the MySQL datadir, or have you"
" used DISCARD TABLESPACE?\n"
"InnoDB: Look from\n"
"InnoDB: " REFMAN "innodb-troubleshooting.html\n"
"InnoDB: how you can resolve the problem.\n",
table->name);
return(DB_ERROR);
}
prebuilt->trx->op_info = "checking table";
old_isolation_level = prebuilt->trx->isolation_level;
/* We must run the index record counts at an isolation level
>= READ COMMITTED, because a dirty read can see a wrong number
of records in some index; to play safe, we use always
REPEATABLE READ here */
prebuilt->trx->isolation_level = TRX_ISO_REPEATABLE_READ;
/* Enlarge the fatal lock wait timeout during CHECK TABLE. */
mutex_enter(&kernel_mutex);
srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
mutex_exit(&kernel_mutex);
index = dict_table_get_first_index(table);
while (index != NULL) {
/* fputs("Validating index ", stderr);
ut_print_name(stderr, trx, FALSE, index->name);
putc('\n', stderr); */
if (!btr_validate_index(index, prebuilt->trx)) {
ret = DB_ERROR;
} else {
if (!row_scan_and_check_index(prebuilt,index, &n_rows)){
ret = DB_ERROR;
}
if (trx_is_interrupted(prebuilt->trx)) {
ret = DB_INTERRUPTED;
break;
}
/* fprintf(stderr, "%lu entries in index %s\n", n_rows,
index->name); */
if (index == dict_table_get_first_index(table)) {
n_rows_in_table = n_rows;
} else if (n_rows != n_rows_in_table) {
ret = DB_ERROR;
fputs("Error: ", stderr);
dict_index_name_print(stderr,
prebuilt->trx, index);
fprintf(stderr,
" contains %lu entries,"
" should be %lu\n",
(ulong) n_rows,
(ulong) n_rows_in_table);
}
}
index = dict_table_get_next_index(index);
}
/* Restore the original isolation level */
prebuilt->trx->isolation_level = old_isolation_level;
/* We validate also the whole adaptive hash index for all tables
at every CHECK TABLE */
if (!btr_search_validate()) {
ret = DB_ERROR;
}
/* Restore the fatal lock wait timeout after CHECK TABLE. */
mutex_enter(&kernel_mutex);
srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
mutex_exit(&kernel_mutex);
prebuilt->trx->op_info = "";
return(ret);
}
/*********************************************************************//** /*********************************************************************//**
Determines if a table is a magic monitor table. Determines if a table is a magic monitor table.
@return TRUE if monitor table */ @return TRUE if monitor table */
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
...@@ -9,6 +10,13 @@ briefly in the InnoDB documentation. The contributions by Google are ...@@ -9,6 +10,13 @@ briefly in the InnoDB documentation. The contributions by Google are
incorporated with their permission, and subject to the conditions contained in incorporated with their permission, and subject to the conditions contained in
the file COPYING.Google. the file COPYING.Google.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
gratefully acknowledged and are described briefly in the InnoDB
documentation. The contributions by Percona Inc. are incorporated with
their permission, and subject to the conditions contained in the file
COPYING.Percona.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License. Foundation; version 2 of the License.
...@@ -22,32 +30,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple ...@@ -22,32 +30,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/ *****************************************************************************/
/***********************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
gratefully acknowledged and are described briefly in the InnoDB
documentation. The contributions by Percona Inc. are incorporated with
their permission, and subject to the conditions contained in the file
COPYING.Percona.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
/**************************************************//** /**************************************************//**
@file srv/srv0srv.c @file srv/srv0srv.c
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, Google Inc. Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
...@@ -9,6 +10,13 @@ briefly in the InnoDB documentation. The contributions by Google are ...@@ -9,6 +10,13 @@ briefly in the InnoDB documentation. The contributions by Google are
incorporated with their permission, and subject to the conditions contained in incorporated with their permission, and subject to the conditions contained in
the file COPYING.Google. the file COPYING.Google.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
gratefully acknowledged and are described briefly in the InnoDB
documentation. The contributions by Percona Inc. are incorporated with
their permission, and subject to the conditions contained in the file
COPYING.Percona.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License. Foundation; version 2 of the License.
...@@ -22,32 +30,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple ...@@ -22,32 +30,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/ *****************************************************************************/
/***********************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
gratefully acknowledged and are described briefly in the InnoDB
documentation. The contributions by Percona Inc. are incorporated with
their permission, and subject to the conditions contained in the file
COPYING.Percona.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
/********************************************************************//** /********************************************************************//**
@file srv/srv0start.c @file srv/srv0start.c
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment