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 {
#define HA_SPATIAL 1024 /* For spatial search */
#define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */
#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. */
#define HA_KEYFLAG_MASK (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | \
HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \
HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY | \
HA_RTREE_INDEX)
HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY)
/*
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;
concat(a, b)
11113333
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;
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),
......
......@@ -1244,16 +1244,6 @@ insert into t1 values ('1111', '3333');
select distinct concat(a, b) from 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
#
......
......@@ -337,9 +337,9 @@ insert into t2 values (1, 1, 'xxfoo');
insert into t2 values (2, 1, 'xxbar');
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);
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);
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;
create table t1 (a text, fulltext key (a)) ENGINE = InnoDB;
insert into t1 select "xxxx yyyy zzzz";
......@@ -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
EXPLAIN SELECT * FROM t1 IGNORE INDEX(a)
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 8 Using where
ERROR HY000: Can't find FULLTEXT index matching the column list
EXPLAIN SELECT * FROM t1 USE INDEX(b)
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 8 Using where
ERROR HY000: Can't find FULLTEXT index matching the column list
EXPLAIN SELECT * FROM t1 FORCE INDEX(b)
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref b b 5 const 5 Using where
ERROR HY000: Can't find FULLTEXT index matching the column list
DROP TABLE t1;
CREATE TABLE t1(a CHAR(10), fulltext(a)) ENGINE = InnoDB;
INSERT INTO t1 VALUES('aaa15');
......@@ -562,14 +559,12 @@ WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
);
count(*)
1
# should return 0
SELECT count(*) FROM t1 WHERE
not exists(
SELECT 1 FROM t2 IGNORE INDEX (b2), t3
WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
);
count(*)
0
ERROR HY000: Can't find FULLTEXT index matching the column list
DROP TABLE t1,t2,t3;
CREATE TABLE t1 (a VARCHAR(4), FULLTEXT(a)) ENGINE = InnoDB;
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
insert into t2 values (1, 'bword'), (3, 'aword'), (5, '');
ANALYZE TABLE t2;
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;
CREATE TABLE t1 (
id int(10) NOT NULL auto_increment,
......@@ -89,9 +89,7 @@ ANALYZE TABLE t2;
SELECT t1.*, MATCH(t1.name) AGAINST('string') AS relevance
FROM t1 LEFT JOIN t2 ON t1.link = t2.id
WHERE MATCH(t1.name, t2.name) AGAINST('string' IN BOOLEAN MODE);
id link name relevance
1 1 string 0.000000001885928302414186
2 0 string 0.000000001885928302414186
ERROR HY000: Incorrect arguments to MATCH
DROP TABLE t1,t2;
CREATE TABLE t1 (a INT) ENGINE = InnoDB;
CREATE TABLE t2 (b INT, c TEXT, KEY(b), FULLTEXT(c)) ENGINE = InnoDB;
......
......@@ -115,7 +115,7 @@ drop table t1, t2;
CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci) ENGINE = InnoDB;
INSERT INTO t1 VALUES('abcd');
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;
create table t1 (a varchar(10), key(a), fulltext (a)) ENGINE = InnoDB;
insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
......
......@@ -710,8 +710,7 @@ CREATE FULLTEXT INDEX i ON t1 (char_column2);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
SELECT * FROM t1 WHERE MATCH(char_column) AGAINST ('abc*' IN BOOLEAN MODE);
id char_column char_column2
NULL abcde abcde
ERROR HY000: Can't find FULLTEXT index matching the column list
DROP TABLE t1;
"----------Test22---------"
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 @@
--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
drop table if exists t1,t2,t3;
--enable_warnings
......@@ -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 (2, 1, 'xxbar');
insert into t2 values (3, 1, 'xxbuz');
# INNODB_FTS: Note there is no fulltext index on table. InnoDB do not support
# Fulltext search in such case, will return 1739
--error ER_TABLE_HAS_NO_FT
# INNODB_FTS: InnoDB do not support MATCH expressions with arguments from
# different tables
--error ER_WRONG_ARGUMENTS
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
#
# INNODB_FTS: Note there is no fulltext index on table. InnoDB do not support
# Fulltext search in such case, will return 1739
--error ER_TABLE_HAS_NO_FT
# Fulltext search in such case
--error ER_FT_MATCHING_KEY_NOT_FOUND
select * from t2 where match name against ('*a*b*c*d*e*f*' in boolean mode);
drop table t1,t2;
......@@ -490,12 +485,15 @@ WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
EXPLAIN SELECT * FROM t1 FORCE INDEX(a)
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)
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)
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)
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
......@@ -592,7 +590,7 @@ SELECT count(*) FROM t1 WHERE
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
not exists(
SELECT 1 FROM t2 IGNORE INDEX (b2), t3
......
......@@ -77,6 +77,7 @@ insert into t2 values (1, 'bword'), (3, 'aword'), (5, '');
-- disable_result_log
ANALYZE TABLE t2;
-- 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);
drop table t1,t2;
......@@ -107,6 +108,7 @@ ANALYZE TABLE t1;
ANALYZE TABLE t2;
-- enable_result_log
--error ER_WRONG_ARGUMENTS
SELECT t1.*, MATCH(t1.name) AGAINST('string') AS relevance
FROM t1 LEFT JOIN t2 ON t1.link = t2.id
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;
INSERT INTO t1 VALUES('abcd');
# 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);
DROP TABLE t1;
......
......@@ -152,7 +152,7 @@ order by
(select b.id, b.betreff from t3 b)
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)
order by match(betreff) against ('+abc') desc;
......
......@@ -9,11 +9,6 @@ let collation=UTF8_UNICODE_CI;
drop table if exists t1;
--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 TABLE t1 (
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
INSERT INTO t1 (char_column) VALUES ('abcde'),('fghij'),('klmno'),('qrstu');
UPDATE t1 SET char_column2 = char_column;
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);
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)
return TRUE;
}
bool allows_multi_table_search= true;
const_item_cache=0;
for (uint i=1 ; i < arg_count ; i++)
{
......@@ -6225,7 +6226,10 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
my_error(ER_WRONG_ARGUMENTS, MYF(0), "AGAINST");
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.
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)
if ((used_tables_cache & ~PARAM_TABLE_BIT) != item->used_tables())
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");
return TRUE;
......@@ -6332,7 +6336,7 @@ bool Item_func_match::fix_index()
}
err:
if (flags & FT_BOOL)
if (allows_search_on_non_indexed_columns(table))
{
key=NO_SUCH_KEY;
return 0;
......
......@@ -1909,6 +1909,41 @@ public:
/* TODO: consider adding in support for the MATCH-based virtual columns */
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
the terms of the GNU General Public License as published by the Free Software
......@@ -245,7 +245,7 @@ ib_open_table_by_id(
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) {
table = NULL;
......@@ -1183,7 +1183,7 @@ ib_cursor_open_index_using_name(
/* We want to increment the ref count, so we do a redundant search. */
table = dict_table_open_on_id(cursor->prebuilt->table->id,
FALSE, FALSE);
FALSE, DICT_TABLE_OP_NORMAL);
ut_a(table != NULL);
/* The first index is always the cluster index. */
......@@ -1630,6 +1630,8 @@ ib_cursor_insert_row(
src_tuple->index->table, q_proc->grph.ins, node->ins);
}
srv_active_wake_master_thread();
return(err);
}
......@@ -1914,6 +1916,8 @@ ib_cursor_update_row(
err = ib_execute_update_query_graph(cursor, pcur);
}
srv_active_wake_master_thread();
return(err);
}
......@@ -2039,6 +2043,8 @@ ib_cursor_delete_row(
err = DB_RECORD_NOT_FOUND;
}
srv_active_wake_master_thread();
return(err);
}
......@@ -2296,12 +2302,14 @@ ib_col_set_value(
ib_tpl_t ib_tpl, /*!< in: tuple instance */
ib_ulint_t col_no, /*!< in: column index in tuple */
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;
dfield_t* dfield;
void* dst = NULL;
ib_tuple_t* tuple = (ib_tuple_t*) ib_tpl;
ulint col_len;
dfield = ib_col_get_dfield(tuple, col_no);
......@@ -2312,6 +2320,7 @@ ib_col_set_value(
}
dtype = dfield_get_type(dfield);
col_len = dtype_get_len(dtype);
/* Not allowed to update system columns. */
if (dtype_get_mtype(dtype) == DATA_SYS) {
......@@ -2325,10 +2334,10 @@ ib_col_set_value(
for that. */
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)) {
dst = mem_heap_alloc(tuple->heap, dtype_get_len(dtype));
dst = mem_heap_alloc(tuple->heap, col_len);
ut_a(dst != NULL);
}
} else if (dst == NULL || len > dfield_get_len(dfield)) {
......@@ -2342,7 +2351,7 @@ ib_col_set_value(
switch (dtype_get_mtype(dtype)) {
case DATA_INT: {
if (dtype_get_len(dtype) == len) {
if (col_len == len) {
ibool usign;
usign = dtype_get_prtype(dtype) & DATA_UNSIGNED;
......@@ -2387,22 +2396,96 @@ ib_col_set_value(
memset((byte*) dst + len,
pad_char,
dtype_get_len(dtype) - len);
col_len - len);
memcpy(dst, src, len);
len = dtype_get_len(dtype);
len = col_len;
break;
}
case DATA_BLOB:
case DATA_BINARY:
case DATA_MYSQL:
case DATA_DECIMAL:
case DATA_VARCHAR:
case DATA_VARMYSQL:
case DATA_FIXBINARY:
if (need_cpy) {
memcpy(dst, src, len);
} else {
dfield_set_data(dfield, src, len);
dst = dfield_get_data(dfield);
}
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:
ut_error;
......@@ -2476,7 +2559,9 @@ ib_col_copy_value_low(
data_len, 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;
} else if (len == 4) {
*(ib_i32_t*)dst = (ib_i32_t)ret;
......@@ -2484,7 +2569,9 @@ ib_col_copy_value_low(
*(ib_i64_t*)dst = (ib_i64_t)ret;
}
} 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;
} else if (len == 4) {
*(ib_u32_t*)dst = (ib_i32_t)ret;
......@@ -3450,7 +3537,7 @@ ib_tuple_write_int(
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(
int col_no, /*!< in: column number */
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(
int col_no, /*!< in: column number */
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(
int col_no, /*!< in: column number */
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(
int col_no, /*!< in: column number */
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(
int col_no, /*!< in: column number */
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(
int col_no, /*!< in: column number */
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(
int col_no, /*!< in: column number */
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(
int col_no, /*!< in: column number */
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(
dfield = ib_col_get_dfield(tuple, col_no);
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 {
return(DB_DATA_MISMATCH);
}
......@@ -3653,7 +3741,8 @@ ib_tuple_write_float(
dfield = ib_col_get_dfield(tuple, col_no);
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 {
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
the terms of the GNU General Public License as published by the Free Software
......@@ -126,7 +126,7 @@ btr_pcur_store_position(
|| mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
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
we do not store the modify_clock, but always do a search
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.
Portions of this file contain modifications contributed and copyrighted by
......@@ -496,14 +496,13 @@ buf_page_is_corrupted(
}
#ifndef UNIV_HOTBACKUP
if (recv_lsn_checks_on) {
if (check_lsn && recv_lsn_checks_on) {
lsn_t current_lsn;
/* Since we are going to reset the page LSN during the import
phase it makes no sense to spam the log with error messages. */
if (check_lsn
&& log_peek_lsn(&current_lsn)
if (log_peek_lsn(&current_lsn)
&& current_lsn
< mach_read_from_8(read_buf + FIL_PAGE_LSN)) {
ut_print_timestamp(stderr);
......@@ -1167,7 +1166,7 @@ buf_chunk_not_freed(
ibool ready;
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_DIRTY:
/* The uncompressed buffer pool should never
......@@ -1492,7 +1491,7 @@ buf_relocate(
ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
#ifdef UNIV_DEBUG
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_FREE:
case BUF_BLOCK_POOL_WATCH:
case BUF_BLOCK_NOT_USED:
case BUF_BLOCK_READY_FOR_USE:
case BUF_BLOCK_FILE_PAGE:
......@@ -1964,7 +1963,7 @@ buf_block_try_discard_uncompressed(
bpage = buf_page_hash_get(buf_pool, space, offset);
if (bpage) {
buf_LRU_free_block(bpage, FALSE);
buf_LRU_free_page(bpage, false);
}
buf_pool_mutex_exit(buf_pool);
......@@ -2014,7 +2013,7 @@ lookup:
buf_read_page(space, zip_size, offset);
#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 */
}
......@@ -2030,11 +2029,11 @@ err_exit:
ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_POOL_WATCH:
case BUF_BLOCK_NOT_USED:
case BUF_BLOCK_READY_FOR_USE:
case BUF_BLOCK_MEMORY:
case BUF_BLOCK_REMOVE_HASH:
case BUF_BLOCK_ZIP_FREE:
break;
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
......@@ -2240,7 +2239,7 @@ buf_block_align_instance(
mutex_enter(&block->mutex);
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_DIRTY:
/* These types should only be used in
......@@ -2436,7 +2435,6 @@ buf_page_get_gen(
ibool must_read;
rw_lock_t* hash_lock;
ib_mutex_t* block_mutex;
buf_page_t* hash_bpage;
ulint retries = 0;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
......@@ -2489,7 +2487,6 @@ loop:
block = guess = NULL;
} else {
ut_ad(!block->page.in_zip_hash);
ut_ad(block->page.in_page_hash);
}
}
......@@ -2543,6 +2540,10 @@ loop:
retries = 0;
} else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
++retries;
DBUG_EXECUTE_IF(
"innodb_page_corruption_retries",
retries = BUF_PAGE_READ_MAX_RETRIES;
);
} else {
fprintf(stderr, "InnoDB: Error: Unable"
" to read tablespace %lu page no"
......@@ -2564,7 +2565,7 @@ loop:
}
#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 */
goto loop;
}
......@@ -2590,6 +2591,7 @@ got_block:
/* The page is being read to buffer pool,
but we cannot wait around for the read to
complete. */
null_exit:
mutex_exit(block_mutex);
return(NULL);
......@@ -2603,6 +2605,14 @@ got_block:
case BUF_BLOCK_ZIP_PAGE:
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;
if (bpage->buf_fix_count
......@@ -2735,7 +2745,7 @@ wait_until_unfixed:
break;
case BUF_BLOCK_ZIP_FREE:
case BUF_BLOCK_POOL_WATCH:
case BUF_BLOCK_NOT_USED:
case BUF_BLOCK_READY_FOR_USE:
case BUF_BLOCK_MEMORY:
......@@ -2780,7 +2790,7 @@ wait_until_unfixed:
relocated or enter or exit the buf_pool while we
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);
rw_lock_x_lock(hash_lock);
......@@ -3728,7 +3738,7 @@ buf_page_create(
memset(frame + FIL_PAGE_FILE_FLUSH_LSN, 0, 8);
#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 */
#ifdef UNIV_IBUF_COUNT_DEBUG
ut_a(ibuf_count_get(buf_block_get_space(block),
......@@ -4196,7 +4206,7 @@ buf_pool_invalidate_instance(
pool invalidation to proceed we must ensure there is NO
write activity happening. */
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_flush_wait_batch_end(buf_pool, type);
......@@ -4285,7 +4295,7 @@ buf_pool_validate_instance(
mutex_enter(&block->mutex);
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_DIRTY:
/* These should only occur on
......@@ -4378,7 +4388,7 @@ assert_s_latched:
/* All clean blocks should be I/O-unfixed. */
break;
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
control block in order to prevent
buf_page_get_gen() from decompressing the block. */
......@@ -4437,7 +4447,7 @@ assert_s_latched:
case BUF_BLOCK_FILE_PAGE:
/* uncompressed page */
break;
case BUF_BLOCK_ZIP_FREE:
case BUF_BLOCK_POOL_WATCH:
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_NOT_USED:
case BUF_BLOCK_READY_FOR_USE:
......@@ -4720,7 +4730,7 @@ buf_get_latched_pages_number_instance(
case BUF_BLOCK_FILE_PAGE:
/* uncompressed page */
break;
case BUF_BLOCK_ZIP_FREE:
case BUF_BLOCK_POOL_WATCH:
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_NOT_USED:
case BUF_BLOCK_READY_FOR_USE:
......@@ -5015,7 +5025,7 @@ buf_print_io_instance(
"Old database pages %lu\n"
"Modified db pages %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->free_list_len,
pool_info->lru_len,
......
This diff is collapsed.
This diff is collapsed.
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.
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
......@@ -107,7 +107,7 @@ buf_read_page_low(
dberr_t* err, /*!< out: DB_SUCCESS or DB_TABLESPACE_DELETED if we are
trying to read from a non-existent tablespace, or a
tablespace which is just now being dropped */
ibool sync, /*!< in: TRUE if synchronous aio is desired */
bool sync, /*!< in: true if synchronous aio is desired */
ulint mode, /*!< in: BUF_READ_IBUF_PAGES_ONLY, ...,
ORed to OS_AIO_SIMULATED_WAKE_LATER (see below
at read-ahead functions) */
......@@ -152,7 +152,7 @@ buf_read_page_low(
syncronous i/o, to make sure they do not get involved in
thread deadlocks. */
sync = TRUE;
sync = true;
}
/* The following call will also check if the tablespace does not exist
......@@ -169,15 +169,17 @@ buf_read_page_low(
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
fprintf(stderr,
"Posting read request for page %lu, sync %lu\n",
(ulong) offset,
(ulong) sync);
"Posting read request for page %lu, sync %s\n",
(ulong) offset, sync ? "true" : "false");
}
#endif
ut_ad(buf_page_in_file(bpage));
thd_wait_begin(NULL, THD_WAIT_DISKIO);
if (sync) {
thd_wait_begin(NULL, THD_WAIT_DISKIO);
}
if (zip_size) {
*err = fil_io(OS_FILE_READ | wake_later
| ignore_nonexistent_pages,
......@@ -191,7 +193,10 @@ buf_read_page_low(
sync, space, 0, offset, 0, UNIV_PAGE_SIZE,
((buf_block_t*) bpage)->frame, bpage);
}
thd_wait_end(NULL);
if (sync) {
thd_wait_end(NULL);
}
if (*err != DB_SUCCESS) {
if (ignore_nonexistent_pages || *err == DB_TABLESPACE_DELETED) {
......@@ -337,7 +342,7 @@ read_ahead:
if (!ibuf_bitmap_page(zip_size, i)) {
count += buf_read_page_low(
&err, FALSE,
&err, false,
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
space, zip_size, FALSE,
tablespace_version, i);
......@@ -401,7 +406,7 @@ buf_read_page(
/* We do the i/o in the synchronous aio mode to save thread
switches: hence TRUE */
count = buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
count = buf_read_page_low(&err, true, BUF_READ_ANY_PAGE, space,
zip_size, FALSE,
tablespace_version, offset);
srv_stats.buf_pool_reads.add(count);
......@@ -447,7 +452,7 @@ buf_read_page_async(
tablespace_version = fil_space_get_version(space);
count = buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE
count = buf_read_page_low(&err, true, BUF_READ_ANY_PAGE
| OS_AIO_SIMULATED_WAKE_LATER
| BUF_READ_IGNORE_NONEXISTENT_PAGES,
space, zip_size, FALSE,
......@@ -708,7 +713,7 @@ buf_read_ahead_linear(
if (!ibuf_bitmap_page(zip_size, i)) {
count += buf_read_page_low(
&err, FALSE,
&err, false,
ibuf_mode,
space, zip_size, FALSE, tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) {
......@@ -754,7 +759,7 @@ UNIV_INTERN
void
buf_read_ibuf_merge_pages(
/*======================*/
ibool sync, /*!< in: TRUE if the caller
bool sync, /*!< in: true if the caller
wants this function to wait
for the highest address page
to get read in, before this
......@@ -893,11 +898,11 @@ buf_read_recv_pages(
os_aio_print_debug = FALSE;
if ((i + 1 == n_stored) && sync) {
buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
buf_read_page_low(&err, true, BUF_READ_ANY_PAGE, space,
zip_size, TRUE, tablespace_version,
page_nos[i]);
} else {
buf_read_page_low(&err, FALSE, BUF_READ_ANY_PAGE
buf_read_page_low(&err, false, BUF_READ_ANY_PAGE
| OS_AIO_SIMULATED_WAKE_LATER,
space, zip_size, TRUE,
tablespace_version, page_nos[i]);
......
#!/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
# the terms of the GNU General Public License as published by the Free Software
......
......@@ -32,7 +32,6 @@ Created 4/18/1996 Heikki Tuuri
#include "dict0crea.h"
#include "btr0btr.h"
#include "dict0load.h"
#include "dict0load.h"
#include "trx0trx.h"
#include "srv0srv.h"
#include "ibuf0ibuf.h"
......
......@@ -44,6 +44,7 @@ Created 1/8/1996 Heikki Tuuri
#include "ut0vec.h"
#include "dict0priv.h"
#include "fts0priv.h"
#include "ha_prototypes.h"
/*****************************************************************//**
Based on a table object, this function builds the entry to be inserted
......@@ -891,11 +892,15 @@ create:
for (index = UT_LIST_GET_FIRST(table->indexes);
index;
index = UT_LIST_GET_NEXT(indexes, index)) {
if (index->id == index_id && !(index->type & DICT_FTS)) {
root_page_no = btr_create(type, space, zip_size,
index_id, index, mtr);
index->page = (unsigned int) root_page_no;
return(root_page_no);
if (index->id == index_id) {
if (index->type & DICT_FTS) {
return(FIL_NULL);
} else {
root_page_no = btr_create(type, space, zip_size,
index_id, index, mtr);
index->page = (unsigned int) root_page_no;
return(root_page_no);
}
}
}
......@@ -1453,11 +1458,11 @@ static __attribute__((nonnull, warn_unused_result))
dberr_t
dict_foreign_eval_sql(
/*==================*/
pars_info_t* info, /*!< in: info struct, or NULL */
pars_info_t* info, /*!< in: info struct */
const char* sql, /*!< in: SQL string to evaluate */
dict_table_t* table, /*!< in: table */
dict_foreign_t* foreign,/*!< in: foreign */
trx_t* trx) /*!< in: transaction */
const char* name, /*!< in: table name (for diagnostics) */
const char* id, /*!< in: foreign key id */
trx_t* trx) /*!< in/out: transaction */
{
dberr_t error;
FILE* ef = dict_foreign_err_file;
......@@ -1470,9 +1475,9 @@ dict_foreign_eval_sql(
ut_print_timestamp(ef);
fputs(" Error in foreign key constraint creation for table ",
ef);
ut_print_name(ef, trx, TRUE, table->name);
ut_print_name(ef, trx, TRUE, name);
fputs(".\nA foreign key constraint of name ", ef);
ut_print_name(ef, trx, TRUE, foreign->id);
ut_print_name(ef, trx, TRUE, id);
fputs("\nalready exists."
" (Note that internally InnoDB adds 'databasename'\n"
"in front of the user-defined constraint name.)\n"
......@@ -1499,7 +1504,7 @@ dict_foreign_eval_sql(
ut_print_timestamp(ef);
fputs(" Internal error in foreign key constraint creation"
" for table ", ef);
ut_print_name(ef, trx, TRUE, table->name);
ut_print_name(ef, trx, TRUE, name);
fputs(".\n"
"See the MySQL .err log in the datadir"
" for more information.\n", ef);
......@@ -1519,10 +1524,10 @@ static __attribute__((nonnull, warn_unused_result))
dberr_t
dict_create_add_foreign_field_to_dictionary(
/*========================================*/
ulint field_nr, /*!< in: foreign field number */
dict_table_t* table, /*!< in: table */
dict_foreign_t* foreign, /*!< in: foreign */
trx_t* trx) /*!< in: transaction */
ulint field_nr, /*!< in: field number */
const char* table_name, /*!< in: table name */
const dict_foreign_t* foreign, /*!< in: foreign */
trx_t* trx) /*!< in/out: transaction */
{
pars_info_t* info = pars_info_create();
......@@ -1543,48 +1548,26 @@ dict_create_add_foreign_field_to_dictionary(
"INSERT INTO SYS_FOREIGN_COLS VALUES"
"(:id, :pos, :for_col_name, :ref_col_name);\n"
"END;\n",
table, foreign, trx));
table_name, foreign->id, trx));
}
/********************************************************************//**
Add a single foreign key definition to the data dictionary tables in the
database. We also generate names to constraints that were not named by the
user. A generated constraint has a name of the format
databasename/tablename_ibfk_NUMBER, where the numbers start from 1, and
are given locally for this table, that is, the number is not global, as in
the old format constraints < 4.0.18 it used to be.
Add a foreign key definition to the data dictionary tables.
@return error code or DB_SUCCESS */
UNIV_INTERN
dberr_t
dict_create_add_foreign_to_dictionary(
/*==================================*/
ulint* id_nr, /*!< in/out: number to use in id generation;
incremented if used */
dict_table_t* table, /*!< in: table */
dict_foreign_t* foreign,/*!< in: foreign */
trx_t* trx) /*!< in/out: dictionary transaction */
const char* name, /*!< in: table name */
const dict_foreign_t* foreign,/*!< in: foreign key */
trx_t* trx) /*!< in/out: dictionary transaction */
{
dberr_t error;
ulint i;
pars_info_t* info = pars_info_create();
if (foreign->id == NULL) {
/* Generate a new constraint id */
char* id;
ulint namelen = strlen(table->name);
id = static_cast<char*>(mem_heap_alloc(
foreign->heap, namelen + 20));
/* no overflow if number < 1e13 */
sprintf(id, "%s_ibfk_%lu", table->name, (ulong) (*id_nr)++);
foreign->id = id;
}
pars_info_add_str_literal(info, "id", foreign->id);
pars_info_add_str_literal(info, "for_name", table->name);
pars_info_add_str_literal(info, "for_name", name);
pars_info_add_str_literal(info, "ref_name",
foreign->referenced_table_name);
......@@ -1598,16 +1581,16 @@ dict_create_add_foreign_to_dictionary(
"INSERT INTO SYS_FOREIGN VALUES"
"(:id, :for_name, :ref_name, :n_cols);\n"
"END;\n"
, table, foreign, trx);
, name, foreign->id, trx);
if (error != DB_SUCCESS) {
return(error);
}
for (i = 0; i < foreign->n_fields; i++) {
for (ulint i = 0; i < foreign->n_fields; i++) {
error = dict_create_add_foreign_field_to_dictionary(
i, table, foreign, trx);
i, name, foreign, trx);
if (error != DB_SUCCESS) {
......@@ -1654,7 +1637,15 @@ dict_create_add_foreigns_to_dictionary(
foreign;
foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) {
error = dict_create_add_foreign_to_dictionary(&number, table,
error = dict_create_add_foreign_id(&number, table->name,
foreign);
if (error != DB_SUCCESS) {
return(error);
}
error = dict_create_add_foreign_to_dictionary(table->name,
foreign, trx);
if (error != DB_SUCCESS) {
......
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.
This program is free software; you can redistribute it and/or modify it under
......@@ -53,10 +53,6 @@ Created 1/8/1996 Heikki Tuuri
UNIV_INTERN mysql_pfs_key_t autoinc_mutex_key;
#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.
@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
the terms of the GNU General Public License as published by the Free Software
......@@ -35,7 +35,7 @@ UNIV_INTERN
dyn_block_t*
dyn_array_add_block(
/*================*/
dyn_array_t* arr) /*!< in: dyn array */
dyn_array_t* arr) /*!< in/out: dyn array */
{
mem_heap_t* heap;
dyn_block_t* block;
......
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.
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
......@@ -1035,6 +1035,11 @@ fsp_try_extend_data_file(
success = fil_extend_space_to_desired_size(&actual_size, space,
size + size_increase);
if (!success) {
return(false);
}
/* We ignore any fragments of a full megabyte when storing the size
to the space header */
......
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
Copyright (c) 2007, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2007, 2013, Oracle and/or its affiliates. All Rights Reserved.
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
......@@ -221,7 +221,7 @@ fts_config_set_value(
graph = fts_parse_sql(
fts_table, info,
"BEGIN UPDATE %s SET value = :value WHERE key = :name;");
"BEGIN UPDATE \"%s\" SET value = :value WHERE key = :name;");
trx->op_info = "setting FTS config value";
......@@ -246,7 +246,7 @@ fts_config_set_value(
graph = fts_parse_sql(
fts_table, info,
"BEGIN\n"
"INSERT INTO %s VALUES(:name, :value);");
"INSERT INTO \"%s\" VALUES(:name, :value);");
trx->op_info = "inserting FTS config value";
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
Copyright (c) 2007, 2011, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2007, 2013, Oracle and/or its affiliates. All Rights Reserved.
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
......@@ -193,6 +193,10 @@ term : FTS_TERM {
free($1);
}
/* Ignore leading '*' */
| '*' term {
$$ = $2;
}
;
text : FTS_TEXT {
......
This diff is collapsed.
This diff is collapsed.
......@@ -62,7 +62,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
return(FTS_TERM);
}
. ;
\n
%%
This diff is collapsed.
......@@ -633,8 +633,8 @@ UNIV_INTERN
void
innobase_copy_frm_flags_from_create_info(
/*=====================================*/
dict_table_t* innodb_table, /*!< in/out: InnoDB table */
HA_CREATE_INFO* create_info); /*!< in: create info */
dict_table_t* innodb_table, /*!< in/out: InnoDB table */
const HA_CREATE_INFO* create_info); /*!< in: create info */
/*********************************************************************//**
Copy table flags from MySQL's TABLE_SHARE into an InnoDB table object.
......@@ -645,5 +645,5 @@ UNIV_INTERN
void
innobase_copy_frm_flags_from_table_share(
/*=====================================*/
dict_table_t* innodb_table, /*!< in/out: InnoDB table */
TABLE_SHARE* table_share); /*!< in: table share */
dict_table_t* innodb_table, /*!< in/out: InnoDB table */
const TABLE_SHARE* table_share); /*!< in: table share */
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
Copyright (c) 2007, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2007, 2013, Oracle and/or its affiliates. All Rights Reserved.
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
......@@ -39,7 +39,6 @@ extern struct st_maria_plugin i_s_innodb_cmpmem;
extern struct st_maria_plugin i_s_innodb_cmpmem_reset;
extern struct st_maria_plugin i_s_innodb_metrics;
extern struct st_maria_plugin i_s_innodb_ft_default_stopword;
extern struct st_maria_plugin i_s_innodb_ft_inserted;
extern struct st_maria_plugin i_s_innodb_ft_deleted;
extern struct st_maria_plugin i_s_innodb_ft_being_deleted;
extern struct st_maria_plugin i_s_innodb_ft_index_cache;
......
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