Merge branch '10.0' into 10.1

This commit is contained in:
Sergei Golubchik 2015-11-19 15:52:14 +01:00
commit beded7d9c9
186 changed files with 2827 additions and 965 deletions

View File

@ -1106,7 +1106,7 @@ inline int get_command_index(char cmd_char)
All client-specific commands are in the first part of commands array
and have a function to implement it.
*/
for (uint i= 0; *commands[i].func; i++)
for (uint i= 0; commands[i].func; i++)
if (commands[i].cmd_char == cmd_char)
return i;
return -1;

View File

@ -879,6 +879,7 @@ static const char *expected_errors[]=
"ERROR 1060", /* Duplicate column name */
"ERROR 1061", /* Duplicate key name */
"ERROR 1054", /* Unknown column */
"ERROR 1290", /* RR_OPTION_PREVENTS_STATEMENT */
0
};

View File

@ -5101,7 +5101,7 @@ static st_error global_error_names[] =
#include <my_base.h>
static st_error handler_error_names[] =
{
{ "<No error>", -1U, "" },
{ "<No error>", UINT_MAX, "" },
#include <handler_ername.h>
{ 0, 0, 0 }
};

View File

@ -95,8 +95,11 @@ IF(MSVC)
STRING(REGEX REPLACE "/STACK:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS}")
STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
STRING(REGEX REPLACE "/INCREMENTAL$" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_DEBUG "${CMAKE_${type}_LINKER_FLAGS_DEBUG}")
STRING(REGEX REPLACE "/INCREMENTAL$" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_DEBUG "${CMAKE_${type}_LINKER_FLAGS_DEBUG}")
SET(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF /release")
ENDFOREACH()
# Mark 32 bit executables large address aware so they can
# use > 2GB address space
@ -112,7 +115,7 @@ IF(MSVC)
#TODO: update the code and remove the disabled warnings
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /we4099")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /we4099")
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
# _WIN64 is defined by the compiler itself.
@ -180,14 +183,14 @@ CHECK_SYMBOL_REPLACEMENT(S_IROTH _S_IREAD sys/stat.h)
CHECK_SYMBOL_REPLACEMENT(S_IFIFO _S_IFIFO sys/stat.h)
CHECK_SYMBOL_REPLACEMENT(SIGQUIT SIGTERM signal.h)
CHECK_SYMBOL_REPLACEMENT(SIGPIPE SIGINT signal.h)
CHECK_SYMBOL_REPLACEMENT(isnan _isnan float.h)
CHECK_SYMBOL_REPLACEMENT(finite _finite float.h)
CHECK_SYMBOL_REPLACEMENT(isnan _isnan "math.h;float.h")
CHECK_SYMBOL_REPLACEMENT(finite _finite "math;float.h")
CHECK_FUNCTION_REPLACEMENT(popen _popen)
CHECK_FUNCTION_REPLACEMENT(pclose _pclose)
CHECK_FUNCTION_REPLACEMENT(access _access)
CHECK_FUNCTION_REPLACEMENT(strcasecmp _stricmp)
CHECK_FUNCTION_REPLACEMENT(strncasecmp _strnicmp)
CHECK_FUNCTION_REPLACEMENT(snprintf _snprintf)
CHECK_SYMBOL_REPLACEMENT(snprintf _snprintf stdio.h)
CHECK_FUNCTION_REPLACEMENT(strtok_r strtok_s)
CHECK_FUNCTION_REPLACEMENT(strtoll _strtoi64)
CHECK_FUNCTION_REPLACEMENT(strtoull _strtoui64)

View File

@ -102,7 +102,6 @@ SET(HAVE_IPPROTO_IPV6 CACHE INTERNAL "")
SET(HAVE_IPV6 TRUE CACHE INTERNAL "")
SET(HAVE_IPV6_V6ONLY 1 CACHE INTERNAL "")
SET(HAVE_ISINF CACHE INTERNAL "")
SET(HAVE_ISNAN CACHE INTERNAL "")
SET(HAVE_ISSETUGID CACHE INTERNAL "")
SET(HAVE_GETUID CACHE INTERNAL "")
SET(HAVE_GETEUID CACHE INTERNAL "")
@ -232,7 +231,6 @@ SET(HAVE_SIZEOF_ULONG FALSE CACHE INTERNAL "")
SET(HAVE_SIZEOF_U_INT32_T FALSE CACHE INTERNAL "")
SET(HAVE_SIZE_OF_SSIZE_T FALSE CACHE INTERNAL "")
SET(HAVE_SLEEP CACHE INTERNAL "")
SET(HAVE_SNPRINTF CACHE INTERNAL "")
SET(HAVE_SOCKADDR_STORAGE_SS_FAMILY 1 CACHE INTERNAL "")
SET(HAVE_SOLARIS_STYLE_GETHOST CACHE INTERNAL "")
SET(STACK_DIRECTION -1 CACHE INTERNAL "")
@ -326,10 +324,8 @@ SET(WORDS_BIGENDIAN CACHE INTERNAL "")
SET(HAVE__S_IFIFO 1 CACHE INTERNAL "")
SET(HAVE__S_IREAD 1 CACHE INTERNAL "")
SET(HAVE__finite 1 CACHE INTERNAL "")
SET(HAVE__isnan 1 CACHE INTERNAL "")
SET(HAVE__pclose 1 CACHE INTERNAL "")
SET(HAVE__popen 1 CACHE INTERNAL "")
SET(HAVE__snprintf 1 CACHE INTERNAL "")
SET(HAVE__stricmp 1 CACHE INTERNAL "")
SET(HAVE__strnicmp 1 CACHE INTERNAL "")
SET(HAVE__strtoi64 1 CACHE INTERNAL "")

View File

@ -325,6 +325,8 @@
#cmakedefine HAVE_TIMESPEC_TS_SEC 1
#cmakedefine STRUCT_DIRENT_HAS_D_INO 1
#cmakedefine STRUCT_DIRENT_HAS_D_NAMLEN 1
#cmakedefine STRUCT_TIMESPEC_HAS_TV_SEC 1
#cmakedefine STRUCT_TIMESPEC_HAS_TV_NSEC 1
#cmakedefine SPRINTF_RETURNS_INT 1
#define USE_MB 1
@ -496,6 +498,7 @@
#define SYSTEM_TYPE "@SYSTEM_TYPE@"
#define MACHINE_TYPE "@CMAKE_SYSTEM_PROCESSOR@"
#define DEFAULT_MACHINE "@DEFAULT_MACHINE@"
#cmakedefine HAVE_DTRACE 1
#cmakedefine SIGNAL_WITH_VIO_CLOSE 1
@ -521,6 +524,10 @@
#cmakedefine strtoll @strtoll@
#cmakedefine strtoull @strtoull@
#cmakedefine vsnprintf @vsnprintf@
#if (_MSC_VER > 1800)
#define tzname _tzname
#define P_tmpdir "C:\\TEMP"
#endif
#if (_MSC_VER > 1310)
# define HAVE_SETENV
#define setenv(a,b,c) _putenv_s(a,b)
@ -529,7 +536,7 @@
/* We don't want the min/max macros */
#ifdef __WIN__
#define NOMINMAX
#define NOMINMAX 1
#endif
/*

View File

@ -1067,6 +1067,9 @@ CHECK_STRUCT_HAS_MEMBER("struct dirent" d_namlen "dirent.h" STRUCT_DIRENT_HAS_D
SET(SPRINTF_RETURNS_INT 1)
CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_H)
CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_sec "time.h" STRUCT_TIMESPEC_HAS_TV_SEC)
CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_nsec "time.h" STRUCT_TIMESPEC_HAS_TV_NSEC)
IF(NOT MSVC)
CHECK_C_SOURCE_RUNS(
"

View File

@ -16,6 +16,10 @@
#ifndef _decimal_h
#define _decimal_h
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{TRUNCATE=0, HALF_EVEN, HALF_UP, CEILING, FLOOR}
decimal_round_mode;
@ -112,5 +116,9 @@ void max_decimal(int precision, int frac, decimal_t *to);
#define E_DEC_ERROR 31
#define E_DEC_FATAL_ERROR 30
#ifdef __cplusplus
}
#endif
#endif

View File

@ -86,10 +86,12 @@ typedef volatile LONG my_pthread_once_t;
#define MY_PTHREAD_ONCE_INPROGRESS 1
#define MY_PTHREAD_ONCE_DONE 2
#if !STRUCT_TIMESPEC_HAS_TV_SEC || !STRUCT_TIMESPEC_HAS_TV_NSEC
struct timespec {
time_t tv_sec;
long tv_nsec;
};
#endif
int win_pthread_mutex_trylock(pthread_mutex_t *mutex);
int pthread_create(pthread_t *, const pthread_attr_t *, pthread_handler, void *);

View File

@ -90,7 +90,7 @@ const char *client_errors[]=
""
};
const char** get_client_errmsgs()
const char** get_client_errmsgs(void)
{
return client_errors;
}

View File

@ -52,7 +52,7 @@ eval SELECT 'hello' INTO OUTFILE 'fake_file.$prefix';
# Use '/' instead of '\' in the error message. On windows platform, dir is
# formed with '\'.
--replace_regex /\\testing_1\\*/\/testing_1\// /66/39/
--replace_regex /\\testing_1\\*/\/testing_1\// /66/39/ /17/39/ /File exists/Directory not empty/
--error 1010
DROP DATABASE testing_1;
let $wait_binlog_event= DROP TABLE IF EXIST;

View File

@ -33,7 +33,6 @@ debug-no-sync
# Retry bind as this may fail on busy server
port-open-timeout=10
bind-address=127.0.0.1
log-bin-trust-function-creators=1
key_buffer_size= 1M
@ -42,6 +41,9 @@ max_heap_table_size= 1M
loose-aria-pagecache-buffer-size=8M
loose-feedback-user-info= mysql-test
loose-feedback-debug-startup-interval=20
loose-feedback-debug-first-interval=60
loose-feedback-debug-interval=60
loose-innodb_data_file_path= ibdata1:12M:autoextend
loose-innodb_buffer_pool_size= 8M

View File

@ -10,7 +10,8 @@ if ($binlog_file)
{
--let $_in_binlog_file=in '$binlog_file'
}
--replace_result $_binlog_start <binlog_start> $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--let $_from_binlog_start=from $_binlog_start
--replace_result "$_from_binlog_start" "from <binlog_start>" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/
--eval show binlog events $_in_binlog_file from $_binlog_start

View File

@ -169,6 +169,13 @@ sub fix_log {
return "$dir/mysqld.log";
}
sub fix_bind_address {
if (IS_WINDOWS) {
return "*";
} else {
return "127.0.0.1";
}
}
sub fix_log_slow_queries {
my ($self, $config, $group_name, $group)= @_;
my $dir= dirname($group->value('datadir'));
@ -251,6 +258,7 @@ my @mysqld_rules=
{ 'ssl-ca' => \&fix_ssl_ca },
{ 'ssl-cert' => \&fix_ssl_server_cert },
{ 'ssl-key' => \&fix_ssl_server_key },
{ 'bind-address' => \&fix_bind_address },
);
if (IS_WINDOWS)

View File

