mariadb/include/mtr0mtr.ic
marko 83d2cd7a62 branches/innodb+: Merge revisions 6773:6801 from branches/zip:
------------------------------------------------------------------------
  r6777 | marko | 2010-03-04 13:01:25 +0200 (Thu, 04 Mar 2010) | 2 lines
  Changed paths:
     M /branches/zip/trx/trx0rec.c

  branches/zip: trx_undo_update_rec_get_update(): Silence a bogus GCC warning
  about a possibly uninitialized variable.
  ------------------------------------------------------------------------
  r6779 | marko | 2010-03-08 14:35:42 +0200 (Mon, 08 Mar 2010) | 6 lines
  Changed paths:
     M /branches/zip/ChangeLog
     M /branches/zip/fil/fil0fil.c

  branches/zip: Fix IMPORT TABLESPACE of compressed tables.  Previously,
  a wrong parameter was passed to buf_flush_init_for_writing().

  fil_reset_too_high_lsns(): Set up page_zip and use it if needed.

  rb://264, Issue #352
  ------------------------------------------------------------------------
  r6781 | marko | 2010-03-09 09:41:08 +0200 (Tue, 09 Mar 2010) | 4 lines
  Changed paths:
     M /branches/zip/ChangeLog
     M /branches/zip/handler/ha_innodb.cc

  branches/zip: Make SHOW ENGINE INNODB MUTEX display SUM(os_waits)
  for block mutexes and blocks.

  Designed by Michael and Marko. rb://188, Issue #358
  ------------------------------------------------------------------------
  r6782 | marko | 2010-03-09 14:09:26 +0200 (Tue, 09 Mar 2010) | 1 line
  Changed paths:
     M /branches/zip/fil/fil0fil.c

  branches/zip: fil0fil.c: Update comments on table->flags as of r6252.
  ------------------------------------------------------------------------
  r6786 | vasil | 2010-03-10 09:16:50 +0200 (Wed, 10 Mar 2010) | 4 lines
  Changed paths:
     M /branches/zip/mysql-test/innodb-consistent.test

  branches/zip:

  Fix typo in comment
  ------------------------------------------------------------------------
  r6787 | marko | 2010-03-10 10:35:06 +0200 (Wed, 10 Mar 2010) | 10 lines
  Changed paths:
     M /branches/zip/ChangeLog
     M /branches/zip/log/log0recv.c

  branches/zip: recv_parse_log_rec(): Remove a bogus assertion about page_no.
  TODO: We might also consider removing recv_max_parsed_page_no, because
  it does not make much sense with *.ibd files.

  recv_report_corrupt_log(), recv_scan_log_recs(): Abort when a
  corrupted log record has been found, unless innodb_force_recovery has
  been set.

  This fixes Issue #464.
  rb://265 approved by Heikki Tuuri
  ------------------------------------------------------------------------
  r6789 | jyang | 2010-03-10 11:18:18 +0200 (Wed, 10 Mar 2010) | 10 lines
  Changed paths:
     M /branches/zip/handler/ha_innodb.cc
     M /branches/zip/handler/handler0alter.cc
     A /branches/zip/mysql-test/innodb_bug51378.result
     A /branches/zip/mysql-test/innodb_bug51378.test

  branches/zip: If a unique index is on a column prefix, such
  unique index cannot be upgrade to primary index even if there
  is no primary index already defined. Also fix possible corruption
  when initialize "ref_length" value in case there is a mismatch
  between MySQL and InnoDB primary key. Fix bug #51378: "Init
  'ref_length'  to correct value, in case an out of bound MySQL
  primary_key".
  rb://262 approved by Marko.
  ------------------------------------------------------------------------
  r6790 | jyang | 2010-03-10 13:09:41 +0200 (Wed, 10 Mar 2010) | 7 lines
  Changed paths:
     M /branches/zip/handler/ha_innodb.cc

  branches/zip: Fix bug #51356: "many valgrind errors in error messages
  with concurrent ddl". Null terminate the name string returned
  from innobase_convert_identifier() call when reporting DB_DUPLICATE_KEY
  error in create_table_def().
  rb://266 approved by Marko
  ------------------------------------------------------------------------
  r6791 | marko | 2010-03-10 13:39:06 +0200 (Wed, 10 Mar 2010) | 1 line
  Changed paths:
     M /branches/zip/ChangeLog

  branches/zip: Add ChangeLog entries for r6789, r6790.
  ------------------------------------------------------------------------
  r6792 | marko | 2010-03-10 13:56:41 +0200 (Wed, 10 Mar 2010) | 1 line
  Changed paths:
     A /branches/zip/mysql-test/innodb_bug38231.result (from /branches/5.1/mysql-test/innodb_bug38231.result:6791)
     A /branches/zip/mysql-test/innodb_bug38231.test (from /branches/5.1/mysql-test/innodb_bug38231.test:6791)
     A /branches/zip/mysql-test/innodb_bug39438-master.opt (from /branches/5.1/mysql-test/innodb_bug39438-master.opt:6791)
     A /branches/zip/mysql-test/innodb_bug39438.result (from /branches/5.1/mysql-test/innodb_bug39438.result:6791)
     A /branches/zip/mysql-test/innodb_bug39438.test (from /branches/5.1/mysql-test/innodb_bug39438.test:6791)

  branches/zip: Copy tests from branches/5.1 that were lost in some merge.
  ------------------------------------------------------------------------
  r6793 | marko | 2010-03-10 14:02:19 +0200 (Wed, 10 Mar 2010) | 60 lines
  Changed paths:
     M /branches/zip/ChangeLog
     M /branches/zip/handler/ha_innodb.cc
     M /branches/zip/mysql-test/innodb_bug21704.result
     A /branches/zip/mysql-test/innodb_bug47621.result (from /branches/5.1/mysql-test/innodb_bug47621.result:6788)
     A /branches/zip/mysql-test/innodb_bug47621.test (from /branches/5.1/mysql-test/innodb_bug47621.test:6788)
     M /branches/zip/plug.in
     M /branches/zip/trx/trx0sys.c

  branches/zip: Merge revisions 6669:6788 from branches/5.1:

    ------------------------------------------------------------------------
    r6774 | calvin | 2010-03-03 23:56:10 +0200 (Wed, 03 Mar 2010) | 2 lines
    Changed paths:
       M /branches/5.1/trx/trx0sys.c

    branches/5.1: fix bug#51653: outdated reference to set-variable
    Non functional change.
    ------------------------------------------------------------------------
    r6780 | vasil | 2010-03-08 19:13:20 +0200 (Mon, 08 Mar 2010) | 4 lines
    Changed paths:
       M /branches/5.1/plug.in

    branches/5.1:

    Whitespace fixup.
    ------------------------------------------------------------------------
    r6783 | jyang | 2010-03-09 17:54:14 +0200 (Tue, 09 Mar 2010) | 9 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
       M /branches/5.1/mysql-test/innodb_bug21704.result
       A /branches/5.1/mysql-test/innodb_bug47621.result
       A /branches/5.1/mysql-test/innodb_bug47621.test

    branches/5.1: Fix bug #47621 "MySQL and InnoDB data dictionaries
    will become out of sync when renaming columns". MySQL does not
    provide new column name information to storage engine to
    update the system table. To avoid column name mismatch, we shall
    just request a table copy for now.

    rb://246 approved by Marko.
    ------------------------------------------------------------------------
    r6785 | vasil | 2010-03-10 09:04:38 +0200 (Wed, 10 Mar 2010) | 11 lines
    Changed paths:
       M /branches/5.1/mysql-test/innodb_bug38231.test

    branches/5.1:

    Add the missing --reap statements in innodb_bug38231.test. Probably MySQL
    enforced the presence of those recently and the test started failing like:

      main.innodb_bug38231                     [ fail ]
              Test ended at 2010-03-10 08:48:32

      CURRENT_TEST: main.innodb_bug38231
      mysqltest: At line 49: Cannot run query on connection between send and reap
    ------------------------------------------------------------------------
    r6788 | vasil | 2010-03-10 10:53:21 +0200 (Wed, 10 Mar 2010) | 8 lines
    Changed paths:
       M /branches/5.1/mysql-test/innodb_bug38231.test

    branches/5.1:

    In innodb_bug38231.test: replace the fragile sleep 0.2 that depends on timing
    with a more robust condition which waits for the TRUNCATE and LOCK commands
    to appear in information_schema.processlist. This could also break if there
    are other sessions executing the same SQL commands, but there are none during
    the execution of the mysql test.
    ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r6798 | marko | 2010-03-11 09:53:01 +0200 (Thu, 11 Mar 2010) | 14 lines
  Changed paths:
     M /branches/zip/ChangeLog
     M /branches/zip/include/buf0buf.h
     M /branches/zip/include/buf0buf.ic

  branches/zip: Fix and clarify the latching of some buf_block_t members.

  buf_block_t::check_index_page_at_flush: Note that this field is not
  protected by any mutex. Make it a separate field, not a bitfield that
  could share the machine word with other fields.

  buf_block_t::lock_hash_val: Note that this field is protected by
  buf_block_t::lock (or during block creation, by buf_pool_mutex and
  buf_block_t::mutex).

  buf_block_get_lock_hash_val(): Assert that block->lock is held by the
  current thread.

  Issue #465, rb://267 approved by Inaam Rana
  ------------------------------------------------------------------------
  r6799 | jyang | 2010-03-11 09:59:42 +0200 (Thu, 11 Mar 2010) | 5 lines
  Changed paths:
     M /branches/zip/mysql-test/innodb_bug44571.result
     M /branches/zip/mysql-test/innodb_bug44571.test

  branches/zip: Once change in bug #47621 merges into zip branch,
  zip only test innodb_bug44571 needs to be updated to reflect the
  column name change would be successful be done in InnoDB as well.
  ------------------------------------------------------------------------
  r6800 | marko | 2010-03-11 12:02:57 +0200 (Thu, 11 Mar 2010) | 1 line
  Changed paths:
     M /branches/zip/btr/btr0pcur.c
     M /branches/zip/buf/buf0buf.c
     M /branches/zip/include/mtr0mtr.ic

  branches/zip: Add ut_ad(mtr->state == MTR_ACTIVE) to various places.
  ------------------------------------------------------------------------
  r6801 | marko | 2010-03-11 13:34:28 +0200 (Thu, 11 Mar 2010) | 2 lines
  Changed paths:
     M /branches/zip/include/mtr0mtr.ic

  branches/zip: mtr_memo_contains(): Relax the assertion of r6800,
  allowing mtr->state == MTR_COMMITTING.
  ------------------------------------------------------------------------
