Commit 0a70eb33 authored by Michael Widenius's avatar Michael Widenius

Fixed test failures (part of merge)

parent 1d0f70c2
......@@ -44,7 +44,6 @@ loose-innodb_write_io_threads= 2
loose-innodb_read_io_threads= 2
loose-innodb_log_buffer_size= 1M
loose-innodb_log_file_size= 5M
loose-innodb_additional_mem_pool_size= 1M
loose-innodb_log_files_in_group= 2
slave-net-timeout=120
......
......@@ -366,7 +366,7 @@ c1
310
400
1000
1010
1110
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
......@@ -648,7 +648,7 @@ t2 CREATE TABLE `t2` (
`n` int(10) unsigned NOT NULL,
`o` enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (`m`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
SHOW CREATE TABLE t1;
Table Create Table
......
......@@ -1598,7 +1598,7 @@ concat(a, b)
drop table t1;
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
ERROR HY000: The used table type doesn't support FULLTEXT indexes
ERROR HY000: The table does not have FULLTEXT index to support this query
DROP TABLE t1;
CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES (1),(2),(3);
......
SET DEBUG_SYNC='reset';
create table t1 (f1 integer, key k1 (f1)) engine=innodb;
create table t2 (f1 int, f2 int, key(f1), key(f2)) engine=innodb;
create table t3 (f2 int, key(f2)) engine=innodb;
insert into t1 values (10);
insert into t2 values (10, 20);
insert into t3 values (20);
alter table t2 add constraint c1 foreign key (f1)
references t1(f1) on update cascade;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
KEY `k1` (`f1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`f1` int(11) DEFAULT NULL,
`f2` int(11) DEFAULT NULL,
KEY `f1` (`f1`),
KEY `f2` (`f2`),
CONSTRAINT `c1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`f2` int(11) DEFAULT NULL,
KEY `f2` (`f2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SET DEBUG_SYNC='innodb_rename_table_ready SIGNAL update_can_proceed
WAIT_FOR dict_unfreeze';
alter table t2 add constraint z1 foreign key (f2)
references t3(f2) on update cascade;
SET DEBUG_SYNC='innodb_row_update_for_mysql_begin
WAIT_FOR update_can_proceed';
SET DEBUG_SYNC='innodb_dml_cascade_dict_unfreeze SIGNAL dict_unfreeze
WAIT_FOR foreign_free_cache';
update ignore t1 set f1 = 20;
ERROR HY000: Error on rename of './test/t2' to '#sql2-temporary' (errno: 182 "Table is being used in foreign key check")
SET DEBUG_SYNC='now SIGNAL foreign_free_cache';
drop table t2;
drop table t1;
drop table t3;
SET DEBUG_SYNC='reset';
......@@ -39,18 +39,17 @@ update t1 set f2 = 6 where f1 = 1 and f2 is null;
(a) Number of rows updated:
select row_count();
row_count()
1
0
(a) After the update statement is executed.
select rowid, f1, f2 from t1;
rowid f1 f2
1 1 10
2 1 NULL
3 1 6
commit;
"The trx with consistent snapshot ended."
select rowid, f1, f2 from t1;
rowid f1 f2
1 1 10
2 1 4
3 1 6
3 1 NULL
drop table t1;
......@@ -44,6 +44,8 @@ trx_foreign_key_checks int(1) NO 0
trx_last_foreign_key_error varchar(256) YES NULL
trx_adaptive_hash_latched int(1) NO 0
trx_adaptive_hash_timeout bigint(21) unsigned NO 0
trx_is_read_only int(1) NO 0
trx_autocommit_non_locking int(1) NO 0
trx_state trx_weight trx_tables_in_use trx_tables_locked trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks trx_foreign_key_checks
RUNNING 4 0 0 7 1 0 REPEATABLE READ 1 1
trx_isolation_level trx_unique_checks trx_foreign_key_checks
......
......@@ -1259,7 +1259,7 @@ drop table t1;
#
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
--error 1214
--error 1765
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
DROP TABLE t1;
......
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--source include/not_embedded.inc
SET DEBUG_SYNC='reset';
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
create table t1 (f1 integer, key k1 (f1)) engine=innodb;
create table t2 (f1 int, f2 int, key(f1), key(f2)) engine=innodb;
create table t3 (f2 int, key(f2)) engine=innodb;
insert into t1 values (10);
insert into t2 values (10, 20);
insert into t3 values (20);
alter table t2 add constraint c1 foreign key (f1)
references t1(f1) on update cascade;
show create table t1;
show create table t2;
show create table t3;
SET DEBUG_SYNC='innodb_rename_table_ready SIGNAL update_can_proceed
WAIT_FOR dict_unfreeze';
--send
alter table t2 add constraint z1 foreign key (f2)
references t3(f2) on update cascade;
connect (thr2,localhost,root,,);
connection thr2;
SET DEBUG_SYNC='innodb_row_update_for_mysql_begin
WAIT_FOR update_can_proceed';
SET DEBUG_SYNC='innodb_dml_cascade_dict_unfreeze SIGNAL dict_unfreeze
WAIT_FOR foreign_free_cache';
--send
update ignore t1 set f1 = 20;
connection default;
--replace_regex /'[^']*test\/#sql2-[0-9a-f-]*'/'#sql2-temporary'/
--error ER_ERROR_ON_RENAME
reap;
SET DEBUG_SYNC='now SIGNAL foreign_free_cache';
connection thr2;
reap;
disconnect thr2;
--source include/wait_until_disconnected.inc
connection default;
drop table t2;
drop table t1;
drop table t3;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
SET DEBUG_SYNC='reset';
......@@ -21,8 +21,11 @@ FLUSH PRIVILEGES;
-- connection con1
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
# this should only fail with UNIV_MEM_DEBUG
CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB;
DROP TABLE innodb_mem_validate;
CREATE TABLE innodb_sql (a INT) ENGINE=INNODB;
DROP TABLE innodb_sql;
CREATE TABLE innodb_monitorx (a INT) ENGINE=INNODB;
DROP TABLE innodb_monitorx;
CREATE TABLE innodb_monito (a INT) ENGINE=INNODB;
......@@ -39,12 +42,10 @@ CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB;
-- connection con1
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
DROP TABLE innodb_monitor;
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
DROP TABLE innodb_mem_validate;
-- connection default
DROP TABLE innodb_monitor;
DROP TABLE innodb_mem_validate;
DROP USER 'shane'@'localhost';
-- disconnect con1
......@@ -10272,8 +10272,14 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
table->s->reclength) == 0);
*/
int error;
DBUG_PRINT("info",("locating record using primary key (position)"));
int error= table->file->ha_rnd_pos_by_record(table->record[0]);
if (!table->file->inited &&
(error= table->file->ha_rnd_init_with_error(0)))
DBUG_RETURN(error);
error= table->file->ha_rnd_pos_by_record(table->record[0]);
if (error)
{
DBUG_PRINT("info",("rnd_pos returns error %d",error));
......
......@@ -1831,7 +1831,8 @@ innobase_next_autoinc(
ulonglong current, /*!< in: Current value */
ulonglong increment, /*!< in: increment current by */
ulonglong offset, /*!< in: AUTOINC offset */
ulonglong max_value) /*!< in: max value for type */
ulonglong max_value, /*!< in: max value for type */
ulonglong reserve) /*!< in: how many values to reserve */
{
ulonglong next_value;
......@@ -1840,51 +1841,16 @@ innobase_next_autoinc(
/* According to MySQL documentation, if the offset is greater than
the increment then the offset is ignored. */
if (offset > increment) {
if (offset >= increment)
offset = 0;
}
if (max_value <= current) {
next_value = max_value;
} else if (offset <= 1) {
/* Offset 0 and 1 are the same, because there must be at
least one node in the system. */
if (max_value - current <= increment) {
next_value = max_value;
} else {
next_value = current + increment;
}
} else if (max_value > current) {
if (current > offset) {
next_value = ((current - offset) / increment) + 1;
} else {
next_value = ((offset - current) / increment) + 1;
}
ut_a(increment > 0);
ut_a(next_value > 0);
/* Check for multiplication overflow. */
if (increment > (max_value / next_value)) {
next_value = max_value;
} else {
next_value *= increment;
ut_a(max_value >= next_value);
/* Check for overflow. */
if (max_value - next_value <= offset) {
next_value = max_value;
} else {
next_value += offset;
}
}
} else {
next_value = max_value;
}
ut_a(next_value <= max_value);
if (max_value <= current)
return max_value;
next_value = (current / increment) + reserve;
next_value = next_value * increment + offset;
/* Check for overflow. */
if (next_value < current || next_value > max_value)
next_value = max_value;
return(next_value);
}
......@@ -2039,7 +2005,7 @@ ha_innobase::ha_innobase(
TABLE_SHARE* table_arg)
:handler(hton, table_arg),
int_table_flags(HA_REC_NOT_IN_SEQ |
HA_NULL_IN_KEY |
HA_NULL_IN_KEY | HA_CAN_VIRTUAL_COLUMNS |
HA_CAN_INDEX_BLOBS |
HA_CAN_SQL_HANDLER |
HA_PRIMARY_KEY_REQUIRED_FOR_POSITION |
......@@ -4324,8 +4290,7 @@ ha_innobase::innobase_initialize_autoinc()
nor the offset, so use a default increment of 1. */
auto_inc = innobase_next_autoinc(
read_auto_inc, 1, 1, col_max_value);
read_auto_inc, 1, 1, col_max_value, 1);
break;
}
case DB_RECORD_NOT_FOUND:
......@@ -6329,7 +6294,7 @@ set_max_autoinc:
auto_inc = innobase_next_autoinc(
auto_inc,
need, offset, col_max_value);
need, offset, col_max_value, 1);
err = innobase_set_max_autoinc(
auto_inc);
......@@ -6743,7 +6708,7 @@ ha_innobase::update_row(
need = prebuilt->autoinc_increment;
auto_inc = innobase_next_autoinc(
auto_inc, need, offset, col_max_value);
auto_inc, need, offset, col_max_value, 1);
error = innobase_set_max_autoinc(auto_inc);
}
......@@ -7063,6 +7028,11 @@ ha_innobase::index_read(
index = prebuilt->index;
if (UNIV_UNLIKELY(index == NULL) || dict_index_is_corrupted(index)) {
DBUG_PRINT("error", ("index: %p index_corrupt: %d data_corrupt: %d",
index,
index ? test(index->type & DICT_CORRUPT) : 0,
(index && index->table ?
test(index->table->corrupted) : 0)));
prebuilt->index_usable = FALSE;
DBUG_RETURN(HA_ERR_CRASHED);
}
......@@ -12249,16 +12219,14 @@ ha_innobase::get_auto_increment(
/* With old style AUTOINC locking we only update the table's
AUTOINC counter after attempting to insert the row. */
if (innobase_autoinc_lock_mode != AUTOINC_OLD_STYLE_LOCKING) {
ulonglong need;
ulonglong current;
ulonglong next_value;
current = *first_value > col_max_value ? autoinc : *first_value;
need = *nb_reserved_values * increment;
/* Compute the last value in the interval */
next_value = innobase_next_autoinc(
current, need, offset, col_max_value);
current, increment, offset, col_max_value, *nb_reserved_values);
prebuilt->autoinc_last_value = next_value;
......@@ -15333,6 +15301,11 @@ ha_innobase::multi_range_read_info(
flags, cost));
}
int ha_innobase::multi_range_read_explain_info(uint mrr_mode, char *str, size_t size)
{
return ds_mrr.dsmrr_explain_info(mrr_mode, str, size);
}
/**
* Index Condition Pushdown interface implementation
......@@ -15347,20 +15320,7 @@ innobase_index_cond(
/*================*/
void* file) /*!< in/out: pointer to ha_innobase */
{
DBUG_ENTER("innobase_index_cond");
ha_innobase* h = reinterpret_cast<class ha_innobase*>(file);
DBUG_ASSERT(h->pushed_idx_cond);
DBUG_ASSERT(h->pushed_idx_cond_keyno != MAX_KEY);
if (h->end_range && h->compare_key2(h->end_range) > 0) {
/* caller should return HA_ERR_END_OF_FILE already */
DBUG_RETURN(ICP_OUT_OF_RANGE);
}
DBUG_RETURN(h->pushed_idx_cond->val_int() ? ICP_MATCH : ICP_NO_MATCH);
return handler_index_cond_check(file);
}
/** Attempt to push down an index condition.
......
......@@ -288,6 +288,9 @@ public:
uint* bufsz, uint* mrr_mode,
Cost_estimate* cost);
int multi_range_read_explain_info(uint mrr_mode,
char *str, size_t size);
/** Attempt to push down an index condition.
* @param[in] keyno MySQL key number
* @param[in] idx_cond Index condition to be checked
......
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