mariadb/include/trx0undo.h
sunny 37312683cc branches/innodb+: Merge revisions r5971:6130 from branches/zip.
------------------------------------------------------------------------
  r5971 | marko | 2009-09-23 23:03:51 +1000 (Wed, 23 Sep 2009) | 2 lines

  branches/zip: os_file_pwrite(): Make the code compile in InnoDB Hot Backup
  when the pwrite system call is not available.
  ------------------------------------------------------------------------
  r5972 | marko | 2009-09-24 05:44:52 +1000 (Thu, 24 Sep 2009) | 5 lines

  branches/zip: fil_node_open_file(): In InnoDB Hot Backup,
  determine the page size of single-file tablespaces before computing
    the file node size.  Otherwise, the space->size of compressed tablespaces
  would be computed with UNIV_PAGE_SIZE instead of key_block_size.
  This should fix Issue #313.
  ------------------------------------------------------------------------
  r5973 | marko | 2009-09-24 05:53:21 +1000 (Thu, 24 Sep 2009) | 2 lines

  branches/zip: recv_add_to_hash_table():
  Simplify obfuscated pointer arithmetics.
  ------------------------------------------------------------------------
  r5978 | marko | 2009-09-24 17:47:56 +1000 (Thu, 24 Sep 2009) | 1 line

  branches/zip: Fix warnings and errors when UNIV_HOTBACKUP is defined.
  ------------------------------------------------------------------------
  r5979 | marko | 2009-09-24 20:16:10 +1000 (Thu, 24 Sep 2009) | 4 lines

  branches/zip: ha_innodb.cc: Define MYSQL_PLUGIN_IMPORT when necessary.
  This preprocessor symbol has been recently introduced in MySQL 5.1.
  The InnoDB Plugin should remain source compatible with MySQL 5.1.24
  and later.
  ------------------------------------------------------------------------
  r5988 | calvin | 2009-09-26 05:14:43 +1000 (Sat, 26 Sep 2009) | 8 lines

  branches/zip: fix bug#47055 unconditional exit(1) on ERROR_WORKING_SET_QUOTA
  1453 (0x5AD) for InnoDB backend

  When error ERROR_WORKING_SET_QUOTA or ERROR_NO_SYSTEM_RESOURCES
  occurs, yields for 100ms and retries the operation.

  Approved by: Heikki (on IM)

  ------------------------------------------------------------------------
  r5992 | vasil | 2009-09-28 17:10:29 +1000 (Mon, 28 Sep 2009) | 4 lines

  branches/zip:

  Add ChangeLog entry for c5988.

  ------------------------------------------------------------------------
  r5994 | marko | 2009-09-28 18:33:59 +1000 (Mon, 28 Sep 2009) | 17 lines

  branches/zip: Try to prevent the reuse of tablespace identifiers after
  InnoDB has crashed during table creation.  Also, refuse to start if
  files with duplicate tablespace identifiers are encountered.

    fil_node_create(): Update fil_system->max_assigned_id.  This should
  prevent the reuse of a space->id when InnoDB does a full crash
  recovery and invokes fil_load_single_table_tablespaces().  Normally,
  fil_system->max_assigned_id is initialized from
  SELECT MAX(ID) FROM SYS_TABLES.

  fil_open_single_table_tablespace(): Return FALSE when
  fil_space_create() fails.

  fil_load_single_table_tablespace(): Exit if fil_space_create() fails
  and innodb_force_recovery=0.

  rb://173 approved by Heikki Tuuri.  This addresses Issue #335.
  ------------------------------------------------------------------------
  r5995 | marko | 2009-09-28 18:52:25 +1000 (Mon, 28 Sep 2009) | 17 lines

  branches/zip: Do not write to PAGE_INDEX_ID after page creation,
  not even when restoring an uncompressed page after a compression failure.

  btr_page_reorganize_low(): On compression failure, do not restore
  those page header fields that should not be affected by the
  reorganization.  Instead, compare the fields.

  page_zip_decompress(): Add the parameter ibool all, for copying all
  page header fields.  Pass the parameter all=TRUE on block read
  completion, redo log application, and page_zip_validate(); pass
  all=FALSE in all other cases.

  page_zip_reorganize(): Do not restore the uncompressed page on
  failure.  It will be restored (to pre-modification state) by the
  caller anyway.

  rb://167, Issue #346
  ------------------------------------------------------------------------
  r5996 | marko | 2009-09-28 22:46:02 +1000 (Mon, 28 Sep 2009) | 4 lines

  branches/zip: Address Issue #350 in comments.

  lock_rec_queue_validate(), lock_rec_queue_validate(): Note that
  this debug code may violate the latching order and cause deadlocks.
  ------------------------------------------------------------------------
  r5997 | marko | 2009-09-28 23:03:58 +1000 (Mon, 28 Sep 2009) | 12 lines

  branches/zip: Remove an assertion failure when the InnoDB data dictionary
  is inconsistent with the MySQL .frm file.

  ha_innobase::index_read(): When the index cannot be found,
  return an error.

  ha_innobase::change_active_index(): When prebuilt->index == NULL,
  set also prebuilt->index_usable = FALSE.  This is not needed for
  correctness, because prebuilt->index_usable is only checked by
  row_search_for_mysql(), which requires prebuilt->index != NULL.

  This addresses Issue #349.  Approved by Heikki Tuuri over IM.
  ------------------------------------------------------------------------
  r6005 | vasil | 2009-09-29 18:09:52 +1000 (Tue, 29 Sep 2009) | 4 lines

  branches/zip:

  ChangeLog: wrap around 78th column, not earlier.

  ------------------------------------------------------------------------
  r6006 | vasil | 2009-09-29 20:15:25 +1000 (Tue, 29 Sep 2009) | 4 lines

  branches/zip:

  Add ChangeLog entry for the release of 1.0.4.

  ------------------------------------------------------------------------
  r6007 | vasil | 2009-09-29 23:19:59 +1000 (Tue, 29 Sep 2009) | 6 lines

  branches/zip:

  Fix the year, should be 2009.

  Pointed by:	Calvin

  ------------------------------------------------------------------------
  r6026 | marko | 2009-09-30 17:18:24 +1000 (Wed, 30 Sep 2009) | 1 line

  branches/zip: Add some debug assertions for checking FSEG_MAGIC_N.
  ------------------------------------------------------------------------
  r6028 | marko | 2009-09-30 23:55:23 +1000 (Wed, 30 Sep 2009) | 3 lines

  branches/zip: recv_no_log_write: New debug flag for tracking down
  Mantis Issue #347.  No modifications should be made to the database
  while recv_apply_hashed_log_recs() is about to complete.
  ------------------------------------------------------------------------
  r6029 | calvin | 2009-10-01 06:32:02 +1000 (Thu, 01 Oct 2009) | 4 lines

    branches/zip: non-functional changes

  Fix typo.

  ------------------------------------------------------------------------
  r6031 | marko | 2009-10-01 21:24:33 +1000 (Thu, 01 Oct 2009) | 49 lines

  branches/zip: Clean up after a crash during DROP INDEX.
  When InnoDB crashes while dropping an index, ensure that
  the index will be completely dropped during crash recovery.

  row_merge_drop_index(): Before dropping an index, rename the index to
  start with TEMP_INDEX_PREFIX_STR and commit the change, so that
  row_merge_drop_temp_indexes() will drop the index after crash
  recovery if the server crashes while dropping the index.

  fseg_inode_try_get(): New function, forked from fseg_inode_get().
  Return NULL if the file segment index node is free.

  fseg_inode_get(): Assert that the file segment index node is not free.

  fseg_free_step(): If the file segment index node is already free,
  print a diagnostic message and return TRUE.

  fsp_free_seg_inode(): Write a nonzero number to FSEG_MAGIC_N, so that
  allocated-and-freed file segment index nodes can be better
  distinguished from uninitialized ones.

  This is rb://174, addressing Issue #348.

  Tested by restarting mysqld upon the completion of the added
  log_write_up_to() invocation below, during DROP INDEX.  The index was
  dropped after crash recovery, and re-issuing the DROP INDEX did not
  crash the server.
    
    Index: btr/btr0btr.c
    ===================================================================
    --- btr/btr0btr.c	(revision 6026)
    +++ btr/btr0btr.c	(working copy)
    @@ -42,6 +42,7 @@ Created 6/2/1994 Heikki Tuuri
     #include "ibuf0ibuf.h"
     #include "trx0trx.h"
    +#include "log0log.h"
     
     /*
     Latching strategy of the InnoDB B-tree
     --------------------------------------
    @@ -873,6 +874,8 @@ leaf_loop:
     
   		  goto leaf_loop;
   	  }
    +
    +	log_write_up_to(mtr.end_lsn, LOG_WAIT_ALL_GROUPS, TRUE);
     top_loop:
   	  mtr_start(&mtr);

  ------------------------------------------------------------------------
  r6033 | calvin | 2009-10-02 06:19:46 +1000 (Fri, 02 Oct 2009) | 4 lines

  branches/zip: fix a typo in error message

  Reported as bug#47763.

  ------------------------------------------------------------------------
  r6043 | inaam | 2009-10-06 01:45:35 +1100 (Tue, 06 Oct 2009) | 12 lines

  branches/zip  rb://176

  Do not invalidate buffer pool while an LRU batch is active. Added
  code to buf_pool_invalidate() to wait for the running batches to finish.

  This patch also resets the state of buf_pool struct at invalidation. This
  addresses the concern where buf_pool->freed_page_clock becomes non-zero
  because we read in a system tablespace page for file format info at
  startup.

  Approved by: Marko

  ------------------------------------------------------------------------
  r6044 | pekka | 2009-10-07 01:44:54 +1100 (Wed, 07 Oct 2009) | 5 lines

  branches/zip:
  Add os_file_is_same() function for Hot Backup (inside ifdef UNIV_HOTBACKUP).
  This is part of the fix for Issue #186.
  Note! The Windows implementation is incomplete.

  ------------------------------------------------------------------------
  r6046 | pekka | 2009-10-08 20:24:56 +1100 (Thu, 08 Oct 2009) | 3 lines

  branches/zip: Revert r6044 which added os_file_is_same() function
  (issue#186). This functionality is moved to Hot Backup source tree.

  ------------------------------------------------------------------------
  r6048 | vasil | 2009-10-09 16:42:55 +1100 (Fri, 09 Oct 2009) | 16 lines

  branches/zip:

  When scanning a directory readdir() is called and stat() after it,
  if a file is deleted between the two calls stat will fail and the
  whole precedure will fail. Change this behavior to continue with the
  next entry if stat() fails because of nonexistent file. This is
  transparent change as it will make it look as if the file was deleted
  before the readdir() call.

  This change is needed in order to fix
  https://svn.innodb.com/mantis/view.php?id=174
  in which we need to abort if os_file_readdir_next_file()
  encounters "real" errors.

  Approved by:	Marko, Pekka (rb://177)

  ------------------------------------------------------------------------
  r6049 | vasil | 2009-10-10 03:05:26 +1100 (Sat, 10 Oct 2009) | 7 lines

  branches/zip:

  Fix compilation warning in Hot Backup:

  innodb/fil/fil0fil.c: In function 'fil_load_single_table_tablespace':
  innodb/fil/fil0fil.c:3253: warning: format '%lld' expects type 'long long int', but argument 6 has type 'ib_int64_t'

  ------------------------------------------------------------------------
  r6064 | calvin | 2009-10-14 02:23:35 +1100 (Wed, 14 Oct 2009) | 4 lines

  branches/zip: non-functional changes

  Changes from MySQL to fix build issue.

  ------------------------------------------------------------------------
  r6065 | inaam | 2009-10-14 04:43:13 +1100 (Wed, 14 Oct 2009) | 7 lines

  branches/zip rb://182

  Call fsync() on datafiles after a batch of pages is written to disk
  even when skip_innodb_doublewrite is set.

  Approved by: Heikki

  ------------------------------------------------------------------------
  r6080 | sunny | 2009-10-15 09:29:01 +1100 (Thu, 15 Oct 2009) | 3 lines

  branches/zip: Change page_mem_alloc_free() to inline.
  Fix Bug #47058 - Failure to compile innodb_plugin on solaris 10u7 + spro cc/CC 5.10

  ------------------------------------------------------------------------
  r6084 | vasil | 2009-10-15 16:21:17 +1100 (Thu, 15 Oct 2009) | 4 lines

  branches/zip:

  Add ChangeLog entry for r6080.

  ------------------------------------------------------------------------
  r6095 | vasil | 2009-10-20 00:04:59 +1100 (Tue, 20 Oct 2009) | 7 lines

  branches/zip:

  Fix Bug#47808 innodb_information_schema.test fails when run under valgrind 

  by using the wait_until_rows_count macro that loops until the number of
  rows becomes 14 instead of sleep 0.1, which is obviously very fragile.

  ------------------------------------------------------------------------
  r6096 | vasil | 2009-10-20 00:06:09 +1100 (Tue, 20 Oct 2009) | 4 lines

  branches/zip:

  Add ChangeLog entry for r6095.

  ------------------------------------------------------------------------
  r6099 | jyang | 2009-10-22 13:58:39 +1100 (Thu, 22 Oct 2009) | 7 lines

  branches/zip: Port bug #46000 related changes from 5.1 to zip
  branch. Due to different code path for creating index in zip
  branch comparing to 5.1), the index reserved name check function
  is extended to be used in ha_innobase::add_index(). 
  rb://190  Approved by: Marko


  ------------------------------------------------------------------------
  r6100 | jyang | 2009-10-22 14:51:07 +1100 (Thu, 22 Oct 2009) | 6 lines

  branches/zip: As a request from mysql, WARN_LEVEL_ERROR cannot
  be used for push_warning_* call any more. Switch to 
  WARN_LEVEL_WARN. Bug #47233.
  rb://172 approved by Sunny Bains and Marko.


  ------------------------------------------------------------------------
  r6101 | jyang | 2009-10-23 19:45:50 +1100 (Fri, 23 Oct 2009) | 7 lines
    
  branches/zip: Update test result with the WARN_LEVEL_ERROR
  to WARN_LEVEL_WARN change. This is the same result as 
  submitted in rb://172 review, which approved by Sunny Bains
  and Marko.

  ------------------------------------------------------------------------
  r6102 | marko | 2009-10-26 18:32:23 +1100 (Mon, 26 Oct 2009) | 1 line

  branches/zip: row_prebuilt_struct::prebuilts: Unused field, remove.
  ------------------------------------------------------------------------
  r6103 | marko | 2009-10-27 00:46:18 +1100 (Tue, 27 Oct 2009) | 4 lines

  branches/zip: row_ins_alloc_sys_fields(): Zero out the system columns
  DB_TRX_ID, DB_ROLL_PTR and DB_ROW_ID, in order to avoid harmless
  Valgrind warnings about uninitialized data.  (The warnings were
  harmless, because the fields would be initialized at a later stage.)
  ------------------------------------------------------------------------
  r6105 | calvin | 2009-10-28 09:05:52 +1100 (Wed, 28 Oct 2009) | 6 lines

  branches/zip: backport r3848 from 6.0 branch

  ----
      branches/6.0: innobase_start_or_create_for_mysql(): Make the 10 MB
      minimum tablespace limit independent of UNIV_PAGE_SIZE. (Bug #41490)

  ------------------------------------------------------------------------
  r6107 | marko | 2009-10-29 01:10:34 +1100 (Thu, 29 Oct 2009) | 5 lines

  branches/zip: buf_page_set_old(): Improve UNIV_LRU_DEBUG diagnostics
  in order to catch the buf_pool->LRU_old corruption reported in Issue #381.

  buf_LRU_old_init(): Set the property from the tail towards the front
  of the buf_pool->LRU list, in order not to trip the debug check.
  ------------------------------------------------------------------------
  r6108 | calvin | 2009-10-29 16:58:04 +1100 (Thu, 29 Oct 2009) | 5 lines

  branches/zip: close file handle when building with UNIV_HOTBACKUP

  The change does not affect regular InnoDB engine. Confirmed by
  Marko.

  ------------------------------------------------------------------------
  r6109 | jyang | 2009-10-29 19:37:32 +1100 (Thu, 29 Oct 2009) | 7 lines

  branches/zip: In os_mem_alloc_large(), if we fail to attach
  the shared memory, reset memory pointer ptr to NULL, and
   allocate memory from conventional pool.
  Bug #48237 Error handling in os_mem_alloc_large appears to be incorrect
  rb://198  Approved by: Marko


  ------------------------------------------------------------------------
  r6110 | marko | 2009-10-29 21:44:57 +1100 (Thu, 29 Oct 2009) | 2 lines

  branches/zip: Makefile.am (INCLUDES): Merge a change from MySQL:
  Use $(srcdir)/include instead of $(top_srcdir)/storage/innobase/include.
  ------------------------------------------------------------------------
  r6111 | marko | 2009-10-29 22:04:11 +1100 (Thu, 29 Oct 2009) | 33 lines

  branches/zip: Fix corruption of buf_pool->LRU_old and improve debug assertions.
  This was reported as Issue #381.

  buf_page_set_old(): Assert that blocks may only be set old if
  buf_pool->LRU_old is initialized and buf_pool->LRU_old_len is nonzero.
  Assert that buf_pool->LRU_old points to the block at the old/new boundary.

  buf_LRU_old_adjust_len(): Invoke buf_page_set_old() after adjusting
  buf_pool->LRU_old and buf_pool->LRU_old_len, in order not to violate
  the added assertions.

  buf_LRU_old_init(): Replace buf_page_set_old() with a direct
  assignment to bpage->old, because these loops that initialize all the
  blocks would temporarily violate the assertions about
  buf_pool->LRU_old.

  buf_LRU_remove_block(): When setting buf_pool->LRU_old = NULL, also
  clear all bpage->old flags and set buf_pool->LRU_old_len = 0.

  buf_LRU_add_block_to_end_low(), buf_LRU_add_block_low(): Move the
  buf_page_set_old() call later in order not to violate the debug
  assertions.  If buf_pool->LRU_old is NULL, set old=FALSE.

  buf_LRU_free_block(): Replace the UNIV_LRU_DEBUG assertion with a
  dummy buf_page_set_old() call that performs more thorough checks.

  buf_LRU_validate(): Do not tolerate garbage in buf_pool->LRU_old_len
  even if buf_pool->LRU_old is NULL.  Check that bpage->old is monotonic.

  buf_relocate(): Make the UNIV_LRU_DEBUG checks stricter.

  buf0buf.h: Revise the documentation of buf_page_t::old and
  buf_pool_t::LRU_old_len.
  ------------------------------------------------------------------------
  r6112 | calvin | 2009-10-30 01:21:15 +1100 (Fri, 30 Oct 2009) | 4 lines

  branches/zip: consideration for icc compilers

  Proposed by MySQL, and approved by Marko.

  ------------------------------------------------------------------------
  r6113 | vasil | 2009-10-30 03:15:50 +1100 (Fri, 30 Oct 2009) | 93 lines

  branches/zip: Merge r5912:6112 from branches/5.1:

  (after this merge the innodb-autoinc test starts to fail, but
  I commit anyway because it would be easier to investigate the
  failure this way)

    ------------------------------------------------------------------------
    r5952 | calvin | 2009-09-22 19:45:07 +0300 (Tue, 22 Sep 2009) | 7 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
    
    branches/5.1: fix bug#42383: Can't create table 'test.bug39438'
    
    For embedded server, MySQL may pass in full path, which is
    currently disallowed. It is needed to relax the condition by
    accepting full paths in the embedded case.
    
    Approved by: Heikki (on IM)
    ------------------------------------------------------------------------
    r6032 | vasil | 2009-10-01 15:55:49 +0300 (Thu, 01 Oct 2009) | 8 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
    
    branches/5.1:
    
    Fix Bug#38996 Race condition in ANALYZE TABLE
    
    by serializing ANALYZE TABLE inside InnoDB.
    
    Approved by:	Heikki (rb://175)
    
    ------------------------------------------------------------------------
    r6045 | jyang | 2009-10-08 02:27:08 +0300 (Thu, 08 Oct 2009) | 7 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
       A /branches/5.1/mysql-test/innodb_bug47777.result
       A /branches/5.1/mysql-test/innodb_bug47777.test
    
    branches/5.1: Fix bug #47777. Treat the Geometry data same as
    Binary BLOB in ha_innobase::store_key_val_for_row(), since the
    Geometry data is stored as Binary BLOB in Innodb.
    
    Review: rb://180 approved by Marko Makela.
    
    
      ------------------------------------------------------------------------
    r6051 | sunny | 2009-10-12 07:05:00 +0300 (Mon, 12 Oct 2009) | 6 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
       M /branches/5.1/mysql-test/innodb-autoinc.result
       M /branches/5.1/mysql-test/innodb-autoinc.test
    
    branches/5.1: Ignore negative values supplied by the user when calculating the
    next value to store in dict_table_t. Setting autoincrement columns top negative
    values is undefined behavior and this change should bring the behavior of
    InnoDB closer to what users expect. Added several tests to check.
    rb://162
    
    ------------------------------------------------------------------------
    r6052 | sunny | 2009-10-12 07:09:56 +0300 (Mon, 12 Oct 2009) | 4 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
       M /branches/5.1/mysql-test/innodb-autoinc.result
       M /branches/5.1/mysql-test/innodb-autoinc.test
    
    branches/5.1: Reset the statement level autoinc counter on ROLLBACK. Fix
    the test results too.
    rb://164
    
    ------------------------------------------------------------------------
    r6053 | sunny | 2009-10-12 07:37:49 +0300 (Mon, 12 Oct 2009) | 6 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
       M /branches/5.1/mysql-test/innodb-autoinc.result
       M /branches/5.1/mysql-test/innodb-autoinc.test
    
    branches/5.1: Copy the maximum AUTOINC value from the old table to the new
    table when MySQL does a CREATE INDEX ON T. This is required because MySQL
    does a table copy, rename and drops the old table.
    Fix Bug#47125: auto_increment start value is ignored if an index is created and engine=innodb
    rb://168
    
    ------------------------------------------------------------------------
    r6076 | vasil | 2009-10-14 19:30:12 +0300 (Wed, 14 Oct 2009) | 4 lines
    Changed paths:
       M /branches/5.1/row/row0mysql.c
    
    branches/5.1:
      
  Fix typo.
      
    ------------------------------------------------------------------------

  ------------------------------------------------------------------------
  r6114 | vasil | 2009-10-30 03:43:51 +1100 (Fri, 30 Oct 2009) | 6 lines

  branches/zip:

  * Add ChangeLog entries for latest changes
  * Obey alphabetical order in the list of the files
  * White-space fixup

  ------------------------------------------------------------------------
  r6121 | sunny | 2009-10-30 10:42:11 +1100 (Fri, 30 Oct 2009) | 7 lines

  branches/zip: This test has been problematic for sometime now. The underlying
  bug is that the data dictionaries get out of sync. In the AUTOINC code we
  try and apply salve to the symptoms. In the past MySQL made some unrelated
  change and the dictionaries stopped getting out of sync and this test started
  to fail. Now, it seems they have reverted that changed and the test is
  passing again. I suspect this is not he last time that this test will change.

  ------------------------------------------------------------------------
  r6124 | jyang | 2009-10-30 19:02:31 +1100 (Fri, 30 Oct 2009) | 5 lines

  branches/zip: Correct the bug number for -r6109 change
  from # 48273 to #48237



  ------------------------------------------------------------------------
  r6126 | vasil | 2009-10-30 19:36:07 +1100 (Fri, 30 Oct 2009) | 45 lines

  branches/zip: Merge r6112:6125 from branches/5.1:

  (skipping r6122 and r6123, Jimmy says these are already present and need
  not be merged):

    ------------------------------------------------------------------------
    r6122 | jyang | 2009-10-30 05:18:38 +0200 (Fri, 30 Oct 2009) | 7 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
       M /branches/5.1/mysql-test/innodb_bug44369.result
       M /branches/5.1/mysql-test/innodb_bug44369.test
       M /branches/5.1/mysql-test/innodb_bug46000.result
       M /branches/5.1/mysql-test/innodb_bug46000.test
    
    branches/5.1: Chnage WARN_LEVEL_ERROR to WARN_LEVEL_WARN
    for push_warning_printf() call in innodb.
    Fix Bug#47233: Innodb calls push_warning(MYSQL_ERROR::WARN_LEVEL_ERROR)
    
    rb://170 approved by Marko.
    
    
    ------------------------------------------------------------------------
    r6123 | jyang | 2009-10-30 05:43:06 +0200 (Fri, 30 Oct 2009) | 8 lines
    Changed paths:
       M /branches/5.1/os/os0proc.c
    
    branches/5.1: In os_mem_alloc_large(), if we fail to attach
    the shared memory, reset memory pointer ptr to NULL, and
    allocate memory from conventional pool. This is a port
    from branches/zip.
    Bug #48237 Error handling in os_mem_alloc_large appears to be incorrect
    rb://198  Approved by: Marko
    
    
    ------------------------------------------------------------------------
    r6125 | vasil | 2009-10-30 10:31:23 +0200 (Fri, 30 Oct 2009) | 4 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
    
    branches/5.1:
    
    White-space fixup.
    
    ------------------------------------------------------------------------

  ------------------------------------------------------------------------
  r6130 | marko | 2009-11-02 20:42:56 +1100 (Mon, 02 Nov 2009) | 9 lines

  branches/zip: Free all resources at shutdown. Set pointers to NULL, so
  that Valgrind will not complain about freed data structures that are
  reachable via pointers.  This addresses Bug #45992 and Bug #46656.

  This patch is mostly based on changes copied from branches/embedded-1.0,
  mainly c5432, c3439, c3134, c2994, c2978, but also some other code was
  copied.  Some added cleanup code is specific to MySQL/InnoDB.

  rb://199 approved by Sunny Bains
    ------------------------------------------------------------------------
2009-11-04 06:02:00 +00:00

551 lines
21 KiB
C

/*****************************************************************************
Copyright (c) 1996, 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/trx0undo.h
Transaction undo log
Created 3/26/1996 Heikki Tuuri
*******************************************************/
#ifndef trx0undo_h
#define trx0undo_h
#include "univ.i"
#include "trx0types.h"
#include "mtr0mtr.h"
#include "trx0sys.h"
#include "page0types.h"
#include "trx0xa.h"
#ifndef UNIV_HOTBACKUP
/***********************************************************************//**
Builds a roll pointer.
@return roll pointer */
UNIV_INLINE
roll_ptr_t
trx_undo_build_roll_ptr(
/*====================*/
ibool is_insert, /*!< in: TRUE if insert undo log */
ulint rseg_id, /*!< in: rollback segment id */
ulint page_no, /*!< in: page number */
ulint offset); /*!< in: offset of the undo entry within page */
/***********************************************************************//**
Decodes a roll pointer. */
UNIV_INLINE
void
trx_undo_decode_roll_ptr(
/*=====================*/
roll_ptr_t roll_ptr, /*!< in: roll pointer */
ibool* is_insert, /*!< out: TRUE if insert undo log */
ulint* rseg_id, /*!< out: rollback segment id */
ulint* page_no, /*!< out: page number */
ulint* offset); /*!< out: offset of the undo
entry within page */
/***********************************************************************//**
Returns TRUE if the roll pointer is of the insert type.
@return TRUE if insert undo log */
UNIV_INLINE
ibool
trx_undo_roll_ptr_is_insert(
/*========================*/
roll_ptr_t roll_ptr); /*!< in: roll pointer */
#endif /* !UNIV_HOTBACKUP */
/*****************************************************************//**
Writes a roll ptr to an index page. In case that the size changes in
some future version, this function should be used instead of
mach_write_... */
UNIV_INLINE
void
trx_write_roll_ptr(
/*===============*/
byte* ptr, /*!< in: pointer to memory where
written */
roll_ptr_t roll_ptr); /*!< in: roll ptr */
/*****************************************************************//**
Reads a roll ptr from an index page. In case that the roll ptr size
changes in some future version, this function should be used instead of
mach_read_...
@return roll ptr */
UNIV_INLINE
roll_ptr_t
trx_read_roll_ptr(
/*==============*/
const byte* ptr); /*!< in: pointer to memory from where to read */
#ifndef UNIV_HOTBACKUP
/******************************************************************//**
Gets an undo log page and x-latches it.
@return pointer to page x-latched */
UNIV_INLINE
page_t*
trx_undo_page_get(
/*==============*/
ulint space, /*!< in: space where placed */
ulint zip_size, /*!< in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no, /*!< in: page number */
mtr_t* mtr); /*!< in: mtr */
/******************************************************************//**
Gets an undo log page and s-latches it.
@return pointer to page s-latched */
UNIV_INLINE
page_t*
trx_undo_page_get_s_latched(
/*========================*/
ulint space, /*!< in: space where placed */
ulint zip_size, /*!< in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no, /*!< in: page number */
mtr_t* mtr); /*!< in: mtr */
/******************************************************************//**
Returns the previous undo record on the page in the specified log, or
NULL if none exists.
@return pointer to record, NULL if none */
UNIV_INLINE
trx_undo_rec_t*
trx_undo_page_get_prev_rec(
/*=======================*/
trx_undo_rec_t* rec, /*!< in: undo log record */
ulint page_no,/*!< in: undo log header page number */
ulint offset);/*!< in: undo log header offset on page */
/******************************************************************//**
Returns the next undo log record on the page in the specified log, or
NULL if none exists.
@return pointer to record, NULL if none */
UNIV_INLINE
trx_undo_rec_t*
trx_undo_page_get_next_rec(
/*=======================*/
trx_undo_rec_t* rec, /*!< in: undo log record */
ulint page_no,/*!< in: undo log header page number */
ulint offset);/*!< in: undo log header offset on page */
/******************************************************************//**
Returns the last undo record on the page in the specified undo log, or
NULL if none exists.
@return pointer to record, NULL if none */
UNIV_INLINE
trx_undo_rec_t*
trx_undo_page_get_last_rec(
/*=======================*/
page_t* undo_page,/*!< in: undo log page */
ulint page_no,/*!< in: undo log header page number */
ulint offset); /*!< in: undo log header offset on page */
/******************************************************************//**
Returns the first undo record on the page in the specified undo log, or
NULL if none exists.
@return pointer to record, NULL if none */
UNIV_INLINE
trx_undo_rec_t*
trx_undo_page_get_first_rec(
/*========================*/
page_t* undo_page,/*!< in: undo log page */
ulint page_no,/*!< in: undo log header page number */
ulint offset);/*!< in: undo log header offset on page */
/***********************************************************************//**
Gets the previous record in an undo log.
@return undo log record, the page s-latched, NULL if none */
UNIV_INTERN
trx_undo_rec_t*
trx_undo_get_prev_rec(
/*==================*/
trx_undo_rec_t* rec, /*!< in: undo record */
ulint page_no,/*!< in: undo log header page number */
ulint offset, /*!< in: undo log header offset on page */
mtr_t* mtr); /*!< in: mtr */
/***********************************************************************//**
Gets the next record in an undo log.
@return undo log record, the page s-latched, NULL if none */
UNIV_INTERN
trx_undo_rec_t*
trx_undo_get_next_rec(
/*==================*/
trx_undo_rec_t* rec, /*!< in: undo record */
ulint page_no,/*!< in: undo log header page number */
ulint offset, /*!< in: undo log header offset on page */
mtr_t* mtr); /*!< in: mtr */
/***********************************************************************//**
Gets the first record in an undo log.
@return undo log record, the page latched, NULL if none */
UNIV_INTERN
trx_undo_rec_t*
trx_undo_get_first_rec(
/*===================*/
ulint space, /*!< in: undo log header space */
ulint zip_size,/*!< in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no,/*!< in: undo log header page number */
ulint offset, /*!< in: undo log header offset on page */
ulint mode, /*!< in: latching mode: RW_S_LATCH or RW_X_LATCH */
mtr_t* mtr); /*!< in: mtr */
/********************************************************************//**
Tries to add a page to the undo log segment where the undo log is placed.
@return page number if success, else FIL_NULL */
UNIV_INTERN
ulint
trx_undo_add_page(
/*==============*/
trx_t* trx, /*!< in: transaction */
trx_undo_t* undo, /*!< in: undo log memory object */
mtr_t* mtr); /*!< in: mtr which does not have a latch to any
undo log page; the caller must have reserved
the rollback segment mutex */
/***********************************************************************//**
Truncates an undo log from the end. This function is used during a rollback
to free space from an undo log. */
UNIV_INTERN
void
trx_undo_truncate_end(
/*==================*/
trx_t* trx, /*!< in: transaction whose undo log it is */
trx_undo_t* undo, /*!< in: undo log */
undo_no_t limit); /*!< in: all undo records with undo number
>= this value should be truncated */
/***********************************************************************//**
Truncates an undo log from the start. This function is used during a purge
operation. */
UNIV_INTERN
void
trx_undo_truncate_start(
/*====================*/
trx_rseg_t* rseg, /*!< in: rollback segment */
ulint space, /*!< in: space id of the log */
ulint hdr_page_no, /*!< in: header page number */
ulint hdr_offset, /*!< in: header offset on the page */
undo_no_t limit); /*!< in: all undo pages with
undo numbers < this value
should be truncated; NOTE that
the function only frees whole
pages; the header page is not
freed, but emptied, if all the
records there are < limit */
/********************************************************************//**
Initializes the undo log lists for a rollback segment memory copy.
This function is only called when the database is started or a new
rollback segment created.
@return the combined size of undo log segments in pages */
UNIV_INTERN
ulint
trx_undo_lists_init(
/*================*/
trx_rseg_t* rseg); /*!< in: rollback segment memory object */
/**********************************************************************//**
Assigns an undo log for a transaction. A new undo log is created or a cached
undo log reused.
@return DB_SUCCESS if undo log assign successful, possible error codes
are: DB_TOO_MANY_CONCURRENT_TRXS DB_OUT_OF_FILE_SPACE
DB_OUT_OF_MEMORY */
UNIV_INTERN
ulint
trx_undo_assign_undo(
/*=================*/
trx_t* trx, /*!< in: transaction */
ulint type); /*!< in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE */
/******************************************************************//**
Sets the state of the undo log segment at a transaction finish.
@return undo log segment header page, x-latched */
UNIV_INTERN
page_t*
trx_undo_set_state_at_finish(
/*=========================*/
trx_rseg_t* rseg, /*!< in: rollback segment memory object */
trx_t* trx, /*!< in: transaction */
trx_undo_t* undo, /*!< in: undo log memory copy */
mtr_t* mtr); /*!< in: mtr */
/******************************************************************//**
Sets the state of the undo log segment at a transaction prepare.
@return undo log segment header page, x-latched */
UNIV_INTERN
page_t*
trx_undo_set_state_at_prepare(
/*==========================*/
trx_t* trx, /*!< in: transaction */
trx_undo_t* undo, /*!< in: undo log memory copy */
mtr_t* mtr); /*!< in: mtr */
/**********************************************************************//**
Adds the update undo log header as the first in the history list, and
frees the memory object, or puts it to the list of cached update undo log
segments. */
UNIV_INTERN
void
trx_undo_update_cleanup(
/*====================*/
trx_t* trx, /*!< in: trx owning the update undo log */
page_t* undo_page, /*!< in: update undo log header page,
x-latched */
mtr_t* mtr); /*!< in: mtr */
/******************************************************************//**
Frees or caches an insert undo log after a transaction commit or rollback.
Knowledge of inserts is not needed after a commit or rollback, therefore
the data can be discarded. */
UNIV_INTERN
void
trx_undo_insert_cleanup(
/*====================*/
trx_t* trx); /*!< in: transaction handle */
#endif /* !UNIV_HOTBACKUP */
/***********************************************************//**
Parses the redo log entry of an undo log page initialization.
@return end of log record or NULL */
UNIV_INTERN
byte*
trx_undo_parse_page_init(
/*=====================*/
byte* ptr, /*!< in: buffer */
byte* end_ptr,/*!< in: buffer end */
page_t* page, /*!< in: page or NULL */
mtr_t* mtr); /*!< in: mtr or NULL */
/***********************************************************//**
Parses the redo log entry of an undo log page header create or reuse.
@return end of log record or NULL */
UNIV_INTERN
byte*
trx_undo_parse_page_header(
/*=======================*/
ulint type, /*!< in: MLOG_UNDO_HDR_CREATE or MLOG_UNDO_HDR_REUSE */
byte* ptr, /*!< in: buffer */
byte* end_ptr,/*!< in: buffer end */
page_t* page, /*!< in: page or NULL */
mtr_t* mtr); /*!< in: mtr or NULL */
/***********************************************************//**
Parses the redo log entry of an undo log page header discard.
@return end of log record or NULL */
UNIV_INTERN
byte*
trx_undo_parse_discard_latest(
/*==========================*/
byte* ptr, /*!< in: buffer */
byte* end_ptr,/*!< in: buffer end */
page_t* page, /*!< in: page or NULL */
mtr_t* mtr); /*!< in: mtr or NULL */
/************************************************************************
Frees an undo log memory copy. */
UNIV_INTERN
void
trx_undo_mem_free(
/*==============*/
trx_undo_t* undo); /* in: the undo object to be freed */
/* Types of an undo log segment */
#define TRX_UNDO_INSERT 1 /* contains undo entries for inserts */
#define TRX_UNDO_UPDATE 2 /* contains undo entries for updates
and delete markings: in short,
modifys (the name 'UPDATE' is a
historical relic) */
/* States of an undo log segment */
#define TRX_UNDO_ACTIVE 1 /* contains an undo log of an active
transaction */
#define TRX_UNDO_CACHED 2 /* cached for quick reuse */
#define TRX_UNDO_TO_FREE 3 /* insert undo segment can be freed */
#define TRX_UNDO_TO_PURGE 4 /* update undo segment will not be
reused: it can be freed in purge when
all undo data in it is removed */
#define TRX_UNDO_PREPARED 5 /* contains an undo log of an
prepared transaction */
#ifndef UNIV_HOTBACKUP
/** Transaction undo log memory object; this is protected by the undo_mutex
in the corresponding transaction object */
struct trx_undo_struct{
/*-----------------------------*/
ulint id; /*!< undo log slot number within the
rollback segment */
ulint type; /*!< TRX_UNDO_INSERT or
TRX_UNDO_UPDATE */
ulint state; /*!< state of the corresponding undo log
segment */
ibool del_marks; /*!< relevant only in an update undo log:
this is TRUE if the transaction may
have delete marked records, because of
a delete of a row or an update of an
indexed field; purge is then
necessary; also TRUE if the transaction
has updated an externally stored
field */
trx_id_t trx_id; /*!< id of the trx assigned to the undo
log */
XID xid; /*!< X/Open XA transaction
identification */
ibool dict_operation; /*!< TRUE if a dict operation trx */
dulint table_id; /*!< if a dict operation, then the table
id */
trx_rseg_t* rseg; /*!< rseg where the undo log belongs */
/*-----------------------------*/
ulint space; /*!< space id where the undo log
placed */
ulint zip_size; /*!< compressed page size of space
in bytes, or 0 for uncompressed */
ulint hdr_page_no; /*!< page number of the header page in
the undo log */
ulint hdr_offset; /*!< header offset of the undo log on the
page */
ulint last_page_no; /*!< page number of the last page in the
undo log; this may differ from
top_page_no during a rollback */
ulint size; /*!< current size in pages */
/*-----------------------------*/
ulint empty; /*!< TRUE if the stack of undo log
records is currently empty */
ulint top_page_no; /*!< page number where the latest undo
log record was catenated; during
rollback the page from which the latest
undo record was chosen */
ulint top_offset; /*!< offset of the latest undo record,
i.e., the topmost element in the undo
log if we think of it as a stack */
undo_no_t top_undo_no; /*!< undo number of the latest record */
buf_block_t* guess_block; /*!< guess for the buffer block where
the top page might reside */
/*-----------------------------*/
UT_LIST_NODE_T(trx_undo_t) undo_list;
/*!< undo log objects in the rollback
segment are chained into lists */
};
#endif /* !UNIV_HOTBACKUP */
/** The offset of the undo log page header on pages of the undo log */
#define TRX_UNDO_PAGE_HDR FSEG_PAGE_DATA
/*-------------------------------------------------------------*/
/** Transaction undo log page header offsets */
/* @{ */
#define TRX_UNDO_PAGE_TYPE 0 /*!< TRX_UNDO_INSERT or
TRX_UNDO_UPDATE */
#define TRX_UNDO_PAGE_START 2 /*!< Byte offset where the undo log
records for the LATEST transaction
start on this page (remember that
in an update undo log, the first page
can contain several undo logs) */
#define TRX_UNDO_PAGE_FREE 4 /*!< On each page of the undo log this
field contains the byte offset of the
first free byte on the page */
#define TRX_UNDO_PAGE_NODE 6 /*!< The file list node in the chain
of undo log pages */
/*-------------------------------------------------------------*/
#define TRX_UNDO_PAGE_HDR_SIZE (6 + FLST_NODE_SIZE)
/*!< Size of the transaction undo
log page header, in bytes */
/* @} */
/** An update undo segment with just one page can be reused if it has
at most this many bytes used; we must leave space at least for one new undo
log header on the page */
#define TRX_UNDO_PAGE_REUSE_LIMIT (3 * UNIV_PAGE_SIZE / 4)
/* An update undo log segment may contain several undo logs on its first page
if the undo logs took so little space that the segment could be cached and
reused. All the undo log headers are then on the first page, and the last one
owns the undo log records on subsequent pages if the segment is bigger than
one page. If an undo log is stored in a segment, then on the first page it is
allowed to have zero undo records, but if the segment extends to several
pages, then all the rest of the pages must contain at least one undo log
record. */
/** The offset of the undo log segment header on the first page of the undo
log segment */
#define TRX_UNDO_SEG_HDR (TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE)
/** Undo log segment header */
/* @{ */
/*-------------------------------------------------------------*/
#define TRX_UNDO_STATE 0 /*!< TRX_UNDO_ACTIVE, ... */
#define TRX_UNDO_LAST_LOG 2 /*!< Offset of the last undo log header
on the segment header page, 0 if
none */
#define TRX_UNDO_FSEG_HEADER 4 /*!< Header for the file segment which
the undo log segment occupies */
#define TRX_UNDO_PAGE_LIST (4 + FSEG_HEADER_SIZE)
/*!< Base node for the list of pages in
the undo log segment; defined only on
the undo log segment's first page */
/*-------------------------------------------------------------*/
/** Size of the undo log segment header */
#define TRX_UNDO_SEG_HDR_SIZE (4 + FSEG_HEADER_SIZE + FLST_BASE_NODE_SIZE)
/* @} */
/** The undo log header. There can be several undo log headers on the first
page of an update undo log segment. */
/* @{ */
/*-------------------------------------------------------------*/
#define TRX_UNDO_TRX_ID 0 /*!< Transaction id */
#define TRX_UNDO_TRX_NO 8 /*!< Transaction number of the
transaction; defined only if the log
is in a history list */
#define TRX_UNDO_DEL_MARKS 16 /*!< Defined only in an update undo
log: TRUE if the transaction may have
done delete markings of records, and
thus purge is necessary */
#define TRX_UNDO_LOG_START 18 /*!< Offset of the first undo log record
of this log on the header page; purge
may remove undo log record from the
log start, and therefore this is not
necessarily the same as this log
header end offset */
#define TRX_UNDO_XID_EXISTS 20 /*!< TRUE if undo log header includes
X/Open XA transaction identification
XID */
#define TRX_UNDO_DICT_TRANS 21 /*!< TRUE if the transaction is a table
create, index create, or drop
transaction: in recovery
the transaction cannot be rolled back
in the usual way: a 'rollback' rather
means dropping the created or dropped
table, if it still exists */
#define TRX_UNDO_TABLE_ID 22 /*!< Id of the table if the preceding
field is TRUE */
#define TRX_UNDO_NEXT_LOG 30 /*!< Offset of the next undo log header
on this page, 0 if none */
#define TRX_UNDO_PREV_LOG 32 /*!< Offset of the previous undo log
header on this page, 0 if none */
#define TRX_UNDO_HISTORY_NODE 34 /*!< If the log is put to the history
list, the file list node is here */
/*-------------------------------------------------------------*/
/** Size of the undo log header without XID information */
#define TRX_UNDO_LOG_OLD_HDR_SIZE (34 + FLST_NODE_SIZE)
/* Note: the writing of the undo log old header is coded by a log record
MLOG_UNDO_HDR_CREATE or MLOG_UNDO_HDR_REUSE. The appending of an XID to the
header is logged separately. In this sense, the XID is not really a member
of the undo log header. TODO: do not append the XID to the log header if XA
is not needed by the user. The XID wastes about 150 bytes of space in every
undo log. In the history list we may have millions of undo logs, which means
quite a large overhead. */
/** X/Open XA Transaction Identification (XID) */
/* @{ */
/** xid_t::formatID */
#define TRX_UNDO_XA_FORMAT (TRX_UNDO_LOG_OLD_HDR_SIZE)
/** xid_t::gtrid_length */
#define TRX_UNDO_XA_TRID_LEN (TRX_UNDO_XA_FORMAT + 4)
/** xid_t::bqual_length */
#define TRX_UNDO_XA_BQUAL_LEN (TRX_UNDO_XA_TRID_LEN + 4)
/** Distributed transaction identifier data */
#define TRX_UNDO_XA_XID (TRX_UNDO_XA_BQUAL_LEN + 4)
/*--------------------------------------------------------------*/
#define TRX_UNDO_LOG_XA_HDR_SIZE (TRX_UNDO_XA_XID + XIDDATASIZE)
/*!< Total size of the undo log header
with the XA XID */
/* @} */
#ifndef UNIV_NONINL
#include "trx0undo.ic"
#endif
#endif