mariadb/storage/innobase/include/ibuf0ibuf.ic
unknown 2606cb9321 Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
All but ss677 are against the mysql-5.1 tree only.

Fixes the following bugs:
- Bug #19834: Using cursors when running in READ-COMMITTED can cause InnoDB to crash
- Bug #20213: DBT2 testing cause mysqld to core using Innodb
- Bug #20493: on partition tables, select and show command casue server crash
- Bug #21113: Duplicate printout in SHOW INNODB STATUS
- Bug #21313: rsql_..._recover_innodb_tmp_table is redundant and broken
- Bug #21467: Manual URL wrong in InnoDB "page corrupted" error report


mysql-test/r/innodb.result:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  innodb.result: Adjust Innodb_rows_inserted and Innodb_rows_updated
  to reflect the deleted statements in r420, which somehow reappeared
  in the MySQL tree.
mysql-test/t/innodb.test:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
sql/ha_innodb.cc:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  ha_innobase::start_stmt(): patch from Heikki:
  Do not call read_view_close_for_mysql().  (Bug #19834)
  
  Fix Bug#20213 and its duplicates: stress test crashes of InnoDB-5.1
  
  Fix Bug #20493 : we must prepare prebuilt->trx to point to the trx of this thd before using it
  
  Add update_thd() to several places in ha_innodb.cc to make sure prebuilt->trx points to the right trx object; in other functions add assertions that prebuilt->trx is for this thd; when 5.1 stabilizes, we can change these assertions to ut_ad() debug version assertions
  
  Remove redundant check_trx_exists() and ut_a() from r701,
  as suggested by Marko
  
  Correct all URLs pointing to the MySQL manual. (Bug #21467)
storage/innobase/btr/btr0btr.c:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  Correct all URLs pointing to the MySQL manual. (Bug #21467)
storage/innobase/buf/buf0buf.c:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  Correct all URLs pointing to the MySQL manual. (Bug #21467)
storage/innobase/dict/dict0dict.c:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  Correct all URLs pointing to the MySQL manual. (Bug #21467)
storage/innobase/fil/fil0fil.c:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  Make the tablespace cache hash size 100 or 1000 times bigger. Fixes bug
  #21112.
  
  After ut_print_timestamp(), always display "  InnoDB:" (note two spaces).
  
  Correct all URLs pointing to the MySQL manual. (Bug #21467)
storage/innobase/fsp/fsp0fsp.c:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  Correct all URLs pointing to the MySQL manual. (Bug #21467)
storage/innobase/ibuf/ibuf0ibuf.c:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  ibuf_print(): Don't print redundant information. Fixes bug #21113.
  
  Remove non-varying variable ibuf->meter and related constant IBUF_THRESHOLD.
storage/innobase/include/btr0cur.ic:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  btr_cur_get_page(): Remove buggy assertion.
storage/innobase/include/buf0buf.ic:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  Correct all URLs pointing to the MySQL manual. (Bug #21467)
storage/innobase/include/ibuf0ibuf.ic:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  Remove non-varying variable ibuf->meter and related constant IBUF_THRESHOLD.
storage/innobase/log/log0log.c:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  Correct all URLs pointing to the MySQL manual. (Bug #21467)
storage/innobase/log/log0recv.c:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  Correct all URLs pointing to the MySQL manual. (Bug #21467)
storage/innobase/os/os0file.c:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  Correct all URLs pointing to the MySQL manual. (Bug #21467)
storage/innobase/row/row0mysql.c:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  Remove the special treatment of tables
  rsql_IDENTIFIER_recover_innodb_tmp_table, which is redundant and
  was broken with the introduction of the "safe" file name encoding of
  identifiers.  (Bug #21313)
  
  ChangeSet@1.2181.173.1  2006-08-02 17:57:06+02:00  ingo@local
  Bug#18775 - Temporary table from alter table visible to other threads
  Continued implementation of WL#1324 (table name to filename encoding)
  Changed back the encoded temp file prefix to #sql.
  
  After ut_print_timestamp(), always display "  InnoDB:" (note two spaces).
  
  Correct all URLs pointing to the MySQL manual. (Bug #21467)
storage/innobase/row/row0sel.c:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  Correct all URLs pointing to the MySQL manual. (Bug #21467)
storage/innobase/row/row0vers.c:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  row_vers_build_for_semi_consistent_read(): rec_trx_id was uninitialized
  in a comparison.  Initialize it.
storage/innobase/srv/srv0start.c:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  Correct all URLs pointing to the MySQL manual. (Bug #21467)
storage/innobase/ut/ut0dbg.c:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
  
  ut_dbg_assertion_failed(): Print space between timestamp and start of error
  message.
  
  After ut_print_timestamp(), always display "  InnoDB:" (note two spaces).
  
  Correct all URLs pointing to the MySQL manual. (Bug #21467)
storage/innobase/Makefile.am:
  Applied innodb-5.1-ss677, -ss680, -ss713, and -ss720 snapshots.
  All but ss677 are against the mysql-5.1 tree only.
2006-08-15 01:42:57 +02:00

224 lines
6.4 KiB
Text

/******************************************************
Insert buffer
(c) 1997 Innobase Oy
Created 7/19/1997 Heikki Tuuri
*******************************************************/
#include "buf0lru.h"
#include "page0page.h"
extern ulint ibuf_flush_count;
/* If this number is n, an index page must contain at least the page size
per n bytes of free space for ibuf to try to buffer inserts to this page.
If there is this much of free space, the corresponding bits are set in the
ibuf bitmap. */
#define IBUF_PAGE_SIZE_PER_FREE_SPACE 32
/* Insert buffer data struct for a single tablespace */
struct ibuf_data_struct{
ulint space; /* space id */
ulint seg_size;/* allocated pages if the file segment
containing ibuf header and tree */
ulint size; /* size of the insert buffer tree in pages */
ibool empty; /* after an insert to the ibuf tree is
performed, this is set to FALSE, and if a
contract operation finds the tree empty, this
is set to TRUE */
ulint free_list_len;
/* length of the free list */
ulint height; /* tree height */
dict_index_t* index; /* insert buffer index */
UT_LIST_NODE_T(ibuf_data_t) data_list;
/* list of ibuf data structs */
ulint n_inserts;/* number of inserts made to the insert
buffer */
ulint n_merges;/* number of pages merged */
ulint n_merged_recs;/* number of records merged */
};
struct ibuf_struct{
ulint size; /* current size of the ibuf index
trees in pages */
ulint max_size; /* recommended maximum size in pages
for the ibuf index tree */
UT_LIST_BASE_NODE_T(ibuf_data_t) data_list;
/* list of ibuf data structs for
each tablespace */
};
/****************************************************************************
Sets the free bit of the page in the ibuf bitmap. This is done in a separate
mini-transaction, hence this operation does not restrict further work to only
ibuf bitmap operations, which would result if the latch to the bitmap page
were kept. */
void
ibuf_set_free_bits(
/*===============*/
ulint type, /* in: index type */
page_t* page, /* in: index page; free bit is reset if the index is
a non-clustered non-unique, and page level is 0 */
ulint val, /* in: value to set: < 4 */
ulint max_val);/* in: ULINT_UNDEFINED or a maximum value which
the bits must have before setting; this is for
debugging */
/**************************************************************************
A basic partial test if an insert to the insert buffer could be possible and
recommended. */
UNIV_INLINE
ibool
ibuf_should_try(
/*============*/
dict_index_t* index, /* in: index where to insert */
ulint ignore_sec_unique) /* in: if != 0, we should
ignore UNIQUE constraint on
a secondary index when we
decide */
{
if (!(index->type & DICT_CLUSTERED)
&& (ignore_sec_unique || !(index->type & DICT_UNIQUE))) {
ibuf_flush_count++;
if (ibuf_flush_count % 8 == 0) {
buf_LRU_try_free_flushed_blocks();
}
return(TRUE);
}
return(FALSE);
}
/***************************************************************************
Checks if a page address is an ibuf bitmap page address. */
UNIV_INLINE
ibool
ibuf_bitmap_page(
/*=============*/
/* out: TRUE if a bitmap page */
ulint page_no)/* in: page number */
{
if (page_no % XDES_DESCRIBED_PER_PAGE == FSP_IBUF_BITMAP_OFFSET) {
return(TRUE);
}
return(FALSE);
}
/*************************************************************************
Translates the free space on a page to a value in the ibuf bitmap.*/
UNIV_INLINE
ulint
ibuf_index_page_calc_free_bits(
/*===========================*/
/* out: value for ibuf bitmap bits */
ulint max_ins_size) /* in: maximum insert size after reorganize
for the page */
{
ulint n;
n = max_ins_size / (UNIV_PAGE_SIZE / IBUF_PAGE_SIZE_PER_FREE_SPACE);
if (n == 3) {
n = 2;
}
if (n > 3) {
n = 3;
}
return(n);
}
/*************************************************************************
Translates the ibuf free bits to the free space on a page in bytes. */
UNIV_INLINE
ulint
ibuf_index_page_calc_free_from_bits(
/*================================*/
/* out: maximum insert size after reorganize for the
page */
ulint bits) /* in: value for ibuf bitmap bits */
{
ut_ad(bits < 4);
if (bits == 3) {
return(4 * UNIV_PAGE_SIZE / IBUF_PAGE_SIZE_PER_FREE_SPACE);
}
return(bits * UNIV_PAGE_SIZE / IBUF_PAGE_SIZE_PER_FREE_SPACE);
}
/*************************************************************************
Translates the free space on a page to a value in the ibuf bitmap.*/
UNIV_INLINE
ulint
ibuf_index_page_calc_free(
/*======================*/
/* out: value for ibuf bitmap bits */
page_t* page) /* in: non-unique secondary index page */
{
return(ibuf_index_page_calc_free_bits(
page_get_max_insert_size_after_reorganize(page, 1)));
}
/****************************************************************************
Updates the free bits of the page in the ibuf bitmap if there is not enough
free on the page any more. This is done in a separate mini-transaction, hence
this operation does not restrict further work to only ibuf bitmap operations,
which would result if the latch to the bitmap page were kept. */
UNIV_INLINE
void
ibuf_update_free_bits_if_full(
/*==========================*/
dict_index_t* index, /* in: index */
page_t* page, /* in: index page to which we have added new
records; the free bits are updated if the
index is non-clustered and non-unique and
the page level is 0, and the page becomes
fuller */
ulint max_ins_size,/* in: value of maximum insert size with
reorganize before the latest operation
performed to the page */
ulint increase)/* in: upper limit for the additional space
used in the latest operation, if known, or
ULINT_UNDEFINED */
{
ulint before;
ulint after;
before = ibuf_index_page_calc_free_bits(max_ins_size);
if (max_ins_size >= increase) {
#if ULINT32_UNDEFINED <= UNIV_PAGE_SIZE
# error "ULINT32_UNDEFINED <= UNIV_PAGE_SIZE"
#endif
after = ibuf_index_page_calc_free_bits(max_ins_size
- increase);
#ifdef UNIV_IBUF_DEBUG
ut_a(after <= ibuf_index_page_calc_free(page));
#endif
} else {
after = ibuf_index_page_calc_free(page);
}
if (after == 0) {
/* We move the page to the front of the buffer pool LRU list:
the purpose of this is to prevent those pages to which we
cannot make inserts using the insert buffer from slipping
out of the buffer pool */
buf_page_make_young(page);
}
if (before > after) {
ibuf_set_free_bits(index->type, page, after, before);
}
}