2010-03-11 11:57:05 +00:00

275 lines
6.4 KiB
Text

/*****************************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/**************************************************//**
@file include/mtr0mtr.ic
Mini-transaction buffer
Created 11/26/1995 Heikki Tuuri
*******************************************************/
#ifndef UNIV_HOTBACKUP
# include "sync0sync.h"
# include "sync0rw.h"
#endif /* !UNIV_HOTBACKUP */
#include "mach0data.h"
/***************************************************************//**
Starts a mini-transaction and creates a mini-transaction handle
and a buffer in the memory buffer given by the caller.
@return mtr buffer which also acts as the mtr handle */
UNIV_INLINE
mtr_t*
mtr_start(
/*======*/
mtr_t* mtr) /*!< in: memory buffer for the mtr buffer */
{
dyn_array_create(&(mtr->memo));
dyn_array_create(&(mtr->log));
mtr->log_mode = MTR_LOG_ALL;
mtr->modifications = FALSE;
mtr->n_log_recs = 0;
ut_d(mtr->state = MTR_ACTIVE);
ut_d(mtr->magic_n = MTR_MAGIC_N);
return(mtr);
}
/***************************************************//**
Pushes an object to an mtr memo stack. */
UNIV_INLINE
void
mtr_memo_push(
/*==========*/
mtr_t* mtr, /*!< in: mtr */
void* object, /*!< in: object */
ulint type) /*!< in: object type: MTR_MEMO_S_LOCK, ... */
{
dyn_array_t* memo;
mtr_memo_slot_t* slot;
ut_ad(object);
ut_ad(type >= MTR_MEMO_PAGE_S_FIX);
ut_ad(type <= MTR_MEMO_X_LOCK);
ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
ut_ad(mtr->state == MTR_ACTIVE);
memo = &(mtr->memo);
slot = (mtr_memo_slot_t*) dyn_array_push(memo, sizeof *slot);
slot->object = object;
slot->type = type;
}
/**********************************************************//**
Sets and returns a savepoint in mtr.
@return savepoint */
UNIV_INLINE
ulint
mtr_set_savepoint(
/*==============*/
mtr_t* mtr) /*!< in: mtr */
{
dyn_array_t* memo;
ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
ut_ad(mtr->state == MTR_ACTIVE);
memo = &(mtr->memo);
return(dyn_array_get_data_size(memo));
}
#ifndef UNIV_HOTBACKUP
/**********************************************************//**
Releases the (index tree) s-latch stored in an mtr memo after a
savepoint. */
UNIV_INLINE
void
mtr_release_s_latch_at_savepoint(
/*=============================*/
mtr_t* mtr, /*!< in: mtr */
ulint savepoint, /*!< in: savepoint */
rw_lock_t* lock) /*!< in: latch to release */
{
mtr_memo_slot_t* slot;
dyn_array_t* memo;
ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
ut_ad(mtr->state == MTR_ACTIVE);
memo = &(mtr->memo);
ut_ad(dyn_array_get_data_size(memo) > savepoint);
slot = (mtr_memo_slot_t*) dyn_array_get_element(memo, savepoint);
ut_ad(slot->object == lock);
ut_ad(slot->type == MTR_MEMO_S_LOCK);
rw_lock_s_unlock(lock);
slot->object = NULL;
}
# ifdef UNIV_DEBUG
/**********************************************************//**
Checks if memo contains the given item.
@return TRUE if contains */
UNIV_INLINE
ibool
mtr_memo_contains(
/*==============*/
mtr_t* mtr, /*!< in: mtr */
const void* object, /*!< in: object to search */
ulint type) /*!< in: type of object */
{
mtr_memo_slot_t* slot;
dyn_array_t* memo;
ulint offset;
ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
ut_ad(mtr->state == MTR_ACTIVE || mtr->state == MTR_COMMITTING);
memo = &(mtr->memo);
offset = dyn_array_get_data_size(memo);
while (offset > 0) {
offset -= sizeof(mtr_memo_slot_t);
slot = dyn_array_get_element(memo, offset);
if ((object == slot->object) && (type == slot->type)) {
return(TRUE);
}
}
return(FALSE);
}
# endif /* UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */
/***************************************************************//**
Returns the log object of a mini-transaction buffer.
@return log */
UNIV_INLINE
dyn_array_t*
mtr_get_log(
/*========*/
mtr_t* mtr) /*!< in: mini-transaction */
{
ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
return(&(mtr->log));
}
/***************************************************************//**
Gets the logging mode of a mini-transaction.
@return logging mode: MTR_LOG_NONE, ... */
UNIV_INLINE
ulint
mtr_get_log_mode(
/*=============*/
mtr_t* mtr) /*!< in: mtr */
{
ut_ad(mtr);
ut_ad(mtr->log_mode >= MTR_LOG_ALL);
ut_ad(mtr->log_mode <= MTR_LOG_SHORT_INSERTS);
return(mtr->log_mode);
}
/***************************************************************//**
Changes the logging mode of a mini-transaction.
@return old mode */
UNIV_INLINE
ulint
mtr_set_log_mode(
/*=============*/
mtr_t* mtr, /*!< in: mtr */
ulint mode) /*!< in: logging mode: MTR_LOG_NONE, ... */
{
ulint old_mode;
ut_ad(mtr);
ut_ad(mode >= MTR_LOG_ALL);
ut_ad(mode <= MTR_LOG_SHORT_INSERTS);
old_mode = mtr->log_mode;
if ((mode == MTR_LOG_SHORT_INSERTS) && (old_mode == MTR_LOG_NONE)) {
/* Do nothing */
} else {
mtr->log_mode = mode;
}
ut_ad(old_mode >= MTR_LOG_ALL);
ut_ad(old_mode <= MTR_LOG_SHORT_INSERTS);
return(old_mode);
}
#ifndef UNIV_HOTBACKUP
/*********************************************************************//**
Locks a lock in s-mode. */
UNIV_INLINE
void
mtr_s_lock_func(
/*============*/
rw_lock_t* lock, /*!< in: rw-lock */
const char* file, /*!< in: file name */
ulint line, /*!< in: line number */
mtr_t* mtr) /*!< in: mtr */
{
ut_ad(mtr);
ut_ad(lock);
rw_lock_s_lock_func(lock, 0, file, line);
mtr_memo_push(mtr, lock, MTR_MEMO_S_LOCK);
}
/*********************************************************************//**
Locks a lock in x-mode. */
UNIV_INLINE
void
mtr_x_lock_func(
/*============*/
rw_lock_t* lock, /*!< in: rw-lock */
const char* file, /*!< in: file name */
ulint line, /*!< in: line number */
mtr_t* mtr) /*!< in: mtr */
{
ut_ad(mtr);
ut_ad(lock);
rw_lock_x_lock_func(lock, 0, file, line);
mtr_memo_push(mtr, lock, MTR_MEMO_X_LOCK);
}
#endif /* !UNIV_HOTBACKUP */