mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Merge branch '10.0' into 10.1
This commit is contained in:
commit
aeefd26ecb
30 changed files with 284 additions and 104 deletions
|
@ -34,11 +34,6 @@ ENDMACRO()
|
|||
|
||||
MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
|
||||
|
||||
# For NDBCLUSTER: Use bundled zlib by default
|
||||
IF (NOT WITH_ZLIB)
|
||||
SET(WITH_ZLIB "bundled" CACHE STRING "By default use bundled zlib on this platform")
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_ZLIB STREQUAL "bundled")
|
||||
MYSQL_USE_BUNDLED_ZLIB()
|
||||
ELSE()
|
||||
|
|
|
@ -246,4 +246,34 @@ EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL b 263 NULL 3 Using index for group-by
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field
|
||||
#
|
||||
set @save_innodb_file_format= @@innodb_file_format;
|
||||
set @save_innodb_large_prefix= @@innodb_large_prefix;
|
||||
set global innodb_file_format = BARRACUDA;
|
||||
set global innodb_large_prefix = ON;
|
||||
CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2),
|
||||
KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go');
|
||||
explain
|
||||
SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu';
|
||||
MIN(t1.v1)
|
||||
king
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t1 VALUES ('king'), ('bad');
|
||||
explain
|
||||
SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row
|
||||
SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x;
|
||||
MIN(x.v1)
|
||||
NULL
|
||||
drop table t1;
|
||||
set global innodb_file_format = @save_innodb_file_format;
|
||||
set global innodb_large_prefix = @save_innodb_large_prefix;
|
||||
End of 5.5 tests
|
||||
|
|
|
@ -1089,6 +1089,7 @@ from
|
|||
t0 A, t0 B, t0 C;
|
||||
drop table t0,t1;
|
||||
#
|
||||
#
|
||||
# MDEV-10360: Extended keys: index properties depend on index order
|
||||
#
|
||||
create table t0 (a int);
|
||||
|
|
|
@ -37,3 +37,21 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||
1 SIMPLE t0 ALL NULL NULL NULL NULL 10
|
||||
1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join)
|
||||
drop table t0,t1,t2;
|
||||
CREATE TABLE t1 (
|
||||
pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1),
|
||||
KEY(f1), KEY(f2)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES
|
||||
(1,4,'v',NULL),(2,6,'v',NULL),(3,7,'c',NULL),(4,1,'e',NULL),(5,0,'x',NULL),
|
||||
(6,7,'i',NULL),(7,7,'e',NULL),(8,1,'p',NULL),(9,7,'s',NULL),(10,1,'j',NULL),
|
||||
(11,5,'z',NULL),(12,2,'c',NULL),(13,0,'a',NULL),(14,1,'q',NULL),(15,8,'y',NULL),
|
||||
(16,1,'m',NULL),(17,1,'r',NULL),(18,9,'v',NULL),(19,1,'n',NULL);
|
||||
CREATE TABLE t2 (f4 INT, f5 CHAR(1)) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (4,'q'),(NULL,'j');
|
||||
SELECT * FROM t1 AS t1_1, t1 AS t1_2, t2
|
||||
WHERE f5 = t1_2.f2 AND ( t1_1.f1 = 103 AND t1_1.f2 = 'o' OR t1_1.pk < f4 );
|
||||
pk f1 f2 f3 pk f1 f2 f3 f4 f5
|
||||
1 4 v NULL 14 1 q NULL 4 q
|
||||
2 6 v NULL 14 1 q NULL 4 q
|
||||
3 7 c NULL 14 1 q NULL 4 q
|
||||
drop table t1,t2;
|
||||
|
|
|
@ -168,11 +168,24 @@ flush privileges;
|
|||
drop database mysqltest_db1;
|
||||
set global read_only= @start_read_only;
|
||||
#
|
||||
# MDEV-16987 - ALTER DATABASE possible in read-only mode
|
||||
#
|
||||
CREATE USER user1@localhost;
|
||||
GRANT ALTER ON test1.* TO user1@localhost;
|
||||
CREATE DATABASE test1;
|
||||
SET GLOBAL read_only=1;
|
||||
ALTER DATABASE test1 CHARACTER SET utf8;
|
||||
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
|
||||
SET GLOBAL read_only=0;
|
||||
DROP DATABASE test1;
|
||||
DROP USER user1@localhost;
|
||||
USE test;
|
||||
# End of 5.5 tests
|
||||
#
|
||||
# WL#5968 Implement START TRANSACTION READ (WRITE|ONLY);
|
||||
#
|
||||
#
|
||||
# Test interaction with read_only system variable.
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
CREATE USER user1;
|
||||
|
@ -204,3 +217,4 @@ COMMIT;
|
|||
DROP USER user1;
|
||||
SET GLOBAL read_only= 0;
|
||||
DROP TABLE t1;
|
||||
# End of 10.0 tests
|
||||
|
|
|
@ -865,6 +865,27 @@ WHERE T.NAME='test/t1';
|
|||
NAME
|
||||
a
|
||||
DROP TABLE t1;
|
||||
# and an MDEV-18041 regression related to indexes prefixes
|
||||
create table `test` (
|
||||
`test_old` varchar(255) NOT NULL,
|
||||
`other` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`test_old`,`other`),
|
||||
UNIQUE KEY uk (`test_old`(100), `other`)
|
||||
) ENGINE=InnoDB;
|
||||
select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new');
|
||||
name pos
|
||||
test_old 0
|
||||
other 1
|
||||
test_old 0
|
||||
other 1
|
||||
alter table `test` CHANGE COLUMN `test_old` `test_new` varchar(255) NOT NULL;
|
||||
select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new');
|
||||
name pos
|
||||
test_new 0
|
||||
other 1
|
||||
test_new 0
|
||||
other 1
|
||||
drop table `test`;
|
||||
#
|
||||
# BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN
|
||||
# DICT_MEM_TABLE_COL_RENAME_LOW
|
||||
|
|
|
@ -522,6 +522,19 @@ SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
|
|||
WHERE T.NAME='test/t1';
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # and an MDEV-18041 regression related to indexes prefixes
|
||||
create table `test` (
|
||||
`test_old` varchar(255) NOT NULL,
|
||||
`other` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`test_old`,`other`),
|
||||
UNIQUE KEY uk (`test_old`(100), `other`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new');
|
||||
alter table `test` CHANGE COLUMN `test_old` `test_new` varchar(255) NOT NULL;
|
||||
select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new');
|
||||
drop table `test`;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN
|
||||
|
|
|
@ -67,6 +67,18 @@ a
|
|||
-3
|
||||
1
|
||||
include/check_slave_no_error.inc
|
||||
drop table t1, t2;
|
||||
DROP TABLE t1, t2;
|
||||
include/check_slave_no_error.inc
|
||||
create database d;
|
||||
create database e;
|
||||
create database d;
|
||||
create database if not exists e;
|
||||
include/check_slave_no_error.inc
|
||||
drop database d;
|
||||
drop database e;
|
||||
drop database d;
|
||||
drop database if exists e;
|
||||
include/check_slave_no_error.inc
|
||||
SET @@global.slave_exec_mode= @old_slave_exec_mode;
|
||||
include/rpl_end.inc
|
||||
|
|
|
@ -75,9 +75,30 @@ SELECT * FROM t1 ORDER BY a;
|
|||
SELECT * FROM t2 ORDER BY a;
|
||||
--source include/check_slave_no_error.inc
|
||||
|
||||
connection slave;
|
||||
drop table t1, t2;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1, t2;
|
||||
sync_slave_with_master;
|
||||
--source include/check_slave_no_error.inc
|
||||
create database d;
|
||||
create database e;
|
||||
|
||||
connection master;
|
||||
create database d;
|
||||
create database if not exists e;
|
||||
|
||||
sync_slave_with_master;
|
||||
--source include/check_slave_no_error.inc
|
||||
drop database d;
|
||||
drop database e;
|
||||
|
||||
connection master;
|
||||
drop database d;
|
||||
drop database if exists e;
|
||||
sync_slave_with_master;
|
||||
--source include/check_slave_no_error.inc
|
||||
|
||||
SET @@global.slave_exec_mode= @old_slave_exec_mode;
|
||||
|
||||
|
|
|
@ -192,4 +192,30 @@ EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
|
|||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field
|
||||
--echo #
|
||||
|
||||
set @save_innodb_file_format= @@innodb_file_format;
|
||||
set @save_innodb_large_prefix= @@innodb_large_prefix;
|
||||
set global innodb_file_format = BARRACUDA;
|
||||
set global innodb_large_prefix = ON;
|
||||
|
||||
CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2),
|
||||
KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go');
|
||||
explain
|
||||
SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu';
|
||||
SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu';
|
||||
drop table t1;
|
||||
|
||||
CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t1 VALUES ('king'), ('bad');
|
||||
explain
|
||||
SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x;
|
||||
SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x;
|
||||
drop table t1;
|
||||
set global innodb_file_format = @save_innodb_file_format;
|
||||
set global innodb_large_prefix = @save_innodb_large_prefix;
|
||||
|
||||
--echo End of 5.5 tests
|
||||
|
|
|
@ -725,6 +725,7 @@ if ($rows < 2)
|
|||
|
||||
drop table t0,t1;
|
||||
|
||||
--echo #
|
||||
--echo #
|
||||
--echo # MDEV-10360: Extended keys: index properties depend on index order
|
||||
--echo #
|
||||
|
|
|
@ -45,3 +45,20 @@ explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250;
|
|||
|
||||
drop table t0,t1,t2;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1),
|
||||
KEY(f1), KEY(f2)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES
|
||||
(1,4,'v',NULL),(2,6,'v',NULL),(3,7,'c',NULL),(4,1,'e',NULL),(5,0,'x',NULL),
|
||||
(6,7,'i',NULL),(7,7,'e',NULL),(8,1,'p',NULL),(9,7,'s',NULL),(10,1,'j',NULL),
|
||||
(11,5,'z',NULL),(12,2,'c',NULL),(13,0,'a',NULL),(14,1,'q',NULL),(15,8,'y',NULL),
|
||||
(16,1,'m',NULL),(17,1,'r',NULL),(18,9,'v',NULL),(19,1,'n',NULL);
|
||||
|
||||
CREATE TABLE t2 (f4 INT, f5 CHAR(1)) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (4,'q'),(NULL,'j');
|
||||
|
||||
SELECT * FROM t1 AS t1_1, t1 AS t1_2, t2
|
||||
WHERE f5 = t1_2.f2 AND ( t1_1.f1 = 103 AND t1_1.f2 = 'o' OR t1_1.pk < f4 );
|
||||
drop table t1,t2;
|
||||
|
|
|
@ -312,6 +312,23 @@ flush privileges;
|
|||
drop database mysqltest_db1;
|
||||
set global read_only= @start_read_only;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16987 - ALTER DATABASE possible in read-only mode
|
||||
--echo #
|
||||
CREATE USER user1@localhost;
|
||||
GRANT ALTER ON test1.* TO user1@localhost;
|
||||
CREATE DATABASE test1;
|
||||
SET GLOBAL read_only=1;
|
||||
change_user user1;
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
ALTER DATABASE test1 CHARACTER SET utf8;
|
||||
change_user root;
|
||||
SET GLOBAL read_only=0;
|
||||
DROP DATABASE test1;
|
||||
DROP USER user1@localhost;
|
||||
USE test;
|
||||
|
||||
--echo # End of 5.5 tests
|
||||
|
||||
--echo #
|
||||
--echo # WL#5968 Implement START TRANSACTION READ (WRITE|ONLY);
|
||||
|
@ -320,10 +337,6 @@ set global read_only= @start_read_only;
|
|||
--echo #
|
||||
--echo # Test interaction with read_only system variable.
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
|
||||
|
@ -373,3 +386,5 @@ DROP TABLE t1;
|
|||
|
||||
# Wait till all disconnects are completed
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
||||
--echo # End of 10.0 tests
|
||||
|
|
|
@ -382,6 +382,12 @@ enum enum_alter_inplace_result {
|
|||
#define HA_KEY_NULL_LENGTH 1
|
||||
#define HA_KEY_BLOB_LENGTH 2
|
||||
|
||||
/* Maximum length of any index lookup key, in bytes */
|
||||
|
||||
#define MAX_KEY_LENGTH (MAX_DATA_LENGTH_FOR_KEY \
|
||||
+(MAX_REF_PARTS \
|
||||
*(HA_KEY_NULL_LENGTH + HA_KEY_BLOB_LENGTH)))
|
||||
|
||||
#define HA_LEX_CREATE_TMP_TABLE 1
|
||||
#define HA_CREATE_TMP_ALTER 8
|
||||
|
||||
|
@ -3371,14 +3377,14 @@ public:
|
|||
uint max_key_parts() const
|
||||
{ return MY_MIN(MAX_REF_PARTS, max_supported_key_parts()); }
|
||||
uint max_key_length() const
|
||||
{ return MY_MIN(MAX_KEY_LENGTH, max_supported_key_length()); }
|
||||
{ return MY_MIN(MAX_DATA_LENGTH_FOR_KEY, max_supported_key_length()); }
|
||||
uint max_key_part_length() const
|
||||
{ return MY_MIN(MAX_KEY_LENGTH, max_supported_key_part_length()); }
|
||||
{ return MY_MIN(MAX_DATA_LENGTH_FOR_KEY, max_supported_key_part_length()); }
|
||||
|
||||
virtual uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; }
|
||||
virtual uint max_supported_keys() const { return 0; }
|
||||
virtual uint max_supported_key_parts() const { return MAX_REF_PARTS; }
|
||||
virtual uint max_supported_key_length() const { return MAX_KEY_LENGTH; }
|
||||
virtual uint max_supported_key_length() const { return MAX_DATA_LENGTH_FOR_KEY; }
|
||||
virtual uint max_supported_key_part_length() const { return 255; }
|
||||
virtual uint min_record_length(uint options) const { return 1; }
|
||||
|
||||
|
|
|
@ -2734,10 +2734,6 @@ bool create_key_parts_for_pseudo_indexes(RANGE_OPT_PARAM *param,
|
|||
{
|
||||
Field **field_ptr;
|
||||
TABLE *table= param->table;
|
||||
partition_info *part_info= NULL;
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
part_info= table->part_info;
|
||||
#endif
|
||||
uint parts= 0;
|
||||
|
||||
for (field_ptr= table->field; *field_ptr; field_ptr++)
|
||||
|
|
|
@ -1987,12 +1987,12 @@ bool partition_info::check_partition_field_length()
|
|||
|
||||
for (i= 0; i < num_part_fields; i++)
|
||||
store_length+= get_partition_field_store_length(part_field_array[i]);
|
||||
if (store_length > MAX_KEY_LENGTH)
|
||||
if (store_length > MAX_DATA_LENGTH_FOR_KEY)
|
||||
DBUG_RETURN(TRUE);
|
||||
store_length= 0;
|
||||
for (i= 0; i < num_subpart_fields; i++)
|
||||
store_length+= get_partition_field_store_length(subpart_field_array[i]);
|
||||
if (store_length > MAX_KEY_LENGTH)
|
||||
if (store_length > MAX_DATA_LENGTH_FOR_KEY)
|
||||
DBUG_RETURN(TRUE);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,17 @@
|
|||
#define MAX_SYS_VAR_LENGTH 32
|
||||
#define MAX_KEY MAX_INDEXES /* Max used keys */
|
||||
#define MAX_REF_PARTS 32 /* Max parts used as ref */
|
||||
#define MAX_KEY_LENGTH 3072 /* max possible key */
|
||||
|
||||
/*
|
||||
Maximum length of the data part of an index lookup key.
|
||||
|
||||
The "data part" is defined as the value itself, not including the
|
||||
NULL-indicator bytes or varchar length bytes ("the Extras"). We need this
|
||||
value because there was a bug where length of the Extras were not counted.
|
||||
|
||||
You probably need MAX_KEY_LENGTH, not this constant.
|
||||
*/
|
||||
#define MAX_DATA_LENGTH_FOR_KEY 3072
|
||||
#if SIZEOF_OFF_T > 4
|
||||
#define MAX_REFLENGTH 8 /* Max length for record ref */
|
||||
#else
|
||||
|
|
|
@ -771,8 +771,7 @@ exit:
|
|||
}
|
||||
|
||||
|
||||
int mysql_create_db(THD *thd, char *db,
|
||||
const DDL_options_st &options,
|
||||
int mysql_create_db(THD *thd, char *db, DDL_options_st options,
|
||||
const Schema_specification_st *create_info)
|
||||
{
|
||||
/*
|
||||
|
@ -780,6 +779,9 @@ int mysql_create_db(THD *thd, char *db,
|
|||
to it, we need to use a copy to make execution prepared statement- safe.
|
||||
*/
|
||||
Schema_specification_st tmp(*create_info);
|
||||
if (thd->slave_thread &&
|
||||
slave_ddl_exec_mode_options == SLAVE_EXEC_MODE_IDEMPOTENT)
|
||||
options.add(DDL_options::OPT_IF_NOT_EXISTS);
|
||||
return mysql_create_db_internal(thd, db, options, &tmp, false);
|
||||
}
|
||||
|
||||
|
@ -1059,6 +1061,9 @@ exit:
|
|||
|
||||
bool mysql_rm_db(THD *thd,char *db, bool if_exists)
|
||||
{
|
||||
if (thd->slave_thread &&
|
||||
slave_ddl_exec_mode_options == SLAVE_EXEC_MODE_IDEMPOTENT)
|
||||
if_exists= true;
|
||||
return mysql_rm_db_internal(thd, db, if_exists, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
|
||||
class THD;
|
||||
|
||||
int mysql_create_db(THD *thd, char *db,
|
||||
const DDL_options_st &options,
|
||||
int mysql_create_db(THD *thd, char *db, DDL_options_st options,
|
||||
const Schema_specification_st *create);
|
||||
bool mysql_alter_db(THD *thd, const char *db,
|
||||
const Schema_specification_st *create);
|
||||
|
|
|
@ -1198,6 +1198,7 @@ static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables)
|
|||
DBUG_RETURN(FALSE);
|
||||
|
||||
if (lex->sql_command == SQLCOM_CREATE_DB ||
|
||||
lex->sql_command == SQLCOM_ALTER_DB ||
|
||||
lex->sql_command == SQLCOM_DROP_DB)
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
|
|
|
@ -19361,6 +19361,10 @@ test_if_quick_select(JOIN_TAB *tab)
|
|||
|
||||
delete tab->select->quick;
|
||||
tab->select->quick=0;
|
||||
|
||||
if (tab->table->file->inited != handler::NONE)
|
||||
tab->table->file->ha_index_or_rnd_end();
|
||||
|
||||
int res= tab->select->test_quick_select(tab->join->thd, tab->keys,
|
||||
(table_map) 0, HA_POS_ERROR, 0,
|
||||
FALSE, /*remove where parts*/FALSE);
|
||||
|
|
|
@ -1851,7 +1851,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||
uint pk_part_length= key_first_info->key_part[i].store_length;
|
||||
if (keyinfo->ext_key_part_map & 1<<i)
|
||||
{
|
||||
if (ext_key_length + pk_part_length > MAX_KEY_LENGTH)
|
||||
if (ext_key_length + pk_part_length > MAX_DATA_LENGTH_FOR_KEY)
|
||||
{
|
||||
add_keyparts_for_this_key= i;
|
||||
break;
|
||||
|
@ -1861,9 +1861,9 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||
}
|
||||
}
|
||||
|
||||
if (add_keyparts_for_this_key < (keyinfo->ext_key_parts -
|
||||
keyinfo->user_defined_key_parts))
|
||||
{
|
||||
if (add_keyparts_for_this_key < keyinfo->ext_key_parts -
|
||||
keyinfo->user_defined_key_parts)
|
||||
{
|
||||
share->ext_key_parts-= keyinfo->ext_key_parts;
|
||||
key_part_map ext_key_part_map= keyinfo->ext_key_part_map;
|
||||
keyinfo->ext_key_parts= keyinfo->user_defined_key_parts;
|
||||
|
|
|
@ -4650,36 +4650,40 @@ err_exit:
|
|||
index != NULL;
|
||||
index = dict_table_get_next_index(index)) {
|
||||
|
||||
bool has_prefixes = false;
|
||||
for (size_t i = 0; i < dict_index_get_n_fields(index); i++) {
|
||||
if (dict_index_get_nth_field(index, i)->prefix_len) {
|
||||
has_prefixes = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (ulint i = 0; i < dict_index_get_n_fields(index); i++) {
|
||||
if (my_strcasecmp(
|
||||
system_charset_info,
|
||||
dict_index_get_nth_field(index, i)->name,
|
||||
from)) {
|
||||
const dict_field_t* field
|
||||
= dict_index_get_nth_field(index, i);
|
||||
if (my_strcasecmp(system_charset_info, field->name,
|
||||
from)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
info = pars_info_create();
|
||||
|
||||
int pos = i;
|
||||
if (has_prefixes) {
|
||||
pos = (pos << 16) + field->prefix_len;
|
||||
}
|
||||
|
||||
pars_info_add_ull_literal(info, "indexid", index->id);
|
||||
pars_info_add_int4_literal(info, "nth", i);
|
||||
pars_info_add_int4_literal(info, "nth", pos);
|
||||
pars_info_add_str_literal(info, "new", to);
|
||||
|
||||
error = que_eval_sql(
|
||||
info,
|
||||
"PROCEDURE RENAME_SYS_FIELDS_PROC () IS\n"
|
||||
"BEGIN\n"
|
||||
|
||||
"UPDATE SYS_FIELDS SET COL_NAME=:new\n"
|
||||
"WHERE INDEX_ID=:indexid\n"
|
||||
"AND POS=:nth;\n"
|
||||
|
||||
/* Try again, in case there is a prefix_len
|
||||
encoded in SYS_FIELDS.POS */
|
||||
|
||||
"UPDATE SYS_FIELDS SET COL_NAME=:new\n"
|
||||
"WHERE INDEX_ID=:indexid\n"
|
||||
"AND POS>=65536*:nth AND POS<65536*(:nth+1);\n"
|
||||
|
||||
"END;\n",
|
||||
FALSE, trx);
|
||||
|
||||
|
|
|
@ -4470,7 +4470,8 @@ do_drop:
|
|||
char msg_tablename[MAX_FULL_NAME_LEN + 1];
|
||||
|
||||
innobase_format_name(
|
||||
msg_tablename, sizeof(tablename),
|
||||
msg_tablename,
|
||||
sizeof msg_tablename,
|
||||
tablename, FALSE);
|
||||
|
||||
ib_logf(IB_LOG_LEVEL_INFO,
|
||||
|
|
|
@ -4666,36 +4666,40 @@ err_exit:
|
|||
index != NULL;
|
||||
index = dict_table_get_next_index(index)) {
|
||||
|
||||
bool has_prefixes = false;
|
||||
for (size_t i = 0; i < dict_index_get_n_fields(index); i++) {
|
||||
if (dict_index_get_nth_field(index, i)->prefix_len) {
|
||||
has_prefixes = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (ulint i = 0; i < dict_index_get_n_fields(index); i++) {
|
||||
if (my_strcasecmp(
|
||||
system_charset_info,
|
||||
dict_index_get_nth_field(index, i)->name,
|
||||
from)) {
|
||||
const dict_field_t* field
|
||||
= dict_index_get_nth_field(index, i);
|
||||
if (my_strcasecmp(system_charset_info, field->name,
|
||||
from)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
info = pars_info_create();
|
||||
|
||||
int pos = i;
|
||||
if (has_prefixes) {
|
||||
pos = (pos << 16) + field->prefix_len;
|
||||
}
|
||||
|
||||
pars_info_add_ull_literal(info, "indexid", index->id);
|
||||
pars_info_add_int4_literal(info, "nth", i);
|
||||
pars_info_add_int4_literal(info, "nth", pos);
|
||||
pars_info_add_str_literal(info, "new", to);
|
||||
|
||||
error = que_eval_sql(
|
||||
info,
|
||||
"PROCEDURE RENAME_SYS_FIELDS_PROC () IS\n"
|
||||
"BEGIN\n"
|
||||
|
||||
"UPDATE SYS_FIELDS SET COL_NAME=:new\n"
|
||||
"WHERE INDEX_ID=:indexid\n"
|
||||
"AND POS=:nth;\n"
|
||||
|
||||
/* Try again, in case there is a prefix_len
|
||||
encoded in SYS_FIELDS.POS */
|
||||
|
||||
"UPDATE SYS_FIELDS SET COL_NAME=:new\n"
|
||||
"WHERE INDEX_ID=:indexid\n"
|
||||
"AND POS>=65536*:nth AND POS<65536*(:nth+1);\n"
|
||||
|
||||
"END;\n",
|
||||
FALSE, trx);
|
||||
|
||||
|
|
|
@ -4481,7 +4481,8 @@ do_drop:
|
|||
char msg_tablename[MAX_FULL_NAME_LEN + 1];
|
||||
|
||||
innobase_format_name(
|
||||
msg_tablename, sizeof(tablename),
|
||||
msg_tablename,
|
||||
sizeof msg_tablename,
|
||||
tablename, FALSE);
|
||||
|
||||
ib_logf(IB_LOG_LEVEL_INFO,
|
||||
|
|
|
@ -48,9 +48,6 @@ pthread_handler_t test_lf_pinbox(void *arg)
|
|||
pins= lf_pinbox_get_pins(&lf_allocator.pinbox);
|
||||
}
|
||||
lf_pinbox_put_pins(pins);
|
||||
pthread_mutex_lock(&mutex);
|
||||
if (!--running_threads) pthread_cond_signal(&cond);
|
||||
pthread_mutex_unlock(&mutex);
|
||||
|
||||
if (with_my_thread_init)
|
||||
my_thread_end();
|
||||
|
@ -105,7 +102,6 @@ pthread_handler_t test_lf_alloc(void *arg)
|
|||
bad|= lf_allocator.mallocs - lf_alloc_pool_count(&lf_allocator);
|
||||
#endif
|
||||
}
|
||||
if (!--running_threads) pthread_cond_signal(&cond);
|
||||
pthread_mutex_unlock(&mutex);
|
||||
|
||||
if (with_my_thread_init)
|
||||
|
@ -172,7 +168,6 @@ pthread_handler_t test_lf_hash(void *arg)
|
|||
lf_hash.size, inserts, scans);
|
||||
bad|= lf_hash.count;
|
||||
}
|
||||
if (!--running_threads) pthread_cond_signal(&cond);
|
||||
pthread_mutex_unlock(&mutex);
|
||||
if (with_my_thread_init)
|
||||
my_thread_end();
|
||||
|
|
|
@ -29,9 +29,6 @@ pthread_handler_t test_atomic_add(void *arg)
|
|||
my_atomic_add32(&bad, x);
|
||||
my_atomic_add32(&bad, -x);
|
||||
}
|
||||
pthread_mutex_lock(&mutex);
|
||||
if (!--running_threads) pthread_cond_signal(&cond);
|
||||
pthread_mutex_unlock(&mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -47,13 +44,6 @@ pthread_handler_t test_atomic_add64(void *arg)
|
|||
my_atomic_add64(&a64, x);
|
||||
my_atomic_add64(&a64, -x);
|
||||
}
|
||||
pthread_mutex_lock(&mutex);
|
||||
if (!--running_threads)
|
||||
{
|
||||
bad= (a64 != 0);
|
||||
pthread_cond_signal(&cond);
|
||||
}
|
||||
pthread_mutex_unlock(&mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -83,9 +73,6 @@ pthread_handler_t test_atomic_fas(void *arg)
|
|||
|
||||
my_atomic_add32(&bad, -x);
|
||||
|
||||
pthread_mutex_lock(&mutex);
|
||||
if (!--running_threads) pthread_cond_signal(&cond);
|
||||
pthread_mutex_unlock(&mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -109,9 +96,6 @@ pthread_handler_t test_atomic_cas(void *arg)
|
|||
ok= my_atomic_cas32(&bad, &y, y-x);
|
||||
} while (!ok) ;
|
||||
}
|
||||
pthread_mutex_lock(&mutex);
|
||||
if (!--running_threads) pthread_cond_signal(&cond);
|
||||
pthread_mutex_unlock(&mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -146,4 +130,5 @@ void do_tests()
|
|||
}
|
||||
a64=0;
|
||||
test_concurrently("my_atomic_add64", test_atomic_add64, THREADS, CYCLES);
|
||||
bad= (a64 != 0);
|
||||
}
|
||||
|
|
|
@ -20,35 +20,34 @@
|
|||
#include <tap.h>
|
||||
|
||||
volatile uint32 bad;
|
||||
pthread_attr_t thr_attr;
|
||||
pthread_mutex_t mutex;
|
||||
pthread_cond_t cond;
|
||||
uint running_threads;
|
||||
|
||||
void do_tests();
|
||||
|
||||
void test_concurrently(const char *test, pthread_handler handler, int n, int m)
|
||||
{
|
||||
pthread_t t;
|
||||
pthread_t *threads= malloc(n * sizeof(pthread_t));
|
||||
int i;
|
||||
ulonglong now= my_interval_timer();
|
||||
|
||||
assert(threads);
|
||||
bad= 0;
|
||||
|
||||
diag("Testing %s with %d threads, %d iterations... ", test, n, m);
|
||||
for (running_threads= n ; n ; n--)
|
||||
for (i= n; i; i--)
|
||||
{
|
||||
if (pthread_create(&t, &thr_attr, handler, &m) != 0)
|
||||
if (pthread_create(&threads[i], 0, handler, &m) != 0)
|
||||
{
|
||||
diag("Could not create thread");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
pthread_mutex_lock(&mutex);
|
||||
while (running_threads)
|
||||
pthread_cond_wait(&cond, &mutex);
|
||||
pthread_mutex_unlock(&mutex);
|
||||
|
||||
for (i= n; i; i--)
|
||||
pthread_join(threads[i], 0);
|
||||
|
||||
now= my_interval_timer() - now;
|
||||
free(threads);
|
||||
ok(!bad, "tested %s in %g secs (%d)", test, ((double)now)/1e9, bad);
|
||||
}
|
||||
|
||||
|
@ -60,9 +59,6 @@ int main(int argc __attribute__((unused)), char **argv)
|
|||
DBUG_SET_INITIAL(argv[1]);
|
||||
|
||||
pthread_mutex_init(&mutex, 0);
|
||||
pthread_cond_init(&cond, 0);
|
||||
pthread_attr_init(&thr_attr);
|
||||
pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED);
|
||||
|
||||
#define CYCLES 3000
|
||||
#define THREADS 30
|
||||
|
@ -71,16 +67,7 @@ int main(int argc __attribute__((unused)), char **argv)
|
|||
|
||||
do_tests();
|
||||
|
||||
/*
|
||||
workaround until we know why it crashes randomly on some machine
|
||||
(BUG#22320).
|
||||
*/
|
||||
#ifdef NOT_USED
|
||||
sleep(2);
|
||||
#endif
|
||||
pthread_mutex_destroy(&mutex);
|
||||
pthread_cond_destroy(&cond);
|
||||
pthread_attr_destroy(&thr_attr);
|
||||
my_end(0);
|
||||
return exit_status();
|
||||
}
|
||||
|
|
|
@ -136,10 +136,8 @@ retry:
|
|||
pthread_mutex_unlock(&lock);
|
||||
pthread_mutex_unlock(& thds[id].lock);
|
||||
wt_thd_destroy(& thds[id].thd);
|
||||
|
||||
if (!--running_threads) /* now, signal when everybody is done with deinit */
|
||||
pthread_cond_signal(&cond);
|
||||
pthread_mutex_unlock(&mutex);
|
||||
|
||||
DBUG_PRINT("wt", ("exiting"));
|
||||
my_thread_end();
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue