Browse Source

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

------------------------------------------------------------------------
  r6560 | sunny | 2010-02-04 16:11:23 +0200 (Thu, 04 Feb 2010) | 7 lines
  Changed paths:
     M /branches/zip/lock/lock0lock.c

  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
  ------------------------------------------------------------------------
  r6591 | marko | 2010-02-08 10:06:39 +0200 (Mon, 08 Feb 2010) | 3 lines
  Changed paths:
     M /branches/zip/row/row0merge.c

  branches/zip: row_merge_drop_index(): Remove redundant condition
  on SYS_INDEXES.TABLE_ID.  INDEX_ID must be instance-widely unique,
  because SYS_FIELDS is not indexed by TABLE_ID.
  ------------------------------------------------------------------------
  r6594 | marko | 2010-02-08 12:55:04 +0200 (Mon, 08 Feb 2010) | 2 lines
  Changed paths:
     M /branches/zip/rem/rem0rec.c

  branches/zip: rec_get_nth_field_offs_old():
  Replace if (!cond) ut_error; tests with ut_a(cond).
  ------------------------------------------------------------------------
  r6595 | marko | 2010-02-08 13:53:02 +0200 (Mon, 08 Feb 2010) | 1 line
  Changed paths:
     M /branches/zip/include/btr0pcur.h
     M /branches/zip/include/btr0pcur.ic

  branches/zip: btr_pcur_commit(): Unused function, remove.
  ------------------------------------------------------------------------
  r6608 | marko | 2010-02-09 11:02:37 +0200 (Tue, 09 Feb 2010) | 1 line
  Changed paths:
     M /branches/zip/handler/handler0alter.cc

  branches/zip: ha_innobase::add_index(): Check for !innodb_table.
  ------------------------------------------------------------------------
  r6609 | marko | 2010-02-09 13:45:40 +0200 (Tue, 09 Feb 2010) | 1 line
  Changed paths:
     M /branches/zip/dict/dict0dict.c

  branches/zip: dict_field_print_low(): Add const qualifier.
  ------------------------------------------------------------------------
  r6610 | marko | 2010-02-09 13:53:59 +0200 (Tue, 09 Feb 2010) | 17 lines
  Changed paths:
     M /branches/zip/dict/dict0boot.c
     M /branches/zip/include/dict0boot.h
     M /branches/zip/row/row0merge.c
     M /branches/zip/row/row0mysql.c

  branches/zip: When dropping temporary indexes and tables at startup,
  first load them to the data dictionary cache and use the normal
  routines for dropping tables or indexes.  This should reduce the
  risk of bugs and also make the code compatible with the upcoming
  TablespaceDictionary implementation.

  DICT_SYS_INDEXES_NAME_FIELD: The clustered index position of SYS_INDEXES.NAME.

  row_merge_drop_temp_indexes(): Scan SYS_INDEXES for tables containing
  temporary indexes, and load the tables as needed. Invoke
  row_merge_drop_index() to drop the indexes.

  row_mysql_drop_temp_tables(): Scan SYS_TABLES for temporary tables,
  load them with dict_load_table() and drop them with
  row_drop_table_for_mysql().

  rb://251, not yet reviewed
  ------------------------------------------------------------------------
  r6611 | marko | 2010-02-09 14:28:25 +0200 (Tue, 09 Feb 2010) | 11 lines
  Changed paths:
     M /branches/zip/include/log0recv.h
     M /branches/zip/log/log0recv.c
     M /branches/zip/srv/srv0start.c

  branches/zip: Roll back dictionary transaction(s) before scanning *.ibd files

  innobase_start_or_create_for_mysql(): Roll back data dictionary
  transactions before scanning the *.ibd files. Then, data dictionary
  records can be loaded to the cache before opening the *.ibd files.

  recv_recovery_rollback_active(): Refactored from
  recv_recovery_from_checkpoint_finish().

  rb://235, committing without review, because this is needed for
  TablespaceDictionary.
  ------------------------------------------------------------------------
  r6612 | marko | 2010-02-09 14:32:39 +0200 (Tue, 09 Feb 2010) | 3 lines
  Changed paths:
     M /branches/zip/log/log0recv.c

  branches/zip: recv_recovery_rollback_active():
  Drop the temporary tables and indexes after enabling sync order checks.
  This should not make any difference. This could have been done in r6611.
  ------------------------------------------------------------------------
  r6614 | inaam | 2010-02-09 20:26:23 +0200 (Tue, 09 Feb 2010) | 7 lines
  Changed paths:
     M /branches/zip/srv/srv0srv.c

  branches/plugin rb://242

  Let the master thread sleep if the amount of work to be done is
  calibrated as taking less than a second.

  Approved by: Heikki
  ------------------------------------------------------------------------
  r6631 | marko | 2010-02-10 09:19:52 +0200 (Wed, 10 Feb 2010) | 1 line
  Changed paths:
     M /branches/zip/ChangeLog

  branches/zip: Document r6614 in ChangeLog.
  ------------------------------------------------------------------------
  r6633 | marko | 2010-02-10 10:40:55 +0200 (Wed, 10 Feb 2010) | 31 lines
  Changed paths:
     M /branches/zip/ChangeLog
     M /branches/zip/buf/buf0buf.c
     M /branches/zip/lock/lock0lock.c

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

    ------------------------------------------------------------------------
    r6545 | jyang | 2010-02-03 03:57:32 +0200 (Wed, 03 Feb 2010) | 8 lines
    Changed paths:
       M /branches/5.1/lock/lock0lock.c

    branches/5.1: Fix bug #49001, "SHOW INNODB STATUS deadlock info
    incorrect when deadlock detection aborts". Print the correct
    lock owner when recursive function lock_deadlock_recursive()
    exceeds its maximum depth LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK.

    rb://217, approved by Marko.
    ------------------------------------------------------------------------
    r6613 | inaam | 2010-02-09 20:23:09 +0200 (Tue, 09 Feb 2010) | 11 lines
    Changed paths:
       M /branches/5.1/buf/buf0buf.c
       M /branches/5.1/buf/buf0rea.c
       M /branches/5.1/include/buf0rea.h

    branches/5.1: Fix Bug #38901
    InnoDB logs error repeatedly when trying to load page into buffer pool

    In buf_page_get_gen() if we are unable to read a page (because of
    corruption or some other reason) we keep on retrying. This fills up
    error log with millions of entries in no time and we'd eventually run
    out of disk space. This patch limits the number of attempts that we
    make (currently set to 100) and after that we abort with a message.

    rb://241 Approved by: Heikki
    ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r6635 | marko | 2010-02-10 11:07:05 +0200 (Wed, 10 Feb 2010) | 4 lines
  Changed paths:
     M /branches/zip/row/row0sel.c

  branches/zip: Clean up after r6559.  Now that
  btr_pcur_open_with_no_init() is a macro, do not mix preprocessor
  directives in the macro invocation, because it is implementation-defined
  whether that is going to work.
  ------------------------------------------------------------------------
  r6639 | marko | 2010-02-10 13:11:04 +0200 (Wed, 10 Feb 2010) | 1 line
  Changed paths:
     M /branches/zip/include/trx0rseg.h
     M /branches/zip/trx/trx0rseg.c

  branches/zip: trx_rseg_create(): Unused function, remove.
  ------------------------------------------------------------------------
  r6660 | marko | 2010-02-11 11:21:11 +0200 (Thu, 11 Feb 2010) | 7 lines
  Changed paths:
     M /branches/zip/row/row0umod.c

  branches/zip: Clarify the rollback of INSERT by UPDATE of delete-marked rec.

  row_undo_mod_remove_clust_low(): Augment the function comment.

  row_undo_mod_remove_clust_low(), row_undo_mod_del_mark_or_remove_sec_low(),
  row_undo_mod_del_mark_or_remove_sec(), row_undo_mod_upd_del_sec():
  Add ut_ad(node->rec_type == TRX_UNDO_UPD_DEL_REC);
  ------------------------------------------------------------------------
  r6672 | marko | 2010-02-11 13:01:18 +0200 (Thu, 11 Feb 2010) | 1 line
  Changed paths:
     M /branches/zip/include/que0que.h
     M /branches/zip/include/que0que.ic
     M /branches/zip/row/row0umod.c

  branches/zip: Introduce thr_is_recv().
  ------------------------------------------------------------------------
  r6673 | marko | 2010-02-11 13:09:48 +0200 (Thu, 11 Feb 2010) | 9 lines
  Changed paths:
     M /branches/zip/btr/btr0cur.c
     M /branches/zip/include/trx0types.h
     M /branches/zip/row/row0umod.c

  branches/zip: Relax a debug assertion about a missing BLOB. (Issue #452)
  When rolling back an incomplete transaction in purge, tolerate missing
  BLOBs also in update undo, when undoing an INSERT by updating a delete-marked
  record, and the delete-marked record is no longer needed.
  Previously, we only tolerated missing BLOBs in insert undo.
  This merely fixes a debug assertion; the code performed correctly
  without UNIV_DEBUG.

  rb://249 approved by Sunny Bains.
  ------------------------------------------------------------------------
  r6674 | inaam | 2010-02-11 17:54:44 +0200 (Thu, 11 Feb 2010) | 16 lines
  Changed paths:
     M /branches/zip/include/mem0mem.h
     M /branches/zip/include/mem0mem.ic
     M /branches/zip/mem/mem0mem.c

  branches/zip bug# 49535

  This is a backport of r4924.
  mem_heap_get_size() scans all allocated blocks to calculate the total
  size of the heap. This patch introduces a new, total_size, field in
  mem_block_info_struct. This field is valid only for base block 
  (i.e.: the first block allocated for the heap) and is set to
  ULINT_UNDEFINED in other blocks.
  This considerably improves the performance of redo scan during recovery.

  rb://108 issue#216

  Approved by: Heikki
  ------------------------------------------------------------------------
  r6675 | marko | 2010-02-11 22:41:11 +0200 (Thu, 11 Feb 2010) | 1 line
  Changed paths:
     M /branches/zip/row/row0umod.c

  branches/zip: Remove bogus debug assertions introduced in r6660.
  ------------------------------------------------------------------------
  r6707 | inaam | 2010-02-12 19:22:35 +0200 (Fri, 12 Feb 2010) | 4 lines
  Changed paths:
     M /branches/zip/ChangeLog

  branches/zip

  ChangeLog entry for r6674.
  ------------------------------------------------------------------------
  r6712 | marko | 2010-02-16 10:05:36 +0200 (Tue, 16 Feb 2010) | 2 lines
  Changed paths:
     M /branches/zip/trx/trx0trx.c

  branches/zip: trx_lists_init_at_db_start(): Assert that the kernel_mutex
  is held by the caller.
  ------------------------------------------------------------------------
  r6713 | sunny | 2010-02-16 10:12:17 +0200 (Tue, 16 Feb 2010) | 7 lines
  Changed paths:
     M /branches/zip/include/trx0trx.h

  branches/zip: Change the bit fields back to ulint. Bit fields were causing
  problems with concurrency on SMP systems because of word packing issues.
  The number of trx_t's in a system is not sufficient enough to require that
  we try and save a few bytes in the data structure.

  See rb://255 for details.
  ------------------------------------------------------------------------
  r6714 | sunny | 2010-02-16 10:12:25 +0200 (Tue, 16 Feb 2010) | 2 lines
  Changed paths:
     M /branches/zip/include/trx0trx.h

  branches/zip: Update the comments and fix the whitespace issues.
  See rb://255 Approved by: Marko
  ------------------------------------------------------------------------
  r6715 | sunny | 2010-02-16 10:14:21 +0200 (Tue, 16 Feb 2010) | 1 line
  Changed paths:
     M /branches/zip/include/trx0trx.h

  branches/zip: Fix comment. Non functional change.
  ------------------------------------------------------------------------
  r6717 | marko | 2010-02-16 14:53:20 +0200 (Tue, 16 Feb 2010) | 2 lines
  Changed paths:
     M /branches/zip/include/log0log.ic

  branches/zip: log_reserve_and_write_fast(): Correct a race condition
  in UNIV_LOG_LSN_DEBUG.  This could have caused Issue #440.
  ------------------------------------------------------------------------
  r6718 | marko | 2010-02-16 15:06:16 +0200 (Tue, 16 Feb 2010) | 1 line
  Changed paths:
     M /branches/zip/include/trx0trx.h

  branches/zip: Fix a comment.
  ------------------------------------------------------------------------
  r6723 | marko | 2010-02-17 11:48:34 +0200 (Wed, 17 Feb 2010) | 3 lines
  Changed paths:
     M /branches/zip/lock/lock0lock.c

  branches/zip: lock_table_other_has_incompatible():
  Return an incompatible lock or NULL instead of TRUE or FALSE.
  Approved by Sunny over IM.
  ------------------------------------------------------------------------
  r6724 | marko | 2010-02-17 15:52:05 +0200 (Wed, 17 Feb 2010) | 11 lines
  Changed paths:
     M /branches/zip/os/os0file.c

  branches/zip: Merge revisions 6613:6669 from branches/5.1:
    ------------------------------------------------------------------------
    r6669 | jyang | 2010-02-11 12:24:19 +0200 (Thu, 11 Feb 2010) | 7 lines

    branches/5.1: Fix bug #50691, AIX implementation of readdir_r
    causes InnoDB errors. readdir_r() returns an non-NULL value
    in the case of reaching the end of a directory. It should
    not be treated as an error return.

    rb://238 approved by Marko
    ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r6726 | marko | 2010-02-17 18:49:21 +0200 (Wed, 17 Feb 2010) | 3 lines
  Changed paths:
     M /branches/zip/include/fil0fil.h

  branches/zip: FIL_PAGE_FILE_FLUSH_LSN: Note that the field is only valid
  for the first page of each ibdata* file, not *.ibd files.
  Suggested by Heikki, in connection with the LSN warning noted in Issue #341.
  ------------------------------------------------------------------------
  r6727 | marko | 2010-02-17 18:50:20 +0200 (Wed, 17 Feb 2010) | 2 lines
  Changed paths:
     M /branches/zip/fsp/fsp0fsp.c

  branches/zip: fsp_init_file_page_low(): Declare the page uninitialized
  for Valgrind.
  ------------------------------------------------------------------------
  r6728 | marko | 2010-02-17 18:54:04 +0200 (Wed, 17 Feb 2010) | 3 lines
  Changed paths:
     M /branches/zip/fsp/fsp0fsp.c
     M /branches/zip/include/univ.i

  branches/zip: Remove UNIV_BASIC_LOG_DEBUG.
  This fixes the FILE_FLUSH_LSN printouts mentioned in Issue #341.
  Suggested by Heikki.
  ------------------------------------------------------------------------
  r6740 | sunny | 2010-02-18 13:44:31 +0200 (Thu, 18 Feb 2010) | 6 lines
  Changed paths:
     M /branches/zip/lock/lock0lock.c

  branches/zip: Don't print the entire lock bit set if the block was not
  found in the buffer pool. Only print the bits that are set and that
  information is in the lock and not in the block.

  See rb://256 approved by Marko.
  ------------------------------------------------------------------------
  r6749 | vasil | 2010-02-20 18:45:41 +0200 (Sat, 20 Feb 2010) | 5 lines
  Changed paths:
     M /branches/embedded-1.0/btr/btr0btr.c
     M /branches/embedded-1.0/btr/btr0cur.c
     M /branches/embedded-1.0/btr/btr0pcur.c
     M /branches/embedded-1.0/buf/buf0buf.c
     M /branches/embedded-1.0/buf/buf0flu.c
     M /branches/embedded-1.0/buf/buf0lru.c
     M /branches/embedded-1.0/dict/dict0boot.c
     M /branches/embedded-1.0/dict/dict0crea.c
     M /branches/embedded-1.0/dict/dict0dict.c
     M /branches/embedded-1.0/dict/dict0load.c
     M /branches/embedded-1.0/fil/fil0fil.c
     M /branches/embedded-1.0/fsp/fsp0fsp.c
     M /branches/embedded-1.0/ibuf/ibuf0ibuf.c
     M /branches/embedded-1.0/include/btr0btr.h
     M /branches/embedded-1.0/include/btr0cur.h
     M /branches/embedded-1.0/include/btr0pcur.h
     M /branches/embedded-1.0/include/btr0pcur.ic
     M /branches/embedded-1.0/include/buf0buf.h
     M /branches/embedded-1.0/include/buf0buf.ic
     M /branches/embedded-1.0/include/dict0boot.h
     M /branches/embedded-1.0/include/fil0fil.h
     M /branches/embedded-1.0/include/lock0lock.h
     M /branches/embedded-1.0/include/log0log.h
     M /branches/embedded-1.0/include/log0log.ic
     M /branches/embedded-1.0/include/log0recv.h
     M /branches/embedded-1.0/include/mem0dbg.h
     M /branches/embedded-1.0/include/mem0dbg.ic
     M /branches/embedded-1.0/include/mem0mem.h
     M /branches/embedded-1.0/include/mem0mem.ic
     M /branches/embedded-1.0/include/os0file.h
     M /branches/embedded-1.0/include/os0sync.h
     M /branches/embedded-1.0/include/os0sync.ic
     M /branches/embedded-1.0/include/os0thread.h
     M /branches/embedded-1.0/include/que0que.h
     M /branches/embedded-1.0/include/que0que.ic
     M /branches/embedded-1.0/include/row0merge.h
     M /branches/embedded-1.0/include/row0prebuilt.h
     M /branches/embedded-1.0/include/srv0srv.h
     M /branches/embedded-1.0/include/sync0sync.h
     M /branches/embedded-1.0/include/trx0rseg.h
     M /branches/embedded-1.0/include/trx0sys.h
     M /branches/embedded-1.0/include/trx0trx.h
     M /branches/embedded-1.0/include/trx0types.h
     M /branches/embedded-1.0/include/trx0undo.h
     M /branches/embedded-1.0/include/trx0xa.h
     M /branches/embedded-1.0/include/univ.i
     M /branches/embedded-1.0/include/ut0vec.h
     M /branches/embedded-1.0/include/ut0vec.ic
     M /branches/embedded-1.0/lock/lock0lock.c
     M /branches/embedded-1.0/log/log0log.c
     M /branches/embedded-1.0/log/log0recv.c
     M /branches/embedded-1.0/mem/mem0mem.c
     M /branches/embedded-1.0/os/os0file.c
     M /branches/embedded-1.0/os/os0thread.c
     M /branches/embedded-1.0/page/page0page.c
     M /branches/embedded-1.0/rem/rem0rec.c
     M /branches/embedded-1.0/row/row0ins.c
     M /branches/embedded-1.0/row/row0merge.c
     M /branches/embedded-1.0/row/row0prebuilt.c
     M /branches/embedded-1.0/row/row0sel.c
     M /branches/embedded-1.0/row/row0umod.c
     M /branches/embedded-1.0/row/row0undo.c
     M /branches/embedded-1.0/row/row0upd.c
     M /branches/embedded-1.0/srv/srv0srv.c
     M /branches/embedded-1.0/srv/srv0start.c
     M /branches/embedded-1.0/sync/sync0sync.c
     M /branches/embedded-1.0/trx/trx0sys.c
     M /branches/embedded-1.0/trx/trx0trx.c
     M /branches/embedded-1.0/trx/trx0undo.c
     M /branches/embedded-1.0/ut/ut0mem.c
     M /branches/innodb+/btr/btr0btr.c
     M /branches/innodb+/btr/btr0cur.c
     M /branches/innodb+/btr/btr0pcur.c
     M /branches/innodb+/buf/buf0buf.c
     M /branches/innodb+/buf/buf0lru.c
     M /branches/innodb+/dict/dict0crea.c
     M /branches/innodb+/dict/dict0dict.c
     M /branches/innodb+/dict/dict0load.c
     M /branches/innodb+/handler/ha_innodb.cc
     M /branches/innodb+/handler/ha_innodb.h
     M /branches/innodb+/handler/handler0alter.cc
     M /branches/innodb+/include/btr0btr.h
     M /branches/innodb+/include/btr0cur.h
     M /branches/innodb+/include/btr0pcur.h
     M /branches/innodb+/include/btr0pcur.ic
     M /branches/innodb+/include/buf0buf.h
     M /branches/innodb+/include/log0log.h
     M /branches/innodb+/include/mem0dbg.h
     M /branches/innodb+/include/mem0dbg.ic
     M /branches/innodb+/include/os0file.h
     M /branches/innodb+/include/row0mysql.h
     M /branches/innodb+/include/srv0srv.h
     M /branches/innodb+/include/sync0sync.h
     M /branches/innodb+/include/trx0trx.h
     M /branches/innodb+/lock/lock0lock.c
     M /branches/innodb+/log/log0log.c
     M /branches/innodb+/log/log0recv.c
     M /branches/innodb+/mem/mem0dbg.c
     M /branches/innodb+/os/os0file.c
     M /branches/innodb+/page/page0page.c
     M /branches/innodb+/row/row0ins.c
     M /branches/innodb+/row/row0mysql.c
     M /branches/innodb+/row/row0sel.c
     M /branches/innodb+/srv/srv0srv.c
     M /branches/innodb+/srv/srv0start.c
     M /branches/innodb+/sync/sync0sync.c
     M /branches/innodb+_metrics_table/btr/btr0btr.c
     M /branches/innodb+_metrics_table/buf/buf0buf.c
     M /branches/innodb+_metrics_table/buf/buf0flu.c
     M /branches/innodb+_metrics_table/dict/dict0crea.c
     M /branches/innodb+_metrics_table/dict/dict0dict.c
     M /branches/innodb+_metrics_table/dict/dict0load.c
     M /branches/innodb+_metrics_table/handler/ha_innodb.cc
     M /branches/innodb+_metrics_table/handler/ha_innodb.h
     M /branches/innodb+_metrics_table/handler/handler0alter.cc
     M /branches/innodb+_metrics_table/handler/i_s.cc
     M /branches/innodb+_metrics_table/handler/i_s.h
     M /branches/innodb+_metrics_table/include/mem0dbg.h
     M /branches/innodb+_metrics_table/include/mem0dbg.ic
     M /branches/innodb+_metrics_table/include/srv0mon.h
     M /branches/innodb+_metrics_table/include/srv0mon.ic
     M /branches/innodb+_metrics_table/include/srv0srv.h
     M /branches/innodb+_metrics_table/lock/lock0lock.c
     M /branches/innodb+_metrics_table/log/log0log.c
     M /branches/innodb+_metrics_table/mem/mem0dbg.c
     M /branches/innodb+_metrics_table/os/os0file.c
     M /branches/innodb+_metrics_table/page/page0zip.c
     M /branches/innodb+_metrics_table/row/row0mysql.c
     M /branches/innodb+_metrics_table/row/row0purge.c
     M /branches/innodb+_metrics_table/row/row0sel.c
     M /branches/innodb+_metrics_table/srv/srv0mon.c
     M /branches/innodb+_metrics_table/srv/srv0srv.c
     M /branches/innodb+_metrics_table/sync/sync0sync.c
     M /branches/innodb+_metrics_table/trx/trx0roll.c
     M /branches/innodb+_metrics_table/trx/trx0trx.c
     M /branches/innodb+_persistent_stats/btr/btr0btr.c
     M /branches/innodb+_persistent_stats/buf/buf0buf.c
     M /branches/innodb+_persistent_stats/data/data0type.c
     M /branches/innodb+_persistent_stats/dict/dict0boot.c
     M /branches/innodb+_persistent_stats/dict/dict0crea.c
     M /branches/innodb+_persistent_stats/dict/dict0dict.c
     M /branches/innodb+_persistent_stats/dict/dict0load.c
     M /branches/innodb+_persistent_stats/dict/dict0mem.c
     M /branches/innodb+_persistent_stats/fil/fil0fil.c
     M /branches/innodb+_persistent_stats/fsp/fsp0fsp.c
     M /branches/innodb+_persistent_stats/handler/ha_innodb.cc
     M /branches/innodb+_persistent_stats/handler/ha_innodb.h
     M /branches/innodb+_persistent_stats/handler/handler0alter.cc
     M /branches/innodb+_persistent_stats/ibuf/ibuf0ibuf.c
     M /branches/innodb+_persistent_stats/include/btr0pcur.h
     M /branches/innodb+_persistent_stats/include/btr0pcur.ic
     M /branches/innodb+_persistent_stats/include/db0err.h
     M /branches/innodb+_persistent_stats/include/dict0dict.h
     M /branches/innodb+_persistent_stats/include/dict0mem.h
     M /branches/innodb+_persistent_stats/include/ha_prototypes.h
     M /branches/innodb+_persistent_stats/include/lock0lock.h
     M /branches/innodb+_persistent_stats/include/log0log.h
     M /branches/innodb+_persistent_stats/include/log0recv.h
     M /branches/innodb+_persistent_stats/include/mem0dbg.h
     M /branches/innodb+_persistent_stats/include/mem0dbg.ic
     M /branches/innodb+_persistent_stats/include/os0file.h
     M /branches/innodb+_persistent_stats/include/pars0pars.h
     M /branches/innodb+_persistent_stats/include/srv0srv.h
     M /branches/innodb+_persistent_stats/include/sync0sync.h
     M /branches/innodb+_persistent_stats/include/trx0sys.h
     M /branches/innodb+_persistent_stats/include/trx0trx.h
     M /branches/innodb+_persistent_stats/include/ut0lst.h
     M /branches/innodb+_persistent_stats/include/ut0ut.h
     M /branches/innodb+_persistent_stats/lock/lock0lock.c
     M /branches/innodb+_persistent_stats/log/log0log.c
     M /branches/innodb+_persistent_stats/log/log0recv.c
     M /branches/innodb+_persistent_stats/mem/mem0dbg.c
     M /branches/innodb+_persistent_stats/os/os0file.c
     M /branches/innodb+_persistent_stats/page/page0page.c
     M /branches/innodb+_persistent_stats/pars/pars0pars.c
     M /branches/innodb+_persistent_stats/row/row0merge.c
     M /branches/innodb+_persistent_stats/row/row0mysql.c
     M /branches/innodb+_persistent_stats/row/row0sel.c
     M /branches/innodb+_persistent_stats/row/row0umod.c
     M /branches/innodb+_persistent_stats/row/row0upd.c
     M /branches/innodb+_persistent_stats/srv/srv0srv.c
     M /branches/innodb+_persistent_stats/srv/srv0start.c
     M /branches/innodb+_persistent_stats/sync/sync0sync.c
     M /branches/innodb+_persistent_stats/trx/trx0i_s.c
     M /branches/innodb+_persistent_stats/trx/trx0sys.c
     M /branches/innodb+_persistent_stats/trx/trx0trx.c
     M /branches/innodb+_persistent_stats/ut/ut0ut.c
     M /branches/innofts+/handler/ha_innodb.cc
     M /branches/innofts+/handler/i_s.cc
     M /branches/innofts+/handler/i_s.h
     M /branches/innofts+/include/fut0fut.h
     M /branches/performance_schema/btr/btr0sea.c
     M /branches/performance_schema/buf/buf0buf.c
     M /branches/performance_schema/dict/dict0dict.c
     M /branches/performance_schema/fil/fil0fil.c
     M /branches/performance_schema/handler/ha_innodb.cc
     M /branches/performance_schema/include/srv0srv.h
     M /branches/performance_schema/include/sync0rw.h
     M /branches/performance_schema/include/sync0rw.ic
     M /branches/performance_schema/include/sync0sync.h
     M /branches/performance_schema/include/sync0sync.ic
     M /branches/performance_schema/include/sync0types.h
     M /branches/performance_schema/log/log0log.c
     M /branches/performance_schema/srv/srv0srv.c
     M /branches/performance_schema/sync/sync0rw.c
     M /branches/performance_schema/trx/trx0i_s.c
     M /branches/performance_schema/trx/trx0purge.c
     M /branches/plugin-2.0/buf/buf0buf.c
     M /branches/plugin-2.0/buf/buf0lru.c
     M /branches/plugin-2.0/dict/dict0boot.c
     M /branches/plugin-2.0/dict/dict0crea.c
     M /branches/plugin-2.0/dict/dict0dict.c
     M /branches/plugin-2.0/dict/dict0load.c
     M /branches/plugin-2.0/dict/dict0mem.c
     M /branches/plugin-2.0/fil/fil0fil.c
     M /branches/plugin-2.0/fsp/fsp0fsp.c
     M /branches/plugin-2.0/handler/ha_innodb.cc
     M /branches/plugin-2.0/handler/ha_innodb.h
     M /branches/plugin-2.0/handler/handler0alter.cc
     M /branches/plugin-2.0/ibuf/ibuf0ibuf.c
     M /branches/plugin-2.0/include/dict0mem.h
     M /branches/plugin-2.0/include/ha_prototypes.h
     M /branches/plugin-2.0/include/lock0lock.h
     M /branches/plugin-2.0/include/log0log.h
     M /branches/plugin-2.0/include/log0recv.h
     M /branches/plugin-2.0/include/mem0dbg.h
     M /branches/plugin-2.0/include/mem0dbg.ic
     M /branches/plugin-2.0/include/os0file.h
     M /branches/plugin-2.0/include/row0mysql.h
     M /branches/plugin-2.0/include/srv0srv.h
     M /branches/plugin-2.0/include/sync0sync.h
     M /branches/plugin-2.0/include/trx0sys.h
     M /branches/plugin-2.0/include/trx0trx.h
     M /branches/plugin-2.0/lock/lock0lock.c
     M /branches/plugin-2.0/log/log0log.c
     M /branches/plugin-2.0/log/log0recv.c
     M /branches/plugin-2.0/mem/mem0dbg.c
     M /branches/plugin-2.0/os/os0file.c
     M /branches/plugin-2.0/page/page0page.c
     M /branches/plugin-2.0/row/row0merge.c
     M /branches/plugin-2.0/row/row0mysql.c
     M /branches/plugin-2.0/row/row0sel.c
     M /branches/plugin-2.0/row/row0umod.c
     M /branches/plugin-2.0/row/row0upd.c
     M /branches/plugin-2.0/srv/srv0srv.c
     M /branches/plugin-2.0/srv/srv0start.c
     M /branches/plugin-2.0/sync/sync0sync.c
     M /branches/plugin-2.0/trx/trx0i_s.c
     M /branches/plugin-2.0/trx/trx0sys.c
     M /branches/plugin-2.0/trx/trx0trx.c
     M /branches/zip/btr/btr0btr.c
     M /branches/zip/btr/btr0cur.c
     M /branches/zip/btr/btr0pcur.c
     M /branches/zip/buf/buf0buf.c
     M /branches/zip/buf/buf0lru.c
     M /branches/zip/dict/dict0boot.c
     M /branches/zip/dict/dict0crea.c
     M /branches/zip/dict/dict0dict.c
     M /branches/zip/dict/dict0load.c
     M /branches/zip/fsp/fsp0fsp.c
     M /branches/zip/handler/ha_innodb.cc
     M /branches/zip/handler/ha_innodb.h
     M /branches/zip/handler/handler0alter.cc
     M /branches/zip/include/btr0btr.h
     M /branches/zip/include/btr0cur.h
     M /branches/zip/include/btr0pcur.h
     M /branches/zip/include/btr0pcur.ic
     M /branches/zip/include/buf0buf.h
     M /branches/zip/include/dict0boot.h
     M /branches/zip/include/fil0fil.h
     M /branches/zip/include/log0log.h
     M /branches/zip/include/log0log.ic
     M /branches/zip/include/log0recv.h
     M /branches/zip/include/mem0dbg.h
     M /branches/zip/include/mem0dbg.ic
     M /branches/zip/include/mem0mem.h
     M /branches/zip/include/mem0mem.ic
     M /branches/zip/include/os0file.h
     M /branches/zip/include/que0que.h
     M /branches/zip/include/que0que.ic
     M /branches/zip/include/row0mysql.h
     M /branches/zip/include/srv0srv.h
     M /branches/zip/include/sync0sync.h
     M /branches/zip/include/trx0rseg.h
     M /branches/zip/include/trx0trx.h
     M /branches/zip/include/trx0types.h
     M /branches/zip/include/univ.i
     M /branches/zip/lock/lock0lock.c
     M /branches/zip/log/log0log.c
     M /branches/zip/log/log0recv.c
     M /branches/zip/mem/mem0dbg.c
     M /branches/zip/mem/mem0mem.c
     M /branches/zip/os/os0file.c
     M /branches/zip/page/page0page.c
     M /branches/zip/rem/rem0rec.c
     M /branches/zip/row/row0ins.c
     M /branches/zip/row/row0merge.c
     M /branches/zip/row/row0mysql.c
     M /branches/zip/row/row0sel.c
     M /branches/zip/row/row0umod.c
     M /branches/zip/srv/srv0srv.c
     M /branches/zip/srv/srv0start.c
     M /branches/zip/sync/sync0sync.c
     M /branches/zip/trx/trx0rseg.c
     M /branches/zip/trx/trx0trx.c

  Non-functional change: update copyright year to 2010 of the files
  that have been modified after 2010-01-01 according to svn.

  for f in $(svn log -v -r{2010-01-01}:HEAD |grep "^   M " |cut -b 16- |sort -u) ; do sed -i "" -E 's/(Copyright \(c\) [0-9]{4},) [0-9]{4}, (.*Innobase Oy.+All Rights Reserved)/\1 2010, \2/' $f ; done
  ------------------------------------------------------------------------
  r6750 | marko | 2010-02-22 08:57:23 +0200 (Mon, 22 Feb 2010) | 2 lines
  Changed paths:
     M /branches/zip/include/row0sel.h
     M /branches/zip/row/row0sel.c

  branches/zip: row_fetch_store_uint4(): Remove unused function.
  This was added to trunk in r435.
  ------------------------------------------------------------------------
  r6754 | marko | 2010-02-24 10:56:43 +0200 (Wed, 24 Feb 2010) | 17 lines
  Changed paths:
     M /branches/zip/row/row0merge.c

  branches/zip: Allocate the merge sort buffers from a heap, not stack.

  The merge sort can use up to 48KiB of buffers when merging blocks.
  That can cause a stack overflow, especially on 64-bit systems when not
  building with inlined functions.  This was reported as Issue #462.

  row_merge_dup_report(): Allocate buf and offsets from a heap.

  row_merge_heap_create(): Allocate space for buf[3] too. Fix bogus
  sizeof arithmetics that happened to work, because
  sizeof(ulint)==sizeof(void*).

  row_merge_blocks(), row_merge_blocks_copy(): Allocate buf[3] from heap.

  row_merge_insert_index_tuples(): Allocate buf from graph_heap.

  rb://258 approved and tested by Sunny Bains
  ------------------------------------------------------------------------
  r6767 | calvin | 2010-03-01 18:16:10 +0200 (Mon, 01 Mar 2010) | 3 lines
  Changed paths:
     M /branches/zip/srv/srv0srv.c

  branches/zip: fix bug#51587
  Non-functional change.
  ------------------------------------------------------------------------
  r6768 | vasil | 2010-03-02 18:20:48 +0200 (Tue, 02 Mar 2010) | 5 lines
  Changed paths:
     M /branches/zip/include/btr0btr.h
     M /branches/zip/include/btr0btr.ic

  branches/zip:

  Add a NOTE to the comment of btr_node_ptr_get_child_page_no()
  to prevent mysterious bugs.
  ------------------------------------------------------------------------
  r6770 | marko | 2010-03-03 12:52:55 +0200 (Wed, 03 Mar 2010) | 12 lines
  Changed paths:
     M /branches/zip/handler/handler0alter.cc
     M /branches/zip/mysql-test/innodb-index.result
     M /branches/zip/mysql-test/innodb-index.test
     M /branches/zip/mysql-test/innodb.result
     M /branches/zip/mysql-test/innodb.test

  branches/zip: Disallow duplicate index name when creating an index.
  This should fix Mantis Issue #461.

  innodb.test, innodb.result, innodb-index.test, innodb-index.result:
  Adjust the test result and mention that the introduced restriction
  has been reported as MySQL Bug #51451.

  innobase_check_index_keys(): Add a parameter for the InnoDB table and
  check that no duplicate index name is added.  Report errors by
  my_error() instead of sql_print_error().

  rb://260 approved by Sunny Bains
  ------------------------------------------------------------------------
  r6771 | marko | 2010-03-03 14:52:43 +0200 (Wed, 03 Mar 2010) | 1 line
  Changed paths:
     M /branches/zip/ChangeLog

  Document r6770.
  ------------------------------------------------------------------------
  r6773 | marko | 2010-03-03 15:31:54 +0200 (Wed, 03 Mar 2010) | 2 lines
  Changed paths:
     M /branches/zip/row/row0row.c

  branches/zip: row_raw_format(): Silence a GCC 4.4.2 warning
  of possibly uninitialized variable format_in_hex.
  ------------------------------------------------------------------------
pull/73/head
marko 16 years ago
parent
commit
fb2ff6daf3
  1. 30
      ChangeLog
  2. 4
      btr/btr0cur.c
  3. 27
      buf/buf0buf.c
  4. 7
      dict/dict0boot.c
  5. 4
      dict/dict0dict.c
  6. 6
      fsp/fsp0fsp.c
  7. 72
      handler/handler0alter.cc
  8. 4
      include/btr0btr.h
  9. 4
      include/btr0btr.ic
  10. 9
      include/btr0pcur.h
  11. 19
      include/btr0pcur.ic
  12. 3
      include/dict0boot.h
  13. 9
      include/fil0fil.h
  14. 11
      include/log0log.ic
  15. 8
      include/log0recv.h
  16. 2
      include/mem0mem.h
  17. 2
      include/mem0mem.ic
  18. 13
      include/que0que.h
  19. 16
      include/que0que.ic
  20. 11
      include/row0sel.h
  21. 13
      include/trx0rseg.h
  22. 65
      include/trx0trx.h
  23. 9
      include/trx0types.h
  24. 7
      include/univ.i
  25. 136
      lock/lock0lock.c
  26. 20
      log/log0recv.c
  27. 2
      mem/mem0mem.c
  28. 3
      mysql-test/innodb-index.result
  29. 2
      mysql-test/innodb-index.test
  30. 10
      mysql-test/innodb.result
  31. 11
      mysql-test/innodb.test
  32. 10
      os/os0file.c
  33. 18
      rem/rem0rec.c
  34. 148
      row/row0merge.c
  35. 139
      row/row0mysql.c
  36. 15
      row/row0row.c
  37. 39
      row/row0sel.c
  38. 31
      row/row0umod.c
  39. 11
      srv/srv0srv.c
  40. 24
      srv/srv0start.c
  41. 38
      trx/trx0rseg.c
  42. 3
      trx/trx0trx.c

30
ChangeLog

@ -1,3 +1,27 @@
2010-03-03 The InnoDB Team
* handler/handler0alter.cc, innodb-index.result, innodb-index.test,
innodb.result, innodb.test:
Disallow a duplicate index name when creating an index.
2010-02-11 The InnoDB Team
* include/mem0mem.h, include/mem0mem.ic, mem/mem0mem.c:
Fix Bug #49535 Available memory check slows down crash
recovery tens of times
2010-02-09 The InnoDB Team
* buf/buf0buf.c:
Fix Bug #38901 InnoDB logs error repeatedly when trying to load
page into buffer pool
2010-02-09 The InnoDB Team
* srv/srv0srv.c:
Let the master thread sleep if the amount of work to be done is
calibrated as taking less than a second.
2010-02-04 The InnoDB Team
* btr/btr0btr.c, btr/btr0cur.c, btr/btr0pcur.c, buf/buf0buf.c,
@ -7,6 +31,12 @@
b-tree cursor functions to the buffer pool requests, in order
to make the latch diagnostics more accurate.
2010-02-03 The InnoDB Team
* lock/lock0lock.c:
Fix Bug#49001 SHOW INNODB STATUS deadlock info incorrect
when deadlock detection aborts
2010-02-03 The InnoDB Team
* buf/buf0lru.c:

4
btr/btr0cur.c

@ -4402,7 +4402,7 @@ btr_free_externally_stored_field(
/* In the rollback of uncommitted transactions, we may
encounter a clustered index record whose BLOBs have
not been written. There is nothing to free then. */
ut_a(rb_ctx == RB_RECOVERY);
ut_a(rb_ctx == RB_RECOVERY || rb_ctx == RB_RECOVERY_PURGE_REC);
return;
}
@ -4448,7 +4448,7 @@ btr_free_externally_stored_field(
|| (mach_read_from_1(field_ref + BTR_EXTERN_LEN)
& BTR_EXTERN_OWNER_FLAG)
/* Rollback and inherited field */
|| (rb_ctx != RB_NONE
|| ((rb_ctx == RB_NORMAL || rb_ctx == RB_RECOVERY)
&& (mach_read_from_1(field_ref + BTR_EXTERN_LEN)
& BTR_EXTERN_INHERITED_FLAG))) {

27
buf/buf0buf.c

@ -243,6 +243,8 @@ the read requests for the whole area.
#ifndef UNIV_HOTBACKUP
/** Value in microseconds */
static const int WAIT_FOR_READ = 5000;
/** Number of attemtps made to read in a page in the buffer pool */
static const ulint BUF_PAGE_READ_MAX_RETRIES = 100;
/** The buffer buf_pool of the database */
UNIV_INTERN buf_pool_t* buf_pool = NULL;
@ -2101,6 +2103,7 @@ buf_page_get_gen(
unsigned access_time;
ulint fix_type;
ibool must_read;
ulint retries = 0;
ut_ad(mtr);
ut_ad((rw_latch == RW_S_LATCH)
@ -2162,7 +2165,29 @@ loop2:
return(NULL);
}
buf_read_page(space, zip_size, offset);
if (buf_read_page(space, zip_size, offset)) {
retries = 0;
} else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
++retries;
} else {
fprintf(stderr, "InnoDB: Error: Unable"
" to read tablespace %lu page no"
" %lu into the buffer pool after"
" %lu attempts\n"
"InnoDB: The most probable cause"
" of this error may be that the"
" table has been corrupted.\n"
"InnoDB: You can try to fix this"
" problem by using"
" innodb_force_recovery.\n"
"InnoDB: Please see reference manual"
" for more details.\n"
"InnoDB: Aborting...\n",
space, offset,
BUF_PAGE_READ_MAX_RETRIES);
ut_error;
}
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(++buf_dbg_counter % 37 || buf_validate());

7
dict/dict0boot.c

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1996, 2010, 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
@ -358,7 +358,7 @@ dict_boot(void)
dict_mem_table_add_col(table, heap, "SPACE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, heap, "PAGE_NO", DATA_INT, 0, 4);
/* The '+ 2' below comes from the 2 system fields */
/* The '+ 2' below comes from the fields DB_TRX_ID, DB_ROLL_PTR */
#if DICT_SYS_INDEXES_PAGE_NO_FIELD != 6 + 2
#error "DICT_SYS_INDEXES_PAGE_NO_FIELD != 6 + 2"
#endif
@ -367,6 +367,9 @@ dict_boot(void)
#endif
#if DICT_SYS_INDEXES_TYPE_FIELD != 4 + 2
#error "DICT_SYS_INDEXES_TYPE_FIELD != 4 + 2"
#endif
#if DICT_SYS_INDEXES_NAME_FIELD != 1 + 2
#error "DICT_SYS_INDEXES_NAME_FIELD != 1 + 2"
#endif
table->id = DICT_INDEXES_ID;

4
dict/dict0dict.c

@ -140,7 +140,7 @@ static
void
dict_field_print_low(
/*=================*/
dict_field_t* field); /*!< in: field */
const dict_field_t* field); /*!< in: field */
/*********************************************************************//**
Frees a foreign key struct. */
static
@ -4403,7 +4403,7 @@ static
void
dict_field_print_low(
/*=================*/
dict_field_t* field) /*!< in: field */
const dict_field_t* field) /*!< in: field */
{
ut_ad(mutex_own(&(dict_sys->mutex)));

6
fsp/fsp0fsp.c

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1995, 2010, 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
@ -869,9 +869,7 @@ fsp_init_file_page_low(
return;
}
#ifdef UNIV_BASIC_LOG_DEBUG
memset(page, 0xff, UNIV_PAGE_SIZE);
#endif
UNIV_MEM_INVALID(page, UNIV_PAGE_SIZE);
mach_write_to_4(page + FIL_PAGE_OFFSET, buf_block_get_page_no(block));
memset(page + FIL_PAGE_LSN, 0, 8);
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,

72
handler/handler0alter.cc

@ -229,9 +229,11 @@ static
int
innobase_check_index_keys(
/*======================*/
const KEY* key_info, /*!< in: Indexes to be created */
ulint num_of_keys) /*!< in: Number of indexes to
be created */
const KEY* key_info, /*!< in: Indexes to be
created */
ulint num_of_keys, /*!< in: Number of
indexes to be created */
const dict_table_t* table) /*!< in: Existing indexes */
{
ulint key_num;
@ -248,9 +250,22 @@ innobase_check_index_keys(
const KEY& key2 = key_info[i];
if (0 == strcmp(key.name, key2.name)) {
sql_print_error("InnoDB: key name `%s` appears"
" twice in CREATE INDEX\n",
key.name);
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0),
key.name);
return(ER_WRONG_NAME_FOR_INDEX);
}
}
/* Check that the same index name does not already exist. */
for (const dict_index_t* index
= dict_table_get_first_index(table);
index; index = dict_table_get_next_index(index)) {
if (0 == strcmp(key.name, index->name)) {
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0),
key.name);
return(ER_WRONG_NAME_FOR_INDEX);
}
@ -258,7 +273,7 @@ innobase_check_index_keys(
/* Check that MySQL does not try to create a column
prefix index field on an inappropriate data type and
that the same colum does not appear twice in the index. */
that the same column does not appear twice in the index. */
for (ulint i = 0; i < key.key_parts; i++) {
const KEY_PART_INFO& key_part1
@ -289,14 +304,8 @@ innobase_check_index_keys(
}
}
sql_print_error("InnoDB: MySQL is trying to"
" create a column prefix"
" index field on an"
" inappropriate data type."
" column `%s`,"
" index `%s`.\n",
field->field_name,
key.name);
my_error(ER_WRONG_KEY_COLUMN, MYF(0),
field->field_name);
return(ER_WRONG_KEY_COLUMN);
}
@ -309,11 +318,8 @@ innobase_check_index_keys(
continue;
}
sql_print_error("InnoDB: column `%s`"
" is not allowed to occur"
" twice in index `%s`.\n",
key_part1.field->field_name,
key.name);
my_error(ER_WRONG_KEY_COLUMN, MYF(0),
key_part1.field->field_name);
return(ER_WRONG_KEY_COLUMN);
}
}
@ -656,12 +662,18 @@ ha_innobase::add_index(
innodb_table = indexed_table
= dict_table_get(prebuilt->table->name, FALSE);
if (UNIV_UNLIKELY(!innodb_table)) {
error = HA_ERR_NO_SUCH_TABLE;
goto err_exit;
}
/* Check if the index name is reserved. */
if (innobase_index_name_is_reserved(trx, key_info, num_of_keys)) {
error = -1;
} else {
/* Check that index keys are sensible */
error = innobase_check_index_keys(key_info, num_of_keys);
error = innobase_check_index_keys(key_info, num_of_keys,
innodb_table);
}
if (UNIV_UNLIKELY(error)) {
@ -803,18 +815,6 @@ err_exit:
index, num_of_idx, table);
error_handling:
#ifdef UNIV_DEBUG
/* TODO: At the moment we can't handle the following statement
in our debugging code below:
alter table t drop index b, add index (b);
The fix will have to parse the SQL and note that the index
being added has the same name as the one being dropped and
ignore that in the dup index check.*/
//dict_table_check_for_dup_indexes(prebuilt->table);
#endif
/* After an error, remove all those index definitions from the
dictionary which were defined. */
@ -826,6 +826,8 @@ error_handling:
row_mysql_lock_data_dictionary(trx);
dict_locked = TRUE;
ut_d(dict_table_check_for_dup_indexes(prebuilt->table));
if (!new_primary) {
error = row_merge_rename_indexes(trx, indexed_table);
@ -1206,9 +1208,7 @@ ha_innobase::final_drop_index(
valid index entry count in the translation table to zero */
share->idx_trans_tbl.index_count = 0;
#ifdef UNIV_DEBUG
dict_table_check_for_dup_indexes(prebuilt->table);
#endif
ut_d(dict_table_check_for_dup_indexes(prebuilt->table));
func_exit:
trx_commit_for_mysql(trx);

4
include/btr0btr.h

@ -203,6 +203,10 @@ btr_leaf_page_release(
mtr_t* mtr); /*!< in: mtr */
/**************************************************************//**
Gets the child node file address in a node pointer.
NOTE: the offsets array must contain all offsets for the record since
we read the last field according to offsets and assume that it contains
the child page number. In other words offsets must have been retrieved
with rec_get_offsets(n_fields=ULINT_UNDEFINED).
@return child node address */
UNIV_INLINE
ulint

4
include/btr0btr.ic

@ -255,6 +255,10 @@ btr_page_set_prev(
/**************************************************************//**
Gets the child node file address in a node pointer.
NOTE: the offsets array must contain all offsets for the record since
we read the last field according to offsets and assume that it contains
the child page number. In other words offsets must have been retrieved
with rec_get_offsets(n_fields=ULINT_UNDEFINED).
@return child node address */
UNIV_INLINE
ulint

9
include/btr0pcur.h

@ -281,20 +281,13 @@ btr_pcur_get_mtr(
/*=============*/
btr_pcur_t* cursor); /*!< in: persistent cursor */
/**************************************************************//**
Commits the pcur mtr and sets the pcur latch mode to BTR_NO_LATCHES,
Commits the mtr and sets the pcur latch mode to BTR_NO_LATCHES,
that is, the cursor becomes detached. If there have been modifications
to the page where pcur is positioned, this can be used instead of
btr_pcur_release_leaf. Function btr_pcur_store_position should be used
before calling this, if restoration of cursor is wanted later. */
UNIV_INLINE
void
btr_pcur_commit(
/*============*/
btr_pcur_t* pcur); /*!< in: persistent cursor */
/**************************************************************//**
Differs from btr_pcur_commit in that we can specify the mtr to commit. */
UNIV_INLINE
void
btr_pcur_commit_specify_mtr(
/*========================*/
btr_pcur_t* pcur, /*!< in: persistent cursor */

19
include/btr0pcur.ic

@ -395,30 +395,13 @@ btr_pcur_move_to_next(
}
/**************************************************************//**
Commits the pcur mtr and sets the pcur latch mode to BTR_NO_LATCHES,
Commits the mtr and sets the pcur latch mode to BTR_NO_LATCHES,
that is, the cursor becomes detached. If there have been modifications
to the page where pcur is positioned, this can be used instead of
btr_pcur_release_leaf. Function btr_pcur_store_position should be used
before calling this, if restoration of cursor is wanted later. */
UNIV_INLINE
void
btr_pcur_commit(
/*============*/
btr_pcur_t* pcur) /*!< in: persistent cursor */
{
ut_a(pcur->pos_state == BTR_PCUR_IS_POSITIONED);
pcur->latch_mode = BTR_NO_LATCHES;
mtr_commit(pcur->mtr);
pcur->pos_state = BTR_PCUR_WAS_POSITIONED;
}
/**************************************************************//**
Differs from btr_pcur_commit in that we can specify the mtr to commit. */
UNIV_INLINE
void
btr_pcur_commit_specify_mtr(
/*========================*/
btr_pcur_t* pcur, /*!< in: persistent cursor */

3
include/dict0boot.h

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1996, 2010, 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
@ -137,6 +137,7 @@ clustered index */
#define DICT_SYS_INDEXES_PAGE_NO_FIELD 8
#define DICT_SYS_INDEXES_SPACE_NO_FIELD 7
#define DICT_SYS_INDEXES_TYPE_FIELD 6
#define DICT_SYS_INDEXES_NAME_FIELD 3
/* When a row id which is zero modulo this number (which must be a power of
two) is assigned, the field DICT_HDR_ROW_ID on the dictionary header page is

9
include/fil0fil.h

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1995, 2010, 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
@ -110,9 +110,10 @@ extern fil_addr_t fil_addr_null;
contents of this field is valid
for all uncompressed pages. */
#define FIL_PAGE_FILE_FLUSH_LSN 26 /*!< this is only defined for the
first page in a data file: the file
has been flushed to disk at least up
to this lsn */
first page in a system tablespace
data file (ibdata*, not *.ibd):
the file has been flushed to disk
at least up to this lsn */
#define FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID 34 /*!< starting from 4.1.x this
contains the space id of the page */
#define FIL_PAGE_DATA 38 /*!< start of the data on the page */

11
include/log0log.ic

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1995, 2010, 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
@ -314,12 +314,15 @@ log_reserve_and_write_fast(
ulint data_len;
#ifdef UNIV_LOG_LSN_DEBUG
/* length of the LSN pseudo-record */
ulint lsn_len = 1
+ mach_get_compressed_size(log_sys->lsn >> 32)
+ mach_get_compressed_size(log_sys->lsn & 0xFFFFFFFFUL);
ulint lsn_len;
#endif /* UNIV_LOG_LSN_DEBUG */
mutex_enter(&log_sys->mutex);
#ifdef UNIV_LOG_LSN_DEBUG
lsn_len = 1
+ mach_get_compressed_size(log_sys->lsn >> 32)
+ mach_get_compressed_size(log_sys->lsn & 0xFFFFFFFFUL);
#endif /* UNIV_LOG_LSN_DEBUG */
data_len = len
#ifdef UNIV_LOG_LSN_DEBUG

8
include/log0recv.h

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1997, 2010, 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
@ -176,6 +176,12 @@ UNIV_INTERN
void
recv_recovery_from_checkpoint_finish(void);
/*======================================*/
/********************************************************//**
Initiates the rollback of active transactions. */
UNIV_INTERN
void
recv_recovery_rollback_active(void);
/*===============================*/
/*******************************************************//**
Scans log from a buffer and stores new log data to the parsing buffer.
Parses and hashes the log records if new data found. Unless

2
include/mem0mem.h

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1994, 2010, 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

2
include/mem0mem.ic

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1994, 2010, 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

13
include/que0que.h

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1996, 2010, 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
@ -30,6 +30,7 @@ Created 5/27/1996 Heikki Tuuri
#include "data0data.h"
#include "dict0types.h"
#include "trx0trx.h"
#include "trx0roll.h"
#include "srv0srv.h"
#include "usr0types.h"
#include "que0types.h"
@ -215,6 +216,16 @@ trx_t*
thr_get_trx(
/*========*/
que_thr_t* thr); /*!< in: query thread */
/*******************************************************************//**
Determines if this thread is rolling back an incomplete transaction
in crash recovery.
@return TRUE if thr is rolling back an incomplete transaction in crash
recovery */
UNIV_INLINE
ibool
thr_is_recv(
/*========*/
const que_thr_t* thr); /*!< in: query thread */
/***********************************************************************//**
Gets the type of a graph node. */
UNIV_INLINE

16
include/que0que.ic

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1996, 2010, 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
@ -38,6 +38,20 @@ thr_get_trx(
return(thr->graph->trx);
}
/*******************************************************************//**
Determines if this thread is rolling back an incomplete transaction
in crash recovery.
@return TRUE if thr is rolling back an incomplete transaction in crash
recovery */
UNIV_INLINE
ibool
thr_is_recv(
/*========*/
const que_thr_t* thr) /*!< in: query thread */
{
return(trx_is_recv(thr->graph->trx));
}
/***********************************************************************//**
Gets the first thr in a fork. */
UNIV_INLINE

11
include/row0sel.h

@ -105,17 +105,6 @@ row_fetch_print(
/*============*/
void* row, /*!< in: sel_node_t* */
void* user_arg); /*!< in: not used */
/****************************************************************//**
Callback function for fetch that stores an unsigned 4 byte integer to the
location pointed. The column's type must be DATA_INT, DATA_UNSIGNED, length
= 4.
@return always returns NULL */
UNIV_INTERN
void*
row_fetch_store_uint4(
/*==================*/
void* row, /*!< in: sel_node_t* */
void* user_arg); /*!< in: data pointer */
/***********************************************************//**
Prints a row in a select result.
@return query thread to run next or NULL */

13
include/trx0rseg.h

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1996, 2010, 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
@ -114,17 +114,6 @@ trx_rseg_list_and_array_init(
/*=========================*/
trx_sysf_t* sys_header, /*!< in: trx system header */
mtr_t* mtr); /*!< in: mtr */
/****************************************************************//**
Creates a new rollback segment to the database.
@return the created segment object, NULL if fail */
UNIV_INTERN
trx_rseg_t*
trx_rseg_create(
/*============*/
ulint space, /*!< in: space id */
ulint max_size, /*!< in: max size in pages */
ulint* id, /*!< out: rseg id */
mtr_t* mtr); /*!< in: mtr */
/***************************************************************************
Free's an instance of the rollback segment in memory. */
UNIV_INTERN

65
include/trx0trx.h

@ -349,7 +349,7 @@ trx_print(
use the default max length */
/** Type of data dictionary operation */
enum trx_dict_op {
typedef enum trx_dict_op {
/** The transaction is not modifying the data dictionary. */
TRX_DICT_OP_NONE = 0,
/** The transaction is creating a table or an index, or
@ -361,7 +361,7 @@ enum trx_dict_op {
existing table. In crash recovery, the data dictionary
must be locked, but the table must not be dropped. */
TRX_DICT_OP_INDEX = 2
};
} trx_dict_op_t;
/**********************************************************************//**
Determine if a transaction is a dictionary operation.
@ -463,72 +463,79 @@ rolling back after a database recovery */
struct trx_struct{
ulint magic_n;
/* All the next fields are protected by the kernel mutex, except the
undo logs which are protected by undo_mutex */
/* These fields are not protected by any mutex. */
const char* op_info; /*!< English text describing the
current operation, or an empty
string */
unsigned is_purge:1; /*!< 0=user transaction, 1=purge */
unsigned is_recovered:1; /*!< 0=normal transaction,
1=recovered, must be rolled back */
unsigned conc_state:2; /*!< state of the trx from the point
ulint conc_state; /*!< state of the trx from the point
of view of concurrency control:
TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY,
... */
unsigned que_state:2; /*!< valid when conc_state == TRX_ACTIVE:
TRX_QUE_RUNNING, TRX_QUE_LOCK_WAIT,
... */
unsigned isolation_level:2;/* TRX_ISO_REPEATABLE_READ, ... */
unsigned check_foreigns:1;/* normally TRUE, but if the user
ulint isolation_level;/* TRX_ISO_REPEATABLE_READ, ... */
ulint check_foreigns; /* normally TRUE, but if the user
wants to suppress foreign key checks,
(in table imports, for example) we
set this FALSE */
unsigned check_unique_secondary:1;
ulint check_unique_secondary;
/* normally TRUE, but if the user
wants to speed up inserts by
suppressing unique key checks
for secondary indexes when we decide
if we can use the insert buffer for
them, we set this FALSE */
unsigned support_xa:1; /*!< normally we do the XA two-phase
ulint support_xa; /*!< normally we do the XA two-phase
commit steps, but by setting this to
FALSE, one can save CPU time and about
150 bytes in the undo log size as then
we skip XA steps */
unsigned flush_log_later:1;/* In 2PC, we hold the
ulint flush_log_later;/* In 2PC, we hold the
prepare_commit mutex across
both phases. In that case, we
defer flush of the logs to disk
until after we release the
mutex. */
unsigned must_flush_log_later:1;/* this flag is set to TRUE in
ulint must_flush_log_later;/* this flag is set to TRUE in
trx_commit_off_kernel() if
flush_log_later was TRUE, and there
were modifications by the transaction;
in that case we must flush the log
in trx_commit_complete_for_mysql() */
unsigned dict_operation:2;/**< @see enum trx_dict_op */
unsigned duplicates:2; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */
unsigned active_trans:2; /*!< 1 - if a transaction in MySQL
ulint duplicates; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */
ulint active_trans; /*!< 1 - if a transaction in MySQL
is active. 2 - if prepare_commit_mutex
was taken */
unsigned has_search_latch:1;
ulint has_search_latch;
/* TRUE if this trx has latched the
search system latch in S-mode */
unsigned declared_to_be_inside_innodb:1;
ulint deadlock_mark; /*!< a mark field used in deadlock
checking algorithm. */
trx_dict_op_t dict_operation; /**< @see enum trx_dict_op */
/* Fields protected by the srv_conc_mutex. */
ulint declared_to_be_inside_innodb;
/* this is TRUE if we have declared
this transaction in
srv_conc_enter_innodb to be inside the
InnoDB engine */
unsigned handling_signals:1;/* this is TRUE as long as the trx
is handling signals */
unsigned dict_operation_lock_mode:2;
/* 0, RW_S_LATCH, or RW_X_LATCH:
/* Fields protected by dict_operation_lock. The very latch
it is used to track. */
ulint dict_operation_lock_mode;
/*!< 0, RW_S_LATCH, or RW_X_LATCH:
the latch mode trx currently holds
on dict_operation_lock */
unsigned deadlock_mark:1;/*!< a mark field used in deadlock
checking algorithm. Always protected
by the kernel_mutex. */
/* All the next fields are protected by the kernel mutex, except the
undo logs which are protected by undo_mutex */
ulint is_purge; /*!< 0=user transaction, 1=purge */
ulint is_recovered; /*!< 0=normal transaction,
1=recovered, must be rolled back */
ulint que_state; /*!< valid when conc_state
== TRX_ACTIVE: TRX_QUE_RUNNING,
TRX_QUE_LOCK_WAIT, ... */
ulint handling_signals;/* this is TRUE as long as the trx
is handling signals */
time_t start_time; /*!< time the trx object was created
or the state last time became
TRX_ACTIVE */

9
include/trx0types.h

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1996, 2010, 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
@ -70,6 +70,13 @@ typedef struct trx_named_savept_struct trx_named_savept_t;
enum trx_rb_ctx {
RB_NONE = 0, /*!< no rollback */
RB_NORMAL, /*!< normal rollback */
RB_RECOVERY_PURGE_REC,
/*!< rolling back an incomplete transaction,
in crash recovery, rolling back an
INSERT that was performed by updating a
delete-marked record; if the delete-marked record
no longer exists in an active read view, it will
be purged */
RB_RECOVERY /*!< rolling back an incomplete transaction,
in crash recovery */
};

7
include/univ.i

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Sun Microsystems, Inc.
@ -232,11 +232,6 @@ by one. */
/* the above option prevents forcing of log to disk
at a buffer page write: it should be tested with this
option off; also some ibuf tests are suppressed */
/*
#define UNIV_BASIC_LOG_DEBUG
*/
/* the above option enables basic recovery debugging:
new allocated file pages are reset */
/* Linkage specifier for non-static InnoDB symbols (variables and functions)
that are only referenced from within InnoDB, not from MySQL */

136
lock/lock0lock.c

@ -376,6 +376,7 @@ UNIV_INTERN FILE* lock_latest_err_file;
/* Flags for recursive deadlock search */
#define LOCK_VICTIM_IS_START 1
#define LOCK_VICTIM_IS_OTHER 2
#define LOCK_EXCEED_MAX_DEPTH 3
/********************************************************************//**
Checks if a lock request results in a deadlock.
@ -394,7 +395,8 @@ Looks recursively for a deadlock.
deadlock and we chose 'start' as the victim, LOCK_VICTIM_IS_OTHER if a
deadlock was found and we chose some other trx as a victim: we must do
the search again in this last case because there may be another
deadlock! */
deadlock!
LOCK_EXCEED_MAX_DEPTH if the lock search exceeds max steps or max depth. */
static
ulint
lock_deadlock_recursive(
@ -404,10 +406,10 @@ lock_deadlock_recursive(
lock_t* wait_lock, /*!< in: lock that is waiting to be granted */
ulint* cost, /*!< in/out: number of calculation steps thus
far: if this exceeds LOCK_MAX_N_STEPS_...
we return LOCK_VICTIM_IS_START */
we return LOCK_EXCEED_MAX_DEPTH */
ulint depth); /*!< in: recursion depth: if this exceeds
LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we
return LOCK_VICTIM_IS_START */
return LOCK_EXCEED_MAX_DEPTH */
/*********************************************************************//**
Gets the nth bit of a record lock.
@ -3261,8 +3263,6 @@ lock_deadlock_occurs(
lock_t* lock, /*!< in: lock the transaction is requesting */
trx_t* trx) /*!< in: transaction */
{
dict_table_t* table;
dict_index_t* index;
trx_t* mark_trx;
ulint ret;
ulint cost = 0;
@ -3284,31 +3284,50 @@ retry:
ret = lock_deadlock_recursive(trx, trx, lock, &cost, 0);
if (ret == LOCK_VICTIM_IS_OTHER) {
switch (ret) {
case LOCK_VICTIM_IS_OTHER:
/* We chose some other trx as a victim: retry if there still
is a deadlock */
goto retry;
}
if (UNIV_UNLIKELY(ret == LOCK_VICTIM_IS_START)) {
if (lock_get_type_low(lock) & LOCK_TABLE) {
table = lock->un_member.tab_lock.table;
index = NULL;
case LOCK_EXCEED_MAX_DEPTH:
/* If the lock search exceeds the max step
or the max depth, the current trx will be
the victim. Print its information. */
rewind(lock_latest_err_file);
ut_print_timestamp(lock_latest_err_file);
fputs("TOO DEEP OR LONG SEARCH IN THE LOCK TABLE"
" WAITS-FOR GRAPH, WE WILL ROLL BACK"
" FOLLOWING TRANSACTION \n",
lock_latest_err_file);
fputs("\n*** TRANSACTION:\n", lock_latest_err_file);
trx_print(lock_latest_err_file, trx, 3000);
fputs("*** WAITING FOR THIS LOCK TO BE GRANTED:\n",
lock_latest_err_file);
if (lock_get_type(lock) == LOCK_REC) {
lock_rec_print(lock_latest_err_file, lock);
} else {
index = lock->index;
table = index->table;
lock_table_print(lock_latest_err_file, lock);
}
break;
lock_deadlock_found = TRUE;
case LOCK_VICTIM_IS_START:
fputs("*** WE ROLL BACK TRANSACTION (2)\n",
lock_latest_err_file);
break;
return(TRUE);
default:
/* No deadlock detected*/
return(FALSE);
}
return(FALSE);
lock_deadlock_found = TRUE;
return(TRUE);
}
/********************************************************************//**
@ -3317,7 +3336,8 @@ Looks recursively for a deadlock.
deadlock and we chose 'start' as the victim, LOCK_VICTIM_IS_OTHER if a
deadlock was found and we chose some other trx as a victim: we must do
the search again in this last case because there may be another
deadlock! */
deadlock!
LOCK_EXCEED_MAX_DEPTH if the lock search exceeds max steps or max depth. */
static
ulint
lock_deadlock_recursive(
@ -3327,10 +3347,10 @@ lock_deadlock_recursive(
lock_t* wait_lock, /*!< in: lock that is waiting to be granted */
ulint* cost, /*!< in/out: number of calculation steps thus
far: if this exceeds LOCK_MAX_N_STEPS_...
we return LOCK_VICTIM_IS_START */
we return LOCK_EXCEED_MAX_DEPTH */
ulint depth) /*!< in: recursion depth: if this exceeds
LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we
return LOCK_VICTIM_IS_START */
return LOCK_EXCEED_MAX_DEPTH */
{
ulint ret;
lock_t* lock;
@ -3406,7 +3426,7 @@ lock_deadlock_recursive(
lock_trx = lock->trx;
if (lock_trx == start || too_far) {
if (lock_trx == start) {
/* We came back to the recursion starting
point: a deadlock detected; or we have
@ -3453,19 +3473,10 @@ lock_deadlock_recursive(
}
#ifdef UNIV_DEBUG
if (lock_print_waits) {
fputs("Deadlock detected"
" or too long search\n",
fputs("Deadlock detected\n",
stderr);
}
#endif /* UNIV_DEBUG */
if (too_far) {
fputs("TOO DEEP OR LONG SEARCH"
" IN THE LOCK TABLE"
" WAITS-FOR GRAPH\n", ef);
return(LOCK_VICTIM_IS_START);
}
if (trx_weight_cmp(wait_lock->trx,
start) >= 0) {
@ -3501,6 +3512,21 @@ lock_deadlock_recursive(
return(LOCK_VICTIM_IS_OTHER);
}
if (too_far) {
#ifdef UNIV_DEBUG
if (lock_print_waits) {
fputs("Deadlock search exceeds"
" max steps or depth.\n",
stderr);
}
#endif /* UNIV_DEBUG */
/* The information about transaction/lock
to be rolled back is available in the top
level. Do not print anything here. */
return(LOCK_EXCEED_MAX_DEPTH);
}
if (lock_trx->que_state == TRX_QUE_LOCK_WAIT) {
/* Another trx ahead has requested lock in an
@ -3727,9 +3753,10 @@ lock_table_enqueue_waiting(
/*********************************************************************//**
Checks if other transactions have an incompatible mode lock request in
the lock queue. */
the lock queue.
@return lock or NULL */
UNIV_INLINE
ibool
lock_t*
lock_table_other_has_incompatible(
/*==============================*/
trx_t* trx, /*!< in: transaction, or NULL if all
@ -3751,13 +3778,13 @@ lock_table_other_has_incompatible(
&& (!lock_mode_compatible(lock_get_mode(lock), mode))
&& (wait || !(lock_get_wait(lock)))) {
return(TRUE);
return(lock);
}
lock = UT_LIST_GET_PREV(un_member.tab_lock.locks, lock);
}
return(FALSE);
return(NULL);
}
/*********************************************************************//**
@ -4282,28 +4309,29 @@ lock_rec_print(
block = buf_page_try_get(space, page_no, &mtr);
if (block) {
for (i = 0; i < lock_rec_get_n_bits(lock); i++) {
for (i = 0; i < lock_rec_get_n_bits(lock); ++i) {
if (lock_rec_get_nth_bit(lock, i)) {
if (!lock_rec_get_nth_bit(lock, i)) {
continue;
}
const rec_t* rec
= page_find_rec_with_heap_no(
buf_block_get_frame(block), i);
offsets = rec_get_offsets(
rec, lock->index, offsets,
ULINT_UNDEFINED, &heap);
fprintf(file, "Record lock, heap no %lu", (ulong) i);
fprintf(file, "Record lock, heap no %lu ",
(ulong) i);
rec_print_new(file, rec, offsets);
putc('\n', file);
}
}
} else {
for (i = 0; i < lock_rec_get_n_bits(lock); i++) {
fprintf(file, "Record lock, heap no %lu\n", (ulong) i);
if (block) {
const rec_t* rec;
rec = page_find_rec_with_heap_no(
buf_block_get_frame(block), i);
offsets = rec_get_offsets(
rec, lock->index, offsets,
ULINT_UNDEFINED, &heap);
putc(' ', file);
rec_print_new(file, rec, offsets);
}
putc('\n', file);
}
mtr_commit(&mtr);

20
log/log0recv.c

@ -3231,8 +3231,6 @@ void
recv_recovery_from_checkpoint_finish(void)
/*======================================*/
{
int i;
/* Apply the hashed log records to the respective file pages */
if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
@ -3280,11 +3278,16 @@ recv_recovery_from_checkpoint_finish(void)
The data dictionary latch should guarantee that there is at
most one data dictionary transaction active at a time. */
trx_rollback_or_clean_recovered(FALSE);
}
/* Drop partially created indexes. */
row_merge_drop_temp_indexes();
/* Drop temporary tables. */
row_mysql_drop_temp_tables();
/********************************************************//**
Initiates the rollback of active transactions. */
UNIV_INTERN
void
recv_recovery_rollback_active(void)
/*===============================*/
{
int i;
#ifdef UNIV_SYNC_DEBUG
/* Wait for a while so that created threads have time to suspend
@ -3294,6 +3297,11 @@ recv_recovery_from_checkpoint_finish(void)
/* Switch latching order checks on in sync0sync.c */
sync_order_checks_on = TRUE;
#endif
/* Drop partially created indexes. */
row_merge_drop_temp_indexes();
/* Drop temporary tables. */
row_mysql_drop_temp_tables();
if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) {
/* Rollback the uncommitted transactions which have no user
session */

2
mem/mem0mem.c

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1994, 2010, 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

3
mysql-test/innodb-index.result

@ -434,6 +434,7 @@ t3 CREATE TABLE `t3` (
KEY `c` (`c`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table t2 drop index b, add index (b);
ERROR 42000: Incorrect index name 'b'
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
@ -444,8 +445,8 @@ t2 CREATE TABLE `t2` (
`e` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `dc` (`d`,`c`),
KEY `c` (`c`),
KEY `b` (`b`),
KEY `c` (`c`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`b`) ON DELETE CASCADE,
CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`c`) REFERENCES `t3` (`c`),
CONSTRAINT `t2_ibfk_3` FOREIGN KEY (`d`) REFERENCES `t4` (`d`)

2
mysql-test/innodb-index.test

@ -131,6 +131,8 @@ show create table t4;
--error ER_CANT_CREATE_TABLE
alter table t3 add constraint dc foreign key (a) references t1(a);
show create table t3;
# this should be fixed by MySQL (see Bug #51451)
--error ER_WRONG_NAME_FOR_INDEX
alter table t2 drop index b, add index (b);
show create table t2;
--error ER_ROW_IS_REFERENCED_2

10
mysql-test/innodb.result

@ -692,6 +692,9 @@ select count(*) from t1 where sca_pic is null;
count(*)
2
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
ERROR 42000: Incorrect index name 'sca_pic'
alter table t1 drop index sca_pic;
alter table t1 add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*)
1
@ -699,6 +702,9 @@ select count(*) from t1 where cat_code='E';
count(*)
0
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
ERROR 42000: Incorrect index name 'sca_pic'
alter table t1 drop index sca_pic;
alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*)
1
@ -1833,6 +1839,7 @@ show variables like "innodb_thread_sleep_delay";
Variable_name Value
innodb_thread_sleep_delay 10000
set storage_engine=INNODB;
set session old_alter_table=1;
drop table if exists t1,t2,t3;
--- Testing varchar ---
--- Testing varchar ---
@ -1970,7 +1977,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where; Using index
alter table t1 add unique(v);
ERROR 23000: Duplicate entry 'v' for key 'v_2'
ERROR 23000: Duplicate entry '{ ' for key 'v_2'
alter table t1 add key(v);
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
qq
@ -2406,6 +2413,7 @@ select * from t1 where a=20 and b is null;
a b
20 NULL
drop table t1;
set session old_alter_table=0;
create table t1 (v varchar(65530), key(v));
Warnings:
Warning 1071 Specified key was too long; max key length is 767 bytes

11
mysql-test/innodb.test

@ -427,11 +427,19 @@ INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca
select count(*) from t1 where sca_code = 'PD';
select count(*) from t1 where sca_code <= 'PD';
select count(*) from t1 where sca_pic is null;
# this should be fixed by MySQL (see Bug #51451)
--error ER_WRONG_NAME_FOR_INDEX
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
alter table t1 drop index sca_pic;
alter table t1 add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where cat_code='E';
# this should be fixed by MySQL (see Bug #51451)
--error ER_WRONG_NAME_FOR_INDEX
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
alter table t1 drop index sca_pic;
alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where sca_pic >= 'n';
select sca_pic from t1 where sca_pic is null;
@ -1377,7 +1385,10 @@ show variables like "innodb_thread_sleep_delay";
let $default=`select @@storage_engine`;
set storage_engine=INNODB;
# this should be fixed by MySQL (see Bug #51451)
set session old_alter_table=1;
source include/varchar.inc;
set session old_alter_table=0;
#
# Some errors/warnings on create

10
os/os0file.c

@ -885,7 +885,15 @@ next_file:
#ifdef HAVE_READDIR_R
ret = readdir_r(dir, (struct dirent*)dirent_buf, &ent);
if (ret != 0) {
if (ret != 0
#ifdef UNIV_AIX
/* On AIX, only if we got non-NULL 'ent' (result) value and
a non-zero 'ret' (return) value, it indicates a failed
readdir_r() call. An NULL 'ent' with an non-zero 'ret'
would indicate the "end of the directory" is reached. */
&& ent != NULL
#endif
) {
fprintf(stderr,
"InnoDB: cannot read directory %s, error %lu\n",
dirname, (ulong)ret);

18
rem/rem0rec.c

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1994, 2010, 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
@ -695,19 +695,9 @@ rec_get_nth_field_offs_old(
ulint os;
ulint next_os;
ut_ad(rec && len);
ut_ad(n < rec_get_n_fields_old(rec));
if (UNIV_UNLIKELY(n > REC_MAX_N_FIELDS)) {
fprintf(stderr, "Error: trying to access field %lu in rec\n",
(ulong) n);
ut_error;
}
if (UNIV_UNLIKELY(rec == NULL)) {
fputs("Error: rec is NULL pointer\n", stderr);
ut_error;
}
ut_ad(len);
ut_a(rec);
ut_a(n < rec_get_n_fields_old(rec));
if (rec_get_1byte_offs_flag(rec)) {
os = rec_1_get_field_start_offs(rec, n);

148
row/row0merge.c

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 2005, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 2005, 2010, 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
@ -429,14 +429,13 @@ row_merge_dup_report(
row_merge_dup_t* dup, /*!< in/out: for reporting duplicates */
const dfield_t* entry) /*!< in: duplicate index entry */
{
mrec_buf_t buf;
mrec_buf_t* buf;
const dtuple_t* tuple;
dtuple_t tuple_store;
const rec_t* rec;
const dict_index_t* index = dup->index;
ulint n_fields= dict_index_get_n_fields(index);
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
mem_heap_t* heap;
ulint* offsets;
ulint n_ext;
@ -446,22 +445,22 @@ row_merge_dup_report(
return;
}
rec_offs_init(offsets_);
/* Convert the tuple to a record and then to MySQL format. */
heap = mem_heap_create((1 + REC_OFFS_HEADER_SIZE + n_fields)
* sizeof *offsets
+ sizeof *buf);
buf = mem_heap_alloc(heap, sizeof *buf);
tuple = dtuple_from_fields(&tuple_store, entry, n_fields);
n_ext = dict_index_is_clust(index) ? dtuple_get_n_ext(tuple) : 0;
rec = rec_convert_dtuple_to_rec(buf, index, tuple, n_ext);
offsets = rec_get_offsets(rec, index, offsets_, ULINT_UNDEFINED,
&heap);
rec = rec_convert_dtuple_to_rec(*buf, index, tuple, n_ext);
offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
innobase_rec_to_mysql(dup->table, rec, index, offsets);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
mem_heap_free(heap);
}
/*************************************************************//**
@ -632,22 +631,26 @@ row_merge_buf_write(
}
/******************************************************//**
Create a memory heap and allocate space for row_merge_rec_offsets().
Create a memory heap and allocate space for row_merge_rec_offsets()
and mrec_buf_t[3].
@return memory heap */
static
mem_heap_t*
row_merge_heap_create(
/*==================*/
const dict_index_t* index, /*!< in: record descriptor */
mrec_buf_t** buf, /*!< out: 3 buffers */
ulint** offsets1, /*!< out: offsets */
ulint** offsets2) /*!< out: offsets */
{
ulint i = 1 + REC_OFFS_HEADER_SIZE
+ dict_index_get_n_fields(index);
mem_heap_t* heap = mem_heap_create(2 * i * sizeof *offsets1);
mem_heap_t* heap = mem_heap_create(2 * i * sizeof **offsets1
+ 3 * sizeof **buf);
*offsets1 = mem_heap_alloc(heap, i * sizeof *offsets1);
*offsets2 = mem_heap_alloc(heap, i * sizeof *offsets2);
*buf = mem_heap_alloc(heap, 3 * sizeof **buf);
*offsets1 = mem_heap_alloc(heap, i * sizeof **offsets1);
*offsets2 = mem_heap_alloc(heap, i * sizeof **offsets2);
(*offsets1)[0] = (*offsets2)[0] = i;
(*offsets1)[1] = (*offsets2)[1] = dict_index_get_n_fields(index);
@ -1410,7 +1413,8 @@ row_merge_blocks(
{
mem_heap_t* heap; /*!< memory heap for offsets0, offsets1 */
mrec_buf_t buf[3]; /*!< buffer for handling split mrec in block[] */
mrec_buf_t* buf; /*!< buffer for handling
split mrec in block[] */
const byte* b0; /*!< pointer to block[0] */
const byte* b1; /*!< pointer to block[1] */
byte* b2; /*!< pointer to block[2] */
@ -1430,7 +1434,7 @@ row_merge_blocks(
}
#endif /* UNIV_DEBUG */
heap = row_merge_heap_create(index, &offsets0, &offsets1);
heap = row_merge_heap_create(index, &buf, &offsets0, &offsets1);
/* Write a record and read the next record. Split the output
file in two halves, which can be merged on the following pass. */
@ -1516,7 +1520,7 @@ row_merge_blocks_copy(
{
mem_heap_t* heap; /*!< memory heap for offsets0, offsets1 */
mrec_buf_t buf[3]; /*!< buffer for handling
mrec_buf_t* buf; /*!< buffer for handling
split mrec in block[] */
const byte* b0; /*!< pointer to block[0] */
byte* b2; /*!< pointer to block[2] */
@ -1534,7 +1538,7 @@ row_merge_blocks_copy(
}
#endif /* UNIV_DEBUG */
heap = row_merge_heap_create(index, &offsets0, &offsets1);
heap = row_merge_heap_create(index, &buf, &offsets0, &offsets1);
/* Write a record and read the next record. Split the output
file in two halves, which can be merged on the following pass. */
@ -1784,7 +1788,6 @@ row_merge_insert_index_tuples(
int fd, /*!< in: file descriptor */
row_merge_block_t* block) /*!< in/out: file buffer */
{
mrec_buf_t buf;
const byte* b;
que_thr_t* thr;
ins_node_t* node;
@ -1803,7 +1806,7 @@ row_merge_insert_index_tuples(
trx->op_info = "inserting index entries";
graph_heap = mem_heap_create(500);
graph_heap = mem_heap_create(500 + sizeof(mrec_buf_t));
node = ins_node_create(INS_DIRECT, table, graph_heap);
thr = pars_complete_graph_for_exec(node, trx, graph_heap);
@ -1825,12 +1828,14 @@ row_merge_insert_index_tuples(
if (!row_merge_read(fd, foffs, block)) {
error = DB_CORRUPTION;
} else {
mrec_buf_t* buf = mem_heap_alloc(graph_heap, sizeof *buf);
for (;;) {
const mrec_t* mrec;
dtuple_t* dtuple;
ulint n_ext;
b = row_merge_read_rec(block, &buf, b, index,
b = row_merge_read_rec(block, buf, b, index,
fd, &foffs, &mrec, offsets);
if (UNIV_UNLIKELY(!b)) {
/* End of list, or I/O error */
@ -2001,14 +2006,12 @@ row_merge_drop_index(
/* Drop the field definitions of the index. */
"DELETE FROM SYS_FIELDS WHERE INDEX_ID = :indexid;\n"
/* Drop the index definition and the B-tree. */
"DELETE FROM SYS_INDEXES WHERE ID = :indexid\n"
" AND TABLE_ID = :tableid;\n"
"DELETE FROM SYS_INDEXES WHERE ID = :indexid;\n"
"END;\n";
ut_ad(index && table && trx);
pars_info_add_dulint_literal(info, "indexid", index->id);
pars_info_add_dulint_literal(info, "tableid", table->id);
trx_start_if_not_started(trx);
trx->op_info = "dropping index";
@ -2057,38 +2060,79 @@ row_merge_drop_temp_indexes(void)
/*=============================*/
{
trx_t* trx;
ulint err;
/* We use the private SQL parser of Innobase to generate the
query graphs needed in deleting the dictionary data from system
tables in Innobase. Deleting a row from SYS_INDEXES table also
frees the file segments of the B-tree associated with the index. */
static const char drop_temp_indexes[] =
"PROCEDURE DROP_TEMP_INDEXES_PROC () IS\n"
"indexid CHAR;\n"
"DECLARE CURSOR c IS SELECT ID FROM SYS_INDEXES\n"
"WHERE SUBSTR(NAME,0,1)='" TEMP_INDEX_PREFIX_STR "';\n"
"BEGIN\n"
"\tOPEN c;\n"
"\tWHILE 1=1 LOOP\n"
"\t\tFETCH c INTO indexid;\n"
"\t\tIF (SQL % NOTFOUND) THEN\n"
"\t\t\tEXIT;\n"
"\t\tEND IF;\n"
"\t\tDELETE FROM SYS_FIELDS WHERE INDEX_ID = indexid;\n"
"\t\tDELETE FROM SYS_INDEXES WHERE ID = indexid;\n"
"\tEND LOOP;\n"
"\tCLOSE c;\n"
"\tCOMMIT WORK;\n"
"END;\n";
btr_pcur_t pcur;
mtr_t mtr;
/* Load the table definitions that contain partially defined
indexes, so that the data dictionary information can be checked
when accessing the tablename.ibd files. */
trx = trx_allocate_for_background();
trx->op_info = "dropping partially created indexes";
row_mysql_lock_data_dictionary(trx);
err = que_eval_sql(NULL, drop_temp_indexes, FALSE, trx);
ut_a(err == DB_SUCCESS);
mtr_start(&mtr);
btr_pcur_open_at_index_side(
TRUE,
dict_table_get_first_index(dict_sys->sys_indexes),
BTR_SEARCH_LEAF, &pcur, TRUE, &mtr);
for (;;) {
const rec_t* rec;
const byte* field;
ulint len;
dulint table_id;
dict_table_t* table;
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
if (!btr_pcur_is_on_user_rec(&pcur)) {
break;
}
rec = btr_pcur_get_rec(&pcur);
field = rec_get_nth_field_old(rec, DICT_SYS_INDEXES_NAME_FIELD,
&len);
if (len == UNIV_SQL_NULL || len == 0
|| mach_read_from_1(field) != (ulint) TEMP_INDEX_PREFIX) {
continue;
}
/* This is a temporary index. */
field = rec_get_nth_field_old(rec, 0/*TABLE_ID*/, &len);
if (len != 8) {
/* Corrupted TABLE_ID */
continue;
}
table_id = mach_read_from_8(field);
btr_pcur_store_position(&pcur, &mtr);
btr_pcur_commit_specify_mtr(&pcur, &mtr);
table = dict_load_table_on_id(table_id);
if (table) {
dict_index_t* index;
for (index = dict_table_get_first_index(table);
index; index = dict_table_get_next_index(index)) {
if (*index->name == TEMP_INDEX_PREFIX) {
row_merge_drop_index(index, table, trx);
trx_commit_for_mysql(trx);
}
}
}
mtr_start(&mtr);
btr_pcur_restore_position(BTR_SEARCH_LEAF,
&pcur, &mtr);
}
btr_pcur_close(&pcur);
mtr_commit(&mtr);
row_mysql_unlock_data_dictionary(trx);
trx_free_for_background(trx);
}

139
row/row0mysql.c

@ -3370,88 +3370,79 @@ void
row_mysql_drop_temp_tables(void)
/*============================*/
{
trx_t* trx;
ulint err;
trx_t* trx;
btr_pcur_t pcur;
mtr_t mtr;
mem_heap_t* heap;
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);
heap = mem_heap_create(200);
if (err != DB_SUCCESS) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Failed to drop temporary tables:"
" error %lu occurred\n",
(ulong) err);
mtr_start(&mtr);
btr_pcur_open_at_index_side(
TRUE,
dict_table_get_first_index(dict_sys->sys_tables),
BTR_SEARCH_LEAF, &pcur, TRUE, &mtr);
for (;;) {
const rec_t* rec;
const byte* field;
ulint len;
const char* table_name;
dict_table_t* table;
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
if (!btr_pcur_is_on_user_rec(&pcur)) {
break;
}
rec = btr_pcur_get_rec(&pcur);
field = rec_get_nth_field_old(rec, 4/*N_COLS*/, &len);
if (len != 4 || !(mach_read_from_4(field) & 0x80000000UL)) {
continue;
}
/* Because this is not a ROW_FORMAT=REDUNDANT table,
the is_temp flag is valid. Examine it. */
field = rec_get_nth_field_old(rec, 7/*MIX_LEN*/, &len);
if (len != 4
|| !(mach_read_from_4(field) & DICT_TF2_TEMPORARY)) {
continue;
}
/* This is a temporary table. */
field = rec_get_nth_field_old(rec, 0/*NAME*/, &len);
if (len == UNIV_SQL_NULL || len == 0) {
/* Corrupted SYS_TABLES.NAME */
continue;
}
table_name = mem_heap_strdupl(heap, (const char*) field, len);
btr_pcur_store_position(&pcur, &mtr);
btr_pcur_commit_specify_mtr(&pcur, &mtr);
table = dict_load_table(table_name);
if (table) {
row_drop_table_for_mysql(table_name, trx, FALSE);
trx_commit_for_mysql(trx);
}
mtr_start(&mtr);
btr_pcur_restore_position(BTR_SEARCH_LEAF,
&pcur, &mtr);
}
btr_pcur_close(&pcur);
mtr_commit(&mtr);
mem_heap_free(heap);
row_mysql_unlock_data_dictionary(trx);
trx_free_for_background(trx);
}

15
row/row0row.c

@ -944,6 +944,10 @@ row_raw_format(
ret = row_raw_format_int(data, data_len, prtype,
buf, buf_size, &format_in_hex);
if (format_in_hex) {
goto format_in_hex;
}
break;
case DATA_CHAR:
case DATA_VARCHAR:
@ -952,14 +956,15 @@ row_raw_format(
ret = row_raw_format_str(data, data_len, prtype,
buf, buf_size, &format_in_hex);
if (format_in_hex) {
goto format_in_hex;
}
break;
/* XXX support more data types */
default:
format_in_hex = TRUE;
}
if (format_in_hex) {
format_in_hex:
if (UNIV_LIKELY(buf_size > 2)) {

39
row/row0sel.c

@ -2167,36 +2167,6 @@ row_fetch_print(
return((void*)42);
}
/****************************************************************//**
Callback function for fetch that stores an unsigned 4 byte integer to the
location pointed. The column's type must be DATA_INT, DATA_UNSIGNED, length
= 4.
@return always returns NULL */
UNIV_INTERN
void*
row_fetch_store_uint4(
/*==================*/
void* row, /*!< in: sel_node_t* */
void* user_arg) /*!< in: data pointer */
{
sel_node_t* node = row;
ib_uint32_t* val = user_arg;
ulint tmp;
dfield_t* dfield = que_node_get_val(node->select_list);
const dtype_t* type = dfield_get_type(dfield);
ulint len = dfield_get_len(dfield);
ut_a(dtype_get_mtype(type) == DATA_INT);
ut_a(dtype_get_prtype(type) & DATA_UNSIGNED);
ut_a(len == 4);
tmp = mach_read_from_4(dfield_get_data(dfield));
*val = (ib_uint32_t) tmp;
return(NULL);
}
/***********************************************************//**
Prints a row in a select result.
@return query thread to run next or NULL */
@ -3200,14 +3170,17 @@ row_sel_try_search_shortcut_for_mysql(
ut_ad(dict_index_is_clust(index));
ut_ad(!prebuilt->templ_contains_blob);
#ifndef UNIV_SEARCH_DEBUG
btr_pcur_open_with_no_init(index, search_tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, pcur,
#ifndef UNIV_SEARCH_DEBUG
RW_S_LATCH,
#else
mtr);
#else /* UNIV_SEARCH_DEBUG */
btr_pcur_open_with_no_init(index, search_tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, pcur,
0,
#endif
mtr);
#endif /* UNIV_SEARCH_DEBUG */
rec = btr_pcur_get_rec(pcur);
if (!page_rec_is_user_rec(rec)) {

31
row/row0umod.c

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1997, 2010, 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
@ -144,13 +144,17 @@ row_undo_mod_clust_low(
/***********************************************************//**
Removes a clustered index record after undo if possible.
This is attempted when the record was inserted by updating a
delete-marked record and there no longer exist transactions
that would see the delete-marked record. In other words, we
roll back the insert by purging the record.
@return DB_SUCCESS, DB_FAIL, or error code: we may run out of file space */
static
ulint
row_undo_mod_remove_clust_low(
/*==========================*/
undo_node_t* node, /*!< in: row undo node */
que_thr_t* thr __attribute__((unused)), /*!< in: query thread */
que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr, /*!< in: mtr */
ulint mode) /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE */
{
@ -159,6 +163,7 @@ row_undo_mod_remove_clust_low(
ulint err;
ibool success;
ut_ad(node->rec_type == TRX_UNDO_UPD_DEL_REC);
pcur = &(node->pcur);
btr_cur = btr_pcur_get_btr_cur(pcur);
@ -190,11 +195,13 @@ row_undo_mod_remove_clust_low(
} else {
ut_ad(mode == BTR_MODIFY_TREE);
/* Note that since this operation is analogous to purge,
we can free also inherited externally stored fields:
hence the RB_NONE in the call below */
/* This operation is analogous to purge, we can free also
inherited externally stored fields */
btr_cur_pessimistic_delete(&err, FALSE, btr_cur, RB_NONE, mtr);
btr_cur_pessimistic_delete(&err, FALSE, btr_cur,
thr_is_recv(thr)
? RB_RECOVERY_PURGE_REC
: RB_NONE, mtr);
/* The delete operation may fail if we have little
file space left: TODO: easiest to crash the database
@ -381,10 +388,11 @@ row_undo_mod_del_mark_or_remove_sec_low(
} else {
ut_ad(mode == BTR_MODIFY_TREE);
/* No need to distinguish RB_RECOVERY here, because we
are deleting a secondary index record: the distinction
between RB_NORMAL and RB_RECOVERY only matters when
deleting a record that contains externally stored
/* No need to distinguish RB_RECOVERY_PURGE here,
because we are deleting a secondary index record:
the distinction between RB_NORMAL and
RB_RECOVERY_PURGE only matters when deleting a
record that contains externally stored
columns. */
ut_ad(!dict_index_is_clust(index));
btr_cur_pessimistic_delete(&err, FALSE, btr_cur,
@ -560,6 +568,7 @@ row_undo_mod_upd_del_sec(
dict_index_t* index;
ulint err = DB_SUCCESS;
ut_ad(node->rec_type == TRX_UNDO_UPD_DEL_REC);
heap = mem_heap_create(1024);
while (node->index != NULL) {
@ -577,7 +586,7 @@ row_undo_mod_upd_del_sec(
does not exist. However, this situation may
only occur during the rollback of incomplete
transactions. */
ut_a(trx_is_recv(thr_get_trx(thr)));
ut_a(thr_is_recv(thr));
} else {
err = row_undo_mod_del_mark_or_remove_sec(
node, thr, index, entry);

11
srv/srv0srv.c

@ -1723,9 +1723,9 @@ srv_printf_innodb_monitor(
"Per second averages calculated from the last %lu seconds\n",
(ulong)time_elapsed);
fputs("----------\n"
"BACKGROUND THREAD\n"
"----------\n", file);
fputs("-----------------\n"
"BACKGROUND THREAD\n"
"-----------------\n", file);
srv_print_master_thread_info(file);
fputs("----------\n"
@ -2530,7 +2530,10 @@ loop:
BUF_FLUSH_LIST,
n_flush,
IB_ULONGLONG_MAX);
skip_sleep = TRUE;
if (n_flush == PCT_IO(100)) {
skip_sleep = TRUE;
}
}
}

24
srv/srv0start.c

@ -1587,6 +1587,14 @@ innobase_start_or_create_for_mysql(void)
dict_boot();
trx_sys_init_at_db_start();
/* Initialize the fsp free limit global variable in the log
system */
fsp_header_get_free_limit();
/* recv_recovery_from_checkpoint_finish needs trx lists which
are initialized in trx_sys_init_at_db_start(). */
recv_recovery_from_checkpoint_finish();
if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
/* The following call is necessary for the insert
buffer to work with multiple tablespaces. We must
@ -1602,26 +1610,14 @@ innobase_start_or_create_for_mysql(void)
every table in the InnoDB data dictionary that has
an .ibd file.
We also determine the maximum tablespace id used.
TODO: We may have incomplete transactions in the
data dictionary tables. Does that harm the scanning of
the data dictionary below? */
We also determine the maximum tablespace id used. */
dict_check_tablespaces_and_store_max_id(
recv_needed_recovery);
}
srv_startup_is_before_trx_rollback_phase = FALSE;
/* Initialize the fsp free limit global variable in the log
system */
fsp_header_get_free_limit();
/* recv_recovery_from_checkpoint_finish needs trx lists which
are initialized in trx_sys_init_at_db_start(). */
recv_recovery_from_checkpoint_finish();
recv_recovery_rollback_active();
/* It is possible that file_format tag has never
been set. In this case we initialize it to minimum

38
trx/trx0rseg.c

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1996, 2010, 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
@ -286,39 +286,3 @@ trx_rseg_list_and_array_init(
}
}
}
/****************************************************************//**
Creates a new rollback segment to the database.
@return the created segment object, NULL if fail */
UNIV_INTERN
trx_rseg_t*
trx_rseg_create(
/*============*/
ulint space, /*!< in: space id */
ulint max_size, /*!< in: max size in pages */
ulint* id, /*!< out: rseg id */
mtr_t* mtr) /*!< in: mtr */
{
ulint flags;
ulint zip_size;
ulint page_no;
trx_rseg_t* rseg;
mtr_x_lock(fil_space_get_latch(space, &flags), mtr);
zip_size = dict_table_flags_to_zip_size(flags);
mutex_enter(&kernel_mutex);
page_no = trx_rseg_header_create(space, zip_size, max_size, id, mtr);
if (page_no == FIL_NULL) {
mutex_exit(&kernel_mutex);
return(NULL);
}
rseg = trx_rseg_mem_create(*id, space, zip_size, page_no, mtr);
mutex_exit(&kernel_mutex);
return(rseg);
}

3
trx/trx0trx.c

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1996, 2010, 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
@ -425,6 +425,7 @@ trx_lists_init_at_db_start(void)
trx_undo_t* undo;
trx_t* trx;
ut_ad(mutex_own(&kernel_mutex));
UT_LIST_INIT(trx_sys->trx_list);
/* Look from the rollback segments if there exist undo logs for

Loading…
Cancel
Save