Commit c25e0221 authored by marko's avatar marko

branches/innodb+: Merge revisions 2799:2835 from branches/zip:

  ------------------------------------------------------------------------
  r2809 | marko | 2008-10-16 09:41:13 +0300 (Thu, 16 Oct 2008) | 18 lines

  branches/zip: Skip the undo log size check on REDUNDANT and COMPACT tables.

  In ROW_FORMAT=DYNAMIC and ROW_FORMAT=COMPRESSED, column prefix indexes
  require that prefixes of externally stored columns be written to the
  undo log. This may make the undo log record bigger than the record on
  the B-tree page.  The maximum size of an undo log record is the page
  size.  That must be checked for, in dict_index_add_to_cache().

  dict_index_add_to_cache(): Skip the undo log size check for REDUNDANT
  and COMPACT tables. These tables store prefixes of externally stored
  columns locally within the clustered index record.  There are no special
  considerations for the undo log record size.

  innodb-index.test: Ensure that the check exists for ROW_FORMAT=DYNAMIC,
  but not for ROW_FORMAT=COMPACT.

  This fixes issue #99.  rb://28 approved by Sunny.
  ------------------------------------------------------------------------
  r2810 | vasil | 2008-10-16 19:57:58 +0300 (Thu, 16 Oct 2008) | 12 lines

  branches/zip:

  Fix Mantis issue#61:

  In row_undo_ins_parse_undo_rec(): if we find that a table has no indexes
  (dict_table_get_first_index() returns NULL) do not try to call
  trx_undo_rec_get_row_ref() with a NULL pointer because that would lead to
  a crash. Instead, print a warning and set node->table to NULL just like
  it is done if the .ibd file is missing.

  Approved by:    Heikki (via IM)
  ------------------------------------------------------------------------
  r2824 | marko | 2008-10-20 09:58:01 +0300 (Mon, 20 Oct 2008) | 2 lines

  branches/zip: rec_convert_dtuple_to_rec_comp(): Relax a too tight assertion.
  Spotted by Sunny.
  ------------------------------------------------------------------------
  r2825 | vasil | 2008-10-20 13:41:04 +0300 (Mon, 20 Oct 2008) | 6 lines

  branches/zip:

  Print the table name via ut_print_name() and add two spaces before InnoDB.

  Suggested by:   Marko
  ------------------------------------------------------------------------
  r2833 | marko | 2008-10-21 10:16:45 +0300 (Tue, 21 Oct 2008) | 2 lines

  branches/zip: ibuf_insert_low(): Avoid unnecessarily
  acquiring and releasing ibuf_mutex.
  ------------------------------------------------------------------------
  r2834 | marko | 2008-10-21 10:18:57 +0300 (Tue, 21 Oct 2008) | 1 line

  branches/zip: ibuf_delete_rec(): Add debug assertions suggested by Heikki.
  ------------------------------------------------------------------------
  r2835 | marko | 2008-10-21 11:04:06 +0300 (Tue, 21 Oct 2008) | 1 line

  branches/zip: ibuf_insert_low(): Simplify a comparison.
  ------------------------------------------------------------------------
