Commit 27d45e46 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-5574 Set AUTO_INCREMENT below max value of column.

Update InnoDB to 5.6.14
Apply MySQL-5.6 hack for MySQL Bug#16434374
Move Aria-only HA_RTREE_INDEX from my_base.h to maria_def.h (breaks an assert in InnoDB)
Fix InnoDB memory leak
parent 27fbb637
...@@ -264,13 +264,11 @@ enum ha_base_keytype { ...@@ -264,13 +264,11 @@ enum ha_base_keytype {
#define HA_SPATIAL 1024 /* For spatial search */ #define HA_SPATIAL 1024 /* For spatial search */
#define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */ #define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */
#define HA_GENERATED_KEY 8192 /* Automaticly generated key */ #define HA_GENERATED_KEY 8192 /* Automaticly generated key */
#define HA_RTREE_INDEX 16384 /* For RTREE search */
/* The combination of the above can be used for key type comparison. */ /* The combination of the above can be used for key type comparison. */
#define HA_KEYFLAG_MASK (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | \ #define HA_KEYFLAG_MASK (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | \
HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \ HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \
HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY | \ HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY)
HA_RTREE_INDEX)
/* /*
Key contains partial segments. Key contains partial segments.
......
create table t1(a int(10)unsigned not null auto_increment primary key,
b varchar(255) not null) engine=innodb default charset=utf8;
insert into t1 values(1,'aaa'),(2,'bbb');
alter table t1 auto_increment=1;
insert into t1 values(NULL, 'ccc');
select * from t1;
a b
1 aaa
2 bbb
3 ccc
drop table t1;
...@@ -1597,10 +1597,6 @@ select distinct concat(a, b) from t1; ...@@ -1597,10 +1597,6 @@ select distinct concat(a, b) from t1;
concat(a, b) concat(a, b)
11113333 11113333
drop table t1; 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 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; 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); INSERT INTO t1 VALUES (1),(2),(3);
CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a), CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
......
...@@ -1244,16 +1244,6 @@ insert into t1 values ('1111', '3333'); ...@@ -1244,16 +1244,6 @@ insert into t1 values ('1111', '3333');
select distinct concat(a, b) from t1; select distinct concat(a, b) from t1;
drop table t1; drop table t1;
#
# BUG#7709 test case - Boolean fulltext query against unsupported
# engines does not fail
#
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
--error 1764
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
DROP TABLE t1;
# #
# check null values #1 # check null values #1
# #
......
...@@ -337,9 +337,9 @@ insert into t2 values (1, 1, 'xxfoo'); ...@@ -337,9 +337,9 @@ insert into t2 values (1, 1, 'xxfoo');
insert into t2 values (2, 1, 'xxbar'); insert into t2 values (2, 1, 'xxbar');
insert into t2 values (3, 1, 'xxbuz'); insert into t2 values (3, 1, 'xxbuz');
select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode); select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode);
ERROR HY000: The table does not have FULLTEXT index to support this query ERROR HY000: Incorrect arguments to MATCH
select * from t2 where match name against ('*a*b*c*d*e*f*' in boolean mode); select * from t2 where match name against ('*a*b*c*d*e*f*' in boolean mode);
ERROR HY000: The table does not have FULLTEXT index to support this query ERROR HY000: Can't find FULLTEXT index matching the column list
drop table t1,t2; drop table t1,t2;
create table t1 (a text, fulltext key (a)) ENGINE = InnoDB; create table t1 (a text, fulltext key (a)) ENGINE = InnoDB;
insert into t1 select "xxxx yyyy zzzz"; insert into t1 select "xxxx yyyy zzzz";
...@@ -479,16 +479,13 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -479,16 +479,13 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where 1 SIMPLE t1 fulltext a a 0 1 Using where
EXPLAIN SELECT * FROM t1 IGNORE INDEX(a) EXPLAIN SELECT * FROM t1 IGNORE INDEX(a)
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
id select_type table type possible_keys key key_len ref rows Extra ERROR HY000: Can't find FULLTEXT index matching the column list
1 SIMPLE t1 ALL b NULL NULL NULL 8 Using where
EXPLAIN SELECT * FROM t1 USE INDEX(b) EXPLAIN SELECT * FROM t1 USE INDEX(b)
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
id select_type table type possible_keys key key_len ref rows Extra ERROR HY000: Can't find FULLTEXT index matching the column list
1 SIMPLE t1 ALL b NULL NULL NULL 8 Using where
EXPLAIN SELECT * FROM t1 FORCE INDEX(b) EXPLAIN SELECT * FROM t1 FORCE INDEX(b)
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
id select_type table type possible_keys key key_len ref rows Extra ERROR HY000: Can't find FULLTEXT index matching the column list
1 SIMPLE t1 ref b b 5 const 5 Using where
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(a CHAR(10), fulltext(a)) ENGINE = InnoDB; CREATE TABLE t1(a CHAR(10), fulltext(a)) ENGINE = InnoDB;
INSERT INTO t1 VALUES('aaa15'); INSERT INTO t1 VALUES('aaa15');
...@@ -562,14 +559,12 @@ WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE) ...@@ -562,14 +559,12 @@ WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
); );
count(*) count(*)
1 1
# should return 0
SELECT count(*) FROM t1 WHERE SELECT count(*) FROM t1 WHERE
not exists( not exists(
SELECT 1 FROM t2 IGNORE INDEX (b2), t3 SELECT 1 FROM t2 IGNORE INDEX (b2), t3
WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE) WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
); );
count(*) ERROR HY000: Can't find FULLTEXT index matching the column list
0
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
CREATE TABLE t1 (a VARCHAR(4), FULLTEXT(a)) ENGINE = InnoDB; CREATE TABLE t1 (a VARCHAR(4), FULLTEXT(a)) ENGINE = InnoDB;
INSERT INTO t1 VALUES INSERT INTO t1 VALUES
......
...@@ -66,7 +66,7 @@ create table t2 (m_id int not null, f char(200), key (m_id), fulltext (f)) engin ...@@ -66,7 +66,7 @@ create table t2 (m_id int not null, f char(200), key (m_id), fulltext (f)) engin
insert into t2 values (1, 'bword'), (3, 'aword'), (5, ''); insert into t2 values (1, 'bword'), (3, 'aword'), (5, '');
ANALYZE TABLE t2; ANALYZE TABLE t2;
select * from t1 left join t2 on m_id = id where match(d, e, f) against ('+aword +bword' in boolean mode); select * from t1 left join t2 on m_id = id where match(d, e, f) against ('+aword +bword' in boolean mode);
id d e m_id f ERROR HY000: Incorrect arguments to MATCH
drop table t1,t2; drop table t1,t2;
CREATE TABLE t1 ( CREATE TABLE t1 (
id int(10) NOT NULL auto_increment, id int(10) NOT NULL auto_increment,
...@@ -89,9 +89,7 @@ ANALYZE TABLE t2; ...@@ -89,9 +89,7 @@ ANALYZE TABLE t2;
SELECT t1.*, MATCH(t1.name) AGAINST('string') AS relevance SELECT t1.*, MATCH(t1.name) AGAINST('string') AS relevance
FROM t1 LEFT JOIN t2 ON t1.link = t2.id FROM t1 LEFT JOIN t2 ON t1.link = t2.id
WHERE MATCH(t1.name, t2.name) AGAINST('string' IN BOOLEAN MODE); WHERE MATCH(t1.name, t2.name) AGAINST('string' IN BOOLEAN MODE);
id link name relevance ERROR HY000: Incorrect arguments to MATCH
1 1 string 0.000000001885928302414186
2 0 string 0.000000001885928302414186
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE TABLE t1 (a INT) ENGINE = InnoDB; CREATE TABLE t1 (a INT) ENGINE = InnoDB;
CREATE TABLE t2 (b INT, c TEXT, KEY(b), FULLTEXT(c)) ENGINE = InnoDB; CREATE TABLE t2 (b INT, c TEXT, KEY(b), FULLTEXT(c)) ENGINE = InnoDB;
......
...@@ -115,7 +115,7 @@ drop table t1, t2; ...@@ -115,7 +115,7 @@ drop table t1, t2;
CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci) ENGINE = InnoDB; CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci) ENGINE = InnoDB;
INSERT INTO t1 VALUES('abcd'); INSERT INTO t1 VALUES('abcd');
SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE); SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE);
ERROR HY000: The table does not have FULLTEXT index to support this query ERROR HY000: Can't find FULLTEXT index matching the column list
DROP TABLE t1; DROP TABLE t1;
create table t1 (a varchar(10), key(a), fulltext (a)) ENGINE = InnoDB; create table t1 (a varchar(10), key(a), fulltext (a)) ENGINE = InnoDB;
insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
......
...@@ -710,8 +710,7 @@ CREATE FULLTEXT INDEX i ON t1 (char_column2); ...@@ -710,8 +710,7 @@ CREATE FULLTEXT INDEX i ON t1 (char_column2);
Warnings: Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
SELECT * FROM t1 WHERE MATCH(char_column) AGAINST ('abc*' IN BOOLEAN MODE); SELECT * FROM t1 WHERE MATCH(char_column) AGAINST ('abc*' IN BOOLEAN MODE);
id char_column char_column2 ERROR HY000: Can't find FULLTEXT index matching the column list
NULL abcde abcde
DROP TABLE t1; DROP TABLE t1;
"----------Test22---------" "----------Test22---------"
CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8) ENGINE = InnoDB; CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8) ENGINE = InnoDB;
......
INSTALL PLUGIN simple_parser SONAME 'mypluglib';
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title) WITH PARSER simple_parser
) ENGINE=MyISAM;
ALTER TABLE articles ENGINE=InnoDB;
ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table
DROP TABLE articles;
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title) WITH PARSER simple_parser
) ENGINE=InnoDB;
ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title)
) ENGINE=InnoDB;
ALTER TABLE articles ADD FULLTEXT INDEX (body) WITH PARSER simple_parser;
ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table
CREATE FULLTEXT INDEX ft_index ON articles(body) WITH PARSER simple_parser;
ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table
DROP TABLE articles;
UNINSTALL PLUGIN simple_parser;
CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
a VARCHAR(200),
b TEXT
) ENGINE= InnoDB;
CREATE FULLTEXT INDEX idx on t1 (a,b);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
INSERT INTO t1 (a,b) VALUES
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
('when To Use MySQL Well','After that you went through a ...'),
('where will Optimizing MySQL','what In this tutorial we will show ...'),
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
('when To Use MySQL Well','After that you went through a ...'),
('where will Optimizing MySQL','what In this tutorial we will show ...'),
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
('when To Use MySQL Well','After that you went through a ...'),
('where will Optimizing MySQL','what In this tutorial we will show ...');
SET SESSION debug_dbug="+d,fts_instrument_result_cache_limit";
SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('mysql' IN BOOLEAN MODE);
COUNT(*)
9
SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('mysql' WITH QUERY EXPANSION);
ERROR HY000: Table handler out of memory
SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('"mysql database"' IN BOOLEAN MODE);
ERROR HY000: Table handler out of memory
SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('"mysql database" @ 5' IN BOOLEAN MODE);
ERROR HY000: Table handler out of memory
SET SESSION debug_dbug="-d,fts_instrument_result_cache_limit";
DROP TABLE t1;
SET GLOBAL innodb_ft_result_cache_limit=default;
...@@ -4,11 +4,6 @@ ...@@ -4,11 +4,6 @@
--source include/have_innodb.inc --source include/have_innodb.inc
if (`select plugin_auth_version <= "5.6.10" from information_schema.plugins where plugin_name='innodb'`)
{
--skip Not fixed in InnoDB 5.6.10 or earlier
}
--disable_warnings --disable_warnings
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3;
--enable_warnings --enable_warnings
...@@ -281,17 +276,17 @@ create table t2 (t2_id int(11) primary key, t1_id int(11), name varchar(32)) ENG ...@@ -281,17 +276,17 @@ create table t2 (t2_id int(11) primary key, t1_id int(11), name varchar(32)) ENG
insert into t2 values (1, 1, 'xxfoo'); insert into t2 values (1, 1, 'xxfoo');
insert into t2 values (2, 1, 'xxbar'); insert into t2 values (2, 1, 'xxbar');
insert into t2 values (3, 1, 'xxbuz'); insert into t2 values (3, 1, 'xxbuz');
# INNODB_FTS: Note there is no fulltext index on table. InnoDB do not support # INNODB_FTS: InnoDB do not support MATCH expressions with arguments from
# Fulltext search in such case, will return 1739 # different tables
--error ER_TABLE_HAS_NO_FT --error ER_WRONG_ARGUMENTS
select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode); select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode);
# #
# Bug #7858: bug with many short (< ft_min_word_len) words in boolean search # Bug #7858: bug with many short (< ft_min_word_len) words in boolean search
# #
# INNODB_FTS: Note there is no fulltext index on table. InnoDB do not support # INNODB_FTS: Note there is no fulltext index on table. InnoDB do not support
# Fulltext search in such case, will return 1739 # Fulltext search in such case
--error ER_TABLE_HAS_NO_FT --error ER_FT_MATCHING_KEY_NOT_FOUND
select * from t2 where match name against ('*a*b*c*d*e*f*' in boolean mode); select * from t2 where match name against ('*a*b*c*d*e*f*' in boolean mode);
drop table t1,t2; drop table t1,t2;
...@@ -490,12 +485,15 @@ WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; ...@@ -490,12 +485,15 @@ WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
EXPLAIN SELECT * FROM t1 FORCE INDEX(a) EXPLAIN SELECT * FROM t1 FORCE INDEX(a)
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
--error ER_FT_MATCHING_KEY_NOT_FOUND
EXPLAIN SELECT * FROM t1 IGNORE INDEX(a) EXPLAIN SELECT * FROM t1 IGNORE INDEX(a)
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
--error ER_FT_MATCHING_KEY_NOT_FOUND
EXPLAIN SELECT * FROM t1 USE INDEX(b) EXPLAIN SELECT * FROM t1 USE INDEX(b)
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
--error ER_FT_MATCHING_KEY_NOT_FOUND
EXPLAIN SELECT * FROM t1 FORCE INDEX(b) EXPLAIN SELECT * FROM t1 FORCE INDEX(b)
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
...@@ -592,7 +590,7 @@ SELECT count(*) FROM t1 WHERE ...@@ -592,7 +590,7 @@ SELECT count(*) FROM t1 WHERE
WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE) WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
); );
--echo # should return 0 --error ER_FT_MATCHING_KEY_NOT_FOUND
SELECT count(*) FROM t1 WHERE SELECT count(*) FROM t1 WHERE
not exists( not exists(
SELECT 1 FROM t2 IGNORE INDEX (b2), t3 SELECT 1 FROM t2 IGNORE INDEX (b2), t3
......
...@@ -77,6 +77,7 @@ insert into t2 values (1, 'bword'), (3, 'aword'), (5, ''); ...@@ -77,6 +77,7 @@ insert into t2 values (1, 'bword'), (3, 'aword'), (5, '');
-- disable_result_log -- disable_result_log
ANALYZE TABLE t2; ANALYZE TABLE t2;
-- enable_result_log -- enable_result_log
--error ER_WRONG_ARGUMENTS
select * from t1 left join t2 on m_id = id where match(d, e, f) against ('+aword +bword' in boolean mode); select * from t1 left join t2 on m_id = id where match(d, e, f) against ('+aword +bword' in boolean mode);
drop table t1,t2; drop table t1,t2;
...@@ -107,6 +108,7 @@ ANALYZE TABLE t1; ...@@ -107,6 +108,7 @@ ANALYZE TABLE t1;
ANALYZE TABLE t2; ANALYZE TABLE t2;
-- enable_result_log -- enable_result_log
--error ER_WRONG_ARGUMENTS
SELECT t1.*, MATCH(t1.name) AGAINST('string') AS relevance SELECT t1.*, MATCH(t1.name) AGAINST('string') AS relevance
FROM t1 LEFT JOIN t2 ON t1.link = t2.id FROM t1 LEFT JOIN t2 ON t1.link = t2.id
WHERE MATCH(t1.name, t2.name) AGAINST('string' IN BOOLEAN MODE); WHERE MATCH(t1.name, t2.name) AGAINST('string' IN BOOLEAN MODE);
......
...@@ -139,7 +139,7 @@ CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci) ENGINE = InnoDB; ...@@ -139,7 +139,7 @@ CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci) ENGINE = InnoDB;
INSERT INTO t1 VALUES('abcd'); INSERT INTO t1 VALUES('abcd');
# INNODB_FTS: Please Note this table do not have FTS. InnoDB return 1214 error # INNODB_FTS: Please Note this table do not have FTS. InnoDB return 1214 error
--error ER_TABLE_HAS_NO_FT --error ER_FT_MATCHING_KEY_NOT_FOUND
SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE); SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE);
DROP TABLE t1; DROP TABLE t1;
......
...@@ -152,7 +152,7 @@ order by ...@@ -152,7 +152,7 @@ order by
(select b.id, b.betreff from t3 b) (select b.id, b.betreff from t3 b)
order by match(betreff) against ('+abc' in boolean mode) desc; order by match(betreff) against ('+abc' in boolean mode) desc;
--error 1191 --error ER_FT_MATCHING_KEY_NOT_FOUND
(select b.id, b.betreff from t3 b) union (select b.id, b.betreff from t3 b) union
(select b.id, b.betreff from t3 b) (select b.id, b.betreff from t3 b)
order by match(betreff) against ('+abc') desc; order by match(betreff) against ('+abc') desc;
......
...@@ -9,11 +9,6 @@ let collation=UTF8_UNICODE_CI; ...@@ -9,11 +9,6 @@ let collation=UTF8_UNICODE_CI;
drop table if exists t1; drop table if exists t1;
--enable_warnings --enable_warnings
if (`select plugin_auth_version <= "5.6.10" from information_schema.plugins where plugin_name='innodb'`)
{
--skip Not fixed in InnoDB 5.6.10 or earlier
}
# Create FTS table # Create FTS table
CREATE TABLE t1 ( CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
...@@ -643,6 +638,7 @@ CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF32, char_col ...@@ -643,6 +638,7 @@ CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF32, char_col
INSERT INTO t1 (char_column) VALUES ('abcde'),('fghij'),('klmno'),('qrstu'); INSERT INTO t1 (char_column) VALUES ('abcde'),('fghij'),('klmno'),('qrstu');
UPDATE t1 SET char_column2 = char_column; UPDATE t1 SET char_column2 = char_column;
CREATE FULLTEXT INDEX i ON t1 (char_column2); CREATE FULLTEXT INDEX i ON t1 (char_column2);
--error ER_FT_MATCHING_KEY_NOT_FOUND
SELECT * FROM t1 WHERE MATCH(char_column) AGAINST ('abc*' IN BOOLEAN MODE); SELECT * FROM t1 WHERE MATCH(char_column) AGAINST ('abc*' IN BOOLEAN MODE);
DROP TABLE t1; DROP TABLE t1;
......
--source include/have_simple_parser.inc
--source include/have_innodb.inc
# Install fts parser plugin
INSTALL PLUGIN simple_parser SONAME 'mypluglib';
# Create a myisam table and alter it to innodb table
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title) WITH PARSER simple_parser
) ENGINE=MyISAM;
--error ER_INNODB_NO_FT_USES_PARSER
ALTER TABLE articles ENGINE=InnoDB;
DROP TABLE articles;
# Create a table having a full text index with parser
--error ER_INNODB_NO_FT_USES_PARSER
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title) WITH PARSER simple_parser
) ENGINE=InnoDB;
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title)
) ENGINE=InnoDB;
# Alter table to add a full text index with parser
--error ER_INNODB_NO_FT_USES_PARSER
ALTER TABLE articles ADD FULLTEXT INDEX (body) WITH PARSER simple_parser;
# Create a full text index with parser
--error ER_INNODB_NO_FT_USES_PARSER
CREATE FULLTEXT INDEX ft_index ON articles(body) WITH PARSER simple_parser;
DROP TABLE articles;
# Uninstall plugin
UNINSTALL PLUGIN simple_parser;
# This is a basic test for innodb fts result cache limit.
-- source include/have_innodb.inc
# Must have debug code to use SET SESSION debug
--source include/have_debug.inc
# Create FTS table
CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
a VARCHAR(200),
b TEXT
) ENGINE= InnoDB;
# Create the FTS index again
CREATE FULLTEXT INDEX idx on t1 (a,b);
# Insert rows
INSERT INTO t1 (a,b) VALUES
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
('when To Use MySQL Well','After that you went through a ...'),
('where will Optimizing MySQL','what In this tutorial we will show ...'),
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
('when To Use MySQL Well','After that you went through a ...'),
('where will Optimizing MySQL','what In this tutorial we will show ...'),
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
('when To Use MySQL Well','After that you went through a ...'),
('where will Optimizing MySQL','what In this tutorial we will show ...');
SET SESSION debug_dbug="+d,fts_instrument_result_cache_limit";
# Simple term search
SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('mysql' IN BOOLEAN MODE);
# Query expansion
--error 128
SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('mysql' WITH QUERY EXPANSION);
# Simple phrase search
--error 128
SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('"mysql database"' IN BOOLEAN MODE);
# Simple proximity search
--error 128
SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('"mysql database" @ 5' IN BOOLEAN MODE);
SET SESSION debug_dbug="-d,fts_instrument_result_cache_limit";
DROP TABLE t1;
SET GLOBAL innodb_ft_result_cache_limit=default;
This diff is collapsed.
#
# MDEV-5574 Set AUTO_INCREMENT below max value of column
#
--source include/have_innodb.inc
create table t1(a int(10)unsigned not null auto_increment primary key,
b varchar(255) not null) engine=innodb default charset=utf8;
insert into t1 values(1,'aaa'),(2,'bbb');
alter table t1 auto_increment=1;
insert into t1 values(NULL, 'ccc');
select * from t1;
drop table t1;
...@@ -6214,6 +6214,7 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref) ...@@ -6214,6 +6214,7 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
return TRUE; return TRUE;
} }
bool allows_multi_table_search= true;
const_item_cache=0; const_item_cache=0;
for (uint i=1 ; i < arg_count ; i++) for (uint i=1 ; i < arg_count ; i++)
{ {
...@@ -6225,7 +6226,10 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref) ...@@ -6225,7 +6226,10 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
my_error(ER_WRONG_ARGUMENTS, MYF(0), "AGAINST"); my_error(ER_WRONG_ARGUMENTS, MYF(0), "AGAINST");
return TRUE; return TRUE;
} }
allows_multi_table_search &=
allows_search_on_non_indexed_columns(((Item_field *)item)->field->table);
} }
/* /*
Check that all columns come from the same table. Check that all columns come from the same table.
We've already checked that columns in MATCH are fields so We've already checked that columns in MATCH are fields so
...@@ -6234,7 +6238,7 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref) ...@@ -6234,7 +6238,7 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
if ((used_tables_cache & ~PARAM_TABLE_BIT) != item->used_tables()) if ((used_tables_cache & ~PARAM_TABLE_BIT) != item->used_tables())
key=NO_SUCH_KEY; key=NO_SUCH_KEY;
if (key == NO_SUCH_KEY && !(flags & FT_BOOL)) if (key == NO_SUCH_KEY && !allows_multi_table_search)
{ {
my_error(ER_WRONG_ARGUMENTS,MYF(0),"MATCH"); my_error(ER_WRONG_ARGUMENTS,MYF(0),"MATCH");
return TRUE; return TRUE;
...@@ -6332,7 +6336,7 @@ bool Item_func_match::fix_index() ...@@ -6332,7 +6336,7 @@ bool Item_func_match::fix_index()
} }
err: err:
if (flags & FT_BOOL) if (allows_search_on_non_indexed_columns(table))
{ {
key=NO_SUCH_KEY; key=NO_SUCH_KEY;
return 0; return 0;
......
...@@ -1909,6 +1909,41 @@ public: ...@@ -1909,6 +1909,41 @@ public:
/* TODO: consider adding in support for the MATCH-based virtual columns */ /* TODO: consider adding in support for the MATCH-based virtual columns */
return trace_unsupported_by_check_vcol_func_processor(func_name()); return trace_unsupported_by_check_vcol_func_processor(func_name());
} }
private:
/**
Check whether storage engine for given table,
allows FTS Boolean search on non-indexed columns.
@todo A flag should be added to the extended fulltext API so that
it may be checked whether search on non-indexed columns are
supported. Currently, it is not possible to check for such a
flag since @c this->ft_handler is not yet set when this function is
called. The current hack is to assume that search on non-indexed
columns are supported for engines that does not support the extended
fulltext API (e.g., MyISAM), while it is not supported for other
engines (e.g., InnoDB)
@param table_arg Table for which storage engine to check
@retval true if BOOLEAN search on non-indexed columns is supported
@retval false otherwise
*/
bool allows_search_on_non_indexed_columns(TABLE* table_arg)
{
// Only Boolean search may support non_indexed columns
if (!(flags & FT_BOOL))
return false;
DBUG_ASSERT(table_arg && table_arg->file);
// Assume that if extended fulltext API is not supported,
// non-indexed columns are allowed. This will be true for MyISAM.
if ((table_arg->file->ha_table_flags() & HA_CAN_FULLTEXT_EXT) == 0)
return true;
return false;
}
}; };
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2008, 2012, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, 2013, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -245,7 +245,7 @@ ib_open_table_by_id( ...@@ -245,7 +245,7 @@ ib_open_table_by_id(
dict_mutex_enter_for_mysql(); dict_mutex_enter_for_mysql();
} }
table = dict_table_open_on_id(table_id, FALSE, FALSE); table = dict_table_open_on_id(table_id, FALSE, DICT_TABLE_OP_NORMAL);
if (table != NULL && table->ibd_file_missing) { if (table != NULL && table->ibd_file_missing) {
table = NULL; table = NULL;
...@@ -1183,7 +1183,7 @@ ib_cursor_open_index_using_name( ...@@ -1183,7 +1183,7 @@ ib_cursor_open_index_using_name(
/* We want to increment the ref count, so we do a redundant search. */ /* We want to increment the ref count, so we do a redundant search. */
table = dict_table_open_on_id(cursor->prebuilt->table->id, table = dict_table_open_on_id(cursor->prebuilt->table->id,
FALSE, FALSE); FALSE, DICT_TABLE_OP_NORMAL);
ut_a(table != NULL); ut_a(table != NULL);
/* The first index is always the cluster index. */ /* The first index is always the cluster index. */
...@@ -1630,6 +1630,8 @@ ib_cursor_insert_row( ...@@ -1630,6 +1630,8 @@ ib_cursor_insert_row(
src_tuple->index->table, q_proc->grph.ins, node->ins); src_tuple->index->table, q_proc->grph.ins, node->ins);
} }
srv_active_wake_master_thread();
return(err); return(err);
} }
...@@ -1914,6 +1916,8 @@ ib_cursor_update_row( ...@@ -1914,6 +1916,8 @@ ib_cursor_update_row(
err = ib_execute_update_query_graph(cursor, pcur); err = ib_execute_update_query_graph(cursor, pcur);
} }
srv_active_wake_master_thread();
return(err); return(err);
} }
...@@ -2039,6 +2043,8 @@ ib_cursor_delete_row( ...@@ -2039,6 +2043,8 @@ ib_cursor_delete_row(
err = DB_RECORD_NOT_FOUND; err = DB_RECORD_NOT_FOUND;
} }
srv_active_wake_master_thread();
return(err); return(err);
} }
...@@ -2296,12 +2302,14 @@ ib_col_set_value( ...@@ -2296,12 +2302,14 @@ ib_col_set_value(
ib_tpl_t ib_tpl, /*!< in: tuple instance */ ib_tpl_t ib_tpl, /*!< in: tuple instance */
ib_ulint_t col_no, /*!< in: column index in tuple */ ib_ulint_t col_no, /*!< in: column index in tuple */
const void* src, /*!< in: data value */ const void* src, /*!< in: data value */
ib_ulint_t len) /*!< in: data value len */ ib_ulint_t len, /*!< in: data value len */
ib_bool_t need_cpy) /*!< in: if need memcpy */
{ {
const dtype_t* dtype; const dtype_t* dtype;
dfield_t* dfield; dfield_t* dfield;
void* dst = NULL; void* dst = NULL;
ib_tuple_t* tuple = (ib_tuple_t*) ib_tpl; ib_tuple_t* tuple = (ib_tuple_t*) ib_tpl;
ulint col_len;
dfield = ib_col_get_dfield(tuple, col_no); dfield = ib_col_get_dfield(tuple, col_no);
...@@ -2312,6 +2320,7 @@ ib_col_set_value( ...@@ -2312,6 +2320,7 @@ ib_col_set_value(
} }
dtype = dfield_get_type(dfield); dtype = dfield_get_type(dfield);
col_len = dtype_get_len(dtype);
/* Not allowed to update system columns. */ /* Not allowed to update system columns. */
if (dtype_get_mtype(dtype) == DATA_SYS) { if (dtype_get_mtype(dtype) == DATA_SYS) {
...@@ -2325,10 +2334,10 @@ ib_col_set_value( ...@@ -2325,10 +2334,10 @@ ib_col_set_value(
for that. */ for that. */
if (ib_col_is_capped(dtype)) { if (ib_col_is_capped(dtype)) {
len = ut_min(len, dtype_get_len(dtype)); len = ut_min(len, col_len);
if (dst == NULL || len > dfield_get_len(dfield)) { if (dst == NULL || len > dfield_get_len(dfield)) {
dst = mem_heap_alloc(tuple->heap, dtype_get_len(dtype)); dst = mem_heap_alloc(tuple->heap, col_len);
ut_a(dst != NULL); ut_a(dst != NULL);
} }
} else if (dst == NULL || len > dfield_get_len(dfield)) { } else if (dst == NULL || len > dfield_get_len(dfield)) {
...@@ -2342,7 +2351,7 @@ ib_col_set_value( ...@@ -2342,7 +2351,7 @@ ib_col_set_value(
switch (dtype_get_mtype(dtype)) { switch (dtype_get_mtype(dtype)) {
case DATA_INT: { case DATA_INT: {
if (dtype_get_len(dtype) == len) { if (col_len == len) {
ibool usign; ibool usign;
usign = dtype_get_prtype(dtype) & DATA_UNSIGNED; usign = dtype_get_prtype(dtype) & DATA_UNSIGNED;
...@@ -2387,23 +2396,97 @@ ib_col_set_value( ...@@ -2387,23 +2396,97 @@ ib_col_set_value(
memset((byte*) dst + len, memset((byte*) dst + len,
pad_char, pad_char,
dtype_get_len(dtype) - len); col_len - len);
memcpy(dst, src, len); memcpy(dst, src, len);
len = dtype_get_len(dtype); len = col_len;
break; break;
} }
case DATA_BLOB: case DATA_BLOB:
case DATA_BINARY: case DATA_BINARY:
case DATA_MYSQL:
case DATA_DECIMAL: case DATA_DECIMAL:
case DATA_VARCHAR: case DATA_VARCHAR:
case DATA_VARMYSQL:
case DATA_FIXBINARY: case DATA_FIXBINARY:
if (need_cpy) {
memcpy(dst, src, len); memcpy(dst, src, len);
} else {
dfield_set_data(dfield, src, len);
dst = dfield_get_data(dfield);
}
break; break;
case DATA_MYSQL:
case DATA_VARMYSQL: {
ulint cset;
CHARSET_INFO* cs;
int error = 0;
ulint true_len = len;
/* For multi byte character sets we need to
calculate the true length of the data. */
cset = dtype_get_charset_coll(
dtype_get_prtype(dtype));
cs = all_charsets[cset];
if (cs) {
uint pos = (uint)(col_len / cs->mbmaxlen);
if (len > 0 && cs->mbmaxlen > 1) {
true_len = (ulint)
cs->cset->well_formed_len(
cs,
(const char*)src,
(const char*)src + len,
pos,
&error);
if (true_len < len) {
len = true_len;
}
}
}
/* All invalid bytes in data need be truncated.
If len == 0, means all bytes of the data is invalid.
In this case, the data will be truncated to empty.*/
memcpy(dst, src, len);
/* For DATA_MYSQL, need to pad the unused
space with spaces. */
if (dtype_get_mtype(dtype) == DATA_MYSQL) {
ulint n_chars;
if (len < col_len) {
ulint pad_len = col_len - len;
ut_a(cs != NULL);
ut_a(!(pad_len % cs->mbminlen));
cs->cset->fill(cs, (char*)dst + len,
pad_len,
0x20 /* space */);
}
/* Why we should do below? See function
row_mysql_store_col_in_innobase_format */
ut_a(!(dtype_get_len(dtype)
% dtype_get_mbmaxlen(dtype)));
n_chars = dtype_get_len(dtype)
/ dtype_get_mbmaxlen(dtype);
/* Strip space padding. */
while (col_len > n_chars
&& ((char*)dst)[col_len - 1] == 0x20) {
col_len--;
}
len = col_len;
}
break;
}
default: default:
ut_error; ut_error;
} }
...@@ -2476,7 +2559,9 @@ ib_col_copy_value_low( ...@@ -2476,7 +2559,9 @@ ib_col_copy_value_low(
data_len, usign); data_len, usign);
if (usign) { if (usign) {
if (len == 2) { if (len == 1) {
*(ib_i8_t*)dst = (ib_i8_t)ret;
} else if (len == 2) {
*(ib_i16_t*)dst = (ib_i16_t)ret; *(ib_i16_t*)dst = (ib_i16_t)ret;
} else if (len == 4) { } else if (len == 4) {
*(ib_i32_t*)dst = (ib_i32_t)ret; *(ib_i32_t*)dst = (ib_i32_t)ret;
...@@ -2484,7 +2569,9 @@ ib_col_copy_value_low( ...@@ -2484,7 +2569,9 @@ ib_col_copy_value_low(
*(ib_i64_t*)dst = (ib_i64_t)ret; *(ib_i64_t*)dst = (ib_i64_t)ret;
} }
} else { } else {
if (len == 2) { if (len == 1) {
*(ib_u8_t*)dst = (ib_i8_t)ret;
} else if (len == 2) {
*(ib_u16_t*)dst = (ib_i16_t)ret; *(ib_u16_t*)dst = (ib_i16_t)ret;
} else if (len == 4) { } else if (len == 4) {
*(ib_u32_t*)dst = (ib_i32_t)ret; *(ib_u32_t*)dst = (ib_i32_t)ret;
...@@ -3450,7 +3537,7 @@ ib_tuple_write_int( ...@@ -3450,7 +3537,7 @@ ib_tuple_write_int(
return(DB_DATA_MISMATCH); return(DB_DATA_MISMATCH);
} }
return(ib_col_set_value(ib_tpl, col_no, value, type_len)); return(ib_col_set_value(ib_tpl, col_no, value, type_len, true));
} }
/*****************************************************************//** /*****************************************************************//**
...@@ -3465,7 +3552,7 @@ ib_tuple_write_i8( ...@@ -3465,7 +3552,7 @@ ib_tuple_write_i8(
int col_no, /*!< in: column number */ int col_no, /*!< in: column number */
ib_i8_t val) /*!< in: value to write */ ib_i8_t val) /*!< in: value to write */
{ {
return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val))); return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val), true));
} }
/*****************************************************************//** /*****************************************************************//**
...@@ -3480,7 +3567,7 @@ ib_tuple_write_i16( ...@@ -3480,7 +3567,7 @@ ib_tuple_write_i16(
int col_no, /*!< in: column number */ int col_no, /*!< in: column number */
ib_i16_t val) /*!< in: value to write */ ib_i16_t val) /*!< in: value to write */
{ {
return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val))); return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val), true));
} }
/*****************************************************************//** /*****************************************************************//**
...@@ -3495,7 +3582,7 @@ ib_tuple_write_i32( ...@@ -3495,7 +3582,7 @@ ib_tuple_write_i32(
int col_no, /*!< in: column number */ int col_no, /*!< in: column number */
ib_i32_t val) /*!< in: value to write */ ib_i32_t val) /*!< in: value to write */
{ {
return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val))); return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val), true));
} }
/*****************************************************************//** /*****************************************************************//**
...@@ -3510,7 +3597,7 @@ ib_tuple_write_i64( ...@@ -3510,7 +3597,7 @@ ib_tuple_write_i64(
int col_no, /*!< in: column number */ int col_no, /*!< in: column number */
ib_i64_t val) /*!< in: value to write */ ib_i64_t val) /*!< in: value to write */
{ {
return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val))); return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val), true));
} }
/*****************************************************************//** /*****************************************************************//**
...@@ -3525,7 +3612,7 @@ ib_tuple_write_u8( ...@@ -3525,7 +3612,7 @@ ib_tuple_write_u8(
int col_no, /*!< in: column number */ int col_no, /*!< in: column number */
ib_u8_t val) /*!< in: value to write */ ib_u8_t val) /*!< in: value to write */
{ {
return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val))); return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val), true));
} }
/*****************************************************************//** /*****************************************************************//**
...@@ -3540,7 +3627,7 @@ ib_tuple_write_u16( ...@@ -3540,7 +3627,7 @@ ib_tuple_write_u16(
int col_no, /*!< in: column number */ int col_no, /*!< in: column number */
ib_u16_t val) /*!< in: value to write */ ib_u16_t val) /*!< in: value to write */
{ {
return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val))); return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val), true));
} }
/*****************************************************************//** /*****************************************************************//**
...@@ -3555,7 +3642,7 @@ ib_tuple_write_u32( ...@@ -3555,7 +3642,7 @@ ib_tuple_write_u32(
int col_no, /*!< in: column number */ int col_no, /*!< in: column number */
ib_u32_t val) /*!< in: value to write */ ib_u32_t val) /*!< in: value to write */
{ {
return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val))); return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val), true));
} }
/*****************************************************************//** /*****************************************************************//**
...@@ -3570,7 +3657,7 @@ ib_tuple_write_u64( ...@@ -3570,7 +3657,7 @@ ib_tuple_write_u64(
int col_no, /*!< in: column number */ int col_no, /*!< in: column number */
ib_u64_t val) /*!< in: value to write */ ib_u64_t val) /*!< in: value to write */
{ {
return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val))); return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val), true));
} }
/*****************************************************************//** /*****************************************************************//**
...@@ -3603,7 +3690,8 @@ ib_tuple_write_double( ...@@ -3603,7 +3690,8 @@ ib_tuple_write_double(
dfield = ib_col_get_dfield(tuple, col_no); dfield = ib_col_get_dfield(tuple, col_no);
if (dtype_get_mtype(dfield_get_type(dfield)) == DATA_DOUBLE) { if (dtype_get_mtype(dfield_get_type(dfield)) == DATA_DOUBLE) {
return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val))); return(ib_col_set_value(ib_tpl, col_no,
&val, sizeof(val), true));
} else { } else {
return(DB_DATA_MISMATCH); return(DB_DATA_MISMATCH);
} }
...@@ -3653,7 +3741,8 @@ ib_tuple_write_float( ...@@ -3653,7 +3741,8 @@ ib_tuple_write_float(
dfield = ib_col_get_dfield(tuple, col_no); dfield = ib_col_get_dfield(tuple, col_no);
if (dtype_get_mtype(dfield_get_type(dfield)) == DATA_FLOAT) { if (dtype_get_mtype(dfield_get_type(dfield)) == DATA_FLOAT) {
return(ib_col_set_value(ib_tpl, col_no, &val, sizeof(val))); return(ib_col_set_value(ib_tpl, col_no,
&val, sizeof(val), true));
} else { } else {
return(DB_DATA_MISMATCH); return(DB_DATA_MISMATCH);
} }
......
This diff is collapsed.
This diff is collapsed.
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -126,7 +126,7 @@ btr_pcur_store_position( ...@@ -126,7 +126,7 @@ btr_pcur_store_position(
|| mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
ut_a(cursor->latch_mode != BTR_NO_LATCHES); ut_a(cursor->latch_mode != BTR_NO_LATCHES);
if (UNIV_UNLIKELY(page_get_n_recs(page) == 0)) { if (page_is_empty(page)) {
/* It must be an empty index tree; NOTE that in this case /* It must be an empty index tree; NOTE that in this case
we do not store the modify_clock, but always do a search we do not store the modify_clock, but always do a search
if we restore the cursor position */ if we restore the cursor position */
......
This diff is collapsed.
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc. Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
...@@ -496,14 +496,13 @@ buf_page_is_corrupted( ...@@ -496,14 +496,13 @@ buf_page_is_corrupted(
} }
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
if (recv_lsn_checks_on) { if (check_lsn && recv_lsn_checks_on) {
lsn_t current_lsn; lsn_t current_lsn;
/* Since we are going to reset the page LSN during the import /* Since we are going to reset the page LSN during the import
phase it makes no sense to spam the log with error messages. */ phase it makes no sense to spam the log with error messages. */
if (check_lsn if (log_peek_lsn(&current_lsn)
&& log_peek_lsn(&current_lsn)
&& current_lsn && current_lsn
< mach_read_from_8(read_buf + FIL_PAGE_LSN)) { < mach_read_from_8(read_buf + FIL_PAGE_LSN)) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
...@@ -1167,7 +1166,7 @@ buf_chunk_not_freed( ...@@ -1167,7 +1166,7 @@ buf_chunk_not_freed(
ibool ready; ibool ready;
switch (buf_block_get_state(block)) { switch (buf_block_get_state(block)) {
case BUF_BLOCK_ZIP_FREE: case BUF_BLOCK_POOL_WATCH:
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY: case BUF_BLOCK_ZIP_DIRTY:
/* The uncompressed buffer pool should never /* The uncompressed buffer pool should never
...@@ -1492,7 +1491,7 @@ buf_relocate( ...@@ -1492,7 +1491,7 @@ buf_relocate(
ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage)); ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
switch (buf_page_get_state(bpage)) { switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_FREE: case BUF_BLOCK_POOL_WATCH:
case BUF_BLOCK_NOT_USED: case BUF_BLOCK_NOT_USED:
case BUF_BLOCK_READY_FOR_USE: case BUF_BLOCK_READY_FOR_USE:
case BUF_BLOCK_FILE_PAGE: case BUF_BLOCK_FILE_PAGE:
...@@ -1964,7 +1963,7 @@ buf_block_try_discard_uncompressed( ...@@ -1964,7 +1963,7 @@ buf_block_try_discard_uncompressed(
bpage = buf_page_hash_get(buf_pool, space, offset); bpage = buf_page_hash_get(buf_pool, space, offset);
if (bpage) { if (bpage) {
buf_LRU_free_block(bpage, FALSE); buf_LRU_free_page(bpage, false);
} }
buf_pool_mutex_exit(buf_pool); buf_pool_mutex_exit(buf_pool);
...@@ -2014,7 +2013,7 @@ lookup: ...@@ -2014,7 +2013,7 @@ lookup:
buf_read_page(space, zip_size, offset); buf_read_page(space, zip_size, offset);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(++buf_dbg_counter % 37 || buf_validate()); ut_a(++buf_dbg_counter % 5771 || buf_validate());
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
} }
...@@ -2030,11 +2029,11 @@ err_exit: ...@@ -2030,11 +2029,11 @@ err_exit:
ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage)); ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
switch (buf_page_get_state(bpage)) { switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_POOL_WATCH:
case BUF_BLOCK_NOT_USED: case BUF_BLOCK_NOT_USED:
case BUF_BLOCK_READY_FOR_USE: case BUF_BLOCK_READY_FOR_USE:
case BUF_BLOCK_MEMORY: case BUF_BLOCK_MEMORY:
case BUF_BLOCK_REMOVE_HASH: case BUF_BLOCK_REMOVE_HASH:
case BUF_BLOCK_ZIP_FREE:
break; break;
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY: case BUF_BLOCK_ZIP_DIRTY:
...@@ -2240,7 +2239,7 @@ buf_block_align_instance( ...@@ -2240,7 +2239,7 @@ buf_block_align_instance(
mutex_enter(&block->mutex); mutex_enter(&block->mutex);
switch (buf_block_get_state(block)) { switch (buf_block_get_state(block)) {
case BUF_BLOCK_ZIP_FREE: case BUF_BLOCK_POOL_WATCH:
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY: case BUF_BLOCK_ZIP_DIRTY:
/* These types should only be used in /* These types should only be used in
...@@ -2436,7 +2435,6 @@ buf_page_get_gen( ...@@ -2436,7 +2435,6 @@ buf_page_get_gen(
ibool must_read; ibool must_read;
rw_lock_t* hash_lock; rw_lock_t* hash_lock;
ib_mutex_t* block_mutex; ib_mutex_t* block_mutex;
buf_page_t* hash_bpage;
ulint retries = 0; ulint retries = 0;
buf_pool_t* buf_pool = buf_pool_get(space, offset); buf_pool_t* buf_pool = buf_pool_get(space, offset);
...@@ -2489,7 +2487,6 @@ loop: ...@@ -2489,7 +2487,6 @@ loop:
block = guess = NULL; block = guess = NULL;
} else { } else {
ut_ad(!block->page.in_zip_hash); ut_ad(!block->page.in_zip_hash);
ut_ad(block->page.in_page_hash);
} }
} }
...@@ -2543,6 +2540,10 @@ loop: ...@@ -2543,6 +2540,10 @@ loop:
retries = 0; retries = 0;
} else if (retries < BUF_PAGE_READ_MAX_RETRIES) { } else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
++retries; ++retries;
DBUG_EXECUTE_IF(
"innodb_page_corruption_retries",
retries = BUF_PAGE_READ_MAX_RETRIES;
);
} else { } else {
fprintf(stderr, "InnoDB: Error: Unable" fprintf(stderr, "InnoDB: Error: Unable"
" to read tablespace %lu page no" " to read tablespace %lu page no"
...@@ -2564,7 +2565,7 @@ loop: ...@@ -2564,7 +2565,7 @@ loop:
} }
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(++buf_dbg_counter % 37 || buf_validate()); ut_a(++buf_dbg_counter % 5771 || buf_validate());
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
goto loop; goto loop;
} }
...@@ -2590,6 +2591,7 @@ got_block: ...@@ -2590,6 +2591,7 @@ got_block:
/* The page is being read to buffer pool, /* The page is being read to buffer pool,
but we cannot wait around for the read to but we cannot wait around for the read to
complete. */ complete. */
null_exit:
mutex_exit(block_mutex); mutex_exit(block_mutex);
return(NULL); return(NULL);
...@@ -2603,6 +2605,14 @@ got_block: ...@@ -2603,6 +2605,14 @@ got_block:
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY: case BUF_BLOCK_ZIP_DIRTY:
if (mode == BUF_PEEK_IF_IN_POOL) {
/* This mode is only used for dropping an
adaptive hash index. There cannot be an
adaptive hash index for a compressed-only
page, so do not bother decompressing the page. */
goto null_exit;
}
bpage = &block->page; bpage = &block->page;
if (bpage->buf_fix_count if (bpage->buf_fix_count
...@@ -2735,7 +2745,7 @@ wait_until_unfixed: ...@@ -2735,7 +2745,7 @@ wait_until_unfixed:
break; break;
case BUF_BLOCK_ZIP_FREE: case BUF_BLOCK_POOL_WATCH:
case BUF_BLOCK_NOT_USED: case BUF_BLOCK_NOT_USED:
case BUF_BLOCK_READY_FOR_USE: case BUF_BLOCK_READY_FOR_USE:
case BUF_BLOCK_MEMORY: case BUF_BLOCK_MEMORY:
...@@ -2780,7 +2790,7 @@ wait_until_unfixed: ...@@ -2780,7 +2790,7 @@ wait_until_unfixed:
relocated or enter or exit the buf_pool while we relocated or enter or exit the buf_pool while we
are holding the buf_pool->mutex. */ are holding the buf_pool->mutex. */
if (buf_LRU_free_block(&block->page, TRUE)) { if (buf_LRU_free_page(&block->page, true)) {
buf_pool_mutex_exit(buf_pool); buf_pool_mutex_exit(buf_pool);
rw_lock_x_lock(hash_lock); rw_lock_x_lock(hash_lock);
...@@ -3728,7 +3738,7 @@ buf_page_create( ...@@ -3728,7 +3738,7 @@ buf_page_create(
memset(frame + FIL_PAGE_FILE_FLUSH_LSN, 0, 8); memset(frame + FIL_PAGE_FILE_FLUSH_LSN, 0, 8);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(++buf_dbg_counter % 357 || buf_validate()); ut_a(++buf_dbg_counter % 5771 || buf_validate());
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
#ifdef UNIV_IBUF_COUNT_DEBUG #ifdef UNIV_IBUF_COUNT_DEBUG
ut_a(ibuf_count_get(buf_block_get_space(block), ut_a(ibuf_count_get(buf_block_get_space(block),
...@@ -4196,7 +4206,7 @@ buf_pool_invalidate_instance( ...@@ -4196,7 +4206,7 @@ buf_pool_invalidate_instance(
pool invalidation to proceed we must ensure there is NO pool invalidation to proceed we must ensure there is NO
write activity happening. */ write activity happening. */
if (buf_pool->n_flush[i] > 0) { if (buf_pool->n_flush[i] > 0) {
enum buf_flush type = static_cast<enum buf_flush>(i); buf_flush_t type = static_cast<buf_flush_t>(i);
buf_pool_mutex_exit(buf_pool); buf_pool_mutex_exit(buf_pool);
buf_flush_wait_batch_end(buf_pool, type); buf_flush_wait_batch_end(buf_pool, type);
...@@ -4285,7 +4295,7 @@ buf_pool_validate_instance( ...@@ -4285,7 +4295,7 @@ buf_pool_validate_instance(
mutex_enter(&block->mutex); mutex_enter(&block->mutex);
switch (buf_block_get_state(block)) { switch (buf_block_get_state(block)) {
case BUF_BLOCK_ZIP_FREE: case BUF_BLOCK_POOL_WATCH:
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY: case BUF_BLOCK_ZIP_DIRTY:
/* These should only occur on /* These should only occur on
...@@ -4378,7 +4388,7 @@ assert_s_latched: ...@@ -4378,7 +4388,7 @@ assert_s_latched:
/* All clean blocks should be I/O-unfixed. */ /* All clean blocks should be I/O-unfixed. */
break; break;
case BUF_IO_READ: case BUF_IO_READ:
/* In buf_LRU_free_block(), we temporarily set /* In buf_LRU_free_page(), we temporarily set
b->io_fix = BUF_IO_READ for a newly allocated b->io_fix = BUF_IO_READ for a newly allocated
control block in order to prevent control block in order to prevent
buf_page_get_gen() from decompressing the block. */ buf_page_get_gen() from decompressing the block. */
...@@ -4437,7 +4447,7 @@ assert_s_latched: ...@@ -4437,7 +4447,7 @@ assert_s_latched:
case BUF_BLOCK_FILE_PAGE: case BUF_BLOCK_FILE_PAGE:
/* uncompressed page */ /* uncompressed page */
break; break;
case BUF_BLOCK_ZIP_FREE: case BUF_BLOCK_POOL_WATCH:
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_NOT_USED: case BUF_BLOCK_NOT_USED:
case BUF_BLOCK_READY_FOR_USE: case BUF_BLOCK_READY_FOR_USE:
...@@ -4720,7 +4730,7 @@ buf_get_latched_pages_number_instance( ...@@ -4720,7 +4730,7 @@ buf_get_latched_pages_number_instance(
case BUF_BLOCK_FILE_PAGE: case BUF_BLOCK_FILE_PAGE:
/* uncompressed page */ /* uncompressed page */
break; break;
case BUF_BLOCK_ZIP_FREE: case BUF_BLOCK_POOL_WATCH:
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_NOT_USED: case BUF_BLOCK_NOT_USED:
case BUF_BLOCK_READY_FOR_USE: case BUF_BLOCK_READY_FOR_USE:
...@@ -5015,7 +5025,7 @@ buf_print_io_instance( ...@@ -5015,7 +5025,7 @@ buf_print_io_instance(
"Old database pages %lu\n" "Old database pages %lu\n"
"Modified db pages %lu\n" "Modified db pages %lu\n"
"Pending reads %lu\n" "Pending reads %lu\n"
"Pending writes: LRU %lu, flush list %lu single page %lu\n", "Pending writes: LRU %lu, flush list %lu, single page %lu\n",
pool_info->pool_size, pool_info->pool_size,
pool_info->free_list_len, pool_info->free_list_len,
pool_info->lru_len, pool_info->lru_len,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!/bin/sh #!/bin/sh
# #
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it under # This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software # the terms of the GNU General Public License as published by the Free Software
......
...@@ -32,7 +32,6 @@ Created 4/18/1996 Heikki Tuuri ...@@ -32,7 +32,6 @@ Created 4/18/1996 Heikki Tuuri
#include "dict0crea.h" #include "dict0crea.h"
#include "btr0btr.h" #include "btr0btr.h"
#include "dict0load.h" #include "dict0load.h"
#include "dict0load.h"
#include "trx0trx.h" #include "trx0trx.h"
#include "srv0srv.h" #include "srv0srv.h"
#include "ibuf0ibuf.h" #include "ibuf0ibuf.h"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
...@@ -53,10 +53,6 @@ Created 1/8/1996 Heikki Tuuri ...@@ -53,10 +53,6 @@ Created 1/8/1996 Heikki Tuuri
UNIV_INTERN mysql_pfs_key_t autoinc_mutex_key; UNIV_INTERN mysql_pfs_key_t autoinc_mutex_key;
#endif /* UNIV_PFS_MUTEX */ #endif /* UNIV_PFS_MUTEX */
/** Prefix for tmp tables, adopted from sql/table.h */
#define tmp_file_prefix "#sql"
#define tmp_file_prefix_length 4
/**********************************************************************//** /**********************************************************************//**
Creates a table memory object. Creates a table memory object.
@return own: table object */ @return own: table object */
......
This diff is collapsed.
This diff is collapsed.
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -35,7 +35,7 @@ UNIV_INTERN ...@@ -35,7 +35,7 @@ UNIV_INTERN
dyn_block_t* dyn_block_t*
dyn_array_add_block( dyn_array_add_block(
/*================*/ /*================*/
dyn_array_t* arr) /*!< in: dyn array */ dyn_array_t* arr) /*!< in/out: dyn array */
{ {
mem_heap_t* heap; mem_heap_t* heap;
dyn_block_t* block; dyn_block_t* block;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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