@ -2021,6 +2021,15 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `idx` (`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (
`event_id` bigint(20) unsigned NOT NULL DEFAULT '0',
`market_id` bigint(20) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`event_id`,`market_id`)
);
ALTER TABLE t1 ADD PRIMARY KEY IF NOT EXISTS event_id (event_id,market_id);
Warnings:
Note 1061 Multiple primary key defined
DROP TABLE t1;
#
# MDEV-7374 : Losing connection to MySQL while running ALTER TABLE
#
@ -2045,6 +2054,3 @@ t1 CREATE TABLE `t1` (
KEY `i1` (`a`) COMMENT 'comment2'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# Start of 10.1 tests
#

View File

@ -1805,5 +1805,20 @@ set impressions = column_add(impressions,
);
drop table t1;
#
# MDEV-8565: COLUMN_CHECK fails on valid data
#
SELECT COLUMN_CHECK(COLUMN_CREATE('a',0,'b','1'));
COLUMN_CHECK(COLUMN_CREATE('a',0,'b','1'))
1
SELECT COLUMN_CHECK(COLUMN_CREATE('a',1,'b','1'));
COLUMN_CHECK(COLUMN_CREATE('a',1,'b','1'))
1
SELECT COLUMN_JSON(COLUMN_CREATE('a',0,'b','1'));
COLUMN_JSON(COLUMN_CREATE('a',0,'b','1'))
{"a":0,"b":"1"}
SELECT COLUMN_JSON(COLUMN_CREATE('a',1,'b','1'));
COLUMN_JSON(COLUMN_CREATE('a',1,'b','1'))
{"a":1,"b":"1"}
#
# end of 10.0 tests
#

View File

@ -18,7 +18,7 @@ change column body body longtext character set utf8 collate utf8_bin;
use events_test;
select @@event_scheduler;
@@event_scheduler
DISABLED
OFF
show events;
ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
select event_name from information_schema.events;
@ -40,12 +40,12 @@ ERROR HY000: Cannot proceed because system tables used by Event Scheduler were f
drop event intact_check;
ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
set global event_scheduler=on;
ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
ERROR HY000: Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
set global event_scheduler=off;
ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
ERROR HY000: Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
show variables like 'event_scheduler';
Variable_name Value
event_scheduler DISABLED
event_scheduler OFF
Make sure that we still can create and drop databases,
and no warnings are produced.
drop database if exists mysqltest_database_not_exists;
@ -58,6 +58,22 @@ Error 1545 Failed to open mysql.event
Restore the original mysql.event table
drop table mysql.event;
rename table event_like to mysql.event;
check that we can now enable events without restart
set global event_scheduler=original;
Warnings:
Note 1408 Event Scheduler: Loaded 3 events
select @@global.event_scheduler;
@@global.event_scheduler
ON
set global event_scheduler=on;
select @@global.event_scheduler;
@@global.event_scheduler
ON
show events;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
events_test abc1 root@localhost SYSTEM RECURRING # 1 SECOND # # ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
events_test abc2 root@localhost SYSTEM RECURRING # 1 SECOND # # ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
events_test abc3 root@localhost SYSTEM RECURRING # 1 SECOND # # ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
Now let's restart the server again
use events_test;
select @@event_scheduler;

View File

@ -0,0 +1,8 @@
create user foo@localhost;
select user,host,password from mysql.user where user='foo';
user host password
foo localhost
select user,host,password from mysql.user where user='foo';
user host password
foo localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
drop user foo@localhost;

View File

@ -65,4 +65,9 @@ CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1;
RENAME TABLE t1 TO T1;
ALTER TABLE T1 RENAME t1;
DROP TABLE t1;
create table t1 (a int);
create trigger t1_bi before insert on t1 for each row set new.a= 1;
show triggers like '%T1%';
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
drop table t1;
set GLOBAL sql_mode=default;

View File

@ -57,3 +57,4 @@ Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
update mysql.user set password='' where user='root';
flush privileges;
set global event_scheduler=OFF;

View File

@ -767,3 +767,37 @@ f1 f2 f3 f4 f5 f6
INSERT INTO t3 SELECT * FROM t2 WHERE f3 = 'm' AND f2 ='c';
DROP TABLE t1,t2,t3;
set global default_storage_engine=default;
#
# Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT
# Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE
#
CREATE TABLE t1
(a INT,
b INT,
PRIMARY KEY (a))
ENGINE = InnoDB
PARTITION BY HASH (a) PARTITIONS 3;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
# con1
ALTER TABLE t1 ADD INDEX idx1 (b);
# con default
SELECT b FROM t1 WHERE b = 0;
ERROR HY000: Table definition has changed, please retry transaction
SELECT b FROM t1 WHERE b = 0;
ERROR HY000: Table definition has changed, please retry transaction
DROP TABLE t1;
# Same test without partitioning
CREATE TABLE t1
(a INT,
b INT,
PRIMARY KEY (a))
ENGINE = InnoDB;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
# con1
ALTER TABLE t1 ADD INDEX idx1 (b);
# con default
SELECT b FROM t1 WHERE b = 0;
ERROR HY000: Table definition has changed, please retry transaction
SELECT b FROM t1 WHERE b = 0;
ERROR HY000: Table definition has changed, please retry transaction
DROP TABLE t1;

View File

@ -4053,3 +4053,24 @@ SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1;
ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)'
drop table t1;
# End of 5.3 tests
#
# MDEV-8756: MariaDB 10.0.21 crashes during PREPARE
#
CREATE TABLE t1 ( id INT(10), value INT(10) );
CREATE TABLE t2 ( id INT(10) );
SET @save_sql_mode= @@sql_mode;
SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY';
PREPARE stmt FROM 'UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)';
execute stmt;
insert into t1 values (1,10),(2,10),(3,10);
insert into t2 values (1),(2);
execute stmt;
select * from t1;
id value
1 1
2 1
3 NULL
deallocate prepare stmt;
SET SESSION sql_mode = @save_sql_mode;
DROP TABLE t1,t2;
# End of 10.0 tests

View File

@ -0,0 +1,22 @@
#
# CHANGE MASTER TO doesn't work with prepared statements
#
CHANGE MASTER TO MASTER_HOST='host1', MASTER_USER='user1';
# Master_Host : host1
# Master_User : user1
SET @s := "CHANGE MASTER TO MASTER_HOST='host2'";
PREPARE stmt FROM @s;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
# Master_Host : host2
# Master_User : user1
SET @s := "CHANGE MASTER TO MASTER_USER='user2'";
PREPARE stmt FROM @s;
EXECUTE stmt;
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
# Master_Host : host2
# Master_User : user2
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root';
# End of test

View File

@ -59,7 +59,9 @@ DROP FUNCTION f1;
DROP FUNCTION f2;
DROP FUNCTION f3;
set global event_scheduler=1;
ERROR HY000: The MariaDB server is running with the --event-scheduler=DISABLED or --skip-grant-tables option so it cannot execute this statement
Warnings:
Note 1408 Event Scheduler: Loaded 0 events
set global event_scheduler=0;
select count(*) from information_schema.COLUMN_PRIVILEGES;
count(*)
0

View File

@ -421,4 +421,99 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
DROP TABLE t1,t2;
#
# MDEV-7370: Server deadlocks on renaming a table for which persistent statistics exists
#
drop database if exists db1;
drop database if exists db1;
create database db1;
create database db2;
use db1;
#
# First, run the original testcase:
#
create table t1 (i int);
insert into t1 values (10),(20);
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
db1.t1 analyze status Engine-independent statistics collected
db1.t1 analyze status OK
rename table t1 to db2.t1;
# Verify that stats in the old database are gone:
select * from mysql.column_stats where db_name='db1' and table_name='t1';
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
select * from mysql.table_stats where db_name='db1' and table_name='t1';
db_name table_name cardinality
# Verify that stats are present in the new database:
select * from mysql.column_stats where db_name='db2' and table_name='t1';
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
db2 t1 i 10 20 0.0000 4.0000 1.0000 0 NULL NULL
select * from mysql.table_stats where db_name='db2' and table_name='t1';
db_name table_name cardinality
db2 t1 2
#
# Now, try with more than one column and with indexes:
#
use test;
create table t1(a int primary key);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
use db1;
create table t2 (a int, b int, c int, key IDX1(a), key IDX2(a,b));
insert into t2 select a/10, a/2, a from test.t1;
analyze table t2 persistent for all;
Table Op Msg_type Msg_text
db1.t2 analyze status Engine-independent statistics collected
db1.t2 analyze status Table is already up to date
alter table t2 rename db2.t2;
# Verify that stats in the old database are gone:
select * from mysql.table_stats where db_name='db1' and table_name='t2';
db_name table_name cardinality
select * from mysql.column_stats where db_name='db1' and table_name='t2';
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
select * from mysql.index_stats where db_name='db1' and table_name='t2';
db_name table_name index_name prefix_arity avg_frequency
# Verify that stats are present in the new database:
select * from mysql.table_stats where db_name='db2' and table_name='t2';
db_name table_name cardinality
db2 t2 10
select * from mysql.column_stats where db_name='db2' and table_name='t2';
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
db2 t2 a 0 1 0.0000 4.0000 5.0000 0 NULL NULL
db2 t2 b 0 5 0.0000 4.0000 1.6667 0 NULL NULL
db2 t2 c 0 9 0.0000 4.0000 1.0000 0 NULL NULL
select * from mysql.index_stats where db_name='db2' and table_name='t2';
db_name table_name index_name prefix_arity avg_frequency
db2 t2 IDX1 1 5.0000
db2 t2 IDX2 1 5.0000
db2 t2 IDX2 2 1.6667
use db2;
#
# Now, rename within the same database and verify:
#
rename table t2 to t3;
# No stats under old name:
select * from mysql.table_stats where db_name='db2' and table_name='t2';
db_name table_name cardinality
select * from mysql.column_stats where db_name='db2' and table_name='t2';
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
select * from mysql.index_stats where db_name='db2' and table_name='t2';
db_name table_name index_name prefix_arity avg_frequency
# Stats under the new name:
select * from mysql.table_stats where db_name='db2' and table_name='t3';
db_name table_name cardinality
db2 t3 10
select * from mysql.column_stats where db_name='db2' and table_name='t3';
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
db2 t3 a 0 1 0.0000 4.0000 5.0000 0 NULL NULL
db2 t3 b 0 5 0.0000 4.0000 1.6667 0 NULL NULL
db2 t3 c 0 9 0.0000 4.0000 1.0000 0 NULL NULL
select * from mysql.index_stats where db_name='db2' and table_name='t3';
db_name table_name index_name prefix_arity avg_frequency
db2 t3 IDX1 1 5.0000
db2 t3 IDX2 1 5.0000
db2 t3 IDX2 2 1.6667
use test;
drop database db1;
drop database db2;
drop table t1;
set use_stat_tables=@save_use_stat_tables;

View File

@ -448,6 +448,101 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
DROP TABLE t1,t2;
#
# MDEV-7370: Server deadlocks on renaming a table for which persistent statistics exists
#
drop database if exists db1;
drop database if exists db1;
create database db1;
create database db2;
use db1;
#
# First, run the original testcase:
#
create table t1 (i int);
insert into t1 values (10),(20);
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
db1.t1 analyze status Engine-independent statistics collected
db1.t1 analyze status OK
rename table t1 to db2.t1;
# Verify that stats in the old database are gone:
select * from mysql.column_stats where db_name='db1' and table_name='t1';
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
select * from mysql.table_stats where db_name='db1' and table_name='t1';
db_name table_name cardinality
# Verify that stats are present in the new database:
select * from mysql.column_stats where db_name='db2' and table_name='t1';
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
db2 t1 i 10 20 0.0000 4.0000 1.0000 0 NULL NULL
select * from mysql.table_stats where db_name='db2' and table_name='t1';
db_name table_name cardinality
db2 t1 2
#
# Now, try with more than one column and with indexes:
#
use test;
create table t1(a int primary key);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
use db1;
create table t2 (a int, b int, c int, key IDX1(a), key IDX2(a,b));
insert into t2 select a/10, a/2, a from test.t1;
analyze table t2 persistent for all;
Table Op Msg_type Msg_text
db1.t2 analyze status Engine-independent statistics collected
db1.t2 analyze status OK
alter table t2 rename db2.t2;
# Verify that stats in the old database are gone:
select * from mysql.table_stats where db_name='db1' and table_name='t2';
db_name table_name cardinality
select * from mysql.column_stats where db_name='db1' and table_name='t2';
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
select * from mysql.index_stats where db_name='db1' and table_name='t2';
db_name table_name index_name prefix_arity avg_frequency
# Verify that stats are present in the new database:
select * from mysql.table_stats where db_name='db2' and table_name='t2';
db_name table_name cardinality
db2 t2 10
select * from mysql.column_stats where db_name='db2' and table_name='t2';
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
db2 t2 a 0 1 0.0000 4.0000 5.0000 0 NULL NULL
db2 t2 b 0 5 0.0000 4.0000 1.6667 0 NULL NULL
db2 t2 c 0 9 0.0000 4.0000 1.0000 0 NULL NULL
select * from mysql.index_stats where db_name='db2' and table_name='t2';
db_name table_name index_name prefix_arity avg_frequency
db2 t2 IDX1 1 5.0000
db2 t2 IDX2 1 5.0000
db2 t2 IDX2 2 1.6667
use db2;
#
# Now, rename within the same database and verify:
#
rename table t2 to t3;
# No stats under old name:
select * from mysql.table_stats where db_name='db2' and table_name='t2';
db_name table_name cardinality
select * from mysql.column_stats where db_name='db2' and table_name='t2';
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
select * from mysql.index_stats where db_name='db2' and table_name='t2';
db_name table_name index_name prefix_arity avg_frequency
# Stats under the new name:
select * from mysql.table_stats where db_name='db2' and table_name='t3';
db_name table_name cardinality
db2 t3 10
select * from mysql.column_stats where db_name='db2' and table_name='t3';
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
db2 t3 a 0 1 0.0000 4.0000 5.0000 0 NULL NULL
db2 t3 b 0 5 0.0000 4.0000 1.6667 0 NULL NULL
db2 t3 c 0 9 0.0000 4.0000 1.0000 0 NULL NULL
select * from mysql.index_stats where db_name='db2' and table_name='t3';
db_name table_name index_name prefix_arity avg_frequency
db2 t3 IDX1 1 5.0000
db2 t3 IDX2 1 5.0000
db2 t3 IDX2 2 1.6667
use test;
drop database db1;
drop database db2;
drop table t1;
set use_stat_tables=@save_use_stat_tables;
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
SET SESSION STORAGE_ENGINE=DEFAULT;

View File

@ -1622,3 +1622,22 @@ test t2 id 1 1024 0.0000 8.0000 63 SINGLE_PREC_HB 03070B0F13171B1F23272B2F33373B
set histogram_size=default;
drop table t1, t2;
set use_stat_tables=@save_use_stat_tables;
#
# Bug MDEV-7383: min/max value for a column not utf8 compatible
#
create table t1 (a varchar(100)) engine=MyISAM;
insert into t1 values(unhex('D879626AF872675F73E662F8'));
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
show warnings;
Level Code Message
select db_name, table_name, column_name,
HEX(min_value), HEX(max_value),
nulls_ratio, avg_frequency,
hist_size, hist_type, HEX(histogram)
FROM mysql.column_stats;
db_name table_name column_name HEX(min_value) HEX(max_value) nulls_ratio avg_frequency hist_size hist_type HEX(histogram)
test t1 a D879626AF872675F73E662F8 D879626AF872675F73E662F8 0.0000 1.0000 0 NULL NULL
drop table t1;

View File

@ -7109,3 +7109,27 @@ sq
NULL
deallocate prepare stmt;
drop table t1,t2,t3,t4;
#
# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
# m_lock_type != 2' failed in handler::ha_index_read_map
#
CREATE TABLE t1 (f1 INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT, KEY(f2));
INSERT INTO t2 VALUES (3);
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
3
SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
f2
3
SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
count(*)
1
delete from t1;
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
NULL
drop view v2;
drop table t1,t2;

View File

@ -7109,6 +7109,30 @@ sq
NULL
deallocate prepare stmt;
drop table t1,t2,t3,t4;
#
# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
# m_lock_type != 2' failed in handler::ha_index_read_map
#
CREATE TABLE t1 (f1 INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT, KEY(f2));
INSERT INTO t2 VALUES (3);
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
3
SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
f2
3
SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
count(*)
1
delete from t1;
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
NULL
drop view v2;
drop table t1,t2;
set optimizer_switch=default;
select @@optimizer_switch like '%exists_to_in=off%';
@@optimizer_switch like '%exists_to_in=off%'

View File

@ -7102,6 +7102,30 @@ sq
NULL
deallocate prepare stmt;
drop table t1,t2,t3,t4;
#
# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
# m_lock_type != 2' failed in handler::ha_index_read_map
#
CREATE TABLE t1 (f1 INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT, KEY(f2));
INSERT INTO t2 VALUES (3);
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
3
SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
f2
3
SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
count(*)
1
delete from t1;
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
NULL
drop view v2;
drop table t1,t2;
set optimizer_switch=default;
select @@optimizer_switch like '%materialization=on%';
@@optimizer_switch like '%materialization=on%'

View File

@ -7100,4 +7100,28 @@ sq
NULL
deallocate prepare stmt;
drop table t1,t2,t3,t4;
#
# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
# m_lock_type != 2' failed in handler::ha_index_read_map
#
CREATE TABLE t1 (f1 INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT, KEY(f2));
INSERT INTO t2 VALUES (3);
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
3
SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
f2
3
SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
count(*)
1
delete from t1;
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
NULL
drop view v2;
drop table t1,t2;
set @optimizer_switch_for_subselect_test=null;

View File

@ -7115,6 +7115,30 @@ sq
NULL
deallocate prepare stmt;
drop table t1,t2,t3,t4;
#
# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
# m_lock_type != 2' failed in handler::ha_index_read_map
#
CREATE TABLE t1 (f1 INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT, KEY(f2));
INSERT INTO t2 VALUES (3);
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
3
SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
f2
3
SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
count(*)
1
delete from t1;
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
NULL
drop view v2;
drop table t1,t2;
set optimizer_switch=default;
select @@optimizer_switch like '%subquery_cache=on%';
@@optimizer_switch like '%subquery_cache=on%'

View File

@ -7100,5 +7100,29 @@ sq
NULL
deallocate prepare stmt;
drop table t1,t2,t3,t4;
#
# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
# m_lock_type != 2' failed in handler::ha_index_read_map
#
CREATE TABLE t1 (f1 INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT, KEY(f2));
INSERT INTO t2 VALUES (3);
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
3
SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
f2
3
SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
count(*)
1
delete from t1;
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
NULL
drop view v2;
drop table t1,t2;
set @optimizer_switch_for_subselect_test=null;
set @join_cache_level_for_subselect_test=NULL;

View File

@ -290,8 +290,8 @@ column_stats CREATE TABLE `column_stats` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`column_name` varchar(64) COLLATE utf8_bin NOT NULL,
`min_value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`max_value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`min_value` varbinary(255) DEFAULT NULL,
`max_value` varbinary(255) DEFAULT NULL,
`nulls_ratio` decimal(12,4) DEFAULT NULL,
`avg_length` decimal(12,4) DEFAULT NULL,
`avg_frequency` decimal(12,4) DEFAULT NULL,

View File

@ -290,8 +290,8 @@ column_stats CREATE TABLE `column_stats` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`column_name` varchar(64) COLLATE utf8_bin NOT NULL,
`min_value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`max_value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`min_value` varbinary(255) DEFAULT NULL,
`max_value` varbinary(255) DEFAULT NULL,
`nulls_ratio` decimal(12,4) DEFAULT NULL,
`avg_length` decimal(12,4) DEFAULT NULL,
`avg_frequency` decimal(12,4) DEFAULT NULL,

View File

@ -290,8 +290,8 @@ column_stats CREATE TABLE `column_stats` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`column_name` varchar(64) COLLATE utf8_bin NOT NULL,
`min_value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`max_value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`min_value` varbinary(255) DEFAULT NULL,
`max_value` varbinary(255) DEFAULT NULL,
`nulls_ratio` decimal(12,4) DEFAULT NULL,
`avg_length` decimal(12,4) DEFAULT NULL,
`avg_frequency` decimal(12,4) DEFAULT NULL,

View File

@ -290,8 +290,8 @@ column_stats CREATE TABLE `column_stats` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`column_name` varchar(64) COLLATE utf8_bin NOT NULL,
`min_value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`max_value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`min_value` varbinary(255) DEFAULT NULL,
`max_value` varbinary(255) DEFAULT NULL,
`nulls_ratio` decimal(12,4) DEFAULT NULL,
`avg_length` decimal(12,4) DEFAULT NULL,
`avg_frequency` decimal(12,4) DEFAULT NULL,

View File

@ -619,6 +619,65 @@ Handler_update 5
ROLLBACK;
DROP TABLE t1, t2;
#
# MDEV-8938: Server Crash on Update with joins
#
CREATE TABLE `t1` (
`name` varchar(255) NOT NULL,
`value` varchar(4095) DEFAULT NULL,
PRIMARY KEY (`name`)
);
UPDATE `t1` SET value = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `t1` WHERE `name`="consoleproxy.url.domain") AS `temptable` WHERE `temptable`.`name`="consoleproxy.url.domain")) WHERE `name`="consoleproxy.url.domain";
drop table t1;
CREATE TABLE `t1` (
`name` varchar(255) NOT NULL,
`value` varchar(4095) DEFAULT NULL,
PRIMARY KEY (`name`)
);
create table t2 (
`name` varchar(255) NOT NULL,
`value` varchar(4095) DEFAULT NULL,
PRIMARY KEY (`name`)
);
UPDATE t1
SET value = (SELECT value FROM t2 WHERE `name`= t1.name)
WHERE value is null ;
drop table t1,t2;
#
#MDEV-8701: Crash on derived query
#
CREATE TABLE t1 (
data_exit_entry_id int(11) NOT NULL,
data_entry_id int(11) NOT NULL,
data_entry_exit_id int(11) NOT NULL,
data_exit_entry_quantity double NOT NULL
) DEFAULT CHARSET=utf8;
CREATE TABLE t2 (
data_entry_id int(11) NOT NULL,
data_entry_cost double NOT NULL,
data_entry_quantity double NOT NULL
) DEFAULT CHARSET=utf8;
create algorithm=temptable view v1 as SELECT data_entry_exit_id, data_exit_entry_quantity, data_entry_cost
FROM t1 INNER JOIN t2 as dt ON dt.data_entry_id = t1.data_entry_id;
UPDATE t2
SET data_entry_cost
= ( ( SELECT SUM(data_exit_entry_quantity * data_entry_cost)
FROM
v1 AS query
WHERE data_entry_exit_id = t2.data_entry_id
)
);
UPDATE t2
SET data_entry_cost
= ( ( SELECT SUM(data_exit_entry_quantity * data_entry_cost)
FROM
( SELECT data_entry_exit_id, data_exit_entry_quantity, data_entry_cost
FROM t1 INNER JOIN t2 as dt ON dt.data_entry_id = t1.data_entry_id) AS query
WHERE data_entry_exit_id = t2.data_entry_id
)
);
drop view v1;
drop table t1, t2;
#
# MDEV-4410: update does not want to use a covering index, but select uses it.
#
create table t2(a int);

View File

@ -5507,6 +5507,39 @@ UPDATE t1, t2 SET a = 1 WHERE a IN ( SELECT 0 FROM v3 );
EXECUTE stmt;
DROP TABLE t1, t2, t3;
DROP VIEW v3;
#
# MDEV-8632: Segmentation fault on INSERT
#
CREATE TABLE `t1` (
`id` int(10) unsigned NOT NULL,
`r` float NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
create view v1 as select id, if(r=r,1,2) as d from t1;
create view v2 as
select id,
d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
from v1;
insert into t1 (id, r)
select id,p from
(
select id,
d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
from (
select id, if(r=r,1,2) as d
from t1
) a
) b
on duplicate key update r=p;
insert into t1 (id, r)
select id,p from v2
on duplicate key update r=p;
prepare stmt from "insert into t1 (id, r) select id,p from v2 on duplicate key update r=p";
execute stmt;
execute stmt;
deallocate prepare stmt;
drop view v1,v2;
drop table `t1`;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------
@ -5627,6 +5660,149 @@ count(v3.i)
0
drop table t1, t2;
drop view v3;
#
# MDEV-8525: mariadb 10.0.20 crashing when data is read by Kodi
# media center (http://kodi.tv).
#
CREATE TABLE `t1` (
`idSong` int(11) NOT NULL AUTO_INCREMENT,
`idAlbum` int(11) DEFAULT NULL,
`idPath` int(11) DEFAULT NULL,
`strArtists` text,
`strGenres` text,
`strTitle` varchar(512) DEFAULT NULL,
`iTrack` int(11) DEFAULT NULL,
`iDuration` int(11) DEFAULT NULL,
`iYear` int(11) DEFAULT NULL,
`dwFileNameCRC` text,
`strFileName` text,
`strMusicBrainzTrackID` text,
`iTimesPlayed` int(11) DEFAULT NULL,
`iStartOffset` int(11) DEFAULT NULL,
`iEndOffset` int(11) DEFAULT NULL,
`idThumb` int(11) DEFAULT NULL,
`lastplayed` varchar(20) DEFAULT NULL,
`rating` char(1) DEFAULT '0',
`comment` text,
`mood` text,
PRIMARY KEY (`idSong`),
UNIQUE KEY `idxSong7` (`idAlbum`,`strMusicBrainzTrackID`(36)),
KEY `idxSong` (`strTitle`(255)),
KEY `idxSong1` (`iTimesPlayed`),
KEY `idxSong2` (`lastplayed`),
KEY `idxSong3` (`idAlbum`),
KEY `idxSong6` (`idPath`,`strFileName`(255))
) DEFAULT CHARSET=utf8;
INSERT INTO `t1` VALUES (1,1,1,'strArtists1','strGenres1','strTitle1',1,100,2000,NULL,'strFileName1','strMusicBrainzTrackID1',0,0,0,NULL,NULL,'0','',''),(2,2,2,'strArtists2','strGenres2','strTitle2',2,200,2001,NULL,'strFileName2','strMusicBrainzTrackID2',0,0,0,NULL,NULL,'0','','');
CREATE TABLE `t2` (
`idAlbum` int(11) NOT NULL AUTO_INCREMENT,
`strAlbum` varchar(256) DEFAULT NULL,
`strMusicBrainzAlbumID` text,
`strArtists` text,
`strGenres` text,
`iYear` int(11) DEFAULT NULL,
`idThumb` int(11) DEFAULT NULL,
`bCompilation` int(11) NOT NULL DEFAULT '0',
`strMoods` text,
`strStyles` text,
`strThemes` text,
`strReview` text,
`strImage` text,
`strLabel` text,
`strType` text,
`iRating` int(11) DEFAULT NULL,
`lastScraped` varchar(20) DEFAULT NULL,
`dateAdded` varchar(20) DEFAULT NULL,
`strReleaseType` text,
PRIMARY KEY (`idAlbum`),
UNIQUE KEY `idxAlbum_2` (`strMusicBrainzAlbumID`(36)),
KEY `idxAlbum` (`strAlbum`(255)),
KEY `idxAlbum_1` (`bCompilation`)
) DEFAULT CHARSET=utf8;
INSERT INTO `t2` VALUES (1,'strAlbum1','strMusicBrainzAlbumID1','strArtists1','strGenres1',2000,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'album');
CREATE TABLE `t3` (
`idArtist` int(11) DEFAULT NULL,
`idAlbum` int(11) DEFAULT NULL,
`strJoinPhrase` text,
`boolFeatured` int(11) DEFAULT NULL,
`iOrder` int(11) DEFAULT NULL,
`strArtist` text,
UNIQUE KEY `idxAlbumArtist_1` (`idAlbum`,`idArtist`),
UNIQUE KEY `idxAlbumArtist_2` (`idArtist`,`idAlbum`),
KEY `idxAlbumArtist_3` (`boolFeatured`)
) DEFAULT CHARSET=utf8;
INSERT INTO `t3` VALUES (1,1,'',0,0,'strArtist1');
CREATE TABLE `t4` (
`idArtist` int(11) NOT NULL AUTO_INCREMENT,
`strArtist` varchar(256) DEFAULT NULL,
`strMusicBrainzArtistID` text,
`strBorn` text,
`strFormed` text,
`strGenres` text,
`strMoods` text,
`strStyles` text,
`strInstruments` text,
`strBiography` text,
`strDied` text,
`strDisbanded` text,
`strYearsActive` text,
`strImage` text,
`strFanart` text,
`lastScraped` varchar(20) DEFAULT NULL,
`dateAdded` varchar(20) DEFAULT NULL,
PRIMARY KEY (`idArtist`),
UNIQUE KEY `idxArtist1` (`strMusicBrainzArtistID`(36)),
KEY `idxArtist` (`strArtist`(255))
) DEFAULT CHARSET=utf8;
INSERT INTO `t4` VALUES (1,'strArtist1','strMusicBrainzArtistID',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
CREATE VIEW `v1` AS select `t2`.`idAlbum` AS `idAlbum`,`t2`.`strAlbum` AS `strAlbum`,`t2`.`strMusicBrainzAlbumID` AS `strMusicBrainzAlbumID`,`t2`.`strArtists` AS `strArtists`,`t2`.`strGenres` AS `strGenres`,`t2`.`iYear` AS `iYear`,`t2`.`strMoods` AS `strMoods`,`t2`.`strStyles` AS `strStyles`,`t2`.`strThemes` AS `strThemes`,`t2`.`strReview` AS `strReview`,`t2`.`strLabel` AS `strLabel`,`t2`.`strType` AS `strType`,`t2`.`strImage` AS `strImage`,`t2`.`iRating` AS `iRating`,`t2`.`bCompilation` AS `bCompilation`,(select min(`t1`.`iTimesPlayed`) from `t1` where (`t1`.`idAlbum` = `t2`.`idAlbum`)) AS `iTimesPlayed`,`t2`.`strReleaseType` AS `strReleaseType` from `t2`;
CREATE VIEW `v2` AS select `t3`.`idAlbum` AS `idAlbum`,`t3`.`idArtist` AS `idArtist`,`t4`.`strArtist` AS `strArtist`,`t4`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,`t3`.`boolFeatured` AS `boolFeatured`,`t3`.`strJoinPhrase` AS `strJoinPhrase`,`t3`.`iOrder` AS `iOrder` from (`t3` join `t4` on((`t3`.`idArtist` = `t4`.`idArtist`)));
SELECT v1.*,v2.* FROM v1 LEFT JOIN v2 ON v1.idAlbum = v2.idAlbum WHERE v1.idAlbum = 1 ORDER BY v2.iOrder;
idAlbum strAlbum strMusicBrainzAlbumID strArtists strGenres iYear strMoods strStyles strThemes strReview strLabel strType strImage iRating bCompilation iTimesPlayed strReleaseType idAlbum idArtist strArtist strMusicBrainzArtistID boolFeatured strJoinPhrase iOrder
1 strAlbum1 strMusicBrainzAlbumID1 strArtists1 strGenres1 2000 NULL NULL NULL NULL NULL NULL NULL NULL 0 0 album 1 1 strArtist1 strMusicBrainzArtistID 0 0
drop view v1,v2;
drop table t1,t2,t3,t4;
#
# MDEV-8913: Derived queries with same column names as final
# projection causes issues when using Order By
#
create table t1 (field int);
insert into t1 values (10),(5),(3),(8),(20);
SELECT sq.f2 AS f1, sq.f1 AS f2
FROM ( SELECT field AS f1, 1 AS f2 FROM t1) AS sq
ORDER BY sq.f1;
f1 f2
1 3
1 5
1 8
1 10
1 20
create view v1 as SELECT field AS f1, 1 AS f2 FROM t1;
SELECT sq.f2 AS f1, sq.f1 AS f2
FROM v1 AS sq
ORDER BY sq.f1;
f1 f2
1 3
1 5
1 8
1 10
1 20
drop view v1;
create table t2 SELECT field AS f1, 1 AS f2 FROM t1;
SELECT
sq.f2 AS f1,
sq.f1 AS f2
FROM t2 AS sq
ORDER BY sq.f1;
f1 f2
1 3
1 5
1 8
1 10
1 20
drop table t1, t2;
SELECT 1 FROM (SELECT 1 as a) AS b HAVING (SELECT `SOME_GARBAGE`.b.a)=1;
ERROR 42S22: Unknown column 'SOME_GARBAGE.b.a' in 'field list'
# -----------------------------------------------------------------
# -- End of 10.0 tests.
# -----------------------------------------------------------------

View File

@ -16,8 +16,8 @@ def mysql column_stats db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8
def mysql column_stats histogram 11 NULL YES varbinary 255 255 NULL NULL NULL NULL NULL varbinary(255) select,insert,update,references
def mysql column_stats hist_size 9 NULL YES tinyint NULL NULL 3 0 NULL NULL NULL tinyint(3) unsigned select,insert,update,references
def mysql column_stats hist_type 10 NULL YES enum 14 42 NULL NULL NULL utf8 utf8_bin enum('SINGLE_PREC_HB','DOUBLE_PREC_HB') select,insert,update,references
def mysql column_stats max_value 5 NULL YES varchar 255 765 NULL NULL NULL utf8 utf8_bin varchar(255) select,insert,update,references
def mysql column_stats min_value 4 NULL YES varchar 255 765 NULL NULL NULL utf8 utf8_bin varchar(255) select,insert,update,references
def mysql column_stats max_value 5 NULL YES varbinary 255 255 NULL NULL NULL NULL NULL varbinary(255) select,insert,update,references
def mysql column_stats min_value 4 NULL YES varbinary 255 255 NULL NULL NULL NULL NULL varbinary(255) select,insert,update,references
def mysql column_stats nulls_ratio 6 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) select,insert,update,references
def mysql column_stats table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql db Alter_priv 13 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
@ -333,8 +333,8 @@ NULL mysql columns_priv Timestamp timestamp NULL NULL NULL NULL timestamp
3.0000 mysql column_stats db_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql column_stats table_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql column_stats column_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql column_stats min_value varchar 255 765 utf8 utf8_bin varchar(255)
3.0000 mysql column_stats max_value varchar 255 765 utf8 utf8_bin varchar(255)
1.0000 mysql column_stats min_value varbinary 255 255 NULL NULL varbinary(255)
1.0000 mysql column_stats max_value varbinary 255 255 NULL NULL varbinary(255)
NULL mysql column_stats nulls_ratio decimal NULL NULL NULL NULL decimal(12,4)
NULL mysql column_stats avg_length decimal NULL NULL NULL NULL decimal(12,4)
NULL mysql column_stats avg_frequency decimal NULL NULL NULL NULL decimal(12,4)

View File

@ -0,0 +1,30 @@
CREATE TABLE `test_wo_keys` (
`f01` int AUTO_INCREMENT,
`f02` bigint, `f03` bigint, `f04` enum('a','b'),
`f05` date, `f06` int, `f07` int, `f08` double, `f09` int,
`f10` bigint, `f11` double, `f12` enum('a','b','c','d','e'),
`f13` int, `f14` int, `f15` varchar(255), `f16` int, `f17` int, `f18` int,
`f19` double, `f20` double, `f21` double, `f22` double, `f23` double, `f24` tinyint,
`f25` double, `f26` double, `f27` double, `f28` double, `f29` int unsigned,
`f30` int unsigned, `f31` bigint, `f32` int unsigned, `f33` bigint,
`f34` int unsigned, `f35` int unsigned,
PRIMARY KEY `f01` (`f01`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
show status like '%merge_buffers%';
Variable_name Value
Innodb_os_merge_buffers_written 0
Innodb_os_merge_buffers_read 0
Innodb_os_merge_buffers_merged 0
ALTER TABLE test_wo_keys
ADD KEY `f06` (`f06`), ADD KEY `f05` (`f05`), ADD KEY `f04` (`f04`), ADD KEY `f23` (`f23`),
ADD KEY `f10` (`f10`), ADD KEY `f11` (`f11`), ADD KEY `f09` (`f09`), ADD KEY `f22` (`f22`),
ADD KEY `f21` (`f21`), ADD KEY `f07` (`f07`), ADD KEY `f08` (`f08`), ADD KEY `f18` (`f18`),
ADD KEY `f19` (`f19`), ADD KEY `f20` (`f20`), ADD KEY `f29` (`f29`,`f31`,`f33`),
ADD KEY `f35` (`f35`), ADD KEY `f25` (`f25`), ADD KEY `f26` (`f26`),
ADD KEY `f27` (`f27`), ADD KEY `f28` (`f28`);
show status like '%merge_buffers%';
Variable_name Value
Innodb_os_merge_buffers_written 0
Innodb_os_merge_buffers_read 0
Innodb_os_merge_buffers_merged 0
DROP TABLE test_wo_keys;

View File

@ -25,7 +25,7 @@ create table t2(a int, constraint a foreign key a (a) references t1(a)) engine=i
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
Warning 150 Create table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns. Error close to foreign key a (a) references t1(a)) engine=innodb.
Warning 150 Create table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near ' foreign key a (a) references t1(a)) engine=innodb'.
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
drop table t1;
@ -42,7 +42,7 @@ alter table t2 add constraint b foreign key (b) references t2(b);
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
Warning 150 Alter table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns. Error close to foreign key (b) references t2(b).
Warning 150 Alter table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near ' foreign key (b) references t2(b)'.
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
drop table t2, t1;
@ -51,7 +51,7 @@ alter table t1 add constraint c1 foreign key (f1) references t11(f1);
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Referenced table `test`.`t11` not found in the data dictionary close to foreign key (f1) references t11(f1).
Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Referenced table `test`.`t11` not found in the data dictionary near ' foreign key (f1) references t11(f1)'.
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
drop table t1;
@ -90,14 +90,14 @@ alter table t1 add constraint c1 foreign key (f1) references t1(f1) on update se
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
Warning 150 Alter table `test`.`t1` with foreign key constraint failed. You have defined a SET NULL condition but column f1 is defined as NOT NULL in foreign key (f1) references t1(f1) on update set null close to on update set null.
Warning 150 Alter table `test`.`t1` with foreign key constraint failed. You have defined a SET NULL condition but column 'f1' is defined as NOT NULL in ' foreign key (f1) references t1(f1) on update set null' near ' on update set null'.
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
create table t2(a int not null, foreign key(a) references t1(f1) on delete set null) engine=innodb;
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
Warning 150 Create table `test`.`t2` with foreign key constraint failed. You have defined a SET NULL condition but column a is defined as NOT NULL in foreign key(a) references t1(f1) on delete set null) engine=innodb close to on delete set null) engine=innodb.
Warning 150 Create table `test`.`t2` with foreign key constraint failed. You have defined a SET NULL condition but column 'a' is defined as NOT NULL in 'foreign key(a) references t1(f1) on delete set null) engine=innodb' near ' on delete set null) engine=innodb'.
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
drop table t1;
@ -106,7 +106,7 @@ create table t2(a char(20), key(a), foreign key(a) references t1(f1)) engine=inn
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
Warning 150 Create table `test`.`t2` with foreign key constraint failed. Field type or character set for column a does not mach referenced column f1 close to foreign key(a) references t1(f1)) engine=innodb
Warning 150 Create table `test`.`t2` with foreign key constraint failed. Field type or character set for column 'a' does not mach referenced column 'f1' near 'foreign key(a) references t1(f1)) engine=innodb'.
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
drop table t1;

View File

@ -50,8 +50,8 @@ CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
Warning 150 Create table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary close to FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
) ENGINE=InnoDB.
Warning 150 Create table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary near ' FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
) ENGINE=InnoDB'.
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
CREATE TABLE t2 (
@ -65,7 +65,7 @@ ALTER TABLE t2 ADD CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
Warning 150 Alter table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary close to FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE.
Warning 150 Alter table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary near ' FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE'.
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
drop table t2;

View File

@ -130,6 +130,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs disabled
os_log_pending_writes disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
trx_rw_commits disabled
trx_ro_commits disabled
trx_nl_ro_commits disabled
@ -278,6 +281,9 @@ lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
@ -316,6 +322,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs enabled
os_log_pending_writes enabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
set global innodb_monitor_enable="";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of ''
set global innodb_monitor_enable="_";

View File

@ -0,0 +1,8 @@
START TRANSACTION WITH CONSISTENT SNAPSHOT;
CREATE TABLE IF NOT EXISTS t1 (pk INT PRIMARY KEY, i INT, KEY(i)) ENGINE=InnoDB;
UPDATE t1 SET i = 0;
ERROR HY000: Table definition has changed, please retry transaction
UPDATE t1 SET pk = 0;
ERROR HY000: Table definition has changed, please retry transaction
commit;
drop table t1;

View File

@ -0,0 +1,32 @@
--source include/have_innodb.inc
#
# MDEV-8696: Adding indexes on empty table is slow with large innodb_sort_buffer_size.
#
CREATE TABLE `test_wo_keys` (
`f01` int AUTO_INCREMENT,
`f02` bigint, `f03` bigint, `f04` enum('a','b'),
`f05` date, `f06` int, `f07` int, `f08` double, `f09` int,
`f10` bigint, `f11` double, `f12` enum('a','b','c','d','e'),
`f13` int, `f14` int, `f15` varchar(255), `f16` int, `f17` int, `f18` int,
`f19` double, `f20` double, `f21` double, `f22` double, `f23` double, `f24` tinyint,
`f25` double, `f26` double, `f27` double, `f28` double, `f29` int unsigned,
`f30` int unsigned, `f31` bigint, `f32` int unsigned, `f33` bigint,
`f34` int unsigned, `f35` int unsigned,
PRIMARY KEY `f01` (`f01`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
show status like '%merge_buffers%';
ALTER TABLE test_wo_keys
ADD KEY `f06` (`f06`), ADD KEY `f05` (`f05`), ADD KEY `f04` (`f04`), ADD KEY `f23` (`f23`),
ADD KEY `f10` (`f10`), ADD KEY `f11` (`f11`), ADD KEY `f09` (`f09`), ADD KEY `f22` (`f22`),
ADD KEY `f21` (`f21`), ADD KEY `f07` (`f07`), ADD KEY `f08` (`f08`), ADD KEY `f18` (`f18`),
ADD KEY `f19` (`f19`), ADD KEY `f20` (`f20`), ADD KEY `f29` (`f29`,`f31`,`f33`),
ADD KEY `f35` (`f35`), ADD KEY `f25` (`f25`), ADD KEY `f26` (`f26`),
ADD KEY `f27` (`f27`), ADD KEY `f28` (`f28`);
show status like '%merge_buffers%';
DROP TABLE test_wo_keys;

View File

@ -0,0 +1,18 @@
--source include/have_log_bin.inc
--source include/have_binlog_format_row.inc
--source include/have_innodb.inc
START TRANSACTION WITH CONSISTENT SNAPSHOT;
--connect (con1,localhost,root,,test)
CREATE TABLE IF NOT EXISTS t1 (pk INT PRIMARY KEY, i INT, KEY(i)) ENGINE=InnoDB;
--connection default
--error 1412
UPDATE t1 SET i = 0;
--error 1412
UPDATE t1 SET pk = 0;
commit;
drop table t1;

View File

@ -1,5 +1,21 @@
DROP TABLE IF EXISTS t1;
#
# Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT
# Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE
#
CREATE TABLE t1 (a INT, b VARCHAR(64), KEY(b,a))
PARTITION BY HASH (a) PARTITIONS 3;
INSERT INTO t1 VALUES (1, "1"), (2, "2"), (3, "3"), (4, "Four"), (5, "Five"),
(6, "Six"), (7, "Seven"), (8, "Eight"), (9, "Nine");
SET SESSION debug_dbug="+d,ha_partition_fail_index_init";
SELECT * FROM t1 WHERE b = "Seven";
ERROR HY000: Table has no partition for value 0
SET SESSION debug_dbug="-d,ha_partition_fail_index_init";
SELECT * FROM t1 WHERE b = "Seven";
a b
7 Seven
DROP TABLE t1;
#
# WL#4445: EXCHANGE PARTITION WITH TABLE
# Verify ddl_log in case of crashing.
call mtr.add_suppression("Attempting backtrace. You can use the following information to find out");

View File

@ -12,6 +12,24 @@
DROP TABLE IF EXISTS t1;
--enable_warnings
# Partitioning test that require debug features
--echo #
--echo # Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT
--echo # Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE
--echo #
CREATE TABLE t1 (a INT, b VARCHAR(64), KEY(b,a))
PARTITION BY HASH (a) PARTITIONS 3;
INSERT INTO t1 VALUES (1, "1"), (2, "2"), (3, "3"), (4, "Four"), (5, "Five"),
(6, "Six"), (7, "Seven"), (8, "Eight"), (9, "Nine");
SET SESSION debug_dbug="+d,ha_partition_fail_index_init";
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
SELECT * FROM t1 WHERE b = "Seven";
SET SESSION debug_dbug="-d,ha_partition_fail_index_init";
SELECT * FROM t1 WHERE b = "Seven";
DROP TABLE t1;
--let $DATADIR= `SELECT @@datadir;`
--echo #

View File

@ -0,0 +1,4 @@
if (!`SELECT count(*) FROM performance_schema.performance_timers WHERE timer_name='CYCLE' AND timer_frequency IS NOT NULL`)
{
Skip Need performance timer CYCLE;
}

View File

@ -557,7 +557,7 @@ ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'eve
#
# Grant access to change tables with the root account
GRANT UPDATE ON performance_schema.setup_consumers TO pfs_user_4;
GRANT UPDATE ON performance_schema.setup_timers TO pfs_user_4;
GRANT UPDATE, SELECT ON performance_schema.setup_timers TO pfs_user_4;
GRANT UPDATE, SELECT ON performance_schema.setup_instruments TO pfs_user_4;
GRANT DROP ON performance_schema.events_waits_current TO pfs_user_4;
GRANT DROP ON performance_schema.events_waits_history TO pfs_user_4;
@ -568,7 +568,7 @@ UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name LIKE 'wait/synch/mutex/%'
OR name LIKE 'wait/synch/rwlock/%';
UPDATE performance_schema.setup_consumers SET enabled = 'YES';
UPDATE performance_schema.setup_timers SET timer_name = 'TICK';
UPDATE performance_schema.setup_timers SET timer_name = 'TICK' WHERE name <> "wait";
TRUNCATE TABLE performance_schema.events_waits_history_long;
TRUNCATE TABLE performance_schema.events_waits_history;
TRUNCATE TABLE performance_schema.events_waits_current;
@ -579,6 +579,5 @@ flush privileges;
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
UPDATE performance_schema.setup_consumers SET enabled = 'YES';
UPDATE performance_schema.setup_timers SET timer_name = 'MICROSECOND' where name="idle";
UPDATE performance_schema.setup_timers SET timer_name = 'CYCLE' where name="wait";
UPDATE performance_schema.setup_timers SET timer_name = 'NANOSECOND' where name="stage";
UPDATE performance_schema.setup_timers SET timer_name = 'NANOSECOND' where name="statement";

View File

@ -2,6 +2,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
--source include/have_timer_cycle.inc
--replace_column 2 <frequency> 3 <resolution> 4 <overhead>
select * from performance_schema.performance_timers;

View File

@ -2,6 +2,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
--source include/have_timer_cycle.inc
# Set to a known state
update performance_schema.setup_timers

View File

@ -294,7 +294,7 @@ TRUNCATE TABLE performance_schema.events_waits_current;
--echo # Grant access to change tables with the root account
GRANT UPDATE ON performance_schema.setup_consumers TO pfs_user_4;
GRANT UPDATE ON performance_schema.setup_timers TO pfs_user_4;
GRANT UPDATE, SELECT ON performance_schema.setup_timers TO pfs_user_4;
GRANT UPDATE, SELECT ON performance_schema.setup_instruments TO pfs_user_4;
GRANT DROP ON performance_schema.events_waits_current TO pfs_user_4;
GRANT DROP ON performance_schema.events_waits_history TO pfs_user_4;
@ -311,7 +311,11 @@ WHERE name LIKE 'wait/synch/mutex/%'
UPDATE performance_schema.setup_consumers SET enabled = 'YES';
UPDATE performance_schema.setup_timers SET timer_name = 'TICK';
# We do not touch "wait", to avoid restoring it at the end of the test,
# as its default value initialized at server startup is ambiguous:
# it can be CYCLE or NANOSECOND depending on platform
UPDATE performance_schema.setup_timers SET timer_name = 'TICK' WHERE name <> "wait";
TRUNCATE TABLE performance_schema.events_waits_history_long;
TRUNCATE TABLE performance_schema.events_waits_history;
@ -327,7 +331,8 @@ flush privileges;
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
UPDATE performance_schema.setup_consumers SET enabled = 'YES';
# Restore the default values for the timers that we changed.
# Note, we did not touch "wait", see above.
UPDATE performance_schema.setup_timers SET timer_name = 'MICROSECOND' where name="idle";
UPDATE performance_schema.setup_timers SET timer_name = 'CYCLE' where name="wait";
UPDATE performance_schema.setup_timers SET timer_name = 'NANOSECOND' where name="stage";
UPDATE performance_schema.setup_timers SET timer_name = 'NANOSECOND' where name="statement";

View File

@ -3,7 +3,8 @@ select plugin_status from information_schema.plugins where plugin_name='feedback
plugin_status
ACTIVE
select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid';
and variable_name not like '%_uid'
and variable_name not like '%debug%';
VARIABLE_NAME VARIABLE_VALUE
FEEDBACK used 1
FEEDBACK version 1.1

View File

@ -6,7 +6,8 @@ SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback wher
variable_value = @feedback_used + 1
1
select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'
and variable_name not like '%debug%';
VARIABLE_NAME VARIABLE_VALUE
FEEDBACK version 1.1
FEEDBACK_HTTP_PROXY

View File

@ -6,7 +6,8 @@ SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback wher
variable_value = @feedback_used + 1
1
select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'
and variable_name not like '%debug%';
VARIABLE_NAME VARIABLE_VALUE
FEEDBACK version 1.1
FEEDBACK_HTTP_PROXY
@ -23,7 +24,6 @@ VARIABLE_VALUE>0 VARIABLE_NAME
1 Collation used latin1_swedish_ci
1 Collation used utf8_bin
1 Collation used utf8_general_ci
feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
feedback plugin: server replied 'ok'
feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
feedback plugin: server replied 'ok'
set global sql_mode=ONLY_FULL_GROUP_BY;
6: feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
6: feedback plugin: server replied 'ok'

View File

@ -10,6 +10,8 @@ select plugin_status from information_schema.plugins where plugin_name='feedback
--replace_result https http
--sorted_result
select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid';
and variable_name not like '%_uid'
and variable_name not like '%debug%';
uninstall plugin feedback;

View File

@ -24,7 +24,8 @@ SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback wher
--replace_result https http
--sorted_result
select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'
and variable_name not like '%debug%';
# Embedded server does not use the table mysqld.user and thus
# does not automatically use latin1_bin on startup. Use it manually.

View File

@ -13,7 +13,11 @@ if (!$MTR_FEEDBACK_PLUGIN) {
# Let's wait, and hope that mtr is started with --parallel and
# is doing some work in other workers.
#
sleep 310;
sleep 100;
set global sql_mode=ONLY_FULL_GROUP_BY;
sleep 210;
# The test expects that the plugin will send a report at least 2 times,
# now (5 min after loading) and on server shutdown which happens below.
@ -25,20 +29,15 @@ sleep 310;
--let $shutdown_timeout= 60
source include/restart_mysqld.inc;
replace_result https http;
replace_result https http 2 6;
perl;
$log_error= $ENV{'MYSQLTEST_VARDIR'} . '/log/mysqld.1.err';
open(LOG, '<', $log_error) or die "open(< $log_error): $!";
# Get the first few rows (as there may be different number rows in the log)
$i= 0;
while ($_=<LOG>)
{
if (/feedback plugin:.*/)
{
print "$&\n";
break if ($i++ >= 3);
}
%logg=();
while ($_=<LOG>) {
$logg{$&}++ if /feedback plugin:.*/;
}
print "$logg{$_}: $_\n" for sort keys %logg;
close LOG;
EOF

View File

@ -36,6 +36,10 @@ select user, host, is_role from user where user like 'test%';
user host is_role
create role '';
ERROR OP000: Invalid role specification ``.
create role ' ';
ERROR OP000: Invalid role specification ``.
create role 'foo ';
drop role foo;
create role r1;
drop user r1;
ERROR HY000: Operation DROP USER failed for 'r1'@'%'

View File

@ -52,6 +52,14 @@ connection default;
--error ER_INVALID_ROLE
create role '';
#
# MDEV-8609 Server crashes in is_invalid_role_name on reloading ACL with a blank role name
#
--error ER_INVALID_ROLE
create role ' ';
create role 'foo ';
drop role foo;
#
# MDEV-5523 Server crashes on DROP USER <rolename>
#

View File

@ -1,3 +1,6 @@
#
# MDEV-6401 SET ROLE returning ERROR 1959 Invalid role specification for valid role
#
--source include/not_embedded.inc
create role r1;
create user foo@'127.0.0.1';

View File

@ -56,3 +56,9 @@ Host User Role Admin_option
localhost root r1 Y
drop role r1;
drop user u2;
create user foo@localhost;
grant create user on *.* to foo@localhost;
create role look, isp, xxx, ppp;
rename user current_user to nnnn@'%';
drop role look, isp, xxx, ppp;
drop user nnnn@'%';

View File

@ -54,3 +54,16 @@ select * from mysql.roles_mapping;
drop role r1;
drop user u2;
#
# MDEV-8614 Assertion `status == 0' failed in add_role_user_mapping_action on RENAME USER
#
create user foo@localhost;
grant create user on *.* to foo@localhost;
--connect (con1, localhost, foo,,)
create role look, isp, xxx, ppp;
rename user current_user to nnnn@'%';
drop role look, isp, xxx, ppp;
connection default;
disconnect con1;
drop user nnnn@'%';

View File

@ -88,6 +88,12 @@ a b
18 0
19 0
UNLOCK TABLES;
SELECT "after UNLOCK TABLES" as state;
state
after UNLOCK TABLES
SELECT "after reap of STOP SLAVE" as state;
state
after reap of STOP SLAVE
include/wait_for_slave_to_stop.inc
include/start_slave.inc
SELECT * FROM t2 ORDER BY a;

View File

@ -162,9 +162,13 @@ SELECT * FROM t2 ORDER BY a;
--connection s2
UNLOCK TABLES;
SELECT "after UNLOCK TABLES" as state;
--connection s1
reap;
SELECT "after reap of STOP SLAVE" as state;
--connection server_2
--source include/wait_for_slave_to_stop.inc
--source include/start_slave.inc

View File

@ -130,6 +130,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs disabled
os_log_pending_writes disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
trx_rw_commits disabled
trx_ro_commits disabled
trx_nl_ro_commits disabled
@ -278,6 +281,9 @@ lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
@ -316,6 +322,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs enabled
os_log_pending_writes enabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
set global innodb_monitor_enable="";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of ''
set global innodb_monitor_enable="_";

View File

@ -130,6 +130,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs disabled
os_log_pending_writes disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
trx_rw_commits disabled
trx_ro_commits disabled
trx_nl_ro_commits disabled
@ -278,6 +281,9 @@ lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
@ -316,6 +322,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs enabled
os_log_pending_writes enabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
set global innodb_monitor_enable="";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of ''
set global innodb_monitor_enable="_";

View File

@ -130,6 +130,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs disabled
os_log_pending_writes disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
trx_rw_commits disabled
trx_ro_commits disabled
trx_nl_ro_commits disabled
@ -278,6 +281,9 @@ lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
@ -316,6 +322,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs enabled
os_log_pending_writes enabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
set global innodb_monitor_enable="";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of ''
set global innodb_monitor_enable="_";

View File

@ -130,6 +130,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs disabled
os_log_pending_writes disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
trx_rw_commits disabled
trx_ro_commits disabled
trx_nl_ro_commits disabled
@ -278,6 +281,9 @@ lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
@ -316,6 +322,9 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs enabled
os_log_pending_writes enabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
set global innodb_monitor_enable="";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of ''
set global innodb_monitor_enable="_";

View File

@ -1700,6 +1700,18 @@ alter table t1 add unique index if not exists idx(i);
show create table t1;
DROP TABLE t1;
#
# MDEV-8358 ADD PRIMARY KEY IF NOT EXISTS -> ERROR 1068 (42000): Multiple primary key
#
CREATE TABLE t1 (
`event_id` bigint(20) unsigned NOT NULL DEFAULT '0',
`market_id` bigint(20) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`event_id`,`market_id`)
);
ALTER TABLE t1 ADD PRIMARY KEY IF NOT EXISTS event_id (event_id,market_id);
DROP TABLE t1;
--echo #
--echo # MDEV-7374 : Losing connection to MySQL while running ALTER TABLE
--echo #
@ -1722,6 +1734,3 @@ ALTER TABLE t1 DROP INDEX i1, ADD INDEX i1(a) COMMENT 'comment2';
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
--echo # Start of 10.1 tests
--echo #