parent cfa731c8
......@@ -1461,6 +1461,29 @@ dict_index_add_to_cache(
n_ord = new_index->n_uniq;
}
switch (dict_table_get_format(table)) {
case DICT_TF_FORMAT_51:
/* ROW_FORMAT=REDUNDANT and ROW_FORMAT=COMPACT store
prefixes of externally stored columns locally within
the record. There are no special considerations for
the undo log record size. */
goto undo_size_ok;
case DICT_TF_FORMAT_ZIP:
/* In ROW_FORMAT=DYNAMIC and ROW_FORMAT=COMPRESSED,
column prefix indexes require that prefixes of
externally stored columns are written to the undo log.
This may make the undo log record bigger than the
record on the B-tree page. The maximum size of an
undo log record is the page size. That must be
checked for below. */
break;
#if DICT_TF_FORMAT_ZIP != DICT_TF_FORMAT_MAX
# error "DICT_TF_FORMAT_ZIP != DICT_TF_FORMAT_MAX"
#endif
}
for (i = 0; i < n_ord; i++) {
const dict_field_t* field
= dict_index_get_nth_field(new_index, i);
......@@ -1494,6 +1517,7 @@ dict_index_add_to_cache(
}
}
undo_size_ok:
/* Flag the ordering columns */
for (i = 0; i < n_ord; i++) {
......
......@@ -3217,17 +3217,17 @@ ibuf_insert_low(
mem_heap_free(heap);
if (err == DB_SUCCESS) {
mutex_enter(&ibuf_mutex);
if (err == DB_SUCCESS) {
ibuf->empty = FALSE;
}
mutex_exit(&ibuf_mutex);
if ((mode == BTR_MODIFY_TREE) && (err == DB_SUCCESS)) {
if (mode == BTR_MODIFY_TREE) {
ibuf_contract_after_insert(entry_size);
}
}
if (do_merge) {
#ifdef UNIV_IBUF_DEBUG
......@@ -3553,6 +3553,9 @@ ibuf_delete_rec(
ulint err;
ut_ad(ibuf_inside());
ut_ad(page_rec_is_user_rec(btr_pcur_get_rec(pcur)));
ut_ad(ibuf_rec_get_page_no(btr_pcur_get_rec(pcur)) == page_no);
ut_ad(ibuf_rec_get_space(btr_pcur_get_rec(pcur)) == space);
success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr);
......@@ -3568,6 +3571,10 @@ ibuf_delete_rec(
return(FALSE);
}
ut_ad(page_rec_is_user_rec(btr_pcur_get_rec(pcur)));
ut_ad(ibuf_rec_get_page_no(btr_pcur_get_rec(pcur)) == page_no);
ut_ad(ibuf_rec_get_space(btr_pcur_get_rec(pcur)) == space);
/* We have to resort to a pessimistic delete from ibuf */
btr_pcur_store_position(pcur, mtr);
......
......@@ -886,10 +886,12 @@ a
44
commit;
drop table t1;
set global innodb_file_per_table=on;
set global innodb_file_format='Barracuda';
create table t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob,
q blob,r blob,s blob,t blob,u blob)
engine=innodb;
engine=innodb row_format=dynamic;
create index t1a on t1 (a(1));
create index t1b on t1 (b(1));
create index t1c on t1 (c(1));
......@@ -960,8 +962,14 @@ t1 CREATE TABLE `t1` (
KEY `t1s` (`s`(1)),
KEY `t1t` (`t`(1)),
KEY `t1st` (`s`(1),`t`(1))
) ENGINE=InnoDB DEFAULT CHARSET=latin1
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
create index t1u on t1 (u(1));
ERROR HY000: Too big row
alter table t1 row_format=compact;
create index t1u on t1 (u(1));
drop table t1;
set global innodb_file_per_table=0;
set global innodb_file_format=Antelope;
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
CREATE TABLE t1(
......
......@@ -354,6 +354,10 @@ disconnect b;
drop table t1;
let $per_table=`select @@innodb_file_per_table`;
let $format=`select @@innodb_file_format`;
set global innodb_file_per_table=on;
set global innodb_file_format='Barracuda';
# Test creating a table that could lead to undo log overflow.
# In the undo log, we write a 768-byte prefix (REC_MAX_INDEX_COL_LEN)
# of each externally stored column that appears as a column prefix in an index.
......@@ -361,7 +365,7 @@ drop table t1;
create table t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob,
q blob,r blob,s blob,t blob,u blob)
engine=innodb;
engine=innodb row_format=dynamic;
create index t1a on t1 (a(1));
create index t1b on t1 (b(1));
create index t1c on t1 (c(1));
......@@ -388,7 +392,14 @@ create index t1u on t1 (u(1));
create index t1ut on t1 (u(1), t(1));
create index t1st on t1 (s(1), t(1));
show create table t1;
--error 139
create index t1u on t1 (u(1));
alter table t1 row_format=compact;
create index t1u on t1 (u(1));
drop table t1;
eval set global innodb_file_per_table=$per_table;
eval set global innodb_file_format=$format;
#
# Test to check whether CREATE INDEX handles implicit foreign key
......
......@@ -1048,7 +1048,8 @@ rec_convert_dtuple_to_rec_comp(
ulint n_node_ptr_field;
ulint fixed_len;
ulint null_mask = 1;
ut_ad(dict_table_is_comp(index->table));
ut_ad(extra == 0 || dict_table_is_comp(index->table));
ut_ad(extra == 0 || extra == REC_N_NEW_EXTRA_BYTES);
ut_ad(n_fields > 0);
switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) {
......
......@@ -231,7 +231,7 @@ static
void
row_undo_ins_parse_undo_rec(
/*========================*/
undo_node_t* node) /* in: row undo node */
undo_node_t* node) /* in/out: row undo node */
{
dict_index_t* clust_index;
byte* ptr;
......@@ -258,8 +258,19 @@ row_undo_ins_parse_undo_rec(
} else {
clust_index = dict_table_get_first_index(node->table);
if (clust_index != NULL) {
ptr = trx_undo_rec_get_row_ref(
ptr, clust_index, &node->ref, node->heap);
} else {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: table ");
ut_print_name(stderr, node->trx, TRUE,
node->table->name);
fprintf(stderr, " has no indexes, "
"ignoring the table\n");
node->table = NULL;
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment