branches/innodb+: Merge 2637:2660 from branches/zip.

This commit is contained in:
marko 2008-09-22 07:57:34 +00:00
parent 1c8ce73ace
commit c5fa1c20be
36 changed files with 356 additions and 170 deletions

View file

@ -1,3 +1,20 @@
2008-09-17 The InnoDB Team
* mysql-test/innodb.result, mysql-test/innodb-zip.result,
mysql-test/innodb-zip.test, mysql-test/innodb.test,
ibuf/ibuf0ibuf.c, dict/dict0crea.c, dict/dict0load.c, dict/dict0boot.c,
include/dict0dict.h, include/trx0trx.h,
dict/dict0dict.c, trx/trx0trx.c,
include/ha_prototypes.h, handler/ha_innodb.cc:
When creating an index in innodb_strict_mode, check that the
maximum record size will never exceed the B-tree page size limit.
For uncompressed tables, there should always be enough space for
two records in an empty B-tree page. For compressed tables, there
should be enough space for storing two node pointer records or one
data record in an empty page in uncompressed format.
The purpose of this check is to guarantee that INSERT or UPDATE
will never fail due to too big record size.
2008-09-17 The InnoDB Team 2008-09-17 The InnoDB Team
* btr/btr0cur.c, data/data0data.c, include/page0zip.h, * btr/btr0cur.c, data/data0data.c, include/page0zip.h,
@ -8,7 +25,6 @@
pointer records in an empty B-tree page. Also, require that at pointer records in an empty B-tree page. Also, require that at
least one data record will fit in an empty compressed page. This least one data record will fit in an empty compressed page. This
will reduce the maximum size of records in compressed tables. will reduce the maximum size of records in compressed tables.
This was reported as Mantis issue #73.
2008-09-09 The InnoDB Team 2008-09-09 The InnoDB Team

View file

@ -313,9 +313,7 @@ btr_page_alloc_for_ibuf(
dict_table_zip_size(index->table), dict_table_zip_size(index->table),
node_addr.page, RW_X_LATCH, mtr); node_addr.page, RW_X_LATCH, mtr);
new_page = buf_block_get_frame(new_block); new_page = buf_block_get_frame(new_block);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(new_block, SYNC_TREE_NODE_NEW); buf_block_dbg_add_level(new_block, SYNC_TREE_NODE_NEW);
#endif /* UNIV_SYNC_DEBUG */
flst_remove(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, flst_remove(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
new_page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, new_page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE,
@ -375,9 +373,7 @@ btr_page_alloc(
new_block = buf_page_get(dict_index_get_space(index), new_block = buf_page_get(dict_index_get_space(index),
dict_table_zip_size(index->table), dict_table_zip_size(index->table),
new_page_no, RW_X_LATCH, mtr); new_page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(new_block, SYNC_TREE_NODE_NEW); buf_block_dbg_add_level(new_block, SYNC_TREE_NODE_NEW);
#endif /* UNIV_SYNC_DEBUG */
return(new_block); return(new_block);
} }
@ -751,9 +747,8 @@ btr_create(
space, 0, space, 0,
IBUF_HEADER + IBUF_TREE_SEG_HEADER, mtr); IBUF_HEADER + IBUF_TREE_SEG_HEADER, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(ibuf_hdr_block, SYNC_TREE_NODE_NEW); buf_block_dbg_add_level(ibuf_hdr_block, SYNC_TREE_NODE_NEW);
#endif /* UNIV_SYNC_DEBUG */
ut_ad(buf_block_get_page_no(ibuf_hdr_block) ut_ad(buf_block_get_page_no(ibuf_hdr_block)
== IBUF_HEADER_PAGE_NO); == IBUF_HEADER_PAGE_NO);
/* Allocate then the next page to the segment: it will be the /* Allocate then the next page to the segment: it will be the
@ -782,9 +777,7 @@ btr_create(
page_no = buf_block_get_page_no(block); page_no = buf_block_get_page_no(block);
frame = buf_block_get_frame(block); frame = buf_block_get_frame(block);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW); buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW);
#endif /* UNIV_SYNC_DEBUG */
if (type & DICT_IBUF) { if (type & DICT_IBUF) {
/* It is an insert buffer tree: initialize the free list */ /* It is an insert buffer tree: initialize the free list */
@ -799,9 +792,7 @@ btr_create(
PAGE_HEADER + PAGE_BTR_SEG_LEAF, mtr); PAGE_HEADER + PAGE_BTR_SEG_LEAF, mtr);
/* The fseg create acquires a second latch on the page, /* The fseg create acquires a second latch on the page,
therefore we must declare it: */ therefore we must declare it: */
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW); buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW);
#endif /* UNIV_SYNC_DEBUG */
} }
/* Create a new index page on the the allocated segment page */ /* Create a new index page on the the allocated segment page */

View file