View File

@ -871,6 +871,18 @@ set impressions = column_add(impressions,
drop table t1;
--echo #
--echo # MDEV-8565: COLUMN_CHECK fails on valid data
--echo #
SELECT COLUMN_CHECK(COLUMN_CREATE('a',0,'b','1'));
SELECT COLUMN_CHECK(COLUMN_CREATE('a',1,'b','1'));
SELECT COLUMN_JSON(COLUMN_CREATE('a',0,'b','1'));
SELECT COLUMN_JSON(COLUMN_CREATE('a',1,'b','1'));
--echo #
--echo # end of 10.0 tests
--echo #

View File

@ -71,9 +71,9 @@ drop event intact_check_1;
drop event intact_check_2;
--error ER_EVENTS_DB_ERROR
drop event intact_check;
--error ER_EVENTS_DB_ERROR
--error ER_STARTUP
set global event_scheduler=on;
--error ER_EVENTS_DB_ERROR
--error ER_STARTUP
set global event_scheduler=off;
show variables like 'event_scheduler';
--echo Make sure that we still can create and drop databases,
@ -84,6 +84,16 @@ drop database mysqltest_db1;
--echo Restore the original mysql.event table
drop table mysql.event;
rename table event_like to mysql.event;
--echo check that we can now enable events without restart
set global event_scheduler=original;
select @@global.event_scheduler;
set global event_scheduler=on;
select @@global.event_scheduler;
--sorted_result
--replace_column 6 # 9 # 10 #
show events;
--echo Now let's restart the server again
--source include/restart_mysqld.inc

View File

@ -0,0 +1,26 @@
#
# MDEV-7656 init_file option does not allow changing passwords
#
--source include/not_embedded.inc
create user foo@localhost;
select user,host,password from mysql.user where user='foo';
--write_file $MYSQLTEST_VARDIR/init.file
grant all on *.* to foo@localhost identified by 'test';
EOF
--enable_reconnect
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
--exec echo "restart:--init-file=$MYSQLTEST_VARDIR/init.file " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
select user,host,password from mysql.user where user='foo';
drop user foo@localhost;

View File

@ -105,4 +105,12 @@ RENAME TABLE t1 TO T1;
ALTER TABLE T1 RENAME t1;
DROP TABLE t1;
#
# MDEV-9014 SHOW TRIGGERS not case sensitive
#
create table t1 (a int);
create trigger t1_bi before insert on t1 for each row set new.a= 1;
show triggers like '%T1%';
drop table t1;
set GLOBAL sql_mode=default;

View File

@ -19,4 +19,5 @@ connect(con1,localhost,root,foo,,,);
update mysql.user set password='' where user='root';
flush privileges;
# Load event table
set global event_scheduler=OFF;

View File

@ -858,3 +858,45 @@ INSERT INTO t3 SELECT * FROM t2 WHERE f3 = 'm' AND f2 ='c';
DROP TABLE t1,t2,t3;
set global default_storage_engine=default;
--echo #
--echo # Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT
--echo # Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE
--echo #
CREATE TABLE t1
(a INT,
b INT,
PRIMARY KEY (a))
ENGINE = InnoDB
PARTITION BY HASH (a) PARTITIONS 3;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
--connect (con1, localhost, root,,)
--echo # con1
ALTER TABLE t1 ADD INDEX idx1 (b);
--connection default
--echo # con default
--error ER_TABLE_DEF_CHANGED
SELECT b FROM t1 WHERE b = 0;
--error ER_TABLE_DEF_CHANGED
SELECT b FROM t1 WHERE b = 0;
--disconnect con1
DROP TABLE t1;
--echo # Same test without partitioning
CREATE TABLE t1
(a INT,
b INT,
PRIMARY KEY (a))
ENGINE = InnoDB;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
--echo # con1
--connect (con1, localhost, root,,)
ALTER TABLE t1 ADD INDEX idx1 (b);
--connection default
--echo # con default
--error ER_TABLE_DEF_CHANGED
SELECT b FROM t1 WHERE b = 0;
--error ER_TABLE_DEF_CHANGED
SELECT b FROM t1 WHERE b = 0;
--disconnect con1
DROP TABLE t1;

View File

@ -123,6 +123,7 @@ CHECK TABLE t1;
SELECT * FROM t1;
--echo # Note that it is currently impossible to drop a partitioned table
--echo # without the .par file
--replace_result "Not owner" "Operation not permitted"
--error ER_GET_ERRNO
DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.frm

View File

@ -19,6 +19,9 @@ SHOW TABLES;
--replace_result $MYSQLD_DATADIR ./
--error ER_FAILED_READ_FROM_PAR_FILE
SHOW CREATE TABLE t1;
# The replace is needed for Solaris
--replace_result "Not owner" "Operation not permitted"
--error ER_GET_ERRNO
DROP TABLE t1;
--list_files $MYSQLD_DATADIR/test t1*

View File

@ -3650,3 +3650,25 @@ SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1;
drop table t1;
--echo # End of 5.3 tests
--echo #
--echo # MDEV-8756: MariaDB 10.0.21 crashes during PREPARE
--echo #
CREATE TABLE t1 ( id INT(10), value INT(10) );
CREATE TABLE t2 ( id INT(10) );
SET @save_sql_mode= @@sql_mode;
SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY';
PREPARE stmt FROM 'UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)';
execute stmt;
insert into t1 values (1,10),(2,10),(3,10);
insert into t2 values (1),(2);
execute stmt;
select * from t1;
deallocate prepare stmt;
SET SESSION sql_mode = @save_sql_mode;
DROP TABLE t1,t2;
--echo # End of 10.0 tests

View File

@ -0,0 +1,45 @@
--source include/not_embedded.inc
--source include/have_log_bin.inc
--echo #
--echo # CHANGE MASTER TO doesn't work with prepared statements
--echo #
CHANGE MASTER TO MASTER_HOST='host1', MASTER_USER='user1';
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
--echo # Master_Host : $master_host
--echo # Master_User : $master_user
SET @s := "CHANGE MASTER TO MASTER_HOST='host2'";
PREPARE stmt FROM @s;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
--echo # Master_Host : $master_host
--echo # Master_User : $master_user
SET @s := "CHANGE MASTER TO MASTER_USER='user2'";
PREPARE stmt FROM @s;
EXECUTE stmt;
# Multiple executions should not hurt.
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
--echo # Master_Host : $master_host
--echo # Master_User : $master_user
# Reset
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root';
--echo # End of test

View File

@ -112,8 +112,8 @@ DROP FUNCTION f3;
#
# Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server
#
--error ER_OPTION_PREVENTS_STATEMENT
set global event_scheduler=1;
set global event_scheduler=0;
#
# Bug#26285 Selecting information_schema crahes server

View File

@ -232,4 +232,77 @@ SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-7370: Server deadlocks on renaming a table for which persistent statistics exists
--echo #
--disable_warnings
drop database if exists db1;
drop database if exists db1;
--enable_warnings
create database db1;
create database db2;
use db1;
--echo #
--echo # First, run the original testcase:
--echo #
create table t1 (i int);
insert into t1 values (10),(20);
analyze table t1 persistent for all;
rename table t1 to db2.t1;
--echo # Verify that stats in the old database are gone:
select * from mysql.column_stats where db_name='db1' and table_name='t1';
select * from mysql.table_stats where db_name='db1' and table_name='t1';
--echo # Verify that stats are present in the new database:
select * from mysql.column_stats where db_name='db2' and table_name='t1';
select * from mysql.table_stats where db_name='db2' and table_name='t1';
--echo #
--echo # Now, try with more than one column and with indexes:
--echo #
use test;
create table t1(a int primary key);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
use db1;
create table t2 (a int, b int, c int, key IDX1(a), key IDX2(a,b));
insert into t2 select a/10, a/2, a from test.t1;
analyze table t2 persistent for all;
alter table t2 rename db2.t2;
--echo # Verify that stats in the old database are gone:
select * from mysql.table_stats where db_name='db1' and table_name='t2';
select * from mysql.column_stats where db_name='db1' and table_name='t2';
select * from mysql.index_stats where db_name='db1' and table_name='t2';
--echo # Verify that stats are present in the new database:
select * from mysql.table_stats where db_name='db2' and table_name='t2';
select * from mysql.column_stats where db_name='db2' and table_name='t2';
select * from mysql.index_stats where db_name='db2' and table_name='t2';
use db2;
--echo #
--echo # Now, rename within the same database and verify:
--echo #
rename table t2 to t3;
--echo # No stats under old name:
select * from mysql.table_stats where db_name='db2' and table_name='t2';
select * from mysql.column_stats where db_name='db2' and table_name='t2';
select * from mysql.index_stats where db_name='db2' and table_name='t2';
--echo # Stats under the new name:
select * from mysql.table_stats where db_name='db2' and table_name='t3';
select * from mysql.column_stats where db_name='db2' and table_name='t3';
select * from mysql.index_stats where db_name='db2' and table_name='t3';
use test;
drop database db1;
drop database db2;
drop table t1;
set use_stat_tables=@save_use_stat_tables;

View File

@ -701,3 +701,19 @@ drop table t1, t2;
set use_stat_tables=@save_use_stat_tables;
--echo #
--echo # Bug MDEV-7383: min/max value for a column not utf8 compatible
--echo #
create table t1 (a varchar(100)) engine=MyISAM;
insert into t1 values(unhex('D879626AF872675F73E662F8'));
analyze table t1 persistent for all;
show warnings;
select db_name, table_name, column_name,
HEX(min_value), HEX(max_value),
nulls_ratio, avg_frequency,
hist_size, hist_type, HEX(histogram)
FROM mysql.column_stats;
drop table t1;

View File

@ -5966,3 +5966,26 @@ EXECUTE stmt;
deallocate prepare stmt;
drop table t1,t2,t3,t4;
--echo #
--echo # MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
--echo # m_lock_type != 2' failed in handler::ha_index_read_map
--echo #
CREATE TABLE t1 (f1 INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT, KEY(f2));
INSERT INTO t2 VALUES (3);
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
delete from t1;
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
drop view v2;
drop table t1,t2;

View File

@ -559,6 +559,79 @@ SHOW STATUS LIKE 'HANDLER_UPDATE';
ROLLBACK;
DROP TABLE t1, t2;
--echo #
--echo # MDEV-8938: Server Crash on Update with joins
--echo #
CREATE TABLE `t1` (
`name` varchar(255) NOT NULL,
`value` varchar(4095) DEFAULT NULL,
PRIMARY KEY (`name`)
);
UPDATE `t1` SET value = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `t1` WHERE `name`="consoleproxy.url.domain") AS `temptable` WHERE `temptable`.`name`="consoleproxy.url.domain")) WHERE `name`="consoleproxy.url.domain";
drop table t1;
CREATE TABLE `t1` (
`name` varchar(255) NOT NULL,
`value` varchar(4095) DEFAULT NULL,
PRIMARY KEY (`name`)
);
create table t2 (
`name` varchar(255) NOT NULL,
`value` varchar(4095) DEFAULT NULL,
PRIMARY KEY (`name`)
);
UPDATE t1
SET value = (SELECT value FROM t2 WHERE `name`= t1.name)
WHERE value is null ;
drop table t1,t2;
--echo #
--echo #MDEV-8701: Crash on derived query
--echo #
CREATE TABLE t1 (
data_exit_entry_id int(11) NOT NULL,
data_entry_id int(11) NOT NULL,
data_entry_exit_id int(11) NOT NULL,
data_exit_entry_quantity double NOT NULL
) DEFAULT CHARSET=utf8;
CREATE TABLE t2 (
data_entry_id int(11) NOT NULL,
data_entry_cost double NOT NULL,
data_entry_quantity double NOT NULL
) DEFAULT CHARSET=utf8;
create algorithm=temptable view v1 as SELECT data_entry_exit_id, data_exit_entry_quantity, data_entry_cost
FROM t1 INNER JOIN t2 as dt ON dt.data_entry_id = t1.data_entry_id;
UPDATE t2
SET data_entry_cost
= ( ( SELECT SUM(data_exit_entry_quantity * data_entry_cost)
FROM
v1 AS query
WHERE data_entry_exit_id = t2.data_entry_id
)
);
UPDATE t2
SET data_entry_cost
= ( ( SELECT SUM(data_exit_entry_quantity * data_entry_cost)
FROM
( SELECT data_entry_exit_id, data_exit_entry_quantity, data_entry_cost
FROM t1 INNER JOIN t2 as dt ON dt.data_entry_id = t1.data_entry_id) AS query
WHERE data_entry_exit_id = t2.data_entry_id
)
);
drop view v1;
drop table t1, t2;
--echo #
--echo # MDEV-4410: update does not want to use a covering index, but select uses it.
--echo #