@ -433,7 +433,6 @@ btr_cur_search_to_nth_level(
} }
#endif /* BTR_CUR_HASH_ADAPT */ #endif /* BTR_CUR_HASH_ADAPT */
#endif /* BTR_CUR_ADAPT */ #endif /* BTR_CUR_ADAPT */
btr_cur_n_non_sea++; btr_cur_n_non_sea++;
/* If the hash search did not succeed, do binary search down the /* If the hash search did not succeed, do binary search down the
@ -614,11 +613,10 @@ retry_page_get:
} }
#endif /* UNIV_ZIP_DEBUG */ #endif /* UNIV_ZIP_DEBUG */
#ifdef UNIV_SYNC_DEBUG
if (rw_latch != RW_NO_LATCH) { if (rw_latch != RW_NO_LATCH) {
buf_block_dbg_add_level(block, SYNC_TREE_NODE); buf_block_dbg_add_level(block, SYNC_TREE_NODE);
} }
#endif
ut_ad(0 == ut_dulint_cmp(index->id, btr_page_get_index_id(page))); ut_ad(0 == ut_dulint_cmp(index->id, btr_page_get_index_id(page)));
if (UNIV_UNLIKELY(height == ULINT_UNDEFINED)) { if (UNIV_UNLIKELY(height == ULINT_UNDEFINED)) {
@ -3975,10 +3973,8 @@ btr_store_big_rec_extern_fields(
prev_block = buf_page_get(space_id, zip_size, prev_block = buf_page_get(space_id, zip_size,
prev_page_no, prev_page_no,
RW_X_LATCH, &mtr); RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(prev_block, buf_block_dbg_add_level(prev_block,
SYNC_EXTERN_STORAGE); SYNC_EXTERN_STORAGE);
#endif /* UNIV_SYNC_DEBUG */
prev_page = buf_block_get_frame(prev_block); prev_page = buf_block_get_frame(prev_block);
if (UNIV_LIKELY_NULL(page_zip)) { if (UNIV_LIKELY_NULL(page_zip)) {
@ -4073,10 +4069,9 @@ btr_store_big_rec_extern_fields(
rec_block = buf_page_get(space_id, zip_size, rec_block = buf_page_get(space_id, zip_size,
rec_page_no, rec_page_no,
RW_X_LATCH, &mtr); RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(rec_block, buf_block_dbg_add_level(rec_block,
SYNC_NO_ORDER_CHECK); SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
if (err == Z_STREAM_END) { if (err == Z_STREAM_END) {
mach_write_to_4(field_ref mach_write_to_4(field_ref
+ BTR_EXTERN_LEN, 0); + BTR_EXTERN_LEN, 0);
@ -4152,10 +4147,8 @@ next_zip_page:
rec_block = buf_page_get(space_id, zip_size, rec_block = buf_page_get(space_id, zip_size,
rec_page_no, rec_page_no,
RW_X_LATCH, &mtr); RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(rec_block, buf_block_dbg_add_level(rec_block,
SYNC_NO_ORDER_CHECK); SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
mlog_write_ulint(field_ref + BTR_EXTERN_LEN, 0, mlog_write_ulint(field_ref + BTR_EXTERN_LEN, 0,
MLOG_4BYTES, &mtr); MLOG_4BYTES, &mtr);
@ -4299,9 +4292,7 @@ btr_free_externally_stored_field(
page_get_page_no( page_get_page_no(
page_align(field_ref)), page_align(field_ref)),
RW_X_LATCH, &mtr); RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(rec_block, SYNC_NO_ORDER_CHECK); buf_block_dbg_add_level(rec_block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
page_no = mach_read_from_4(field_ref + BTR_EXTERN_PAGE_NO); page_no = mach_read_from_4(field_ref + BTR_EXTERN_PAGE_NO);
if (/* There is no external storage data */ if (/* There is no external storage data */
@ -4322,9 +4313,7 @@ btr_free_externally_stored_field(
ext_block = buf_page_get(space_id, ext_zip_size, page_no, ext_block = buf_page_get(space_id, ext_zip_size, page_no,
RW_X_LATCH, &mtr); RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(ext_block, SYNC_EXTERN_STORAGE); buf_block_dbg_add_level(ext_block, SYNC_EXTERN_STORAGE);
#endif /* UNIV_SYNC_DEBUG */
page = buf_block_get_frame(ext_block); page = buf_block_get_frame(ext_block);
if (ext_zip_size) { if (ext_zip_size) {
@ -4514,9 +4503,7 @@ btr_copy_blob_prefix(
mtr_start(&mtr); mtr_start(&mtr);
block = buf_page_get(space_id, 0, page_no, RW_S_LATCH, &mtr); block = buf_page_get(space_id, 0, page_no, RW_S_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_EXTERN_STORAGE); buf_block_dbg_add_level(block, SYNC_EXTERN_STORAGE);
#endif /* UNIV_SYNC_DEBUG */
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
/* Unfortunately, FIL_PAGE_TYPE was uninitialized for /* Unfortunately, FIL_PAGE_TYPE was uninitialized for

View file

@ -244,10 +244,10 @@ btr_pcur_restore_position(
cursor->block_when_stored, cursor->block_when_stored,
cursor->modify_clock, mtr))) { cursor->modify_clock, mtr))) {
cursor->pos_state = BTR_PCUR_IS_POSITIONED; cursor->pos_state = BTR_PCUR_IS_POSITIONED;
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(btr_pcur_get_block(cursor), buf_block_dbg_add_level(btr_pcur_get_block(cursor),
SYNC_TREE_NODE); SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */
if (cursor->rel_pos == BTR_PCUR_ON) { if (cursor->rel_pos == BTR_PCUR_ON) {
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
const rec_t* rec; const rec_t* rec;

View file

@ -845,9 +845,7 @@ btr_search_guess_on_hash(
rw_lock_s_unlock(&btr_search_latch); rw_lock_s_unlock(&btr_search_latch);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH); buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
#endif /* UNIV_SYNC_DEBUG */
} }
if (UNIV_UNLIKELY(buf_block_get_state(block) if (UNIV_UNLIKELY(buf_block_get_state(block)
@ -1158,9 +1156,7 @@ btr_search_drop_page_hash_when_freed(
BUF_GET_IF_IN_POOL, __FILE__, __LINE__, BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
&mtr); &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH); buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
#endif /* UNIV_SYNC_DEBUG */
btr_search_drop_page_hash_index(block); btr_search_drop_page_hash_index(block);

View file

@ -2284,9 +2284,8 @@ buf_page_optimistic_get_func(
} }
if (UNIV_UNLIKELY(modify_clock != block->modify_clock)) { if (UNIV_UNLIKELY(modify_clock != block->modify_clock)) {
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
if (rw_latch == RW_S_LATCH) { if (rw_latch == RW_S_LATCH) {
rw_lock_s_unlock(&(block->lock)); rw_lock_s_unlock(&(block->lock));
} else { } else {
@ -2486,9 +2485,8 @@ buf_page_try_get_func(
#ifdef UNIV_DEBUG_FILE_ACCESSES #ifdef UNIV_DEBUG_FILE_ACCESSES
ut_a(block->page.file_page_was_freed == FALSE); ut_a(block->page.file_page_was_freed == FALSE);
#endif /* UNIV_DEBUG_FILE_ACCESSES */ #endif /* UNIV_DEBUG_FILE_ACCESSES */
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
buf_pool->n_page_gets++; buf_pool->n_page_gets++;
return(block); return(block);

View file

@ -39,9 +39,9 @@ dict_hdr_get(
block = buf_page_get(DICT_HDR_SPACE, 0, DICT_HDR_PAGE_NO, block = buf_page_get(DICT_HDR_SPACE, 0, DICT_HDR_PAGE_NO,
RW_X_LATCH, mtr); RW_X_LATCH, mtr);
header = DICT_HDR + buf_block_get_frame(block); header = DICT_HDR + buf_block_get_frame(block);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_DICT_HEADER); buf_block_dbg_add_level(block, SYNC_DICT_HEADER);
#endif /* UNIV_SYNC_DEBUG */
return(header); return(header);
} }
@ -279,7 +279,8 @@ dict_boot(void)
error = dict_index_add_to_cache(table, index, error = dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr mtr_read_ulint(dict_hdr
+ DICT_HDR_TABLES, + DICT_HDR_TABLES,
MLOG_4BYTES, &mtr)); MLOG_4BYTES, &mtr),
FALSE);
ut_a(error == DB_SUCCESS); ut_a(error == DB_SUCCESS);
/*-------------------------*/ /*-------------------------*/
@ -291,7 +292,8 @@ dict_boot(void)
error = dict_index_add_to_cache(table, index, error = dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr mtr_read_ulint(dict_hdr
+ DICT_HDR_TABLE_IDS, + DICT_HDR_TABLE_IDS,
MLOG_4BYTES, &mtr)); MLOG_4BYTES, &mtr),
FALSE);
ut_a(error == DB_SUCCESS); ut_a(error == DB_SUCCESS);
/*-------------------------*/ /*-------------------------*/
@ -322,7 +324,8 @@ dict_boot(void)
error = dict_index_add_to_cache(table, index, error = dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr mtr_read_ulint(dict_hdr
+ DICT_HDR_COLUMNS, + DICT_HDR_COLUMNS,
MLOG_4BYTES, &mtr)); MLOG_4BYTES, &mtr),
FALSE);
ut_a(error == DB_SUCCESS); ut_a(error == DB_SUCCESS);
/*-------------------------*/ /*-------------------------*/
@ -363,7 +366,8 @@ dict_boot(void)
error = dict_index_add_to_cache(table, index, error = dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr mtr_read_ulint(dict_hdr
+ DICT_HDR_INDEXES, + DICT_HDR_INDEXES,
MLOG_4BYTES, &mtr)); MLOG_4BYTES, &mtr),
FALSE);
ut_a(error == DB_SUCCESS); ut_a(error == DB_SUCCESS);
/*-------------------------*/ /*-------------------------*/
@ -389,7 +393,8 @@ dict_boot(void)
error = dict_index_add_to_cache(table, index, error = dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr mtr_read_ulint(dict_hdr
+ DICT_HDR_FIELDS, + DICT_HDR_FIELDS,
MLOG_4BYTES, &mtr)); MLOG_4BYTES, &mtr),
FALSE);
ut_a(error == DB_SUCCESS); ut_a(error == DB_SUCCESS);
mtr_commit(&mtr); mtr_commit(&mtr);

View file

@ -216,8 +216,6 @@ dict_build_table_def_step(
const char* path_or_name; const char* path_or_name;
ibool is_path; ibool is_path;
mtr_t mtr; mtr_t mtr;
ulint i;
ulint row_len;
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
@ -227,14 +225,6 @@ dict_build_table_def_step(
thr_get_trx(thr)->table_id = table->id; thr_get_trx(thr)->table_id = table->id;
row_len = 0;
for (i = 0; i < table->n_def; i++) {
row_len += dict_col_get_min_size(&table->cols[i]);
}
if (row_len > BTR_PAGE_MAX_REC_SIZE) {
return(DB_TOO_BIG_RECORD);
}
if (srv_file_per_table) { if (srv_file_per_table) {
/* We create a new single-table tablespace for the table. /* We create a new single-table tablespace for the table.
We initially let it be 4 pages: We initially let it be 4 pages:
@ -1089,7 +1079,7 @@ dict_create_index_step(
dulint index_id = node->index->id; dulint index_id = node->index->id;
err = dict_index_add_to_cache(node->table, node->index, err = dict_index_add_to_cache(node->table, node->index,
FIL_NULL); FIL_NULL, trx_is_strict(trx));
node->index = dict_index_get_if_in_cache_low(index_id); node->index = dict_index_get_if_in_cache_low(index_id);
ut_a(!node->index == (err != DB_SUCCESS)); ut_a(!node->index == (err != DB_SUCCESS));

View file

@ -22,6 +22,8 @@ Created 1/8/1996 Heikki Tuuri
#include "btr0btr.h" #include "btr0btr.h"
#include "btr0cur.h" #include "btr0cur.h"
#include "btr0sea.h" #include "btr0sea.h"
#include "page0zip.h"
#include "page0page.h"
#include "pars0pars.h" #include "pars0pars.h"
#include "pars0sym.h" #include "pars0sym.h"
#include "que0que.h" #include "que0que.h"
@ -1262,6 +1264,156 @@ is_ord_part:
return(undo_page_len >= UNIV_PAGE_SIZE); return(undo_page_len >= UNIV_PAGE_SIZE);
} }
/********************************************************************
If a record of this index might not fit on a single B-tree page,
return TRUE. */
static
ibool
dict_index_too_big_for_tree(
/*========================*/
/* out: TRUE if the index
record could become too big */
const dict_table_t* table, /* in: table */
const dict_index_t* new_index) /* in: index */
{
ulint zip_size;
ulint comp;
ulint i;
/* maximum possible storage size of a record */
ulint rec_max_size;
/* maximum allowed size of a record on a leaf page */
ulint page_rec_max;
/* maximum allowed size of a node pointer record */
ulint page_ptr_max;
comp = dict_table_is_comp(table);
zip_size = dict_table_zip_size(table);
if (zip_size && zip_size < UNIV_PAGE_SIZE) {
/* On a compressed page, two records must fit in the
uncompressed page modification log. On compressed
pages with zip_size == UNIV_PAGE_SIZE, this limit will
never be reached. */
ut_ad(comp);
/* The maximum allowed record size is the size of
an empty page, minus a byte for recoding the heap
number in the page modification log. The maximum
allowed node pointer size is half that. */
page_rec_max = page_zip_empty_size(new_index->n_fields,
zip_size) - 1;
page_ptr_max = page_rec_max / 2;
/* On a compressed page, there is a two-byte entry in
the dense page directory for every record. But there
is no record header. */
rec_max_size = 2;
} else {
/* The maximum allowed record size is half a B-tree
page. No additional sparse page directory entry will
be generated for the first few user records. */
page_rec_max = page_get_free_space_of_empty(comp) / 2;
page_ptr_max = page_rec_max;
/* Each record has a header. */
rec_max_size = comp
? REC_N_NEW_EXTRA_BYTES
: REC_N_OLD_EXTRA_BYTES;
}
if (comp) {
/* Include the "null" flags in the
maximum possible record size. */
rec_max_size += UT_BITS_IN_BYTES(new_index->n_nullable);
} else {
/* For each column, include a 2-byte offset and a
"null" flag. The 1-byte format is only used in short
records that do not contain externally stored columns.
Such records could never exceed the page limit, even
when using the 2-byte format. */
rec_max_size += 2 * new_index->n_fields;
}
/* Compute the maximum possible record size. */
for (i = 0; i < new_index->n_fields; i++) {
const dict_field_t* field
= dict_index_get_nth_field(new_index, i);
const dict_col_t* col
= dict_field_get_col(field);
ulint field_max_size;
ulint field_ext_max_size;
/* In dtuple_convert_big_rec(), variable-length columns
that are longer than BTR_EXTERN_FIELD_REF_SIZE * 2
may be chosen for external storage.
Fixed-length columns, and all columns of secondary
index records are always stored inline. */
/* Determine the maximum length of the index field.
The field_ext_max_size should be computed as the worst
case in rec_get_converted_size_comp() for
REC_STATUS_ORDINARY records. */
field_max_size = dict_col_get_fixed_size(col);
if (field_max_size) {
/* dict_index_add_col() should guarantee this */
ut_ad(!field->prefix_len
|| field->fixed_len == field->prefix_len);
/* Fixed lengths are not encoded
in ROW_FORMAT=COMPACT. */
field_ext_max_size = 0;
goto add_field_size;
}
field_max_size = dict_col_get_max_size(col);
field_ext_max_size = field_max_size < 256 ? 1 : 2;
if (field->prefix_len) {
if (field->prefix_len < field_max_size) {
field_max_size = field->prefix_len;
}
} else if (field_max_size > BTR_EXTERN_FIELD_REF_SIZE * 2
&& dict_index_is_clust(new_index)) {
/* In the worst case, we have a locally stored
column of BTR_EXTERN_FIELD_REF_SIZE * 2 bytes.
The length can be stored in one byte. If the
column were stored externally, the lengths in
the clustered index page would be
BTR_EXTERN_FIELD_REF_SIZE and 2. */
field_max_size = BTR_EXTERN_FIELD_REF_SIZE * 2;
field_ext_max_size = 1;
}
if (comp) {
/* Add the extra size for ROW_FORMAT=COMPACT.
For ROW_FORMAT=REDUNDANT, these bytes were
added to rec_max_size before this loop. */
rec_max_size += field_ext_max_size;
}
add_field_size:
rec_max_size += field_max_size;
/* Check the size limit on leaf pages. */
if (UNIV_UNLIKELY(rec_max_size >= page_rec_max)) {
return(TRUE);
}
/* Check the size limit on non-leaf pages. Records
stored in non-leaf B-tree pages consist of the unique
columns of the record (the key columns of the B-tree)
and a node pointer field. When we have processed the
unique columns, rec_max_size equals the size of the
node pointer record minus the node pointer column. */
if (i + 1 == dict_index_get_n_unique_in_tree(new_index)
&& rec_max_size + REC_NODE_PTR_SIZE >= page_ptr_max) {
return(TRUE);
}
}
return(FALSE);
}
/************************************************************************** /**************************************************************************
Adds an index to the dictionary cache. */ Adds an index to the dictionary cache. */
UNIV_INTERN UNIV_INTERN
@ -1272,7 +1424,10 @@ dict_index_add_to_cache(
dict_table_t* table, /* in: table on which the index is */ dict_table_t* table, /* in: table on which the index is */
dict_index_t* index, /* in, own: index; NOTE! The index memory dict_index_t* index, /* in, own: index; NOTE! The index memory
object is freed in this function! */ object is freed in this function! */
ulint page_no)/* in: root page number of the index */ ulint page_no,/* in: root page number of the index */
ibool strict) /* in: TRUE=refuse to create the index
if records could be too big to fit in
an B-tree page */
{ {
dict_index_t* new_index; dict_index_t* new_index;
ulint n_ord; ulint n_ord;
@ -1303,6 +1458,13 @@ dict_index_add_to_cache(
new_index->n_fields = new_index->n_def; new_index->n_fields = new_index->n_def;
if (strict && dict_index_too_big_for_tree(table, new_index)) {
too_big:
dict_mem_index_free(new_index);
dict_mem_index_free(index);
return(DB_TOO_BIG_RECORD);
}
if (UNIV_UNLIKELY(index->type & DICT_UNIVERSAL)) { if (UNIV_UNLIKELY(index->type & DICT_UNIVERSAL)) {
n_ord = new_index->n_fields; n_ord = new_index->n_fields;
} else { } else {
@ -1334,9 +1496,8 @@ dict_index_add_to_cache(
if (dict_index_too_big_for_undo(table, new_index)) { if (dict_index_too_big_for_undo(table, new_index)) {
/* An undo log record might not fit in /* An undo log record might not fit in
a single page. Refuse to create this index. */ a single page. Refuse to create this index. */
dict_mem_index_free(new_index);
dict_mem_index_free(index); goto too_big;
return(DB_TOO_BIG_RECORD);
} }
break; break;

View file

@ -765,7 +765,8 @@ dict_load_indexes(
index->id = id; index->id = id;
dict_load_fields(index, heap); dict_load_fields(index, heap);
error = dict_index_add_to_cache(table, index, page_no); error = dict_index_add_to_cache(table, index, page_no,
FALSE);
/* The data dictionary tables should never contain /* The data dictionary tables should never contain
invalid index definitions. If we ignored this error invalid index definitions. If we ignored this error
and simply did not load this index definition, the and simply did not load this index definition, the

View file

@ -4262,18 +4262,16 @@ fil_io(
ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE) ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE)
|| !ibuf_bitmap_page(zip_size, block_offset) || !ibuf_bitmap_page(zip_size, block_offset)
|| sync || is_log); || sync || is_log);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!ibuf_inside() || is_log || (type == OS_FILE_WRITE) ut_ad(!ibuf_inside() || is_log || (type == OS_FILE_WRITE)
|| ibuf_page(space_id, zip_size, block_offset, NULL)); || ibuf_page(space_id, zip_size, block_offset, NULL));
#endif
#endif #endif
if (sync) { if (sync) {
mode = OS_AIO_SYNC; mode = OS_AIO_SYNC;
} else if (type == OS_FILE_READ && !is_log
&& ibuf_page(space_id, zip_size, block_offset, NULL)) {
mode = OS_AIO_IBUF;
} else if (is_log) { } else if (is_log) {
mode = OS_AIO_LOG; mode = OS_AIO_LOG;
} else if (type == OS_FILE_READ
&& ibuf_page(space_id, zip_size, block_offset, NULL)) {
mode = OS_AIO_IBUF;
} else { } else {
mode = OS_AIO_NORMAL; mode = OS_AIO_NORMAL;
} }

View file

@ -345,9 +345,8 @@ fsp_get_space_header(
block = buf_page_get(id, zip_size, 0, RW_X_LATCH, mtr); block = buf_page_get(id, zip_size, 0, RW_X_LATCH, mtr);
header = FSP_HEADER_OFFSET + buf_block_get_frame(block); header = FSP_HEADER_OFFSET + buf_block_get_frame(block);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE); buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
ut_ad(id == mach_read_from_4(FSP_SPACE_ID + header)); ut_ad(id == mach_read_from_4(FSP_SPACE_ID + header));
ut_ad(zip_size == dict_table_flags_to_zip_size( ut_ad(zip_size == dict_table_flags_to_zip_size(
mach_read_from_4(FSP_SPACE_FLAGS + header))); mach_read_from_4(FSP_SPACE_FLAGS + header)));
@ -730,9 +729,8 @@ xdes_get_descriptor_with_space_hdr(
block = buf_page_get(space, zip_size, descr_page_no, block = buf_page_get(space, zip_size, descr_page_no,
RW_X_LATCH, mtr); RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE); buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
descr_page = buf_block_get_frame(block); descr_page = buf_block_get_frame(block);
} }
@ -765,9 +763,8 @@ xdes_get_descriptor(
fsp_header_t* sp_header; fsp_header_t* sp_header;
block = buf_page_get(space, zip_size, 0, RW_X_LATCH, mtr); block = buf_page_get(space, zip_size, 0, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE); buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
sp_header = FSP_HEADER_OFFSET + buf_block_get_frame(block); sp_header = FSP_HEADER_OFFSET + buf_block_get_frame(block);
return(xdes_get_descriptor_with_space_hdr(sp_header, space, offset, return(xdes_get_descriptor_with_space_hdr(sp_header, space, offset,
mtr)); mtr));
@ -948,9 +945,7 @@ fsp_header_init(
zip_size = dict_table_flags_to_zip_size(flags); zip_size = dict_table_flags_to_zip_size(flags);
block = buf_page_create(space, 0, zip_size, mtr); block = buf_page_create(space, 0, zip_size, mtr);
buf_page_get(space, zip_size, 0, RW_X_LATCH, mtr); buf_page_get(space, zip_size, 0, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE); buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
/* The prior contents of the file page should be ignored */ /* The prior contents of the file page should be ignored */
@ -1380,10 +1375,9 @@ fsp_fill_free_list(
space, i, zip_size, mtr); space, i, zip_size, mtr);
buf_page_get(space, zip_size, i, buf_page_get(space, zip_size, i,
RW_X_LATCH, mtr); RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, buf_block_dbg_add_level(block,
SYNC_FSP_PAGE); SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
fsp_init_file_page(block, mtr); fsp_init_file_page(block, mtr);
mlog_write_ulint(buf_block_get_frame(block) mlog_write_ulint(buf_block_get_frame(block)
+ FIL_PAGE_TYPE, + FIL_PAGE_TYPE,
@ -1404,9 +1398,8 @@ fsp_fill_free_list(
buf_page_get(space, zip_size, buf_page_get(space, zip_size,
i + FSP_IBUF_BITMAP_OFFSET, i + FSP_IBUF_BITMAP_OFFSET,
RW_X_LATCH, &ibuf_mtr); RW_X_LATCH, &ibuf_mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE); buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
fsp_init_file_page(block, &ibuf_mtr); fsp_init_file_page(block, &ibuf_mtr);
ibuf_bitmap_page_init(block, &ibuf_mtr); ibuf_bitmap_page_init(block, &ibuf_mtr);
@ -1637,9 +1630,7 @@ fsp_alloc_free_page(
buf_page_create(space, page_no, zip_size, mtr); buf_page_create(space, page_no, zip_size, mtr);
block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, mtr); block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE); buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
/* Prior contents of the page should be ignored */ /* Prior contents of the page should be ignored */
fsp_init_file_page(block, mtr); fsp_init_file_page(block, mtr);
@ -1881,9 +1872,7 @@ fsp_alloc_seg_inode_page(
} }
block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, mtr); block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE); buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
block->check_index_page_at_flush = FALSE; block->check_index_page_at_flush = FALSE;
@ -1941,9 +1930,8 @@ fsp_alloc_seg_inode(
mach_read_from_4(FSP_SPACE_FLAGS + space_header)); mach_read_from_4(FSP_SPACE_FLAGS + space_header));
block = buf_page_get(page_get_space_id(page_align(space_header)), block = buf_page_get(page_get_space_id(page_align(space_header)),
zip_size, page_no, RW_X_LATCH, mtr); zip_size, page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE); buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
n = fsp_seg_inode_page_find_free(page, 0, zip_size, mtr); n = fsp_seg_inode_page_find_free(page, 0, zip_size, mtr);
@ -2714,9 +2702,8 @@ fseg_alloc_free_page_low(
mach_read_from_4(FSP_SPACE_FLAGS + space_header)); mach_read_from_4(FSP_SPACE_FLAGS + space_header));
block = buf_page_create(space, ret_page, zip_size, mtr); block = buf_page_create(space, ret_page, zip_size, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_FSP_PAGE); buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
if (UNIV_UNLIKELY(block != buf_page_get(space, zip_size, if (UNIV_UNLIKELY(block != buf_page_get(space, zip_size,
ret_page, RW_X_LATCH, ret_page, RW_X_LATCH,
mtr))) { mtr))) {

View file

@ -94,6 +94,16 @@ static bool innodb_inited = 0;
#define INSIDE_HA_INNOBASE_CC #define INSIDE_HA_INNOBASE_CC
/* In the Windows plugin, the return value of current_thd is
undefined. Map it to NULL. */
#if defined MYSQL_DYNAMIC_PLUGIN && defined __WIN__
# undef current_thd
# define current_thd NULL
# define EQ_CURRENT_THD(thd) TRUE
#else /* MYSQL_DYNAMIC_PLUGIN && __WIN__ */
# define EQ_CURRENT_THD(thd) ((thd) == current_thd)
#endif /* MYSQL_DYNAMIC_PLUGIN && __WIN__ */
#ifdef MYSQL_DYNAMIC_PLUGIN #ifdef MYSQL_DYNAMIC_PLUGIN
/* These must be weak global variables in the dynamic plugin. */ /* These must be weak global variables in the dynamic plugin. */
struct handlerton* innodb_hton_ptr; struct handlerton* innodb_hton_ptr;
@ -652,6 +662,18 @@ thd_is_select(
return(thd_sql_command((const THD*) thd) == SQLCOM_SELECT); return(thd_sql_command((const THD*) thd) == SQLCOM_SELECT);
} }
/**********************************************************************
Returns true if the thread is executing in innodb_strict_mode. */
ibool
thd_is_strict(
/*==========*/
/* out: true if thd is in strict mode */
void* thd) /* in: thread handle (THD*) */
{
return(THDVAR((THD*) thd, strict_mode));
}
/************************************************************************ /************************************************************************
Obtain the InnoDB transaction of a MySQL thread. */ Obtain the InnoDB transaction of a MySQL thread. */
inline inline
@ -1076,7 +1098,7 @@ check_trx_exists(
{ {
trx_t*& trx = thd_to_trx(thd); trx_t*& trx = thd_to_trx(thd);
ut_ad(thd == current_thd); ut_ad(EQ_CURRENT_THD(thd));
if (trx == NULL) { if (trx == NULL) {
DBUG_ASSERT(thd != NULL); DBUG_ASSERT(thd != NULL);
@ -1169,7 +1191,7 @@ ha_innobase::update_thd()
/*=====================*/ /*=====================*/
{ {
THD* thd = ha_thd(); THD* thd = ha_thd();
ut_ad(thd == current_thd); ut_ad(EQ_CURRENT_THD(thd));
update_thd(thd); update_thd(thd);
} }
@ -2550,7 +2572,7 @@ ha_innobase::table_flags() const
{ {
/* Need to use tx_isolation here since table flags is (also) /* Need to use tx_isolation here since table flags is (also)
called before prebuilt is inited. */ called before prebuilt is inited. */
ulong const tx_isolation = thd_tx_isolation(current_thd); ulong const tx_isolation = thd_tx_isolation(ha_thd());
if (tx_isolation <= ISO_READ_COMMITTED) if (tx_isolation <= ISO_READ_COMMITTED)
return int_table_flags; return int_table_flags;
return int_table_flags | HA_BINLOG_STMT_CAPABLE; return int_table_flags | HA_BINLOG_STMT_CAPABLE;
@ -2905,7 +2927,7 @@ ha_innobase::close(void)
DBUG_ENTER("ha_innobase::close"); DBUG_ENTER("ha_innobase::close");
thd = current_thd; // avoid calling current_thd twice, it may be slow thd = ha_thd();
if (thd != NULL) { if (thd != NULL) {
innobase_release_temporary_latches(ht, thd); innobase_release_temporary_latches(ht, thd);
} }
@ -6155,7 +6177,6 @@ innobase_drop_database(
the database name is 'test' */ the database name is 'test' */
{ {
ulint len = 0; ulint len = 0;
trx_t* parent_trx;
trx_t* trx; trx_t* trx;
char* ptr; char* ptr;
int error; int error;
@ -6167,12 +6188,16 @@ innobase_drop_database(
DBUG_ASSERT(hton == innodb_hton_ptr); DBUG_ASSERT(hton == innodb_hton_ptr);
parent_trx = check_trx_exists(thd); /* In the Windows plugin, thd = current_thd is always NULL */
if (thd) {
trx_t* parent_trx = check_trx_exists(thd);
/* In case MySQL calls this in the middle of a SELECT query, release /* In case MySQL calls this in the middle of a SELECT
possible adaptive hash latch to avoid deadlocks of threads */ query, release possible adaptive hash latch to avoid
deadlocks of threads */
trx_search_latch_release_if_reserved(parent_trx); trx_search_latch_release_if_reserved(parent_trx);
}
ptr = strend(path) - 2; ptr = strend(path) - 2;
@ -6192,10 +6217,15 @@ innobase_drop_database(
#endif #endif
trx = trx_allocate_for_mysql(); trx = trx_allocate_for_mysql();
trx->mysql_thd = thd; trx->mysql_thd = thd;
trx->mysql_query_str = thd_query(thd); if (thd) {
trx->mysql_query_str = thd_query(thd);
if (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) { if (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) {
trx->check_foreigns = FALSE; trx->check_foreigns = FALSE;
}
} else {
/* In the Windows plugin, thd = current_thd is always NULL */
trx->mysql_query_str = NULL;
} }
error = row_drop_database_for_mysql(namebuf, trx); error = row_drop_database_for_mysql(namebuf, trx);
@ -7409,7 +7439,7 @@ ha_innobase::external_lock(
if (lock_type == F_WRLCK) if (lock_type == F_WRLCK)
{ {
ulong const binlog_format= thd_binlog_format(thd); ulong const binlog_format= thd_binlog_format(thd);
ulong const tx_isolation = thd_tx_isolation(current_thd); ulong const tx_isolation = thd_tx_isolation(ha_thd());
if (tx_isolation <= ISO_READ_COMMITTED && if (tx_isolation <= ISO_READ_COMMITTED &&
binlog_format == BINLOG_FORMAT_STMT) binlog_format == BINLOG_FORMAT_STMT)
{ {
@ -7978,7 +8008,7 @@ ha_innobase::store_lock(
} }
} }
DBUG_ASSERT(thd == current_thd); DBUG_ASSERT(EQ_CURRENT_THD(thd));
const bool in_lock_tables = thd_in_lock_tables(thd); const bool in_lock_tables = thd_in_lock_tables(thd);
const uint sql_command = thd_sql_command(thd); const uint sql_command = thd_sql_command(thd);

View file

@ -330,10 +330,7 @@ ibuf_header_page_get(
block = buf_page_get( block = buf_page_get(
IBUF_SPACE_ID, 0, FSP_IBUF_HEADER_PAGE_NO, RW_X_LATCH, mtr); IBUF_SPACE_ID, 0, FSP_IBUF_HEADER_PAGE_NO, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_IBUF_HEADER); buf_block_dbg_add_level(block, SYNC_IBUF_HEADER);
#endif /* UNIV_SYNC_DEBUG */
return(buf_block_get_frame(block)); return(buf_block_get_frame(block));
} }
@ -356,9 +353,7 @@ ibuf_tree_root_get(
block = buf_page_get( block = buf_page_get(
IBUF_SPACE_ID, 0, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH, mtr); IBUF_SPACE_ID, 0, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE); buf_block_dbg_add_level(block, SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */
return(buf_block_get_frame(block)); return(buf_block_get_frame(block));
} }
@ -435,6 +430,7 @@ ibuf_init_at_db_start(void)
dict_index_t* index; dict_index_t* index;
ulint n_used; ulint n_used;
page_t* header_page; page_t* header_page;
ulint error;
ibuf = mem_alloc(sizeof(ibuf_t)); ibuf = mem_alloc(sizeof(ibuf_t));
@ -476,10 +472,7 @@ ibuf_init_at_db_start(void)
block = buf_page_get( block = buf_page_get(
IBUF_SPACE_ID, 0, FSP_IBUF_TREE_ROOT_PAGE_NO, IBUF_SPACE_ID, 0, FSP_IBUF_TREE_ROOT_PAGE_NO,
RW_X_LATCH, &mtr); RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE); buf_block_dbg_add_level(block, SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */
root = buf_block_get_frame(block); root = buf_block_get_frame(block);
} }
@ -511,7 +504,9 @@ ibuf_init_at_db_start(void)
index->id = ut_dulint_add(DICT_IBUF_ID_MIN, IBUF_SPACE_ID); index->id = ut_dulint_add(DICT_IBUF_ID_MIN, IBUF_SPACE_ID);
dict_index_add_to_cache(table, index, FSP_IBUF_TREE_ROOT_PAGE_NO); error = dict_index_add_to_cache(table, index,
FSP_IBUF_TREE_ROOT_PAGE_NO, FALSE);
ut_a(error == DB_SUCCESS);
ibuf->index = dict_table_get_first_index(table); ibuf->index = dict_table_get_first_index(table);
} }
@ -730,9 +725,7 @@ ibuf_bitmap_get_map_page(
block = buf_page_get(space, zip_size, block = buf_page_get(space, zip_size,
ibuf_bitmap_page_no_calc(zip_size, page_no), ibuf_bitmap_page_no_calc(zip_size, page_no),
RW_X_LATCH, mtr); RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_IBUF_BITMAP); buf_block_dbg_add_level(block, SYNC_IBUF_BITMAP);
#endif /* UNIV_SYNC_DEBUG */
return(buf_block_get_frame(block)); return(buf_block_get_frame(block));
} }
@ -1953,9 +1946,8 @@ ibuf_add_free_page(void)
block = buf_page_get( block = buf_page_get(
IBUF_SPACE_ID, 0, page_no, RW_X_LATCH, &mtr); IBUF_SPACE_ID, 0, page_no, RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW); buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW);
#endif /* UNIV_SYNC_DEBUG */
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
} }
@ -2085,9 +2077,8 @@ ibuf_remove_free_page(void)
block = buf_page_get( block = buf_page_get(
IBUF_SPACE_ID, 0, page_no, RW_X_LATCH, &mtr); IBUF_SPACE_ID, 0, page_no, RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE); buf_block_dbg_add_level(block, SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
} }
@ -2600,9 +2591,8 @@ ibuf_get_volume_buffered(
block = buf_page_get( block = buf_page_get(
IBUF_SPACE_ID, 0, prev_page_no, RW_X_LATCH, mtr); IBUF_SPACE_ID, 0, prev_page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE); buf_block_dbg_add_level(block, SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */
prev_page = buf_block_get_frame(block); prev_page = buf_block_get_frame(block);
} }
@ -2675,9 +2665,8 @@ count_later:
block = buf_page_get( block = buf_page_get(
IBUF_SPACE_ID, 0, next_page_no, RW_X_LATCH, mtr); IBUF_SPACE_ID, 0, next_page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE); buf_block_dbg_add_level(block, SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */
next_page = buf_block_get_frame(block); next_page = buf_block_get_frame(block);
} }
@ -3775,9 +3764,7 @@ loop:
ut_a(success); ut_a(success);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE); buf_block_dbg_add_level(block, SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */
} }
/* Position pcur in the insert buffer at the first entry for this /* Position pcur in the insert buffer at the first entry for this

View file

@ -29,12 +29,12 @@ btr_block_get(
buf_block_t* block; buf_block_t* block;
block = buf_page_get(space, zip_size, page_no, mode, mtr); block = buf_page_get(space, zip_size, page_no, mode, mtr);
#ifdef UNIV_SYNC_DEBUG
if (mode != RW_NO_LATCH) { if (mode != RW_NO_LATCH) {
buf_block_dbg_add_level(block, SYNC_TREE_NODE); buf_block_dbg_add_level(block, SYNC_TREE_NODE);
} }
#endif
return(block); return(block);
} }

View file

@ -608,6 +608,8 @@ buf_block_dbg_add_level(
buf_block_t* block, /* in: buffer page buf_block_t* block, /* in: buffer page
where we have acquired latch */ where we have acquired latch */
ulint level); /* in: latching order level */ ulint level); /* in: latching order level */
#else /* UNIV_SYNC_DEBUG */
# define buf_block_dbg_add_level(block, level) /* nothing */
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
/************************************************************************* /*************************************************************************
Gets the state of a block. */ Gets the state of a block. */

View file

@ -716,7 +716,10 @@ dict_index_add_to_cache(
dict_table_t* table, /* in: table on which the index is */ dict_table_t* table, /* in: table on which the index is */
dict_index_t* index, /* in, own: index; NOTE! The index memory dict_index_t* index, /* in, own: index; NOTE! The index memory
object is freed in this function! */ object is freed in this function! */
ulint page_no);/* in: root page number of the index */ ulint page_no,/* in: root page number of the index */
ibool strict);/* in: TRUE=refuse to create the index
if records could be too big to fit in
an B-tree page */
/************************************************************************** /**************************************************************************
Removes an index from the dictionary cache. */ Removes an index from the dictionary cache. */
UNIV_INTERN UNIV_INTERN

View file

@ -33,9 +33,7 @@ fut_get_ptr(
block = buf_page_get(space, zip_size, addr.page, rw_latch, mtr); block = buf_page_get(space, zip_size, addr.page, rw_latch, mtr);
ptr = buf_block_get_frame(block) + addr.boffset; ptr = buf_block_get_frame(block) + addr.boffset;
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
return(ptr); return(ptr);
} }

View file

@ -206,5 +206,14 @@ innobase_get_charset(
/* out: connection character set */ /* out: connection character set */
void* mysql_thd); /* in: MySQL thread handle */ void* mysql_thd); /* in: MySQL thread handle */
/**********************************************************************
Returns true if the thread is executing in innodb_strict_mode. */
ibool
thd_is_strict(
/*==========*/
/* out: true if thd is in strict mode */
void* thd); /* in: thread handle (THD*) */
#endif #endif
#endif #endif

View file

@ -26,9 +26,8 @@ trx_rsegf_get(
trx_rsegf_t* header; trx_rsegf_t* header;
block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, mtr); block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_RSEG_HEADER); buf_block_dbg_add_level(block, SYNC_RSEG_HEADER);
#endif /* UNIV_SYNC_DEBUG */
header = TRX_RSEG + buf_block_get_frame(block); header = TRX_RSEG + buf_block_get_frame(block);
return(header); return(header);
@ -52,9 +51,8 @@ trx_rsegf_get_new(
trx_rsegf_t* header; trx_rsegf_t* header;
block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, mtr); block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_RSEG_HEADER_NEW); buf_block_dbg_add_level(block, SYNC_RSEG_HEADER_NEW);
#endif /* UNIV_SYNC_DEBUG */
header = TRX_RSEG + buf_block_get_frame(block); header = TRX_RSEG + buf_block_get_frame(block);
return(header); return(header);

View file

@ -100,9 +100,8 @@ trx_sysf_get(
block = buf_page_get(TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO, block = buf_page_get(TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO,
RW_X_LATCH, mtr); RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TRX_SYS_HEADER); buf_block_dbg_add_level(block, SYNC_TRX_SYS_HEADER);
#endif /* UNIV_SYNC_DEBUG */
header = TRX_SYS + buf_block_get_frame(block); header = TRX_SYS + buf_block_get_frame(block);
return(header); return(header);

View file

@ -406,6 +406,15 @@ trx_is_interrupted(
#define trx_is_interrupted(trx) FALSE #define trx_is_interrupted(trx) FALSE
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
/**************************************************************************
Determines if the currently running transaction is in innodb_strict_mode. */
UNIV_INTERN
ibool
trx_is_strict(
/*==========*/
/* out: TRUE if strict */
trx_t* trx); /* in: transaction */
/*********************************************************************** /***********************************************************************
Calculates the "weight" of a transaction. The weight of one transaction Calculates the "weight" of a transaction. The weight of one transaction
is estimated as the number of altered rows + the number of locked rows. is estimated as the number of altered rows + the number of locked rows.

View file

@ -135,9 +135,7 @@ trx_undo_page_get(
{ {
buf_block_t* block = buf_page_get(space, zip_size, page_no, buf_block_t* block = buf_page_get(space, zip_size, page_no,
RW_X_LATCH, mtr); RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE);
#endif /* UNIV_SYNC_DEBUG */
return(buf_block_get_frame(block)); return(buf_block_get_frame(block));
} }
@ -157,9 +155,7 @@ trx_undo_page_get_s_latched(
{ {
buf_block_t* block = buf_page_get(space, zip_size, page_no, buf_block_t* block = buf_page_get(space, zip_size, page_no,
RW_S_LATCH, mtr); RW_S_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE);
#endif /* UNIV_SYNC_DEBUG */
return(buf_block_get_frame(block)); return(buf_block_get_frame(block));
} }

View file

@ -4699,9 +4699,8 @@ lock_rec_validate_page(
block = buf_page_get(space, fil_space_get_zip_size(space), block = buf_page_get(space, fil_space_get_zip_size(space),
page_no, RW_X_LATCH, &mtr); page_no, RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
page = block->frame; page = block->frame;
lock_mutex_enter_kernel(); lock_mutex_enter_kernel();

View file

@ -1253,9 +1253,7 @@ recv_recover_page(
&mtr); &mtr);
ut_a(success); ut_a(success);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
} }
/* Read the newest modification lsn from the page */ /* Read the newest modification lsn from the page */
@ -1491,10 +1489,9 @@ loop:
block = buf_page_get( block = buf_page_get(
space, zip_size, page_no, space, zip_size, page_no,
RW_X_LATCH, &mtr); RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level( buf_block_dbg_add_level(
block, SYNC_NO_ORDER_CHECK); block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
recv_recover_page(FALSE, FALSE, block); recv_recover_page(FALSE, FALSE, block);
mtr_commit(&mtr); mtr_commit(&mtr);
} else { } else {

View file

@ -122,15 +122,29 @@ table_schema table_name row_format
test t1 Compressed test t1 Compressed
test t2 Compact test t2 Compact
drop table t1,t2; drop table t1,t2;
SET SESSION innodb_strict_mode = on;
CREATE TABLE t1( CREATE TABLE t1(
c TEXT NOT NULL, d TEXT NOT NULL, c TEXT NOT NULL, d TEXT NOT NULL,
PRIMARY KEY (c(767),d(767))) PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(
'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~(*,.02468:<>@BDFHJLNPRTVXZ\^`bdfhjlnprtvxz|~)+-/13579;=?ACEGIKMOQSUWY[]_acegikmoqsuwy{}(+.147:=@CFILORUX[^adgjmpsvy|(+.147:=@CFILORUX[^adgjmpsvy|(+.147:=@CFILORUX[^adgjmpsvy|(,048<@DHLPTX\`dhlptx|)-159=AEIMQUY]aeimquy}*.26:>BFJNRVZ^bfjnrvz~+/37;?CGKOSW[_cgkosw{(-27<AFKPUZ_dinsx}+05:?DINSX]bglqv{).38=BGLQV[`ejoty~,16;@EJOTY^chmrw|*/49>CHMRW\afkpuz(.4:@FLRX^djpv|+17=CIOU[agmsy(.4:@FLRX^djpv|+17=CIOU[agmsy(.4:@FLRX^djpv|+17=CIOU[agmsy(/6=DKRY`gnu|,3:AHOV]dkry)07>ELSZahov}-4;BIPW^elsz*18?FMT[bipw~.5<CJQX_fmt{+29@GNU\cjqx(08@HPX`hpx)19AIQYaiqy*2:BJRZbjrz+3;CKS[cks{,4<DLT\dlt|-5=EMU]emu}.6>FNV^fnv~/7?GOW_gow(1:CLU^gpy+4=FOXajs|.7@IR[dmv(1:CLU^gpy+4=FOXajs|.7@IR[dmv(1:CLU^gpy+4=',
'FOXajs|.7@IR[dmv(2<FPZdnx+5?IS]gq{.8BLV`jt~1;EOYcmw*4>HR\fpz-7AKU_is}0:DNXblv)3=GQ[eoy,6@JT^hr|/9CMWaku(3>IT_ju)4?JU`kv*5@KValw+6ALWbmx,7BMXcny-8CNYdoz.9DOZep{/:EP[fq|0;FQ\gr}1<GR]hs~2=HS^it(4@LXdp|1=IUamy.:FR^jv+7CO[gs(4@LXdp|1=IUamy.:FR^jv+7CO[gs(4@LXdp|1=IUamy.:FR^jv+7CO[gs(5BO\iv,9FS`mz0=JWdq~4AN[hu+8ER_ly/<IVcp}3@MZgt*7DQ^kx.;HUbo|2?LYfs)6CP]jw-:GTan{1>KXer(6DR`n|3AO]ky0>LZhv-;IWes*8FTbp~5CQ_m{2@N\jx/=KYgu,:HVdr)7ESao}4BP^lz1?M[iw.<JXft+9GUcq(7FUds+:IXgv.=L[jy1@O^m|4CRap(7FUds+:IXgv.=L[jy1@O^m|4CRap(7FUds+:IXgv.=L[jy1@O^m|4CRap(8HXhx1AQaq*:JZjz3CScs,<L\l|5EUeu.>N^n~7GWgw0@P`p)9IYiy2BRbr+;K[k{4DTdt-=M]m}6FVfv/?O_o(9J[l}7HYj{5FWhy3DUfw1BSdu/@Qbs->O`q+<M^o):K\m~8IZk|6GXiz4EVgx2CTev0ARct.?Par,=N_p*;L]n(:L^p+=Oas.@Rdv1CUgy4FXj|7I[m(:L^p+=Oas.@Rdv1CUgy4FXj|7');
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
CREATE TABLE t1(
c TEXT NOT NULL, d TEXT NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
CREATE TABLE t1(
c TEXT NOT NULL, d TEXT NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
drop table t1; drop table t1;
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(439)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
DROP TABLE t1;
create table t1( c1 int not null, c2 blob, c3 blob, c4 blob, create table t1( c1 int not null, c2 blob, c3 blob, c4 blob,
primary key(c1, c2(22), c3(22))) primary key(c1, c2(22), c3(22)))
engine = innodb row_format = dynamic; engine = innodb row_format = dynamic;

View file

@ -84,20 +84,29 @@ SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb'; FROM information_schema.tables WHERE engine='innodb';
drop table t1,t2; drop table t1,t2;
# data generated with SET SESSION innodb_strict_mode = on;
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1( CREATE TABLE t1(
c TEXT NOT NULL, d TEXT NOT NULL, c TEXT NOT NULL, d TEXT NOT NULL,
PRIMARY KEY (c(767),d(767))) PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
# random data generated with
# perl -e 'my $i,$j,$k;for($j=1;$j<19;$j++){for($i=$k=0;$k<87;$k++,$i+=$j,$i%=87){printf "%c",$i+40}}'
# truncated to 2*767 bytes and split to two 767-byte columns
--error ER_TOO_BIG_ROWSIZE --error ER_TOO_BIG_ROWSIZE
INSERT INTO t1 VALUES( CREATE TABLE t1(
'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~(*,.02468:<>@BDFHJLNPRTVXZ\^`bdfhjlnprtvxz|~)+-/13579;=?ACEGIKMOQSUWY[]_acegikmoqsuwy{}(+.147:=@CFILORUX[^adgjmpsvy|(+.147:=@CFILORUX[^adgjmpsvy|(+.147:=@CFILORUX[^adgjmpsvy|(,048<@DHLPTX\`dhlptx|)-159=AEIMQUY]aeimquy}*.26:>BFJNRVZ^bfjnrvz~+/37;?CGKOSW[_cgkosw{(-27<AFKPUZ_dinsx}+05:?DINSX]bglqv{).38=BGLQV[`ejoty~,16;@EJOTY^chmrw|*/49>CHMRW\afkpuz(.4:@FLRX^djpv|+17=CIOU[agmsy(.4:@FLRX^djpv|+17=CIOU[agmsy(.4:@FLRX^djpv|+17=CIOU[agmsy(/6=DKRY`gnu|,3:AHOV]dkry)07>ELSZahov}-4;BIPW^elsz*18?FMT[bipw~.5<CJQX_fmt{+29@GNU\cjqx(08@HPX`hpx)19AIQYaiqy*2:BJRZbjrz+3;CKS[cks{,4<DLT\dlt|-5=EMU]emu}.6>FNV^fnv~/7?GOW_gow(1:CLU^gpy+4=FOXajs|.7@IR[dmv(1:CLU^gpy+4=FOXajs|.7@IR[dmv(1:CLU^gpy+4=', c TEXT NOT NULL, d TEXT NOT NULL,
'FOXajs|.7@IR[dmv(2<FPZdnx+5?IS]gq{.8BLV`jt~1;EOYcmw*4>HR\fpz-7AKU_is}0:DNXblv)3=GQ[eoy,6@JT^hr|/9CMWaku(3>IT_ju)4?JU`kv*5@KValw+6ALWbmx,7BMXcny-8CNYdoz.9DOZep{/:EP[fq|0;FQ\gr}1<GR]hs~2=HS^it(4@LXdp|1=IUamy.:FR^jv+7CO[gs(4@LXdp|1=IUamy.:FR^jv+7CO[gs(4@LXdp|1=IUamy.:FR^jv+7CO[gs(5BO\iv,9FS`mz0=JWdq~4AN[hu+8ER_ly/<IVcp}3@MZgt*7DQ^kx.;HUbo|2?LYfs)6CP]jw-:GTan{1>KXer(6DR`n|3AO]ky0>LZhv-;IWes*8FTbp~5CQ_m{2@N\jx/=KYgu,:HVdr)7ESao}4BP^lz1?M[iw.<JXft+9GUcq(7FUds+:IXgv.=L[jy1@O^m|4CRap(7FUds+:IXgv.=L[jy1@O^m|4CRap(7FUds+:IXgv.=L[jy1@O^m|4CRap(8HXhx1AQaq*:JZjz3CScs,<L\l|5EUeu.>N^n~7GWgw0@P`p)9IYiy2BRbr+;K[k{4DTdt-=M]m}6FVfv/?O_o(9J[l}7HYj{5FWhy3DUfw1BSdu/@Qbs->O`q+<M^o):K\m~8IZk|6GXiz4EVgx2CTev0ARct.?Par,=N_p*;L]n(:L^p+=Oas.@Rdv1CUgy4FXj|7I[m(:L^p+=Oas.@Rdv1CUgy4FXj|7'); PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
CREATE TABLE t1(
c TEXT NOT NULL, d TEXT NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
drop table t1; drop table t1;
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(439)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
DROP TABLE t1;
# #
# Test blob column inheritance (mantis issue#36) # Test blob column inheritance (mantis issue#36)

View file

@ -3177,6 +3177,7 @@ t1 CREATE TABLE `t1` (
CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`) CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1 ) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
set innodb_strict_mode=on;
CREATE TABLE t1 ( CREATE TABLE t1 (
c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255), c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255),
c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255), c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255),

View file

@ -2343,6 +2343,7 @@ DROP TABLE t1,t2;
# #
# Bug #21101 (Prints wrong error message if max row size is too large) # Bug #21101 (Prints wrong error message if max row size is too large)
# #
set innodb_strict_mode=on;
--error 1118 --error 1118
CREATE TABLE t1 ( CREATE TABLE t1 (
c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255), c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255),

View file

@ -186,7 +186,9 @@ os_mem_free_large(
} }
#endif /* HAVE_LARGE_PAGES && UNIV_LINUX */ #endif /* HAVE_LARGE_PAGES && UNIV_LINUX */
#ifdef __WIN__ #ifdef __WIN__
if (!VirtualFree(ptr, size, MEM_DECOMMIT | MEM_RELEASE)) { /* When RELEASE memory, the size parameter must be 0.
Do not use MEM_RELEASE with MEM_DECOMMIT. */
if (!VirtualFree(ptr, 0, MEM_RELEASE)) {
fprintf(stderr, "InnoDB: VirtualFree(%p, %lu) failed;" fprintf(stderr, "InnoDB: VirtualFree(%p, %lu) failed;"
" Windows error %lu\n", " Windows error %lu\n",
ptr, (ulong) size, (ulong) GetLastError()); ptr, (ulong) size, (ulong) GetLastError());

View file

@ -559,9 +559,8 @@ skip_secondaries:
that the space id of the undo log record is 0! */ that the space id of the undo log record is 0! */
block = buf_page_get(0, 0, page_no, RW_X_LATCH, &mtr); block = buf_page_get(0, 0, page_no, RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE);
#endif /* UNIV_SYNC_DEBUG */
data_field = buf_block_get_frame(block) data_field = buf_block_get_frame(block)
+ offset + internal_offset; + offset + internal_offset;

View file

@ -1231,9 +1231,8 @@ trx_undo_report_row_operation(
page_no, RW_X_LATCH, page_no, RW_X_LATCH,
undo->guess_block, BUF_GET, undo->guess_block, BUF_GET,
__FILE__, __LINE__, &mtr); __FILE__, __LINE__, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(undo_block, SYNC_TRX_UNDO_PAGE); buf_block_dbg_add_level(undo_block, SYNC_TRX_UNDO_PAGE);
#endif /* UNIV_SYNC_DEBUG */
undo_page = buf_block_get_frame(undo_block); undo_page = buf_block_get_frame(undo_block);
if (op_type == TRX_UNDO_INSERT_OP) { if (op_type == TRX_UNDO_INSERT_OP) {

View file

@ -84,9 +84,7 @@ trx_rseg_header_create(
return(FIL_NULL); return(FIL_NULL);
} }
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_RSEG_HEADER_NEW); buf_block_dbg_add_level(block, SYNC_RSEG_HEADER_NEW);
#endif /* UNIV_SYNC_DEBUG */
page_no = buf_block_get_page_no(block); page_no = buf_block_get_page_no(block);

View file

@ -187,9 +187,7 @@ trx_sys_mark_upgraded_to_multiple_tablespaces(void)
block = buf_page_get(TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO, block = buf_page_get(TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO,
RW_X_LATCH, &mtr); RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
doublewrite = buf_block_get_frame(block) + TRX_SYS_DOUBLEWRITE; doublewrite = buf_block_get_frame(block) + TRX_SYS_DOUBLEWRITE;
@ -233,9 +231,7 @@ start_again:
block = buf_page_get(TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO, block = buf_page_get(TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO,
RW_X_LATCH, &mtr); RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
doublewrite = buf_block_get_frame(block) + TRX_SYS_DOUBLEWRITE; doublewrite = buf_block_get_frame(block) + TRX_SYS_DOUBLEWRITE;
@ -272,9 +268,7 @@ start_again:
/* fseg_create acquires a second latch on the page, /* fseg_create acquires a second latch on the page,
therefore we must declare it: */ therefore we must declare it: */
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block2, SYNC_NO_ORDER_CHECK); buf_block_dbg_add_level(block2, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
if (block2 == NULL) { if (block2 == NULL) {
fprintf(stderr, fprintf(stderr,
@ -321,10 +315,8 @@ start_again:
new_block = buf_page_get(TRX_SYS_SPACE, 0, page_no, new_block = buf_page_get(TRX_SYS_SPACE, 0, page_no,
RW_X_LATCH, &mtr); RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(new_block, buf_block_dbg_add_level(new_block,
SYNC_NO_ORDER_CHECK); SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
/* Make a dummy change to the page to ensure it will /* Make a dummy change to the page to ensure it will
be written to disk in a flush */ be written to disk in a flush */
@ -902,9 +894,8 @@ trx_sysf_create(
/* Create the trx sys file block in a new allocated file segment */ /* Create the trx sys file block in a new allocated file segment */
block = fseg_create(TRX_SYS_SPACE, 0, TRX_SYS + TRX_SYS_FSEG_HEADER, block = fseg_create(TRX_SYS_SPACE, 0, TRX_SYS + TRX_SYS_FSEG_HEADER,
mtr); mtr);
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TRX_SYS_HEADER); buf_block_dbg_add_level(block, SYNC_TRX_SYS_HEADER);
#endif /* UNIV_SYNC_DEBUG */
ut_a(buf_block_get_page_no(block) == TRX_SYS_PAGE_NO); ut_a(buf_block_get_page_no(block) == TRX_SYS_PAGE_NO);
page = buf_block_get_frame(block); page = buf_block_get_frame(block);

View file

@ -34,6 +34,22 @@ UNIV_INTERN sess_t* trx_dummy_sess = NULL;
the kernel mutex */ the kernel mutex */
UNIV_INTERN ulint trx_n_mysql_transactions = 0; UNIV_INTERN ulint trx_n_mysql_transactions = 0;
/**************************************************************************
Determines if the currently running transaction is in innodb_strict_mode. */
UNIV_INTERN
ibool
trx_is_strict(
/*==========*/
/* out: TRUE if strict */
trx_t* trx) /* in: transaction */
{
#ifndef UNIV_HOTBACKUP
return(trx && trx->mysql_thd && thd_is_strict(trx->mysql_thd));
#else /* UNIV_HOTBACKUP */
return(FALSE);
#endif /* UNIV_HOTBACKUP */
}
/***************************************************************** /*****************************************************************
Set detailed error message for the transaction. */ Set detailed error message for the transaction. */
UNIV_INTERN UNIV_INTERN

View file

@ -457,9 +457,8 @@ trx_undo_seg_create(
return(DB_OUT_OF_FILE_SPACE); return(DB_OUT_OF_FILE_SPACE);
} }
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE);
#endif /* UNIV_SYNC_DEBUG */
*undo_page = buf_block_get_frame(block); *undo_page = buf_block_get_frame(block);
page_hdr = *undo_page + TRX_UNDO_PAGE_HDR; page_hdr = *undo_page + TRX_UNDO_PAGE_HDR;