View File

@ -5456,6 +5456,41 @@ EXECUTE stmt;
DROP TABLE t1, t2, t3;
DROP VIEW v3;
--echo #
--echo # MDEV-8632: Segmentation fault on INSERT
--echo #
CREATE TABLE `t1` (
`id` int(10) unsigned NOT NULL,
`r` float NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
create view v1 as select id, if(r=r,1,2) as d from t1;
create view v2 as
select id,
d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
from v1;
insert into t1 (id, r)
select id,p from
(
select id,
d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
from (
select id, if(r=r,1,2) as d
from t1
) a
) b
on duplicate key update r=p;
insert into t1 (id, r)
select id,p from v2
on duplicate key update r=p;
prepare stmt from "insert into t1 (id, r) select id,p from v2 on duplicate key update r=p";
execute stmt;
execute stmt;
deallocate prepare stmt;
drop view v1,v2;
drop table `t1`;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
--echo # -----------------------------------------------------------------
@ -5500,6 +5535,151 @@ execute stmt;
drop table t1, t2;
drop view v3;
--echo #
--echo # MDEV-8525: mariadb 10.0.20 crashing when data is read by Kodi
--echo # media center (http://kodi.tv).
--echo #
CREATE TABLE `t1` (
`idSong` int(11) NOT NULL AUTO_INCREMENT,
`idAlbum` int(11) DEFAULT NULL,
`idPath` int(11) DEFAULT NULL,
`strArtists` text,
`strGenres` text,
`strTitle` varchar(512) DEFAULT NULL,
`iTrack` int(11) DEFAULT NULL,
`iDuration` int(11) DEFAULT NULL,
`iYear` int(11) DEFAULT NULL,
`dwFileNameCRC` text,
`strFileName` text,
`strMusicBrainzTrackID` text,
`iTimesPlayed` int(11) DEFAULT NULL,
`iStartOffset` int(11) DEFAULT NULL,
`iEndOffset` int(11) DEFAULT NULL,
`idThumb` int(11) DEFAULT NULL,
`lastplayed` varchar(20) DEFAULT NULL,
`rating` char(1) DEFAULT '0',
`comment` text,
`mood` text,
PRIMARY KEY (`idSong`),
UNIQUE KEY `idxSong7` (`idAlbum`,`strMusicBrainzTrackID`(36)),
KEY `idxSong` (`strTitle`(255)),
KEY `idxSong1` (`iTimesPlayed`),
KEY `idxSong2` (`lastplayed`),
KEY `idxSong3` (`idAlbum`),
KEY `idxSong6` (`idPath`,`strFileName`(255))
) DEFAULT CHARSET=utf8;
INSERT INTO `t1` VALUES (1,1,1,'strArtists1','strGenres1','strTitle1',1,100,2000,NULL,'strFileName1','strMusicBrainzTrackID1',0,0,0,NULL,NULL,'0','',''),(2,2,2,'strArtists2','strGenres2','strTitle2',2,200,2001,NULL,'strFileName2','strMusicBrainzTrackID2',0,0,0,NULL,NULL,'0','','');
CREATE TABLE `t2` (
`idAlbum` int(11) NOT NULL AUTO_INCREMENT,
`strAlbum` varchar(256) DEFAULT NULL,
`strMusicBrainzAlbumID` text,
`strArtists` text,
`strGenres` text,
`iYear` int(11) DEFAULT NULL,
`idThumb` int(11) DEFAULT NULL,
`bCompilation` int(11) NOT NULL DEFAULT '0',
`strMoods` text,
`strStyles` text,
`strThemes` text,
`strReview` text,
`strImage` text,
`strLabel` text,
`strType` text,
`iRating` int(11) DEFAULT NULL,
`lastScraped` varchar(20) DEFAULT NULL,
`dateAdded` varchar(20) DEFAULT NULL,
`strReleaseType` text,
PRIMARY KEY (`idAlbum`),
UNIQUE KEY `idxAlbum_2` (`strMusicBrainzAlbumID`(36)),
KEY `idxAlbum` (`strAlbum`(255)),
KEY `idxAlbum_1` (`bCompilation`)
) DEFAULT CHARSET=utf8;
INSERT INTO `t2` VALUES (1,'strAlbum1','strMusicBrainzAlbumID1','strArtists1','strGenres1',2000,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'album');
CREATE TABLE `t3` (
`idArtist` int(11) DEFAULT NULL,
`idAlbum` int(11) DEFAULT NULL,
`strJoinPhrase` text,
`boolFeatured` int(11) DEFAULT NULL,
`iOrder` int(11) DEFAULT NULL,
`strArtist` text,
UNIQUE KEY `idxAlbumArtist_1` (`idAlbum`,`idArtist`),
UNIQUE KEY `idxAlbumArtist_2` (`idArtist`,`idAlbum`),
KEY `idxAlbumArtist_3` (`boolFeatured`)
) DEFAULT CHARSET=utf8;
INSERT INTO `t3` VALUES (1,1,'',0,0,'strArtist1');
CREATE TABLE `t4` (
`idArtist` int(11) NOT NULL AUTO_INCREMENT,
`strArtist` varchar(256) DEFAULT NULL,
`strMusicBrainzArtistID` text,
`strBorn` text,
`strFormed` text,
`strGenres` text,
`strMoods` text,
`strStyles` text,
`strInstruments` text,
`strBiography` text,
`strDied` text,
`strDisbanded` text,
`strYearsActive` text,
`strImage` text,
`strFanart` text,
`lastScraped` varchar(20) DEFAULT NULL,
`dateAdded` varchar(20) DEFAULT NULL,
PRIMARY KEY (`idArtist`),
UNIQUE KEY `idxArtist1` (`strMusicBrainzArtistID`(36)),
KEY `idxArtist` (`strArtist`(255))
) DEFAULT CHARSET=utf8;
INSERT INTO `t4` VALUES (1,'strArtist1','strMusicBrainzArtistID',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
CREATE VIEW `v1` AS select `t2`.`idAlbum` AS `idAlbum`,`t2`.`strAlbum` AS `strAlbum`,`t2`.`strMusicBrainzAlbumID` AS `strMusicBrainzAlbumID`,`t2`.`strArtists` AS `strArtists`,`t2`.`strGenres` AS `strGenres`,`t2`.`iYear` AS `iYear`,`t2`.`strMoods` AS `strMoods`,`t2`.`strStyles` AS `strStyles`,`t2`.`strThemes` AS `strThemes`,`t2`.`strReview` AS `strReview`,`t2`.`strLabel` AS `strLabel`,`t2`.`strType` AS `strType`,`t2`.`strImage` AS `strImage`,`t2`.`iRating` AS `iRating`,`t2`.`bCompilation` AS `bCompilation`,(select min(`t1`.`iTimesPlayed`) from `t1` where (`t1`.`idAlbum` = `t2`.`idAlbum`)) AS `iTimesPlayed`,`t2`.`strReleaseType` AS `strReleaseType` from `t2`;
CREATE VIEW `v2` AS select `t3`.`idAlbum` AS `idAlbum`,`t3`.`idArtist` AS `idArtist`,`t4`.`strArtist` AS `strArtist`,`t4`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,`t3`.`boolFeatured` AS `boolFeatured`,`t3`.`strJoinPhrase` AS `strJoinPhrase`,`t3`.`iOrder` AS `iOrder` from (`t3` join `t4` on((`t3`.`idArtist` = `t4`.`idArtist`)));
SELECT v1.*,v2.* FROM v1 LEFT JOIN v2 ON v1.idAlbum = v2.idAlbum WHERE v1.idAlbum = 1 ORDER BY v2.iOrder;
drop view v1,v2;
drop table t1,t2,t3,t4;
--echo #
--echo # MDEV-8913: Derived queries with same column names as final
--echo # projection causes issues when using Order By
--echo #
create table t1 (field int);
insert into t1 values (10),(5),(3),(8),(20);
SELECT sq.f2 AS f1, sq.f1 AS f2
FROM ( SELECT field AS f1, 1 AS f2 FROM t1) AS sq
ORDER BY sq.f1;
create view v1 as SELECT field AS f1, 1 AS f2 FROM t1;
SELECT sq.f2 AS f1, sq.f1 AS f2
FROM v1 AS sq
ORDER BY sq.f1;
drop view v1;
create table t2 SELECT field AS f1, 1 AS f2 FROM t1;
SELECT
sq.f2 AS f1,
sq.f1 AS f2
FROM t2 AS sq
ORDER BY sq.f1;
drop table t1, t2;
--error ER_BAD_FIELD_ERROR
SELECT 1 FROM (SELECT 1 as a) AS b HAVING (SELECT `SOME_GARBAGE`.b.a)=1;
--echo # -----------------------------------------------------------------
--echo # -- End of 10.0 tests.
--echo # -----------------------------------------------------------------

View File

@ -44,7 +44,7 @@ const int LF_HASH_OVERHEAD= sizeof(LF_SLIST);
/*
a structure to pass the context (pointers two the three successive elements
in a list) from lfind to linsert/ldelete
in a list) from l_find to l_insert/l_delete
*/
typedef struct {
intptr volatile *prev;
@ -84,7 +84,7 @@ typedef struct {
0 - ok
1 - error (callbck returned 1)
*/
static int lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
static int l_find(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
const uchar *key, uint keylen, CURSOR *cursor, LF_PINS *pins,
my_hash_walk_action callback)
{
@ -157,7 +157,7 @@ retry:
/*
DESCRIPTION
insert a 'node' in the list that starts from 'head' in the correct
position (as found by lfind)
position (as found by l_find)
RETURN
0 - inserted
@ -167,7 +167,7 @@ retry:
it uses pins[0..2], on return all pins are removed.
if there're nodes with the same key value, a new node is added before them.
*/
static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
static LF_SLIST *l_insert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
LF_SLIST *node, LF_PINS *pins, uint flags)
{
CURSOR cursor;
@ -175,7 +175,7 @@ static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
for (;;)
{
if (lfind(head, cs, node->hashnr, node->key, node->keylen,
if (l_find(head, cs, node->hashnr, node->key, node->keylen,
&cursor, pins, 0) &&
(flags & LF_HASH_UNIQUE))
{
@ -219,7 +219,7 @@ static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
NOTE
it uses pins[0..2], on return all pins are removed.
*/
static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
static int l_delete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
const uchar *key, uint keylen, LF_PINS *pins)
{
CURSOR cursor;
@ -227,7 +227,7 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
for (;;)
{
if (!lfind(head, cs, hashnr, key, keylen, &cursor, pins, 0))
if (!l_find(head, cs, hashnr, key, keylen, &cursor, pins, 0))
{
res= 1; /* not found */
break;
@ -251,7 +251,7 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
(to ensure the number of "set DELETED flag" actions
is equal to the number of "remove from the list" actions)
*/
lfind(head, cs, hashnr, key, keylen, &cursor, pins, 0);
l_find(head, cs, hashnr, key, keylen, &cursor, pins, 0);
}
res= 0;
break;
@ -277,12 +277,12 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
it uses pins[0..2], on return the pin[2] keeps the node found
all other pins are removed.
*/
static LF_SLIST *lsearch(LF_SLIST * volatile *head, CHARSET_INFO *cs,
static LF_SLIST *l_search(LF_SLIST * volatile *head, CHARSET_INFO *cs,
uint32 hashnr, const uchar *key, uint keylen,
LF_PINS *pins)
{
CURSOR cursor;
int res= lfind(head, cs, hashnr, key, keylen, &cursor, pins, 0);
int res= l_find(head, cs, hashnr, key, keylen, &cursor, pins, 0);
if (res)
lf_pin(pins, 2, cursor.curr);
else
@ -392,7 +392,7 @@ void lf_hash_destroy(LF_HASH *hash)
-1 - out of memory
NOTE
see linsert() for pin usage notes
see l_insert() for pin usage notes
*/
int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
{
@ -412,7 +412,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins)))
return -1;
node->hashnr= my_reverse_bits(hashnr) | 1; /* normal node */
if (linsert(el, hash->charset, node, pins, hash->flags))
if (l_insert(el, hash->charset, node, pins, hash->flags))
{
lf_alloc_free(pins, node);
return 1;
@ -432,7 +432,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
0 - deleted
1 - didn't (not found)
NOTE
see ldelete() for pin usage notes
see l_delete() for pin usage notes
*/
int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
{
@ -450,7 +450,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
if (unlikely(bucket == 0))
return 1; /* if there's no bucket==0, the hash is empty */
}
if (ldelete(el, hash->charset, my_reverse_bits(hashnr) | 1,
if (l_delete(el, hash->charset, my_reverse_bits(hashnr) | 1,
(uchar *)key, keylen, pins))
{
return 1;
@ -466,7 +466,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
NULL if nothing is found
NOTE
see lsearch() for pin usage notes
see l_search() for pin usage notes
*/
void *lf_hash_search_using_hash_value(LF_HASH *hash, LF_PINS *pins,
my_hash_value_type hashnr,
@ -484,7 +484,7 @@ void *lf_hash_search_using_hash_value(LF_HASH *hash, LF_PINS *pins,
if (unlikely(bucket == 0))
return 0; /* if there's no bucket==0, the hash is empty */
}
found= lsearch(el, hash->charset, my_reverse_bits(hashnr) | 1,
found= l_search(el, hash->charset, my_reverse_bits(hashnr) | 1,
(uchar *)key, keylen, pins);
return found ? found+1 : 0;
}
@ -514,7 +514,7 @@ int lf_hash_iterate(LF_HASH *hash, LF_PINS *pins,
if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins)))
return 0; /* if there's no bucket==0, the hash is empty */
res= lfind(el, 0, 0, (uchar*)argument, 0, &cursor, pins, action);
res= l_find(el, 0, 0, (uchar*)argument, 0, &cursor, pins, action);
lf_unpin(pins, 2);
lf_unpin(pins, 1);
@ -553,16 +553,16 @@ static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node,
dummy->hashnr= my_reverse_bits(bucket) | 0; /* dummy node */
dummy->key= dummy_key;
dummy->keylen= 0;
if ((cur= linsert(el, hash->charset, dummy, pins, LF_HASH_UNIQUE)))
if ((cur= l_insert(el, hash->charset, dummy, pins, LF_HASH_UNIQUE)))
{
my_free(dummy);
dummy= cur;
}
my_atomic_casptr((void **)node, (void **)(char*) &tmp, dummy);
/*
note that if the CAS above failed (after linsert() succeeded),
it would mean that some other thread has executed linsert() for
the same dummy node, its linsert() failed, it picked up our
note that if the CAS above failed (after l_insert() succeeded),
it would mean that some other thread has executed l_insert() for
the same dummy node, its l_insert() failed, it picked up our
dummy node (in "dummy= cur") and executed the same CAS as above.
Which means that even if CAS above failed we don't need to retry,
and we should not free(dummy) - there's no memory leak here

View File

@ -3722,10 +3722,12 @@ mariadb_dyncol_check(DYNAMIC_COLUMN *str)
if (prev_type != DYN_COL_NULL)
{
/* It is not first entry */
if (prev_data_offset >= data_offset)
if (prev_data_offset > data_offset ||
((prev_type != DYN_COL_INT &&
prev_type != DYN_COL_UINT) && prev_data_offset == data_offset))
{
DBUG_PRINT("info", ("Field order: %u Previous data offset: %u"
" >= Current data offset: %u",
" >(=) Current data offset: %u",
(uint)i,
(uint)prev_data_offset,
(uint)data_offset));

View File

@ -129,6 +129,31 @@ ulonglong my_timer_cycles_il_x86_64();
clock_gettime(CLOCK_SGI_CYCLE) for Irix platforms,
or on read_real_time for aix platforms. There is
nothing for Alpha platforms, they would be tricky.
On the platforms that do not have a CYCLE timer,
"wait" events are initialized to use NANOSECOND instead of CYCLE
during performance_schema initialization (at the server startup).
Linux performance monitor (see "man perf_event_open") can
provide cycle counter on the platforms that do not have
other kinds of cycle counters. But we don't use it so far.
ARM notes
---------
During tests on ARMv7 Debian, perf_even_open() based cycle counter provided
too low frequency with too high overhead:
MariaDB [performance_schema]> SELECT * FROM performance_timers;
+-------------+-----------------+------------------+----------------+
| TIMER_NAME | TIMER_FREQUENCY | TIMER_RESOLUTION | TIMER_OVERHEAD |
+-------------+-----------------+------------------+----------------+
| CYCLE | 689368159 | 1 | 970 |
| NANOSECOND | 1000000000 | 1 | 308 |
| MICROSECOND | 1000000 | 1 | 417 |
| MILLISECOND | 1000 | 1000 | 407 |
| TICK | 127 | 1 | 612 |
+-------------+-----------------+------------------+----------------+
Therefore, it was decided not to use perf_even_open() on ARM
(i.e. go without CYCLE and have "wait" events use NANOSECOND by default).
*/
ulonglong my_timer_cycles(void)

View File

@ -311,11 +311,6 @@ IF(MSVC)
ENDIF(MSVC)
SET(CMAKE_INCLUDE_CURRENT_DIR 1)
# needed to make sure to not link debug libs
# against release libs and vice versa
IF(WIN32)
SET(CMAKE_DEBUG_POSTFIX "d")
ENDIF(WIN32)
SET(targets)

View File

@ -22,6 +22,10 @@ extern ST_SCHEMA_TABLE schema_tables[];
namespace feedback {
#ifndef DBUG_OFF
ulong debug_startup_interval, debug_first_interval, debug_interval;
#endif
char server_uid_buf[SERVER_UID_SIZE+1]; ///< server uid will be written here
/* backing store for system variables */
@ -253,6 +257,18 @@ static int init(void *p)
prepare_linux_info();
#ifndef DBUG_OFF
if (startup_interval != debug_startup_interval ||
first_interval != debug_first_interval ||
interval != debug_interval)
{
startup_interval= debug_startup_interval;
first_interval= debug_first_interval;
interval= debug_interval;
user_info= "mysql-test";
}
#endif
url_count= 0;
if (*url)
{
@ -361,6 +377,18 @@ static MYSQL_SYSVAR_STR(http_proxy, http_proxy,
"Proxy server host:port.", NULL, NULL,0);
#ifndef DBUG_OFF
static MYSQL_SYSVAR_ULONG(debug_startup_interval, debug_startup_interval,
PLUGIN_VAR_RQCMDARG, "for debugging only",
NULL, NULL, startup_interval, 1, INT_MAX32, 1);
static MYSQL_SYSVAR_ULONG(debug_first_interval, debug_first_interval,
PLUGIN_VAR_RQCMDARG, "for debugging only",
NULL, NULL, first_interval, 1, INT_MAX32, 1);
static MYSQL_SYSVAR_ULONG(debug_interval, debug_interval,
PLUGIN_VAR_RQCMDARG, "for debugging only",
NULL, NULL, interval, 1, INT_MAX32, 1);
#endif
static struct st_mysql_sys_var* settings[] = {
MYSQL_SYSVAR(server_uid),
MYSQL_SYSVAR(user_info),
@ -368,6 +396,11 @@ static struct st_mysql_sys_var* settings[] = {
MYSQL_SYSVAR(send_timeout),
MYSQL_SYSVAR(send_retry_wait),
MYSQL_SYSVAR(http_proxy),
#ifndef DBUG_OFF
MYSQL_SYSVAR(debug_startup_interval),
MYSQL_SYSVAR(debug_first_interval),
MYSQL_SYSVAR(debug_interval),
#endif
NULL
};

View File

@ -65,6 +65,10 @@ class Url {
extern Url **urls;
extern uint url_count;
extern time_t startup_interval;
extern time_t first_interval;
extern time_t interval;
/* these are used to communicate with the background thread */
extern mysql_mutex_t sleep_mutex;
extern mysql_cond_t sleep_condition;

View File

@ -26,9 +26,9 @@ static my_thread_id thd_thread_id; ///< its thread_id
static size_t needed_size= 20480;
static const time_t startup_interval= 60*5; ///< in seconds (5 minutes)
static const time_t first_interval= 60*60*24; ///< in seconds (one day)
static const time_t interval= 60*60*24*7; ///< in seconds (one week)
time_t startup_interval= 60*5; ///< in seconds (5 minutes)
time_t first_interval= 60*60*24; ///< in seconds (one day)
time_t interval= 60*60*24*7; ///< in seconds (one week)
/**
reads the rows from a table and puts them, concatenated, in a String
@ -125,6 +125,7 @@ static int prepare_for_fill(TABLE_LIST *tables)
if (!tables->table)
return 1;
tables->select_lex= thd->lex->current_select;
tables->table->pos_in_table_list= tables;
return 0;
@ -260,7 +261,7 @@ ret:
the effect of the background thread on SHOW STATUS.
*/
mysql_mutex_lock(&LOCK_thread_count);
bzero(&thd->status_var, sizeof(thd->status_var));
thd->set_status_var_init();
thread_count--;
thd->killed= KILL_CONNECTION;
mysql_cond_broadcast(&COND_thread_count);

View File

@ -746,8 +746,10 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name,
/*
At this point, the binlog file and position of this transaction
must have been removed from ActiveTranx.
active_tranxs_ may be NULL if someone disabled semi sync during
cond_timewait()
*/
assert(thd_killed(current_thd) ||
assert(thd_killed(current_thd) || !active_tranxs_ ||
!active_tranxs_->is_tranx_end_pos(trx_wait_binlog_name,
trx_wait_binlog_pos));

View File

@ -24,7 +24,6 @@ rootpass=""
echo_n=
echo_c=
basedir=
bindir=
defaults_file=
defaults_extra_file=
no_defaults=
@ -159,8 +158,15 @@ then
cannot_find_file my_print_defaults $basedir/bin $basedir/extra
exit 1
fi
mysql_command=`find_in_basedir mysql bin`
if test -z "$mysql_command"
then
cannot_find_file mysql $basedir/bin
exit 1
fi
else
print_defaults="@bindir@/my_print_defaults"
mysql_command="@bindir@/mysql"
fi
if test ! -x "$print_defaults"
@ -169,29 +175,17 @@ then
exit 1
fi
if test ! -x "$mysql_command"
then
cannot_find_file "$mysql_command"
exit 1
fi
# Now we can get arguments from the group [client] and [client-server]
# in the my.cfg file, then re-run to merge with command line arguments.
parse_arguments `$print_defaults $defaults_file $defaults_extra_file $no_defaults client client-server client-mariadb`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
# Configure paths to support files
if test -n "$basedir"
then
bindir="$basedir/bin"
elif test -f "./bin/mysql"
then
bindir="./bin"
else
bindir="@bindir@"
fi
mysql_command=`find_in_basedir mysql $bindir`
if test -z "$mysql_command"
then
cannot_find_file mysql $bindir
exit 1
fi
set_echo_compat() {
case `echo "testing\c"`,`echo -n testing` in
*c*,-n*) echo_n= echo_c= ;;

View File

@ -220,7 +220,7 @@ set @had_proxies_priv_table= @@warning_count != 0;
CREATE TABLE IF NOT EXISTS table_stats (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, cardinality bigint(21) unsigned DEFAULT NULL, PRIMARY KEY (db_name,table_name) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Tables';
CREATE TABLE IF NOT EXISTS column_stats (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, column_name varchar(64) NOT NULL, min_value varchar(255) DEFAULT NULL, max_value varchar(255) DEFAULT NULL, nulls_ratio decimal(12,4) DEFAULT NULL, avg_length decimal(12,4) DEFAULT NULL, avg_frequency decimal(12,4) DEFAULT NULL, hist_size tinyint unsigned, hist_type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB'), histogram varbinary(255), PRIMARY KEY (db_name,table_name,column_name) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Columns';
CREATE TABLE IF NOT EXISTS column_stats (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, column_name varchar(64) NOT NULL, min_value varbinary(255) DEFAULT NULL, max_value varbinary(255) DEFAULT NULL, nulls_ratio decimal(12,4) DEFAULT NULL, avg_length decimal(12,4) DEFAULT NULL, avg_frequency decimal(12,4) DEFAULT NULL, hist_size tinyint unsigned, hist_type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB'), histogram varbinary(255), PRIMARY KEY (db_name,table_name,column_name) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Columns';
CREATE TABLE IF NOT EXISTS index_stats (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, index_name varchar(64) NOT NULL, prefix_arity int(11) unsigned NOT NULL, avg_frequency decimal(12,4) DEFAULT NULL, PRIMARY KEY (db_name,table_name,index_name,prefix_arity) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Indexes';

View File

@ -600,6 +600,8 @@ ALTER TABLE event ADD body_utf8 longblob DEFAULT NULL
AFTER db_collation;
ALTER TABLE event MODIFY body_utf8 longblob DEFAULT NULL;
# Enable event scheduler if the event table was not up to date before.
set global event_scheduler=original;
#
# TRIGGER privilege
@ -719,3 +721,5 @@ flush privileges;
ALTER TABLE help_category MODIFY url TEXT NOT NULL;
ALTER TABLE help_topic MODIFY url TEXT NOT NULL;
# MDEV-7383 - varbinary on mix/max of column_stats
alter table column_stats modify min_value varbinary(255) DEFAULT NULL, modify max_value varbinary(255) DEFAULT NULL;

View File

@ -170,188 +170,6 @@ static int get_vio_connect_timeout(MYSQL *mysql)
}
/****************************************************************************
A modified version of connect(). my_connect() allows you to specify
a timeout value, in seconds, that we should wait until we
derermine we can't connect to a particular host. If timeout is 0,
my_connect() will behave exactly like connect().
Base version coded by Steve Bernacki, Jr. <steve@navinet.net>
*****************************************************************************/
int my_connect(my_socket fd, const struct sockaddr *name, uint namelen,
uint timeout)
{
#if defined(__WIN__)
DBUG_ENTER("my_connect");
DBUG_RETURN(connect(fd, (struct sockaddr*) name, namelen));
#else
int flags, res, s_err;
DBUG_ENTER("my_connect");
DBUG_PRINT("enter", ("fd: %d timeout: %u", fd, timeout));
/*
If they passed us a timeout of zero, we should behave
exactly like the normal connect() call does.
*/
if (timeout == 0)
DBUG_RETURN(connect(fd, (struct sockaddr*) name, namelen));
flags = fcntl(fd, F_GETFL, 0); /* Set socket to not block */
#ifdef O_NONBLOCK
fcntl(fd, F_SETFL, flags | O_NONBLOCK); /* and save the flags.. */
#endif
DBUG_PRINT("info", ("connecting non-blocking"));
res= connect(fd, (struct sockaddr*) name, namelen);
DBUG_PRINT("info", ("connect result: %d errno: %d", res, errno));
s_err= errno; /* Save the error... */
fcntl(fd, F_SETFL, flags);
if ((res != 0) && (s_err != EINPROGRESS))
{
errno= s_err; /* Restore it */
DBUG_RETURN(-1);
}
if (res == 0) /* Connected quickly! */
DBUG_RETURN(0);
DBUG_RETURN(wait_for_data(fd, timeout));
#endif
}
/*
Wait up to timeout seconds for a connection to be established.
We prefer to do this with poll() as there is no limitations with this.
If not, we will use select()
*/
#if !defined(__WIN__)
static int wait_for_data(my_socket fd, uint timeout)
{
#ifdef HAVE_POLL
struct pollfd ufds;
int res;
DBUG_ENTER("wait_for_data");
DBUG_PRINT("info", ("polling"));
ufds.fd= fd;
ufds.events= POLLIN | POLLPRI;
if (!(res= poll(&ufds, 1, (int) timeout*1000)))
{
DBUG_PRINT("info", ("poll timed out"));
errno= EINTR;
DBUG_RETURN(-1);
}
DBUG_PRINT("info",
("poll result: %d errno: %d revents: 0x%02d events: 0x%02d",
res, errno, ufds.revents, ufds.events));
if (res < 0 || !(ufds.revents & (POLLIN | POLLPRI)))
DBUG_RETURN(-1);
/*
At this point, we know that something happened on the socket.
But this does not means that everything is alright.
The connect might have failed. We need to retrieve the error code
from the socket layer. We must return success only if we are sure
that it was really a success. Otherwise we might prevent the caller
from trying another address to connect to.
*/
{
int s_err;
socklen_t s_len= sizeof(s_err);
DBUG_PRINT("info", ("Get SO_ERROR from non-blocked connected socket."));
res= getsockopt(fd, SOL_SOCKET, SO_ERROR, &s_err, &s_len);
DBUG_PRINT("info", ("getsockopt res: %d s_err: %d", res, s_err));
if (res)
DBUG_RETURN(res);
/* getsockopt() was successful, check the retrieved status value. */
if (s_err)
{
errno= s_err;
DBUG_RETURN(-1);
}
/* Status from connect() is zero. Socket is successfully connected. */
}
DBUG_RETURN(0);
#else
SOCKOPT_OPTLEN_TYPE s_err_size = sizeof(uint);
fd_set sfds;
struct timeval tv;
time_t start_time, now_time;
int res, s_err;
DBUG_ENTER("wait_for_data");
if (fd >= FD_SETSIZE) /* Check if wrong error */
DBUG_RETURN(0); /* Can't use timeout */
/*
Our connection is "in progress." We can use the select() call to wait
up to a specified period of time for the connection to suceed.
If select() returns 0 (after waiting howevermany seconds), our socket
never became writable (host is probably unreachable.) Otherwise, if
select() returns 1, then one of two conditions exist:
1. An error occured. We use getsockopt() to check for this.
2. The connection was set up sucessfully: getsockopt() will
return 0 as an error.
Thanks goes to Andrew Gierth <andrew@erlenstar.demon.co.uk>
who posted this method of timing out a connect() in
comp.unix.programmer on August 15th, 1997.
*/
FD_ZERO(&sfds);
FD_SET(fd, &sfds);
/*
select could be interrupted by a signal, and if it is,
the timeout should be adjusted and the select restarted
to work around OSes that don't restart select and
implementations of select that don't adjust tv upon
failure to reflect the time remaining
*/
start_time= my_time(0);
for (;;)
{
tv.tv_sec = (long) timeout;
tv.tv_usec = 0;
#if defined(HPUX10)
if ((res = select(fd+1, NULL, (int*) &sfds, NULL, &tv)) > 0)
break;
#else
if ((res = select(fd+1, NULL, &sfds, NULL, &tv)) > 0)
break;
#endif
if (res == 0) /* timeout */
DBUG_RETURN(-1);
now_time= my_time(0);
timeout-= (uint) (now_time - start_time);
if (errno != EINTR || (int) timeout <= 0)
DBUG_RETURN(-1);
}
/*
select() returned something more interesting than zero, let's
see if we have any errors. If the next two statements pass,
we've got an open socket!
*/
s_err=0;
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*) &s_err, &s_err_size) != 0)
DBUG_RETURN(-1);
if (s_err)
{ /* getsockopt could succeed */
errno = s_err;
DBUG_RETURN(-1); /* but return an error... */
}
DBUG_RETURN(0); /* ok */
#endif /* HAVE_POLL */
}
#endif /* !defined(__WIN__) */
/**
Set the internal error message to mysql handler
@ -3165,19 +2983,20 @@ int run_plugin_auth(MYSQL *mysql, char *data, uint data_len,
static int
connect_sync_or_async(MYSQL *mysql, NET *net, my_socket fd,
const struct sockaddr *name, uint namelen)
struct sockaddr *name, uint namelen)
{
int vio_timeout = get_vio_connect_timeout(mysql);
if (mysql->options.extension && mysql->options.extension->async_context &&
mysql->options.extension->async_context->active)
{
my_bool old_mode;
int vio_timeout= get_vio_connect_timeout(mysql);
vio_blocking(net->vio, FALSE, &old_mode);
return my_connect_async(mysql->options.extension->async_context, fd,
name, namelen, vio_timeout);
}
return my_connect(fd, name, namelen, mysql->options.connect_timeout);
return vio_socket_connect(net->vio, name, namelen, vio_timeout);
}

Some files were not shown because too many files have changed in this diff Show More