Merge 10.3 into 10.4

Disable MDEV-20576 assertions until MDEV-20595 has been fixed.
This commit is contained in:
Marko Mäkelä 2019-09-23 17:35:29 +03:00
commit 5a92ccbaea
101 changed files with 1292 additions and 776 deletions

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2017, MariaDB Corporation.
Copyright (c) 2010, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -1074,7 +1074,7 @@ static int get_options(int *argc, char ***argv)
my_progname_short);
return(EX_USAGE);
}
if (strcmp(default_charset, charset_info->csname) &&
if (strcmp(default_charset, MYSQL_AUTODETECT_CHARSET_NAME) &&
!(charset_info= get_charset_by_csname(default_charset,
MY_CS_PRIMARY, MYF(MY_WME))))
exit(1);
@ -1539,6 +1539,9 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
char query_buffer[QUERY_LENGTH];
size_t query_length;
if (!strcmp(cs_name, MYSQL_AUTODETECT_CHARSET_NAME))
cs_name= (char *)my_default_csname();
/* Server lacks facility. This is not an error, by arbitrary decision . */
if (!server_supports_switching_charsets)
return FALSE;

View file

@ -1,13 +1,31 @@
# If timestamping is used, it can (rarely) fail, when public timestamping service has issues.
#
# To handle the error gracefully and tranparently, we'll retry the signtool command,
# second time without "/t URL" parameter
SET(SIGNTOOL_PARAMETERS_NO_TIMESTAMP "@SIGNTOOL_PARAMETERS@")
LIST(FIND SIGNTOOL_PARAMETERS_NO_TIMESTAMP /t idx)
IF(NOT(idx EQUAL -1))
LIST(REMOVE_AT SIGNTOOL_PARAMETERS_NO_TIMESTAMP ${idx})
#remove the URL following /t , as well
LIST(REMOVE_AT SIGNTOOL_PARAMETERS_NO_TIMESTAMP ${idx})
ENDIF()
GET_FILENAME_COMPONENT(SIGNTOOL_DIR "@SIGNTOOL_EXECUTABLE@" DIRECTORY)
GET_FILENAME_COMPONENT(SIGNTOOL_NAME "@SIGNTOOL_EXECUTABLE@" NAME)
FILE(GLOB_RECURSE files "@CMAKE_BINARY_DIR@/*.signme")
MESSAGE(STATUS "signing files")
FOREACH(f ${files})
STRING(REPLACE ".signme" "" exe_location "${f}")
string (REPLACE ";" " " params "@SIGNTOOL_PARAMETERS@")
#MESSAGE("@SIGNTOOL_EXECUTABLE@" sign ${params} "${exe_location}")
EXECUTE_PROCESS(COMMAND
"@SIGNTOOL_EXECUTABLE@" sign @SIGNTOOL_PARAMETERS@ "${exe_location}"
cmd /c "${SIGNTOOL_NAME}" sign @SIGNTOOL_PARAMETERS@ "${exe_location}" 2>NUL
|| "${SIGNTOOL_NAME}" sign ${SIGNTOOL_PARAMETERS_NO_TIMESTAMP} "${exe_location}"
WORKING_DIRECTORY ${SIGNTOOL_DIR}
RESULT_VARIABLE ERR)
IF(NOT ${ERR} EQUAL 0)
MESSAGE( "Error ${ERR} signing ${exe_location}")

View file

@ -2258,6 +2258,16 @@ static int default_my_dbug_sanity(void)
return 0;
}
extern my_bool my_assert;
ATTRIBUTE_COLD
my_bool _db_my_assert(const char *file, int line, const char *msg)
{
my_bool a = my_assert;
_db_flush_();
if (!a)
fprintf(stderr, "%s:%d: assert: %s\n", file, line, msg);
return a;
}
#else
/*

View file

@ -2,8 +2,8 @@
. /usr/share/debconf/confmodule
# assume the filename is /path/to/mariadb-server-##.#.postinst
VER=${0: -13:4}
# Automatically set version to ease maintenance of this file
MAJOR_VER="${DPKG_MAINTSCRIPT_PACKAGE#mariadb-server-}"
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
@ -11,7 +11,7 @@ ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
# This command can be used as pipe to syslog. With "-s" it also logs to stderr.
ERR_LOGGER="logger -p daemon.err -t mariadb-server-$VER.postinst -i"
ERR_LOGGER="logger -p daemon.err -t mariadb-server-$MAJOR_VER.postinst -i"
# This will make an error in a logged command immediately apparent by aborting
# the install, rather than failing silently and leaving a broken install.
set -o pipefail
@ -117,8 +117,8 @@ EOF
set -e
# To avoid downgrades.
touch $mysql_statedir/debian-$VER.flag
touch $mysql_statedir/debian-$MAJOR_VER.flag
# On new installations root user can connect via unix_socket.
# But on upgrades, scripts rely on debian-sys-maint user and
# credentials in /etc/mysql/debian.cnf

View file

@ -1607,7 +1607,8 @@ bool backup_finish()
return(false);
}
if (!write_xtrabackup_info(mysql_connection, XTRABACKUP_INFO, opt_history != 0)) {
if (!write_xtrabackup_info(mysql_connection, XTRABACKUP_INFO,
opt_history != 0, true)) {
return(false);
}

View file

@ -1367,9 +1367,12 @@ PERCONA_SCHEMA.xtrabackup_history and writes a new history record to the
table containing all the history info particular to the just completed
backup. */
bool
write_xtrabackup_info(MYSQL *connection, const char * filename, bool history)
write_xtrabackup_info(MYSQL *connection, const char * filename, bool history,
bool stream)
{
bool result = true;
FILE *fp = NULL;
char *uuid = NULL;
char *server_version = NULL;
char buf_start_time[100];
@ -1395,7 +1398,8 @@ write_xtrabackup_info(MYSQL *connection, const char * filename, bool history)
|| xtrabackup_databases_exclude
);
backup_file_printf(filename,
char *buf = NULL;
int buf_len = asprintf(&buf,
"uuid = %s\n"
"name = %s\n"
"tool_name = %s\n"
@ -1407,8 +1411,8 @@ write_xtrabackup_info(MYSQL *connection, const char * filename, bool history)
"end_time = %s\n"
"lock_time = %d\n"
"binlog_pos = %s\n"
"innodb_from_lsn = %llu\n"
"innodb_to_lsn = %llu\n"
"innodb_from_lsn = " LSN_PF "\n"
"innodb_to_lsn = " LSN_PF "\n"
"partial = %s\n"
"incremental = %s\n"
"format = %s\n"
@ -1425,12 +1429,34 @@ write_xtrabackup_info(MYSQL *connection, const char * filename, bool history)
(int)history_lock_time, /* lock_time */
mysql_binlog_position ?
mysql_binlog_position : "", /* binlog_pos */
incremental_lsn, /* innodb_from_lsn */
metadata_to_lsn, /* innodb_to_lsn */
incremental_lsn,
/* innodb_from_lsn */
metadata_to_lsn,
/* innodb_to_lsn */
is_partial? "Y" : "N",
xtrabackup_incremental ? "Y" : "N", /* incremental */
xb_stream_name[xtrabackup_stream_fmt], /* format */
xtrabackup_compress ? "compressed" : "N"); /* compressed */
if (buf_len < 0) {
msg("Error: cannot generate xtrabackup_info");
result = false;
goto cleanup;
}
if (stream) {
backup_file_printf(filename, "%s", buf);
} else {
fp = fopen(filename, "w");
if (!fp) {
msg("Error: cannot open %s", filename);
result = false;
goto cleanup;
}
if (fwrite(buf, buf_len, 1, fp) < 1) {
result = false;
goto cleanup;
}
}
if (!history) {
goto cleanup;
@ -1492,8 +1518,11 @@ cleanup:
free(uuid);
free(server_version);
free(buf);
if (fp)
fclose(fp);
return(true);
return(result);
}
extern const char *innodb_checksum_algorithm_names[];

View file

@ -68,7 +68,8 @@ bool
write_binlog_info(MYSQL *connection);
bool
write_xtrabackup_info(MYSQL *connection, const char * filename, bool history);
write_xtrabackup_info(MYSQL *connection, const char * filename, bool history,
bool stream);
bool
write_backup_config_file();

View file

@ -3982,7 +3982,7 @@ static bool xtrabackup_backup_low()
}
sprintf(filename, "%s/%s", xtrabackup_extra_lsndir,
XTRABACKUP_INFO);
if (!write_xtrabackup_info(mysql_connection, filename, false)) {
if (!write_xtrabackup_info(mysql_connection, filename, false, false)) {
msg("Error: failed to write info "
"to '%s'.", filename);
return false;

View file

@ -35,7 +35,6 @@ struct _db_stack_frame_ {
};
struct _db_code_state_;
extern MYSQL_PLUGIN_IMPORT my_bool my_assert;
extern my_bool _dbug_on_;
extern my_bool _db_keyword_(struct _db_code_state_ *, const char *, int);
extern int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len);
@ -59,6 +58,8 @@ extern void _db_dump_(uint _line_,const char *keyword,
extern void _db_end_(void);
extern void _db_lock_file_(void);
extern void _db_unlock_file_(void);
ATTRIBUTE_COLD
extern my_bool _db_my_assert(const char *file, int line, const char *msg);
extern FILE *_db_fp_(void);
extern void _db_flush_(void);
extern void dbug_swap_code_state(void **code_state_store);
@ -104,10 +105,9 @@ extern int (*dbug_sanity)(void);
#define DBUG_END() _db_end_ ()
#define DBUG_LOCK_FILE _db_lock_file_()
#define DBUG_UNLOCK_FILE _db_unlock_file_()
#define DBUG_ASSERT(A) do { if (!(A)) { _db_flush_(); \
if (my_assert) assert(A); \
else fprintf(stderr, "%s:%d: assert: %s\n", __FILE__, __LINE__, #A); \
}} while (0)
#define DBUG_ASSERT(A) do { \
if (unlikely(!(A)) && _db_my_assert(__FILE__, __LINE__, #A)) assert(A); \
} while (0)
#define DBUG_SLOW_ASSERT(A) DBUG_ASSERT(A)
#define DBUG_ASSERT_EXISTS
#define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len))

View file

@ -266,7 +266,7 @@ extern ulong my_sync_count;
extern uint mysys_usage_id;
extern int32 my_file_opened;
extern my_bool my_init_done, my_thr_key_mysys_exists;
extern MYSQL_PLUGIN_IMPORT my_bool my_assert;
extern my_bool my_assert;
extern my_bool my_assert_on_error;
extern myf my_global_flags; /* Set to MY_WME for more error messages */
/* Point to current my_message() */

View file

@ -14,6 +14,7 @@ SHOW CREATE TABLE t1;
INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
SELECT ch FROM t1 WHERE ch='admin𝌆';
EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆';
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆';
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆';
DELETE FROM t1;

View file

@ -100,3 +100,23 @@ CREATE TABLE t1(a INT ZEROFILL);
SELECT 1 FROM t1 WHERE t1.a IN (1, t1.a) AND t1.a=2;
1
DROP TABLE t1;
CREATE TABLE t1 (a char(2), index (a));
insert into t1 values ("aa"),("bb");
select * from t1 where a="aa";
a
aa
select * from t1 where a="aaa";
a
select * from t1 where a="aa ";
a
aa
select * from t1 where a>="aaa";
a
bb
explain select * from t1 where a="aaa";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 3 const 1 Using where; Using index
explain select * from t1 where a="aa ";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 3 const 1 Using where; Using index
drop table t1;

View file

@ -94,3 +94,17 @@ DROP TABLE t1;
CREATE TABLE t1(a INT ZEROFILL);
SELECT 1 FROM t1 WHERE t1.a IN (1, t1.a) AND t1.a=2;
DROP TABLE t1;
#
# Check what happens when comparing to long string
#
CREATE TABLE t1 (a char(2), index (a));
insert into t1 values ("aa"),("bb");
select * from t1 where a="aa";
select * from t1 where a="aaa";
select * from t1 where a="aa ";
select * from t1 where a>="aaa";
explain select * from t1 where a="aaa";
explain select * from t1 where a="aa ";
drop table t1;

View file

@ -38,9 +38,9 @@ DROP SERVER server_1;
CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'Remote', HOST 'Server.Example.Com', DATABASE 'test');
SELECT Host FROM mysql.servers WHERE Server_Name = 'server_1';
Host
server.example.com
Server.Example.Com
ALTER SERVER server_1 OPTIONS(HOST 'Server.Example.Org');
SELECT Host FROM mysql.servers WHERE Server_Name = 'server_1';
Host
server.example.org
Server.Example.Org
DROP SERVER server_1;

View file

@ -606,7 +606,7 @@ with t(c) as (select a from t1 where b >= 'c')
select * from t r1 where r1.c=4;
show create view v3;
View Create View character_set_client collation_connection
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS with t as (select `t1`.`a` AS `c` from `t1` where `t1`.`b` >= 'c')select `r1`.`c` AS `c` from `t` `r1` where `r1`.`c` = 4 latin1 latin1_swedish_ci
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS with t(c) as (select `t1`.`a` AS `c` from `t1` where `t1`.`b` >= 'c')select `r1`.`c` AS `c` from `t` `r1` where `r1`.`c` = 4 latin1 latin1_swedish_ci
select * from v3;
c
4
@ -618,7 +618,7 @@ with t(c) as (select a from t1 where b >= 'c')
select * from t r1, t r2 where r1.c=r2.c and r2.c=4;
show create view v4;
View Create View character_set_client collation_connection
v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS with t as (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `r1`.`c` AS `c`,`r2`.`c` AS `d` from (`t` `r1` join (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c') `r2`) where `r1`.`c` = `r2`.`c` and `r2`.`c` = 4 latin1 latin1_swedish_ci
v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS with t(c) as (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `r1`.`c` AS `c`,`r2`.`c` AS `d` from (`t` `r1` join (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c') `r2`) where `r1`.`c` = `r2`.`c` and `r2`.`c` = 4 latin1 latin1_swedish_ci
select * from v4;
c d
4 4

View file

@ -699,7 +699,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
5 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join)
NULL UNION RESULT <union3,4,5> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 with recursive ancestor_couple_ids as (/* select#2 */ select `a`.`father` AS `h_id`,`a`.`mother` AS `w_id` from `coupled_ancestors` `a` where `a`.`father` is not null and `a`.`mother` is not null), coupled_ancestors as (/* select#3 */ select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' union all /* select#4 */ select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `fa` where `test`.`p`.`id` = `fa`.`h_id` union all /* select#5 */ select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `ma` where `test`.`p`.`id` = `ma`.`w_id`)/* select#1 */ select `h`.`name` AS `name`,`h`.`dob` AS `dob`,`w`.`name` AS `name`,`w`.`dob` AS `dob` from `ancestor_couple_ids` `c` join `coupled_ancestors` `h` join `coupled_ancestors` `w` where `h`.`id` = `c`.`h_id` and `w`.`id` = `c`.`w_id`
Note 1003 with recursive ancestor_couple_ids(h_id,w_id) as (/* select#2 */ select `a`.`father` AS `h_id`,`a`.`mother` AS `w_id` from `coupled_ancestors` `a` where `a`.`father` is not null and `a`.`mother` is not null), coupled_ancestors(id,name,dob,father,mother) as (/* select#3 */ select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' union all /* select#4 */ select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `fa` where `test`.`p`.`id` = `fa`.`h_id` union all /* select#5 */ select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `ma` where `test`.`p`.`id` = `ma`.`w_id`)/* select#1 */ select `h`.`name` AS `name`,`h`.`dob` AS `dob`,`w`.`name` AS `name`,`w`.`dob` AS `dob` from `ancestor_couple_ids` `c` join `coupled_ancestors` `h` join `coupled_ancestors` `w` where `h`.`id` = `c`.`h_id` and `w`.`id` = `c`.`w_id`
# simple mutual recursion
with recursive
ancestor_couple_ids(h_id, w_id)
@ -3091,7 +3091,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4 DEPENDENT SUBQUERY <derived2> ALL NULL NULL NULL NULL 16 100.00 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 with recursive destinations as (/* select#2 */ select `test`.`a`.`arrival` AS `city`,1 AS `legs` from `test`.`flights` `a` where `test`.`a`.`departure` = 'Cairo' union /* select#3 */ select `test`.`b`.`arrival` AS `arrival`,`r`.`legs` + 1 AS `r.legs + 1` from `destinations` `r` join `test`.`flights` `b` where `r`.`city` = `test`.`b`.`departure` and !<in_optimizer>(`test`.`b`.`arrival`,<exists>(/* select#4 */ select `destinations`.`city` from `destinations` where trigcond(`test`.`b`.`arrival` = `destinations`.`city` or `destinations`.`city` is null) having trigcond(`destinations`.`city` is null))))/* select#1 */ select `destinations`.`city` AS `city`,`destinations`.`legs` AS `legs` from `destinations`
Note 1003 with recursive destinations(city,legs) as (/* select#2 */ select `test`.`a`.`arrival` AS `city`,1 AS `legs` from `test`.`flights` `a` where `test`.`a`.`departure` = 'Cairo' union /* select#3 */ select `test`.`b`.`arrival` AS `arrival`,`r`.`legs` + 1 AS `r.legs + 1` from `destinations` `r` join `test`.`flights` `b` where `r`.`city` = `test`.`b`.`departure` and !<in_optimizer>(`test`.`b`.`arrival`,<exists>(/* select#4 */ select `destinations`.`city` from `destinations` where trigcond(`test`.`b`.`arrival` = `destinations`.`city` or `destinations`.`city` is null) having trigcond(`destinations`.`city` is null))))/* select#1 */ select `destinations`.`city` AS `city`,`destinations`.`legs` AS `legs` from `destinations`
set standard_compliant_cte=default;
drop table flights;
#
@ -3378,7 +3378,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 with recursive rcte as (/* select#2 */ select 1 AS `a` union /* select#3 */ select cast(`rcte`.`a` + 1 as unsigned) AS `cast(a+1 as unsigned)` from `rcte` where `rcte`.`a` < 10), cte1 as (/* select#4 */ select count(0) AS `c1` from `rcte` join `test`.`t1` where `rcte`.`a` between 3 and 5 and `test`.`t1`.`id` = `rcte`.`a` - 3), cte2 as (/* select#5 */ select count(0) AS `c2` from `rcte` join `test`.`t1` where `rcte`.`a` between 7 and 8 and `test`.`t1`.`id` = `rcte`.`a` - 7)/* select#1 */ select `cte1`.`c1` AS `c1`,`cte2`.`c2` AS `c2` from `cte1` join `cte2`
Note 1003 with recursive rcte(a) as (/* select#2 */ select 1 AS `a` union /* select#3 */ select cast(`rcte`.`a` + 1 as unsigned) AS `cast(a+1 as unsigned)` from `rcte` where `rcte`.`a` < 10), cte1 as (/* select#4 */ select count(0) AS `c1` from `rcte` join `test`.`t1` where `rcte`.`a` between 3 and 5 and `test`.`t1`.`id` = `rcte`.`a` - 3), cte2 as (/* select#5 */ select count(0) AS `c2` from `rcte` join `test`.`t1` where `rcte`.`a` between 7 and 8 and `test`.`t1`.`id` = `rcte`.`a` - 7)/* select#1 */ select `cte1`.`c1` AS `c1`,`cte2`.`c2` AS `c2` from `cte1` join `cte2`
prepare stmt from "with recursive
rcte(a) as
(select 1 union select cast(a+1 as unsigned) from rcte where a < 10),

View file

@ -6748,14 +6748,13 @@ t1 CREATE TABLE `t1` (
INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
SELECT ch FROM t1 WHERE ch='admin𝌆';
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆';
ch
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆';
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
DELETE FROM t1;
INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
@ -6771,22 +6770,14 @@ EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
ch
a
@ -6829,8 +6820,6 @@ EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
ch
a
@ -6850,14 +6839,10 @@ ab
az
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch;
ch
a
@ -6877,8 +6862,6 @@ ab
az
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
ch
z
@ -6889,24 +6872,16 @@ EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
ch
z
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch;
ch
z
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
ALTER TABLE t1 DROP KEY ch;
# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');
@ -6992,14 +6967,13 @@ t1 CREATE TABLE `t1` (
INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
SELECT ch FROM t1 WHERE ch='admin𝌆';
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆';
ch
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆';
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
DELETE FROM t1;
INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
@ -7015,22 +6989,14 @@ EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
ch
a

View file

@ -23,14 +23,13 @@ t1 CREATE TABLE `t1` (
INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
SELECT ch FROM t1 WHERE ch='admin𝌆';
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆';
ch
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆';
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
DELETE FROM t1;
INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
@ -46,22 +45,14 @@ EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
ch
a
@ -104,8 +95,6 @@ EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
ch
a
@ -125,14 +114,10 @@ ab
az
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch;
ch
a
@ -152,8 +137,6 @@ ab
az
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
ch
z
@ -164,24 +147,16 @@ EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
ch
z
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch;
ch
z
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
ALTER TABLE t1 DROP KEY ch;
# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');

View file

@ -5467,14 +5467,13 @@ t1 CREATE TABLE `t1` (
INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
SELECT ch FROM t1 WHERE ch='admin𝌆';
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆';
ch
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆';
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
DELETE FROM t1;
INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
@ -5490,22 +5489,14 @@ EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
ch
a
@ -5548,8 +5539,6 @@ EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
ch
a
@ -5569,14 +5558,10 @@ ab
az
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch;
ch
a
@ -5596,8 +5581,6 @@ ab
az
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
ch
z
@ -5608,24 +5591,16 @@ EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
ch
z
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch;
ch
z
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
ALTER TABLE t1 DROP KEY ch;
# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');
@ -5711,14 +5686,13 @@ t1 CREATE TABLE `t1` (
INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
SELECT ch FROM t1 WHERE ch='admin𝌆';
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆';
ch
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆';
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
DELETE FROM t1;
INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
@ -5734,22 +5708,14 @@ EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
ch
a
@ -5792,8 +5758,6 @@ EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
ch
a
@ -5813,14 +5777,10 @@ ab
az
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch;
ch
a
@ -5840,8 +5800,6 @@ ab
az
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
ch
z
@ -5852,24 +5810,16 @@ EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
ch
z
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch;
ch
z
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
ALTER TABLE t1 DROP KEY ch;
# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');
@ -5955,14 +5905,13 @@ t1 CREATE TABLE `t1` (
INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
SELECT ch FROM t1 WHERE ch='admin𝌆';
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆';
ch
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆';
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
DELETE FROM t1;
INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
@ -5978,22 +5927,14 @@ EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
ch
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
ch
a

View file

@ -2193,7 +2193,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
"range_analysis": {
"table_scan": {
"rows": 1000,
"cost": 1202
"cost": 2e308
},
"potential_range_indexes": [
{

View file

@ -49,6 +49,32 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where
drop table t0, t1;
#
# MDEV-18094: Query with order by limit picking index scan over filesort
#
create table t0 (a int);
INSERT INTO t0 VALUES (0),(0),(0),(0),(2),(0),(0),(1),(1),(0);
CREATE TABLE t1 (
a int(11),
b int(11),
c int(11),
KEY a_c (a,c),
KEY a_b (a,b)
) ENGINE=InnoDB;
insert into t1 select A.a , B.a, C.a from t0 A, t0 B, t0 C;
# should use ref access
explain select a,b,c from t1 where a=1 and c=2 order by b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a_c,a_b a_c 10 const,const 20 Using where; Using filesort
# both should use range access
explain select a,b,c from t1 where a=1 and c=2 order by b limit 1000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a_c,a_b a_b 5 NULL 200 Using where
explain select a,b,c from t1 where a=1 and c=2 order by b limit 2000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a_c,a_b a_b 5 NULL 200 Using where
drop table t1,t0;
# Start of 10.2 tests
#
# MDEV-14071: wrong results with orderby_uses_equalities=on
# (duplicate of MDEV-13994)
#
@ -121,3 +147,4 @@ i n
656 eight
set optimizer_switch= @save_optimizer_switch;
DROP TABLE t1,t2,t3;
# End of 10.2 tests

View file

@ -62,6 +62,32 @@ where key1<3 or key2<3;
drop table t0, t1;
--echo #
--echo # MDEV-18094: Query with order by limit picking index scan over filesort
--echo #
create table t0 (a int);
INSERT INTO t0 VALUES (0),(0),(0),(0),(2),(0),(0),(1),(1),(0);
CREATE TABLE t1 (
a int(11),
b int(11),
c int(11),
KEY a_c (a,c),
KEY a_b (a,b)
) ENGINE=InnoDB;
insert into t1 select A.a , B.a, C.a from t0 A, t0 B, t0 C;
--echo # should use ref access
explain select a,b,c from t1 where a=1 and c=2 order by b;
--echo # both should use range access
explain select a,b,c from t1 where a=1 and c=2 order by b limit 1000;
explain select a,b,c from t1 where a=1 and c=2 order by b limit 2000;
drop table t1,t0;
--echo # Start of 10.2 tests
--echo #
--echo # MDEV-14071: wrong results with orderby_uses_equalities=on
--echo # (duplicate of MDEV-13994)
@ -108,3 +134,5 @@ eval $q2;
set optimizer_switch= @save_optimizer_switch;
DROP TABLE t1,t2,t3;
--echo # End of 10.2 tests

View file

@ -36,10 +36,6 @@ SELECT INFO, INFO_BINARY, 'xxx😎yyy' AS utf8mb4_string FROM INFORMATION_SCHEMA
INFO SELECT INFO, INFO_BINARY, 'xxx????yyy' AS utf8mb4_string FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%xxx%yyy%'
INFO_BINARY SELECT INFO, INFO_BINARY, 'xxx😎yyy' AS utf8mb4_string FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%xxx%yyy%'
utf8mb4_string xxx😎yyy
Warnings:
Level Warning
Code 1366
Message Incorrect string value: '\xF0\x9F\x98\x8Eyy...' for column `information_schema`.`(temporary)`.`INFO` at row 1
#
# End of 10.1 tests
#

View file

@ -2115,23 +2115,15 @@ explain
SELECT * FROM t1 WHERE fd='😁';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1
SELECT * FROM t1 WHERE fd='😁';
id fd
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1
# The following must not use range access:
explain select count(*) from t1 where fd <'😁';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ix_fd ix_fd 63 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1
select count(*) from t1 where fd <'😁';
count(*)
40960
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1
select count(*) from t1 ignore index (ix_fd) where fd <'😁';
count(*)
40960
@ -2353,8 +2345,6 @@ INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e');
EXPLAIN SELECT * FROM t1 WHERE a<=>'😎';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
#
# MDEV-10185: Assertion `tree1->keys[key_no] && tree2->keys[key_no]' failed in

View file

@ -2118,23 +2118,15 @@ explain
SELECT * FROM t1 WHERE fd='😁';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1
SELECT * FROM t1 WHERE fd='😁';
id fd
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1
# The following must not use range access:
explain select count(*) from t1 where fd <'😁';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ix_fd ix_fd 63 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1
select count(*) from t1 where fd <'😁';
count(*)
40960
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1
select count(*) from t1 ignore index (ix_fd) where fd <'😁';
count(*)
40960
@ -2356,8 +2348,6 @@ INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e');
EXPLAIN SELECT * FROM t1 WHERE a<=>'😎';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
#
# MDEV-10185: Assertion `tree1->keys[key_no] && tree2->keys[key_no]' failed in

View file

@ -1668,5 +1668,90 @@ drop table t1;
set use_stat_tables= @save_use_stat_tables;
set @@histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
#
# MDEV-20576: failing assertion DBUG_ASSERT(0.0 < sel && sel <= 1)
#
set @@optimizer_use_condition_selectivity=2;
set names utf8;
CREATE DATABASE world;
use world;
CREATE TABLE Country (
Code char(3) NOT NULL default '',
Name char(52) NOT NULL default '',
SurfaceArea float(10,2) NOT NULL default '0.00',
Population int(11) NOT NULL default '0',
Capital int(11) default NULL,
PRIMARY KEY (Code),
UNIQUE INDEX (Name)
);
CREATE TABLE City (
ID int(11) NOT NULL auto_increment,
Name char(35) NOT NULL default '',
Country char(3) NOT NULL default '',
Population int(11) NOT NULL default '0',
PRIMARY KEY (ID),
INDEX (Population),
INDEX (Country)
);
CREATE TABLE CountryLanguage (
Country char(3) NOT NULL default '',
Language char(30) NOT NULL default '',
Percentage float(3,1) NOT NULL default '0.0',
PRIMARY KEY (Country, Language),
INDEX (Percentage)
);
CREATE INDEX Name ON City(Name);
CREATE INDEX CountryPopulation ON City(Country,Population);
CREATE INDEX CountryName ON City(Country,Name);
set @@optimizer_use_condition_selectivity=2;
EXPLAIN
SELECT * FROM City WHERE Country='FIN';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City ref Country,CountryPopulation,CountryName CountryName 3 const 5 Using index condition
DROP DATABASE world;
use test;
CREATE TABLE t1 (
a INT,
b INT NOT NULL,
c char(100),
KEY (b, c),
KEY (b, a, c)
) ENGINE=MyISAM
DEFAULT CHARSET = utf8;
INSERT INTO t1 VALUES
(1, 1, 1),
(2, 2, 2),
(3, 3, 3),
(4, 4, 4),
(5, 5, 5),
(6, 6, 6),
(7, 7, 7),
(8, 8, 8),
(9, 9, 9);
INSERT INTO t1 SELECT a + 10, b, c FROM t1;
INSERT INTO t1 SELECT a + 20, b, c FROM t1;
INSERT INTO t1 SELECT a + 40, b, c FROM t1;
INSERT INTO t1 SELECT a + 80, b, c FROM t1;
INSERT INTO t1 SELECT a + 160, b, c FROM t1;
INSERT INTO t1 SELECT a + 320, b, c FROM t1;
INSERT INTO t1 SELECT a + 640, b, c FROM t1;
INSERT INTO t1 SELECT a + 1280, b, c FROM t1 LIMIT 80;
EXPLAIN
SELECT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 9;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b,b_2 b 4 NULL 226 Using where
SELECT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 9;
a
2071
2061
2051
2041
2031
2021
2011
2001
1991
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1;
# End of 10.1 tests
set @@global.histogram_size=@save_histogram_size;

View file

@ -1125,6 +1125,87 @@ drop table t1;
set use_stat_tables= @save_use_stat_tables;
set @@histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
--echo #
--echo # MDEV-20576: failing assertion DBUG_ASSERT(0.0 < sel && sel <= 1)
--echo #
set @@optimizer_use_condition_selectivity=2;
set names utf8;
CREATE DATABASE world;
use world;
--source include/world_schema.inc
--disable_query_log
--disable_result_log
--disable_warnings
--source include/world.inc
--enable_warnings
--enable_result_log
--enable_query_log
CREATE INDEX Name ON City(Name);
CREATE INDEX CountryPopulation ON City(Country,Population);
CREATE INDEX CountryName ON City(Country,Name);
--disable_query_log
--disable_result_log
--disable_warnings
ANALYZE TABLE City;
--enable_warnings
--enable_result_log
--enable_query_log
set @@optimizer_use_condition_selectivity=2;
EXPLAIN
SELECT * FROM City WHERE Country='FIN';
DROP DATABASE world;
use test;
CREATE TABLE t1 (
a INT,
b INT NOT NULL,
c char(100),
KEY (b, c),
KEY (b, a, c)
) ENGINE=MyISAM
DEFAULT CHARSET = utf8;
INSERT INTO t1 VALUES
(1, 1, 1),
(2, 2, 2),
(3, 3, 3),
(4, 4, 4),
(5, 5, 5),
(6, 6, 6),
(7, 7, 7),
(8, 8, 8),
(9, 9, 9);
INSERT INTO t1 SELECT a + 10, b, c FROM t1;
INSERT INTO t1 SELECT a + 20, b, c FROM t1;
INSERT INTO t1 SELECT a + 40, b, c FROM t1;
INSERT INTO t1 SELECT a + 80, b, c FROM t1;
INSERT INTO t1 SELECT a + 160, b, c FROM t1;
INSERT INTO t1 SELECT a + 320, b, c FROM t1;
INSERT INTO t1 SELECT a + 640, b, c FROM t1;
INSERT INTO t1 SELECT a + 1280, b, c FROM t1 LIMIT 80;
EXPLAIN
SELECT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 9;
SELECT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 9;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1;
--echo # End of 10.1 tests
#

View file

@ -1678,6 +1678,91 @@ drop table t1;
set use_stat_tables= @save_use_stat_tables;
set @@histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
#
# MDEV-20576: failing assertion DBUG_ASSERT(0.0 < sel && sel <= 1)
#
set @@optimizer_use_condition_selectivity=2;
set names utf8;
CREATE DATABASE world;
use world;
CREATE TABLE Country (
Code char(3) NOT NULL default '',
Name char(52) NOT NULL default '',
SurfaceArea float(10,2) NOT NULL default '0.00',
Population int(11) NOT NULL default '0',
Capital int(11) default NULL,
PRIMARY KEY (Code),
UNIQUE INDEX (Name)
);
CREATE TABLE City (
ID int(11) NOT NULL auto_increment,
Name char(35) NOT NULL default '',
Country char(3) NOT NULL default '',
Population int(11) NOT NULL default '0',
PRIMARY KEY (ID),
INDEX (Population),
INDEX (Country)
);
CREATE TABLE CountryLanguage (
Country char(3) NOT NULL default '',
Language char(30) NOT NULL default '',
Percentage float(3,1) NOT NULL default '0.0',
PRIMARY KEY (Country, Language),
INDEX (Percentage)
);
CREATE INDEX Name ON City(Name);
CREATE INDEX CountryPopulation ON City(Country,Population);
CREATE INDEX CountryName ON City(Country,Name);
set @@optimizer_use_condition_selectivity=2;
EXPLAIN
SELECT * FROM City WHERE Country='FIN';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City ref Country,CountryPopulation,CountryName Country 3 const 7 Using index condition
DROP DATABASE world;
use test;
CREATE TABLE t1 (
a INT,
b INT NOT NULL,
c char(100),
KEY (b, c),
KEY (b, a, c)
) ENGINE=MyISAM
DEFAULT CHARSET = utf8;
INSERT INTO t1 VALUES
(1, 1, 1),
(2, 2, 2),
(3, 3, 3),
(4, 4, 4),
(5, 5, 5),
(6, 6, 6),
(7, 7, 7),
(8, 8, 8),
(9, 9, 9);
INSERT INTO t1 SELECT a + 10, b, c FROM t1;
INSERT INTO t1 SELECT a + 20, b, c FROM t1;
INSERT INTO t1 SELECT a + 40, b, c FROM t1;
INSERT INTO t1 SELECT a + 80, b, c FROM t1;
INSERT INTO t1 SELECT a + 160, b, c FROM t1;
INSERT INTO t1 SELECT a + 320, b, c FROM t1;
INSERT INTO t1 SELECT a + 640, b, c FROM t1;
INSERT INTO t1 SELECT a + 1280, b, c FROM t1 LIMIT 80;
EXPLAIN
SELECT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 9;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b,b_2 b 4 NULL 226 Using where
SELECT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 9;
a
2071
2061
2051
2041
2031
2021
2011
2001
1991
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1;
# End of 10.1 tests
set @@global.histogram_size=@save_histogram_size;
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;

View file

@ -800,7 +800,38 @@ col1
2004-01-01
2004-02-29
0000-10-31
set @@sql_mode= @save_sql_mode;
set @@use_stat_tables=@save_use_stat_tables;
set @@histogram_size= @save_histogram_size;
set @@histogram_type=@save_histogram_type;
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
drop table t1;
#
# MDEV-20589: Server still crashes in Field::set_warning_truncated_wrong_value
#
set names utf8;
create table t1 ( a varchar(255) character set utf8);
insert into t1 values (REPEAT('ӥ',255)), (REPEAT('ç',255));
set use_stat_tables='preferably';
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
set @save_sql_mode= @@sql_mode;
set sql_mode='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
update mysql.column_stats set min_value= REPEAT('ӥ',256) where db_name='test' and table_name='t1';
Warnings:
Warning 1265 Data truncated for column 'min_value' at row 1
set @@sql_mode= @save_sql_mode;
select length(a) from t1 where a=REPEAT('ӥ',255);
length(a)
510
set names latin1;
set @@use_stat_tables=@save_use_stat_tables;
drop table t1;
# please keep this at the last
set @@global.histogram_size=@save_histogram_size;
# Start of 10.4 tests
set histogram_size=0;
#
# MDEV-17255: New optimizer defaults and ANALYZE TABLE
@ -858,8 +889,4 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 2.78 10.00 Using where
drop table t1;
set @@global.histogram_size=@save_histogram_size;
set @@histogram_size= @save_histogram_size;
set @@histogram_type=@save_histogram_type;
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set @@sql_mode= @save_sql_mode;
set @@use_stat_tables=@save_use_stat_tables;
# End of 10.4 tests

View file

@ -544,7 +544,40 @@ analyze table t1;
update mysql.column_stats set min_value='2004-0-31123' where db_name='test' and table_name='t1';
select min_value from mysql.column_stats where db_name='test' and table_name='t1';
select * from t1;
set @@sql_mode= @save_sql_mode;
set @@use_stat_tables=@save_use_stat_tables;
set @@histogram_size= @save_histogram_size;
set @@histogram_type=@save_histogram_type;
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
drop table t1;
--echo #
--echo # MDEV-20589: Server still crashes in Field::set_warning_truncated_wrong_value
--echo #
set names utf8;
create table t1 ( a varchar(255) character set utf8);
insert into t1 values (REPEAT('ӥ',255)), (REPEAT('ç',255));
set use_stat_tables='preferably';
analyze table t1 persistent for all;
set @save_sql_mode= @@sql_mode;
set sql_mode='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
update mysql.column_stats set min_value= REPEAT('ӥ',256) where db_name='test' and table_name='t1';
set @@sql_mode= @save_sql_mode;
select length(a) from t1 where a=REPEAT('ӥ',255);
set names latin1;
set @@use_stat_tables=@save_use_stat_tables;
drop table t1;
--echo # please keep this at the last
set @@global.histogram_size=@save_histogram_size;
--echo # Start of 10.4 tests
set histogram_size=0;
--echo #
@ -590,9 +623,5 @@ select * from t1 where a=1 and b=3;
drop table t1;
set @@global.histogram_size=@save_histogram_size;
set @@histogram_size= @save_histogram_size;
set @@histogram_type=@save_histogram_type;
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set @@sql_mode= @save_sql_mode;
set @@use_stat_tables=@save_use_stat_tables;
--echo # End of 10.4 tests

View file

@ -832,7 +832,38 @@ col1
2004-01-01
2004-02-29
0000-10-31
set @@sql_mode= @save_sql_mode;
set @@use_stat_tables=@save_use_stat_tables;
set @@histogram_size= @save_histogram_size;
set @@histogram_type=@save_histogram_type;
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
drop table t1;
#
# MDEV-20589: Server still crashes in Field::set_warning_truncated_wrong_value
#
set names utf8;
create table t1 ( a varchar(255) character set utf8);
insert into t1 values (REPEAT('ӥ',255)), (REPEAT('ç',255));
set use_stat_tables='preferably';
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
set @save_sql_mode= @@sql_mode;
set sql_mode='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
update mysql.column_stats set min_value= REPEAT('ӥ',256) where db_name='test' and table_name='t1';
Warnings:
Warning 1265 Data truncated for column 'min_value' at row 1
set @@sql_mode= @save_sql_mode;
select length(a) from t1 where a=REPEAT('ӥ',255);
length(a)
510
set names latin1;
set @@use_stat_tables=@save_use_stat_tables;
drop table t1;
# please keep this at the last
set @@global.histogram_size=@save_histogram_size;
# Start of 10.4 tests
set histogram_size=0;
#
# MDEV-17255: New optimizer defaults and ANALYZE TABLE
@ -890,11 +921,7 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 2.78 10.00 Using where
drop table t1;
set @@global.histogram_size=@save_histogram_size;
set @@histogram_size= @save_histogram_size;
set @@histogram_type=@save_histogram_type;
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set @@sql_mode= @save_sql_mode;
set @@use_stat_tables=@save_use_stat_tables;
# End of 10.4 tests
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;

View file

@ -124,14 +124,14 @@ show create table servers;
Table Create Table
servers CREATE TABLE `servers` (
`Server_name` char(64) NOT NULL DEFAULT '',
`Host` char(64) NOT NULL DEFAULT '',
`Host` varchar(2048) NOT NULL DEFAULT '',
`Db` char(64) NOT NULL DEFAULT '',
`Username` char(80) NOT NULL DEFAULT '',
`Password` char(64) NOT NULL DEFAULT '',
`Port` int(4) NOT NULL DEFAULT 0,
`Socket` char(64) NOT NULL DEFAULT '',
`Wrapper` char(64) NOT NULL DEFAULT '',
`Owner` char(64) NOT NULL DEFAULT '',
`Owner` varchar(512) NOT NULL DEFAULT '',
PRIMARY KEY (`Server_name`)
) ENGINE=Aria DEFAULT CHARSET=utf8 PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='MySQL Foreign Servers table'
show create table proc;

View file

@ -162,14 +162,14 @@ show create table servers;
Table Create Table
servers CREATE TABLE `servers` (
`Server_name` char(64) NOT NULL DEFAULT '',
`Host` char(64) NOT NULL DEFAULT '',
`Host` varchar(2048) NOT NULL DEFAULT '',
`Db` char(64) NOT NULL DEFAULT '',
`Username` char(80) NOT NULL DEFAULT '',
`Password` char(64) NOT NULL DEFAULT '',
`Port` int(4) NOT NULL DEFAULT 0,
`Socket` char(64) NOT NULL DEFAULT '',
`Wrapper` char(64) NOT NULL DEFAULT '',
`Owner` char(64) NOT NULL DEFAULT '',
`Owner` varchar(512) NOT NULL DEFAULT '',
PRIMARY KEY (`Server_name`)
) ENGINE=Aria DEFAULT CHARSET=utf8 PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='MySQL Foreign Servers table'
show create table proc;

View file

@ -2586,3 +2586,16 @@ create view v1 as
union
( values (5), (7), (1), (3), (4) order by 2 limit 2 );
ERROR 42S22: Unknown column '2' in 'order clause'
#
# MDEV-20229: view defined as select using
# CTE with named columns defined as TVC
#
create view v1 as with t(a) as (values (2), (1)) select a from t;
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t(a) as (values (2),(1))select `t`.`a` AS `a` from `t` latin1 latin1_swedish_ci
select * from v1;
a
2
1
drop view v1;

View file

@ -1316,3 +1316,13 @@ create view v1 as
( values (5), (7), (1), (3), (4) limit 2 offset 1 )
union
( values (5), (7), (1), (3), (4) order by 2 limit 2 );
--echo #
--echo # MDEV-20229: view defined as select using
--echo # CTE with named columns defined as TVC
--echo #
create view v1 as with t(a) as (values (2), (1)) select a from t;
show create view v1;
select * from v1;
drop view v1;

View file

@ -12,4 +12,3 @@
innodb_scrub : MDEV-8139 scrubbing does not work reliably
innodb_scrub_background : MDEV-8139 scrubbing does not work reliably
innodb-redo-badkey : MDEV-13893/MDEV-12699 fix recovery of corrupted pages

View file

@ -6,7 +6,7 @@ call mtr.add_suppression("InnoDB: Unable to decompress .*.test.t1\\.ibd\\[page i
call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t1 page \\[page id: space=[1-9][0-9]*, page number=[0-9]*\\]");
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
# Restart mysqld --file-key-management-filename=keys2.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
# Wait max 10 min for key encryption threads to encrypt all spaces
SET GLOBAL innodb_file_per_table = ON;
create table t1(a int not null primary key auto_increment, c char(250), b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes encryption_key_id=4;
@ -30,9 +30,9 @@ insert into t3 (c,b) values (repeat('secret9',20), repeat('secre10',6000));
insert into t4 (c,b) values (repeat('secre11',20), repeat('secre12',6000));
COMMIT;
# Kill the server
# restart
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
# Kill the server
# Restart mysqld --innodb-force-recovery=1
# restart: --innodb-force-recovery=1
# Kill the server
# Restart mysqld --file-key-management-filename=keys2.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
drop table t1, t2,t3,t4;

View file

@ -12,7 +12,6 @@ call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed f
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
--echo # Restart mysqld --file-key-management-filename=keys2.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
-- source include/restart_mysqld.inc
@ -68,7 +67,6 @@ let $cleanup= drop table t1,t2,t3,t4;
--let CLEANUP_IF_CHECKPOINT= $cleanup;
--source ../../suite/innodb/include/no_checkpoint_end.inc
--echo # restart
--error 1
-- source include/start_mysqld.inc
--source include/kill_mysqld.inc
@ -77,14 +75,12 @@ let $cleanup= drop table t1,t2,t3,t4;
# Now test with innodb-force-recovery=1 i.e. ignore corrupt pages
#
--echo # Restart mysqld --innodb-force-recovery=1
-- let $restart_parameters=--innodb-force-recovery=1
--error 1
-- source include/start_mysqld.inc
--source include/kill_mysqld.inc
--echo # Restart mysqld --file-key-management-filename=keys2.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
-- source include/start_mysqld.inc

View file

@ -158,8 +158,8 @@ def mysql roles_mapping Host 1 '' NO char 60 180 NULL NULL NULL utf8 utf8_bin ch
def mysql roles_mapping Role 3 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references NEVER NULL
def mysql roles_mapping User 2 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references NEVER NULL
def mysql servers Db 3 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references NEVER NULL
def mysql servers Host 2 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references NEVER NULL
def mysql servers Owner 9 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references NEVER NULL
def mysql servers Host 2 '' NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select,insert,update,references NEVER NULL
def mysql servers Owner 9 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references NEVER NULL
def mysql servers Password 5 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references NEVER NULL
def mysql servers Port 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(4) select,insert,update,references NEVER NULL
def mysql servers Server_name 1 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) PRI select,insert,update,references NEVER NULL
@ -485,14 +485,14 @@ NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp
3.0000 mysql roles_mapping Role char 80 240 utf8 utf8_bin char(80)
3.0000 mysql roles_mapping Admin_option enum 1 3 utf8 utf8_general_ci enum('N','Y')
3.0000 mysql servers Server_name char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Host char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Host varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 mysql servers Db char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Username char 80 240 utf8 utf8_general_ci char(80)
3.0000 mysql servers Password char 64 192 utf8 utf8_general_ci char(64)
NULL mysql servers Port int NULL NULL NULL NULL int(4)
3.0000 mysql servers Socket char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Wrapper char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Owner char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Owner varchar 512 1536 utf8 utf8_general_ci varchar(512)
NULL mysql slow_log start_time timestamp NULL NULL NULL NULL timestamp(6)
1.0000 mysql slow_log user_host mediumtext 16777215 16777215 utf8 utf8_general_ci mediumtext
NULL mysql slow_log query_time time NULL NULL NULL NULL time(6)

View file

@ -144,8 +144,8 @@ def mysql roles_mapping Host 1 '' NO char 60 180 NULL NULL NULL utf8 utf8_bin ch
def mysql roles_mapping Role 3 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI NEVER NULL
def mysql roles_mapping User 2 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI NEVER NULL
def mysql servers Db 3 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) NEVER NULL
def mysql servers Host 2 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) NEVER NULL
def mysql servers Owner 9 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) NEVER NULL
def mysql servers Host 2 '' NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) NEVER NULL
def mysql servers Owner 9 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) NEVER NULL
def mysql servers Password 5 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) NEVER NULL
def mysql servers Port 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(4) NEVER NULL
def mysql servers Server_name 1 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) PRI NEVER NULL
@ -468,14 +468,14 @@ NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp
3.0000 mysql roles_mapping Role char 80 240 utf8 utf8_bin char(80)
3.0000 mysql roles_mapping Admin_option enum 1 3 utf8 utf8_general_ci enum('N','Y')
3.0000 mysql servers Server_name char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Host char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Host varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 mysql servers Db char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Username char 80 240 utf8 utf8_general_ci char(80)
3.0000 mysql servers Password char 64 192 utf8 utf8_general_ci char(64)
NULL mysql servers Port int NULL NULL NULL NULL int(4)
3.0000 mysql servers Socket char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Wrapper char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Owner char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Owner varchar 512 1536 utf8 utf8_general_ci varchar(512)
NULL mysql slow_log start_time timestamp NULL NULL NULL NULL timestamp(6)
1.0000 mysql slow_log user_host mediumtext 16777215 16777215 utf8 utf8_general_ci mediumtext
NULL mysql slow_log query_time time NULL NULL NULL NULL time(6)

View file

@ -10,7 +10,6 @@
#
##############################################################################
MW-286 : MDEV-19992 Galera test failure on MW-286
GCF-1081 : MDEV-18283 Galera test failure on galera.GCF-1081
MW-329 : MDEV-19962 Galera test failure on MW-329
MW-360 : needs rewrite to be MariaDB gtid compatible
@ -36,11 +35,11 @@ galera_many_tables_nopk : MDEV-18182 Galera test failure on galera.galera_many_t
galera_migrate : MariaDB does not support START SLAVE USER
galera_split_brain : MDEV-18280 Galera test failure on galera_split_brain and galera_kill_nochanges
galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade
galera_var_node_address : MDEV-20485 Galera test failure
galera_var_notify_cmd : MDEV-20600 Galera test galera_var_notify_cmd causes hang
galera_var_reject_queries : assertion in inline_mysql_socket_send
galera_var_retry_autocommit: MDEV-18181 Galera test failure on galera.galera_var_retry_autocommit
galera_var_node_address : MDEV-20485 Galera test failure on galera.galera_var_node_address
galera_wan : MDEV-17259 Test failure on galera.galera_wan
mysql-wsrep#198 : MDEV-18935 Galera test mysql-wsrep#198 sporaric assertion transaction.cpp:362: int wsrep::transaction::before_commit(): Assertion `state() == s_executing || state() == s_committing || state() == s_must_abort || state() == s_replaying' failed.
partition : MDEV-19958 Galera test failure on galera.partition
query_cache: MDEV-15805 Test failure on galera.query_cache
galera_var_notify_cmd : MDEV-20600 Galera test galera_var_notify_cmd causes hang

View file

@ -8,10 +8,6 @@ SET GLOBAL wsrep_slave_threads = 1;
connection node_2;
INSERT INTO t1 VALUES (1);
connection node_1;
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) FROM t1;
COUNT(*)
1
SET GLOBAL wsrep_slave_threads = 10;
# Set slave threads to 10 step 2
SET GLOBAL wsrep_slave_threads = 20;
@ -45,9 +41,11 @@ INSERT INTO t1 VALUES (17);
INSERT INTO t1 VALUES (18);
INSERT INTO t1 VALUES (19);
INSERT INTO t1 VALUES (20);
INSERT INTO t1 VALUES (21);
INSERT INTO t1 VALUES (22);
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
21
23
SET GLOBAL wsrep_slave_threads = 1;
DROP TABLE t1;

View file

@ -23,14 +23,12 @@ SET GLOBAL wsrep_slave_threads = 1;
INSERT INTO t1 VALUES (1);
--connection node_1
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) FROM t1;
SET GLOBAL wsrep_slave_threads = 10;
# Note that above insert could be handled by one of the slave threads
--echo # Set slave threads to 10 step 2
--let $wait_condition = SELECT VARIABLE_VALUE = 10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
--let $wait_condition_on_error_output = SELECT COUNT(*), 10 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
--let $wait_condition = SELECT VARIABLE_VALUE >= 9 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
--let $wait_condition_on_error_output = SELECT COUNT(*), 9 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
--source include/wait_condition_with_debug.inc
SET GLOBAL wsrep_slave_threads = 20;
@ -73,6 +71,8 @@ INSERT INTO t1 VALUES (17);
INSERT INTO t1 VALUES (18);
INSERT INTO t1 VALUES (19);
INSERT INTO t1 VALUES (20);
INSERT INTO t1 VALUES (21);
INSERT INTO t1 VALUES (22);
--connection node_1
SELECT COUNT(*) FROM t1;

View file

@ -204,5 +204,32 @@ connection truncate;
disconnect truncate;
connection default;
DROP TABLE t1, t2;
#
# MDEV-16222 Assertion `0' failed in row_purge_remove_sec_if_poss_leaf
# on table with virtual columns and indexes
#
set @saved_dbug= @@global.debug_dbug;
set global debug_dbug= "+d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2";
create table t1 (
pk serial, vb tinyblob as (b) virtual, b tinyblob,
primary key(pk), index (vb(64)))
engine innodb;
insert ignore into t1 (b) values ('foo');
select * into outfile 'load.data' from t1;
load data infile 'load.data' replace into table t1;
set debug_sync= "now WAIT_FOR latch_released";
set global debug_dbug= "-d,ib_purge_virtual_mdev_16222_1";
drop table t1;
set debug_sync= "now SIGNAL drop_started WAIT_FOR got_no_such_table";
create table t1 (
pk serial, vb tinyblob as (b) virtual, b tinyblob,
primary key(pk), index (vb(64)))
engine innodb;
insert ignore into t1 (b) values ('foo');
select * into outfile 'load.data' from t1;
load data infile 'load.data' replace into table t1;
set debug_sync= "now WAIT_FOR got_no_such_table";
set global debug_dbug= @saved_dbug;
drop table t1;
set debug_sync=reset;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;

View file

@ -259,6 +259,54 @@ disconnect truncate;
connection default;
DROP TABLE t1, t2;
--echo #
--echo # MDEV-16222 Assertion `0' failed in row_purge_remove_sec_if_poss_leaf
--echo # on table with virtual columns and indexes
--echo #
--let $datadir= `select @@datadir`
set @saved_dbug= @@global.debug_dbug;
set global debug_dbug= "+d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2";
create table t1 (
pk serial, vb tinyblob as (b) virtual, b tinyblob,
primary key(pk), index (vb(64)))
engine innodb;
insert ignore into t1 (b) values ('foo');
select * into outfile 'load.data' from t1;
load data infile 'load.data' replace into table t1;
set debug_sync= "now WAIT_FOR latch_released";
set global debug_dbug= "-d,ib_purge_virtual_mdev_16222_1";
drop table t1;
--remove_file $datadir/test/load.data
set debug_sync= "now SIGNAL drop_started WAIT_FOR got_no_such_table";
create table t1 (
pk serial, vb tinyblob as (b) virtual, b tinyblob,
primary key(pk), index (vb(64)))
engine innodb;
insert ignore into t1 (b) values ('foo');
select * into outfile 'load.data' from t1;
load data infile 'load.data' replace into table t1;
set debug_sync= "now WAIT_FOR got_no_such_table";
# FIXME: Race condition here:
# 1. purge thread goes into sending got_no_such_table
# 2. test thread finishes debug_sync= "RESET" below
# 3. purge thread sends got_no_such_table
set global debug_dbug= @saved_dbug;
# cleanup
drop table t1;
--remove_file $datadir/test/load.data
--source include/wait_until_count_sessions.inc
set debug_sync=reset;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;

View file

@ -1,30 +0,0 @@
#
# MDEV-16222 Assertion `0' failed in row_purge_remove_sec_if_poss_leaf on table with virtual columns and indexes
#
set @saved_frequency= @@global.innodb_purge_rseg_truncate_frequency;
set global innodb_purge_rseg_truncate_frequency= 1;
set @saved_dbug= @@global.debug_dbug;
set global debug_dbug= "+d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2";
create table t1 (
pk serial, vb tinyblob as (b) virtual, b tinyblob,
primary key(pk), index (vb(64)))
engine innodb;
insert ignore into t1 (b) values ('foo');
select * into outfile 'load.data' from t1;
load data infile 'load.data' replace into table t1;
set debug_sync= "now WAIT_FOR latch_released";
set global debug_dbug= "-d,ib_purge_virtual_mdev_16222_1";
drop table t1;
set debug_sync= "now SIGNAL drop_started WAIT_FOR got_no_such_table";
create table t1 (
pk serial, vb tinyblob as (b) virtual, b tinyblob,
primary key(pk), index (vb(64)))
engine innodb;
insert ignore into t1 (b) values ('foo');
select * into outfile 'load.data' from t1;
load data infile 'load.data' replace into table t1;
set debug_sync= "now WAIT_FOR got_no_such_table";
set global debug_dbug= @saved_dbug;
drop table t1;
set global innodb_purge_rseg_truncate_frequency= @saved_frequency;
set debug_sync= "RESET";

View file

@ -1,53 +0,0 @@
--source include/have_debug.inc
--source include/have_innodb.inc
--echo #
--echo # MDEV-16222 Assertion `0' failed in row_purge_remove_sec_if_poss_leaf on table with virtual columns and indexes
--echo #
--let $datadir= `select @@datadir`
set @saved_frequency= @@global.innodb_purge_rseg_truncate_frequency;
set global innodb_purge_rseg_truncate_frequency= 1;
set @saved_dbug= @@global.debug_dbug;
set global debug_dbug= "+d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2";
create table t1 (
pk serial, vb tinyblob as (b) virtual, b tinyblob,
primary key(pk), index (vb(64)))
engine innodb;
insert ignore into t1 (b) values ('foo');
select * into outfile 'load.data' from t1;
load data infile 'load.data' replace into table t1;
set debug_sync= "now WAIT_FOR latch_released";
set global debug_dbug= "-d,ib_purge_virtual_mdev_16222_1";
drop table t1;
--remove_file $datadir/test/load.data
set debug_sync= "now SIGNAL drop_started WAIT_FOR got_no_such_table";
create table t1 (
pk serial, vb tinyblob as (b) virtual, b tinyblob,
primary key(pk), index (vb(64)))
engine innodb;
insert ignore into t1 (b) values ('foo');
select * into outfile 'load.data' from t1;
load data infile 'load.data' replace into table t1;
set debug_sync= "now WAIT_FOR got_no_such_table";
# FIXME: Racing condition here:
# 1. purge thread goes into sending got_no_such_table
# 2. test thread finishes debug_sync= "RESET" below
# 3. purge thread sends got_no_such_table
set global debug_dbug= @saved_dbug;
# cleanup
drop table t1;
--remove_file $datadir/test/load.data
set global innodb_purge_rseg_truncate_frequency= @saved_frequency;
set debug_sync= "RESET";

View file

@ -9,3 +9,26 @@ disconnect dml;
connection default;
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
#
# MDEV-19529 InnoDB hang on DROP FULLTEXT INDEX
#
CREATE TABLE t1(f1 CHAR(100), FULLTEXT(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES('test');
CREATE TABLE t2 (f1 char(100), FULLTEXT idx1(f1))ENGINE=InnoDB;
INSERT INTO t2 VALUES('mariadb');
connection default;
SET GLOBAL debug_dbug ='+d,fts_instrument_sync_request,ib_optimize_wq_hang';
SET DEBUG_SYNC= 'fts_instrument_sync_request
SIGNAL drop_index_start WAIT_FOR sync_op';
INSERT INTO t1 VALUES('Keyword');
connect con1,localhost,root,,,;
SET DEBUG_SYNC='now WAIT_FOR drop_index_start';
SET DEBUG_SYNC= 'norebuild_fts_drop SIGNAL sync_op WAIT_FOR fts_drop_index';
ALTER TABLE t2 drop index idx1;
connection default;
set DEBUG_SYNC= 'now SIGNAL fts_drop_index';
connection con1;
SET global DEBUG_DBUG=RESET;
drop table t1, t2;
connection default;
set DEBUG_SYNC=RESET;

View file

@ -700,15 +700,21 @@ count(*)
DROP TABLE t1;
"----------Test27---------"
CREATE TABLE t1 (id INT,char_column VARCHAR(60));
CREATE TABLE t2 (FTS_DOC_ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, a TEXT)ENGINE=InnoDB;
ALTER TABLE t2 DROP a;
SET @@autocommit=0;
CREATE FULLTEXT INDEX i ON t1 (char_column);
INSERT INTO t1 values (1,'aaa');
"restart server..."
# Restart the server
--source include/restart_mysqld.inc
DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb')
# restart
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`FTS_DOC_ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`FTS_DOC_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb');
SET @@autocommit=1;
DROP TABLE t1;
DROP TABLE t1, t2;
"----------Test28---------"
drop table if exists `fts_test`;
Warnings:

View file

@ -18,3 +18,34 @@ reap;
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
--echo #
--echo # MDEV-19529 InnoDB hang on DROP FULLTEXT INDEX
--echo #
CREATE TABLE t1(f1 CHAR(100), FULLTEXT(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES('test');
CREATE TABLE t2 (f1 char(100), FULLTEXT idx1(f1))ENGINE=InnoDB;
INSERT INTO t2 VALUES('mariadb');
connection default;
SET GLOBAL debug_dbug ='+d,fts_instrument_sync_request,ib_optimize_wq_hang';
SET DEBUG_SYNC= 'fts_instrument_sync_request
SIGNAL drop_index_start WAIT_FOR sync_op';
send INSERT INTO t1 VALUES('Keyword');
connect(con1,localhost,root,,,);
SET DEBUG_SYNC='now WAIT_FOR drop_index_start';
SET DEBUG_SYNC= 'norebuild_fts_drop SIGNAL sync_op WAIT_FOR fts_drop_index';
send ALTER TABLE t2 drop index idx1;
connection default;
reap;
set DEBUG_SYNC= 'now SIGNAL fts_drop_index';
connection con1;
reap;
SET global DEBUG_DBUG=RESET;
drop table t1, t2;
connection default;
set DEBUG_SYNC=RESET;

View file

@ -670,15 +670,16 @@ DROP TABLE t1;
--echo "----------Test27---------"
#27 Crash after server restart
CREATE TABLE t1 (id INT,char_column VARCHAR(60));
CREATE TABLE t2 (FTS_DOC_ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, a TEXT)ENGINE=InnoDB;
ALTER TABLE t2 DROP a;
SET @@autocommit=0;
CREATE FULLTEXT INDEX i ON t1 (char_column);
INSERT INTO t1 values (1,'aaa');
echo "restart server..."
# Restart the server
--source include/restart_mysqld.inc
SHOW CREATE TABLE t2;
DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb');
SET @@autocommit=1;
DROP TABLE t1;
DROP TABLE t1, t2;
--echo "----------Test28---------"
drop table if exists `fts_test`;

View file

@ -167,7 +167,7 @@ WHERE ts BETWEEN '0000-00-00' AND '2010-00-01 00:00:00'
ORDER BY ts DESC
LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 Using where
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where
DROP TABLE t1;
#

View file

@ -0,0 +1,2 @@
xtrabackup_checkpoints
xtrabackup_info

View file

@ -0,0 +1,7 @@
let $extra_lsndir=$MYSQLTEST_VARDIR/tmp/extra_lsndir;
mkdir $extra_lsndir;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --stream=xbstream --extra-lsndir=$extra_lsndir > /dev/null;
--enable_result_log
list_files $extra_lsndir;
rmdir $extra_lsndir;

View file

@ -0,0 +1 @@
stream.xb

View file

@ -0,0 +1,11 @@
let $basedir=$MYSQLTEST_VARDIR/tmp/mdev-18438;
mkdir $basedir;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --extra-lsndir=$basedir/extra_lsndir --stream=xbstream > $basedir/stream.xb;
mkdir $basedir/backup;
rmdir $basedir/extra_lsndir;
--disable_result_log
exec $XBSTREAM -x -C $basedir/backup < $basedir/stream.xb;
--enable_result_log
rmdir $basedir/backup;
list_files $basedir;
rmdir $basedir;

View file

@ -0,0 +1,40 @@
include/master-slave.inc
[connection master]
connection slave;
include/stop_slave.inc
connection master;
call mtr.add_suppression("Timeout waiting for reply of binlog*");
set global rpl_semi_sync_master_enabled = ON;
SET @@GLOBAL.rpl_semi_sync_master_timeout=100;
create table t1 (i int);
connection slave;
set global rpl_semi_sync_slave_enabled = ON;
CALL mtr.add_suppression("Semi-sync slave net_flush*");
SET @save_debug= @@global.debug;
SET GLOBAL debug_dbug="+d,semislave_failed_net_flush";
include/start_slave.inc
connection master;
connection slave;
"Assert that the net_fulsh() reply failed is present in slave error log.
FOUND 1 /Semi-sync slave net_flush\(\) reply failed/ in mysqld.2.err
"Assert that Slave IO thread is up and running."
SHOW STATUS LIKE 'Slave_running';
Variable_name Value
Slave_running ON
Slave_IO_Running= Yes
"Clear the network failure simulation."
SET GLOBAL debug_dbug= @save_debug;
connection master;
insert into t1 values (10);
connection slave;
connection slave;
# Compare the tables on master and slave.
include/diff_tables.inc [master:t1, slave:t1]
connection master;
drop table t1;
connection slave;
set global rpl_semi_sync_slave_enabled = OFF;
connection master;
set global rpl_semi_sync_master_enabled = OFF;
SET @@GLOBAL.rpl_semi_sync_master_timeout = 10000;
include/rpl_end.inc

View file

@ -0,0 +1,87 @@
# ==== Purpose ====
#
# Test verifies that slave IO thread doesn't report an error, when slave fails
# to send an acknowledgment to master with semi sync replication in use.
#
# ==== Implementation ====
#
# Steps:
# 0 - Have semi synchronous replication in use.
# 1 - Enable a debug simulation point which simulates network flush failure
# at the time of slave reply operation.
# 2 - Do some operation on master and wait for it to be replicated. Master
# will timeout waiting for reply from slave.
# 3 - Check the slave error log for appropriate error message regarding
# net_flush operation failure.
# 4 - Remove the debug simulation and do some more DML operations on master
# and wait for them to be replicated.
# 5 - Slave will be able to replicate and data is consistent on both master
# and slave. Semi sync will be automatically turned on.
#
# ==== References ====
#
# MDEV-20217: Semi_sync: Last_IO_Error: Fatal error: Failed to run
# 'after_queue_event' hook
#
--source include/have_debug.inc
--source include/master-slave.inc
--connection slave
--source include/stop_slave.inc
--connection master
call mtr.add_suppression("Timeout waiting for reply of binlog*");
--let $sav_timeout_master=`SELECT @@GLOBAL.rpl_semi_sync_master_timeout`
set global rpl_semi_sync_master_enabled = ON;
SET @@GLOBAL.rpl_semi_sync_master_timeout=100;
create table t1 (i int);
--connection slave
set global rpl_semi_sync_slave_enabled = ON;
CALL mtr.add_suppression("Semi-sync slave net_flush*");
SET @save_debug= @@global.debug;
SET GLOBAL debug_dbug="+d,semislave_failed_net_flush";
--source include/start_slave.inc
--connection master
--sync_slave_with_master
# Check error log for correct messages.
let $log_error_= `SELECT @@GLOBAL.log_error`;
if(!$log_error_)
{
# MySQL Server on windows is started with --console and thus
# does not know the location of its .err log, use default location
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.2.err;
}
--echo "Assert that the net_fulsh() reply failed is present in slave error log.
--let SEARCH_FILE=$log_error_
--let SEARCH_PATTERN=Semi-sync slave net_flush\(\) reply failed
--source include/search_pattern_in_file.inc
--echo "Assert that Slave IO thread is up and running."
SHOW STATUS LIKE 'Slave_running';
let $status= query_get_value("show slave status", Slave_IO_Running, 1);
echo Slave_IO_Running= $status;
--echo "Clear the network failure simulation."
SET GLOBAL debug_dbug= @save_debug;
--connection master
insert into t1 values (10);
--sync_slave_with_master
--connection slave
--echo # Compare the tables on master and slave.
--let $diff_tables= master:t1, slave:t1
--source include/diff_tables.inc
--connection master
drop table t1;
--sync_slave_with_master
set global rpl_semi_sync_slave_enabled = OFF;
--connection master
set global rpl_semi_sync_master_enabled = OFF;
--eval SET @@GLOBAL.rpl_semi_sync_master_timeout = $sav_timeout_master
--source include/rpl_end.inc

View file

@ -1,6 +1,6 @@
-- Copyright (c) 2007, 2018, Oracle and/or its affiliates.
-- Copyright (c) 2008, 2014, Monty Program Ab & SkySQL Ab
--
-- Copyright (c) 2008, 2019, MariaDB Corporation.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; version 2 of the License.
@ -96,7 +96,7 @@ CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret
CREATE TABLE IF NOT EXISTS plugin ( name varchar(64) DEFAULT '' NOT NULL, dl varchar(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=Aria transactional=1 CHARACTER SET utf8 COLLATE utf8_general_ci comment='MySQL plugins';
CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(80) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) engine=Aria transactional=1 CHARACTER SET utf8 comment='MySQL Foreign Servers table';
CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host varchar(2048) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(80) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) engine=Aria transactional=1 CHARACTER SET utf8 comment='MySQL Foreign Servers table';
CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(141) DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=Aria transactional=1 CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';

View file

@ -938,7 +938,13 @@ do
cmd="$cmd "`shell_quote_string "$i"`
done
cmd="$cmd $args"
[ $dry_run -eq 1 ] && return
if [ $dry_run -eq 1 ]
then
# RETURN or EXIT depending if the script is being sourced or not.
(return 2> /dev/null) && return || exit
fi
# Avoid 'nohup: ignoring input' warning
test -n "$NOHUP_NICENESS" && cmd="$cmd < /dev/null"

View file

@ -64,7 +64,7 @@ inline bool Field::marked_for_read() const
(!table->read_set ||
bitmap_is_set(table->read_set, field_index) ||
(!(ptr >= table->record[0] &&
ptr < table->record[0] + table->s->reclength)));
ptr < table->record[0] + table->s->reclength)));
}
/*
@ -75,7 +75,7 @@ inline bool Field::marked_for_read() const
inline bool Field::marked_for_write_or_computed() const
{
return (is_stat_field || !table ||
return (!table ||
(!table->write_set ||
bitmap_is_set(table->write_set, field_index) ||
(!(ptr >= table->record[0] &&
@ -2441,31 +2441,19 @@ Field *Field::clone(MEM_ROOT *root, TABLE *new_table)
}
Field *Field::clone(MEM_ROOT *root, TABLE *new_table, my_ptrdiff_t diff,
bool stat_flag)
{
Field *tmp;
if ((tmp= (Field*) memdup_root(root,(char*) this,size_of())))
{
tmp->init(new_table);
tmp->move_field_offset(diff);
}
tmp->is_stat_field= stat_flag;
return tmp;
}
Field *Field::clone(MEM_ROOT *root, my_ptrdiff_t diff)
Field *Field::clone(MEM_ROOT *root, TABLE *new_table, my_ptrdiff_t diff)
{
Field *tmp;
if ((tmp= (Field*) memdup_root(root,(char*) this,size_of())))
{
if (new_table)
tmp->init(new_table);
tmp->move_field_offset(diff);
}
return tmp;
}
int Field::set_default()
{
if (default_value)
@ -2898,7 +2886,7 @@ int Field_decimal::store(const char *from_arg, size_t len, CHARSET_INFO *cs)
/*
Write digits of the frac_% parts ;
Depending on get_thd()->count_cutted_fields, we may also want
Depending on get_thd()->count_cuted_fields, we may also want
to know if some non-zero tail of these parts will
be truncated (for example, 0.002->0.00 will generate a warning,
while 0.000->0.00 will not)
@ -7026,7 +7014,8 @@ Field_longstr::check_string_copy_error(const String_copier *copier,
if (likely(!(pos= copier->most_important_error_pos())))
return FALSE;
if (!is_stat_field)
/* Ignore errors from internal expressions */
if (get_thd()->count_cuted_fields > CHECK_FIELD_EXPRESSION)
{
DBUG_ASSERT(sizeof(tmp) >= convert_to_printable_required_length(6));
convert_to_printable(tmp, sizeof(tmp), pos, (end - pos), cs, 6);
@ -7060,8 +7049,9 @@ int
Field_longstr::report_if_important_data(const char *pstr, const char *end,
bool count_spaces)
{
THD *thd= get_thd();
if ((pstr < end) && thd->count_cuted_fields > CHECK_FIELD_EXPRESSION)
THD *thd;
if ((pstr < end) &&
(thd= get_thd())->count_cuted_fields > CHECK_FIELD_EXPRESSION)
{
if (test_if_important_data(field_charset, pstr, end))
{
@ -7072,7 +7062,8 @@ Field_longstr::report_if_important_data(const char *pstr, const char *end,
return 2;
}
else if (count_spaces)
{ /* If we lost only spaces then produce a NOTE, not a WARNING */
{
/* If we lost only spaces then produce a NOTE, not a WARNING */
set_note(WARN_DATA_TRUNCATED, 1);
return 2;
}
@ -11190,13 +11181,17 @@ void Field::set_warning_truncated_wrong_value(const char *type_arg,
const char *value)
{
THD *thd= get_thd();
const char *db_name= table->s->db.str;
const char *table_name= table->s->table_name.str;
const char *db_name;
const char *table_name;
/*
table has in the past been 0 in case of wrong calls when processing
statistics tables. Let's protect against that.
*/
DBUG_ASSERT(table);
if (!db_name)
db_name= "";
if (!table_name)
table_name= "";
db_name= (table && table->s->db.str) ? table->s->db.str : "";
table_name= ((table && table->s->table_name.str) ? table->s->table_name.str :
"");
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,

View file

@ -1271,9 +1271,7 @@ public:
return create_tmp_field(root, new_table, maybe_null());
}
Field *clone(MEM_ROOT *mem_root, TABLE *new_table);
Field *clone(MEM_ROOT *mem_root, TABLE *new_table, my_ptrdiff_t diff,
bool stat_flag= FALSE);
Field *clone(MEM_ROOT *mem_root, my_ptrdiff_t diff);
Field *clone(MEM_ROOT *mem_root, TABLE *new_table, my_ptrdiff_t diff);
inline void move_field(uchar *ptr_arg,uchar *null_ptr_arg,uchar null_bit_arg)
{
ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg;

View file

@ -2661,12 +2661,16 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
records= head->stat_records();
if (!records)
records++; /* purecov: inspected */
scan_time= (double) records / TIME_FOR_COMPARE + 1;
read_time= (double) head->file->scan_time() + scan_time + 1.1;
if (head->force_index)
if (head->force_index || force_quick_range)
scan_time= read_time= DBL_MAX;
if (limit < records)
read_time= (double) records + scan_time + 1; // Force to use index
else
{
scan_time= (double) records / TIME_FOR_COMPARE + 1;
read_time= (double) head->file->scan_time() + scan_time + 1.1;
if (limit < records)
read_time= (double) records + scan_time + 1; // Force to use index
}
possible_keys.clear_all();
@ -11069,6 +11073,16 @@ ha_rows check_quick_select(PARAM *param, uint idx, bool index_only,
bufsize, mrr_flags, cost);
if (rows != HA_POS_ERROR)
{
ha_rows table_records= param->table->stat_records();
if (rows > table_records)
{
/*
For any index the total number of records within all ranges
cannot be be bigger than the number of records in the table
*/
rows= table_records;
set_if_bigger(rows, 1);
}
param->quick_rows[keynr]= rows;
param->possible_keys.set_bit(keynr);
if (update_tbl_stats)

View file

@ -453,11 +453,6 @@ bool find_eq_ref_candidate(TABLE *table, table_map sj_inner_tables);
static SJ_MATERIALIZATION_INFO *
at_sjmat_pos(const JOIN *join, table_map remaining_tables, const JOIN_TAB *tab,
uint idx, bool *loose_scan);
void best_access_path(JOIN *join, JOIN_TAB *s,
table_map remaining_tables, uint idx,
bool disable_jbuf, double record_count,
POSITION *pos, POSITION *loose_scan_pos);
static Item *create_subq_in_equalities(THD *thd, SJ_MATERIALIZATION_INFO *sjm,
Item_in_subselect *subq_pred);
static bool remove_sj_conds(THD *thd, Item **tree);
@ -2781,6 +2776,14 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
{
POSITION *pos= join->positions + idx;
const JOIN_TAB *new_join_tab= pos->table;
#ifdef HAVE_valgrind
new (&pos->firstmatch_picker) Firstmatch_picker;
new (&pos->loosescan_picker) LooseScan_picker;
new (&pos->sjmat_picker) Sj_materialization_picker;
new (&pos->dups_weedout_picker) Duplicate_weedout_picker;
#endif
if (join->emb_sjm_nest || //(1)
!join->select_lex->have_merged_subqueries) //(2)
{
@ -3121,7 +3124,8 @@ bool Sj_materialization_picker::check_qep(JOIN *join,
Json_writer_temp_disable trace_semijoin_mat_scan(thd);
for (i= first_tab + mat_info->tables; i <= idx; i++)
{
best_access_path(join, join->positions[i].table, rem_tables, i,
best_access_path(join, join->positions[i].table, rem_tables,
join->positions, i,
disable_jbuf, prefix_rec_count, &curpos, &dummy);
prefix_rec_count= COST_MULT(prefix_rec_count, curpos.records_read);
prefix_cost= COST_ADD(prefix_cost, curpos.read_time);
@ -3790,7 +3794,8 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join)
Json_writer_object trace_one_table(thd);
trace_one_table.add_table_name(join->best_positions[i].table);
}
best_access_path(join, join->best_positions[i].table, rem_tables, i,
best_access_path(join, join->best_positions[i].table, rem_tables,
join->best_positions, i,
FALSE, prefix_rec_count,
join->best_positions + i, &dummy);
prefix_rec_count *= join->best_positions[i].records_read;
@ -3830,8 +3835,9 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join)
}
if (join->best_positions[idx].use_join_buffer)
{
best_access_path(join, join->best_positions[idx].table,
rem_tables, idx, TRUE /* no jbuf */,
best_access_path(join, join->best_positions[idx].table,
rem_tables, join->best_positions, idx,
TRUE /* no jbuf */,
record_count, join->best_positions + idx, &dummy);
}
record_count *= join->best_positions[idx].records_read;
@ -3869,7 +3875,8 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join)
if (join->best_positions[idx].use_join_buffer || (idx == first))
{
best_access_path(join, join->best_positions[idx].table,
rem_tables, idx, TRUE /* no jbuf */,
rem_tables, join->best_positions, idx,
TRUE /* no jbuf */,
record_count, join->best_positions + idx,
&loose_scan_pos);
if (idx==first)

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2010, 2015, MariaDB
Copyright (c) 2010, 2019, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -91,6 +91,7 @@ class Loose_scan_opt
KEYUSE *best_loose_scan_start_key;
uint best_max_loose_keypart;
table_map best_ref_depend_map;
public:
Loose_scan_opt():
@ -252,13 +253,14 @@ public:
best_loose_scan_records= records;
best_max_loose_keypart= max_loose_keypart;
best_loose_scan_start_key= start_key;
best_ref_depend_map= 0;
}
}
}
}
void check_ref_access_part2(uint key, KEYUSE *start_key, double records,
double read_time)
double read_time, table_map ref_depend_map_arg)
{
if (part1_conds_met && read_time < best_loose_scan_cost)
{
@ -268,6 +270,7 @@ public:
best_loose_scan_records= records;
best_max_loose_keypart= max_loose_keypart;
best_loose_scan_start_key= start_key;
best_ref_depend_map= ref_depend_map_arg;
}
}
@ -283,6 +286,7 @@ public:
best_loose_scan_records= rows2double(quick->records);
best_max_loose_keypart= quick_max_loose_keypart;
best_loose_scan_start_key= NULL;
best_ref_depend_map= 0;
}
}
@ -299,7 +303,7 @@ public:
pos->use_join_buffer= FALSE;
pos->table= tab;
pos->range_rowid_filter_info= tab->range_rowid_filter_info;
// todo need ref_depend_map ?
pos->ref_depend_map= best_ref_depend_map;
DBUG_PRINT("info", ("Produced a LooseScan plan, key %s, %s",
tab->table->key_info[best_loose_scan_key].name.str,
best_loose_scan_start_key? "(ref access)":

View file

@ -4982,13 +4982,14 @@ Stopping slave I/O thread due to out-of-memory error from master");
goto err;
}
if (rpl_semi_sync_slave_status && (mi->semi_ack & SEMI_SYNC_NEED_ACK) &&
repl_semisync_slave.slave_reply(mi))
if (rpl_semi_sync_slave_status && (mi->semi_ack & SEMI_SYNC_NEED_ACK))
{
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
ER_THD(thd, ER_SLAVE_FATAL_ERROR),
"Failed to run 'after_queue_event' hook");
goto err;
/*
We deliberately ignore the error in slave_reply, such error should
not cause the slave IO thread to stop, and the error messages are
already reported.
*/
(void)repl_semisync_slave.slave_reply(mi);
}
if (mi->using_gtid == Master_info::USE_GTID_NO &&

View file

@ -1440,6 +1440,22 @@ void With_clause::print(String *str, enum_query_type query_type)
void With_element::print(String *str, enum_query_type query_type)
{
str->append(query_name);
if (column_list.elements)
{
List_iterator_fast<LEX_CSTRING> li(column_list);
str->append('(');
for (LEX_CSTRING *col_name= li++; ; )
{
str->append(col_name);
col_name= li++;
if (!col_name)
{
str->append(')');
break;
}
str->append(',');
}
}
str->append(STRING_WITH_LEN(" as "));
str->append('(');
spec->print(str, query_type);

View file

@ -107,10 +107,6 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
static ha_rows get_quick_record_count(THD *thd, SQL_SELECT *select,
TABLE *table,
const key_map *keys,ha_rows limit);
void best_access_path(JOIN *join, JOIN_TAB *s,
table_map remaining_tables, uint idx,
bool disable_jbuf, double record_count,
POSITION *pos, POSITION *loose_scan_pos);
static void optimize_straight_join(JOIN *join, table_map join_tables);
static bool greedy_search(JOIN *join, table_map remaining_tables,
uint depth, uint prune_level,
@ -5479,6 +5475,13 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
{
if (choose_plan(join, all_table_map & ~join->const_table_map))
goto error;
#ifdef HAVE_valgrind
// JOIN::positions holds the current query plan. We've already
// made the plan choice, so we should only use JOIN::best_positions
for (uint k=join->const_tables; k < join->table_count; k++)
MEM_UNDEFINED(&join->positions[k], sizeof(join->positions[k]));
#endif
}
else
{
@ -7178,6 +7181,7 @@ void
best_access_path(JOIN *join,
JOIN_TAB *s,
table_map remaining_tables,
const POSITION *join_positions,
uint idx,
bool disable_jbuf,
double record_count,
@ -7298,7 +7302,7 @@ best_access_path(JOIN *join,
if (!keyuse->val->maybe_null || keyuse->null_rejecting)
notnull_part|=keyuse->keypart_map;
double tmp2= prev_record_reads(join->positions, idx,
double tmp2= prev_record_reads(join_positions, idx,
(found_ref | keyuse->used_tables));
if (tmp2 < best_prev_record_reads)
{
@ -7340,7 +7344,7 @@ best_access_path(JOIN *join,
Really, there should be records=0.0 (yes!)
but 1.0 would be probably safer
*/
tmp= prev_record_reads(join->positions, idx, found_ref);
tmp= prev_record_reads(join_positions, idx, found_ref);
records= 1.0;
type= JT_FT;
trace_access_idx.add("access_type", join_type_str[type])
@ -7369,7 +7373,7 @@ best_access_path(JOIN *join,
type= JT_EQ_REF;
trace_access_idx.add("access_type", join_type_str[type])
.add("index", keyinfo->name);
tmp = prev_record_reads(join->positions, idx, found_ref);
tmp = prev_record_reads(join_positions, idx, found_ref);
records=1.0;
}
else
@ -7657,7 +7661,8 @@ best_access_path(JOIN *join,
}
tmp= COST_ADD(tmp, s->startup_cost);
loose_scan_opt.check_ref_access_part2(key, start_key, records, tmp);
loose_scan_opt.check_ref_access_part2(key, start_key, records, tmp,
found_ref);
} /* not ft_key */
if (records < DBL_MAX)
@ -8447,7 +8452,8 @@ optimize_straight_join(JOIN *join, table_map join_tables)
trace_one_table.add_table_name(s);
}
/* Find the best access method from 's' to the current partial plan */
best_access_path(join, s, join_tables, idx, disable_jbuf, record_count,
best_access_path(join, s, join_tables, join->positions, idx,
disable_jbuf, record_count,
position, &loose_scan_pos);
/* compute the cost of the new plan extended with 's' */
@ -9070,7 +9076,19 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
}
keyparts++;
}
/*
Here we discount selectivity of the constant range CR. To calculate
this selectivity we use elements from the quick_rows[] array.
If we have indexes i1,...,ik with the same prefix compatible
with CR any of the estimate quick_rows[i1], ... quick_rows[ik] could
be used for this calculation but here we don't know which one was
actually used. So sel could be greater than 1 and we have to cap it.
However if sel becomes greater than 2 then with high probability
something went wrong.
*/
sel /= (double)table->quick_rows[key] / (double) table->stat_records();
// MDEV-20595 FIXME: DBUG_ASSERT(sel > 0 && sel <= 2.0);
set_if_smaller(sel, 1.0);
used_range_selectivity= true;
}
}
@ -9116,8 +9134,9 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
fldno= table->key_info[key].key_part[keyparts-1].fieldnr - 1;
if (table->field[fldno]->cond_selectivity > 0)
{
{
sel /= table->field[fldno]->cond_selectivity;
// MDEV-20595 FIXME: DBUG_ASSERT(sel > 0 && sel <= 2.0);
set_if_smaller(sel, 1.0);
}
/*
@ -9171,10 +9190,11 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
next_field= next_field->next_equal_field)
{
if (!(next_field->table->map & rem_tables) && next_field->table != table)
{
{
if (field->cond_selectivity > 0)
{
{
sel/= field->cond_selectivity;
// MDEV-20595 FIXME: DBUG_ASSERT(sel > 0 && sel <= 2.0);
set_if_smaller(sel, 1.0);
}
break;
@ -9186,6 +9206,7 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
sel*= table_multi_eq_cond_selectivity(join, idx, s, rem_tables,
keyparts, ref_keyuse_steps);
DBUG_ASSERT(0.0 < sel && sel <= 1.0);
return sel;
}
@ -9376,8 +9397,8 @@ best_extension_by_limited_search(JOIN *join,
/* Find the best access method from 's' to the current partial plan */
POSITION loose_scan_pos;
best_access_path(join, s, remaining_tables, idx, disable_jbuf,
record_count, position, &loose_scan_pos);
best_access_path(join, s, remaining_tables, join->positions, idx,
disable_jbuf, record_count, position, &loose_scan_pos);
/* Compute the cost of extending the plan with 's' */
current_record_count= COST_MULT(record_count, position->records_read);
@ -9781,11 +9802,11 @@ cache_record_length(JOIN *join,uint idx)
*/
double
prev_record_reads(POSITION *positions, uint idx, table_map found_ref)
prev_record_reads(const POSITION *positions, uint idx, table_map found_ref)
{
double found=1.0;
POSITION *pos_end= positions - 1;
for (POSITION *pos= positions + idx - 1; pos != pos_end; pos--)
const POSITION *pos_end= positions - 1;
for (const POSITION *pos= positions + idx - 1; pos != pos_end; pos--)
{
if (pos->table->table->map & found_ref)
{
@ -16675,7 +16696,8 @@ void optimize_wo_join_buffering(JOIN *join, uint first_tab, uint last_tab,
if ((i == first_tab && first_alt) || join->positions[i].use_join_buffer)
{
/* Find the best access method that would not use join buffering */
best_access_path(join, rs, reopt_remaining_tables, i,
best_access_path(join, rs, reopt_remaining_tables,
join->positions, i,
TRUE, rec_count,
&pos, &loose_scan_pos);
}

View file

@ -854,6 +854,7 @@ public:
friend void best_access_path(JOIN *join,
JOIN_TAB *s,
table_map remaining_tables,
const struct st_position *join_positions,
uint idx,
bool disable_jbuf,
double record_count,
@ -2071,6 +2072,11 @@ protected:
}
};
void best_access_path(JOIN *join, JOIN_TAB *s,
table_map remaining_tables,
const POSITION *join_positions, uint idx,
bool disable_jbuf, double record_count,
POSITION *pos, POSITION *loose_scan_pos);
bool cp_buffer_from_ref(THD *thd, TABLE *table, TABLE_REF *ref);
bool error_if_full_join(JOIN *join);
int report_error(TABLE *table, int error);
@ -2435,7 +2441,7 @@ bool instantiate_tmp_table(TABLE *table, KEY *keyinfo,
ulonglong options);
bool open_tmp_table(TABLE *table);
void setup_tmp_table_column_bitmaps(TABLE *table, uchar *bitmaps);
double prev_record_reads(POSITION *positions, uint idx, table_map found_ref);
double prev_record_reads(const POSITION *positions, uint idx, table_map found_ref);
void fix_list_after_tbl_changes(SELECT_LEX *new_parent, List<TABLE_LIST> *tlist);
double get_tmp_table_lookup_cost(THD *thd, double row_count, uint row_size);
double get_tmp_table_write_cost(THD *thd, double row_count, uint row_size);

View file

@ -1,4 +1,5 @@
/* Copyright (C) 2009 MySQL AB
Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -1023,7 +1024,9 @@ public:
{
char buff[MAX_FIELD_WIDTH];
String val(buff, sizeof(buff), &my_charset_bin);
my_bitmap_map *old_map;
old_map= dbug_tmp_use_all_columns(stat_table, stat_table->read_set);
for (uint i= COLUMN_STAT_MIN_VALUE; i <= COLUMN_STAT_HISTOGRAM; i++)
{
Field *stat_field= stat_table->field[i];
@ -1081,6 +1084,7 @@ public:
}
}
}
dbug_tmp_restore_column_map(stat_table->read_set, old_map);
}
@ -1132,12 +1136,18 @@ public:
case COLUMN_STAT_MIN_VALUE:
table_field->read_stats->min_value->set_notnull();
stat_field->val_str(&val);
#if 0 /* MDEV-20589 FIXME: This fails! */
DBUG_ASSERT(table_field->read_stats->min_value->is_stat_field);
#endif
table_field->read_stats->min_value->store(val.ptr(), val.length(),
&my_charset_bin);
break;
case COLUMN_STAT_MAX_VALUE:
table_field->read_stats->max_value->set_notnull();
stat_field->val_str(&val);
#if 0 /* MDEV-20589 FIXME: This fails! */
DBUG_ASSERT(table_field->read_stats->min_value->is_stat_field);
#endif
table_field->read_stats->max_value->store(val.ptr(), val.length(),
&my_charset_bin);
break;
@ -1985,7 +1995,7 @@ void create_min_max_statistical_fields_for_table(TABLE *table)
my_ptrdiff_t diff= record-table->record[0];
if (!bitmap_is_set(table->read_set, table_field->field_index))
continue;
if (!(fld= table_field->clone(&table->mem_root, table, diff, TRUE)))
if (!(fld= table_field->clone(&table->mem_root, table, diff)))
continue;
if (i == 0)
table_field->collected_stats->min_value= fld;
@ -2052,7 +2062,7 @@ void create_min_max_statistical_fields_for_table_share(THD *thd,
Field *fld;
Field *table_field= *field_ptr;
my_ptrdiff_t diff= record - table_share->default_values;
if (!(fld= table_field->clone(&stats_cb->mem_root, diff)))
if (!(fld= table_field->clone(&stats_cb->mem_root, NULL, diff)))
continue;
if (i == 0)
table_field->read_stats->min_value= fld;
@ -3046,9 +3056,12 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
KEY *key_info, *key_info_end;
TABLE_SHARE *table_share= table->s;
Table_statistics *read_stats= table_share->stats_cb.table_stats;
enum_check_fields old_check_level= thd->count_cuted_fields;
DBUG_ENTER("read_statistics_for_table");
/* Don't write warnings for internal field conversions */
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
/* Read statistics from the statistical table table_stats */
stat_table= stat_tables[TABLE_STAT].table;
Table_stat table_stat(stat_table, table);
@ -3129,6 +3142,7 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
}
table->stats_is_read= TRUE;
thd->count_cuted_fields= old_check_level;
DBUG_RETURN(0);
}

View file

@ -1875,6 +1875,7 @@ bool st_select_lex_unit::cleanup()
DBUG_RETURN(FALSE);
}
}
columns_are_renamed= false;
cleaned= 1;
for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select())

View file

@ -3073,8 +3073,6 @@ server_option:
{
MYSQL_YYABORT_UNLESS(Lex->server_options.host.str == 0);
Lex->server_options.host= $2;
my_casedn_str(system_charset_info,
(char*) Lex->server_options.host.str);
}
| DATABASE TEXT_STRING_sys
{

View file

@ -2850,8 +2850,6 @@ server_option:
{
MYSQL_YYABORT_UNLESS(Lex->server_options.host.str == 0);
Lex->server_options.host= $2;
my_casedn_str(system_charset_info,
(char*) Lex->server_options.host.str);
}
| DATABASE TEXT_STRING_sys
{

View file

@ -2439,30 +2439,6 @@ dict_table_copy_types(
dict_table_copy_v_types(tuple, table);
}
/********************************************************************
Wait until all the background threads of the given table have exited, i.e.,
bg_threads == 0. Note: bg_threads_mutex must be reserved when
calling this. */
void
dict_table_wait_for_bg_threads_to_exit(
/*===================================*/
dict_table_t* table, /*< in: table */
ulint delay) /*< in: time in microseconds to wait between
checks of bg_threads. */
{
fts_t* fts = table->fts;
ut_ad(mutex_own(&fts->bg_threads_mutex));
while (fts->bg_threads > 0) {
mutex_exit(&fts->bg_threads_mutex);
os_thread_sleep(delay);
mutex_enter(&fts->bg_threads_mutex);
}
}
/*******************************************************************//**
Builds the internal dictionary cache representation for a clustered
index, containing also system fields not defined by the user.

View file

@ -215,8 +215,7 @@ fts_config_set_value(
pars_info_bind_varchar_literal(info, "value",
value->f_str, value->f_len);
const bool dict_locked = fts_table->table->fts->fts_status
& TABLE_DICT_LOCKED;
const bool dict_locked = fts_table->table->fts->dict_locked;
fts_table->suffix = "CONFIG";
fts_get_table_name(fts_table, table_name, dict_locked);

View file

@ -459,7 +459,7 @@ fts_load_user_stopword(
dberr_t error = DB_SUCCESS;
ibool ret = TRUE;
trx_t* trx;
ibool has_lock = fts->fts_status & TABLE_DICT_LOCKED;
ibool has_lock = fts->dict_locked;
trx = trx_create();
trx->op_info = "Load user stopword table into FTS cache";
@ -917,18 +917,16 @@ fts_que_graph_free_check_lock(
const fts_index_cache_t*index_cache, /*!< in: FTS index cache */
que_t* graph) /*!< in: query graph */
{
ibool has_dict = FALSE;
bool has_dict = FALSE;
if (fts_table && fts_table->table) {
ut_ad(fts_table->table->fts);
has_dict = fts_table->table->fts->fts_status
& TABLE_DICT_LOCKED;
has_dict = fts_table->table->fts->dict_locked;
} else if (index_cache) {
ut_ad(index_cache->index->table->fts);
has_dict = index_cache->index->table->fts->fts_status
& TABLE_DICT_LOCKED;
has_dict = index_cache->index->table->fts->dict_locked;
}
if (!has_dict) {
@ -2780,7 +2778,7 @@ fts_update_sync_doc_id(
pars_info_bind_varchar_literal(info, "doc_id", id, id_len);
fts_get_table_name(&fts_table, fts_name,
table->fts->fts_status & TABLE_DICT_LOCKED);
table->fts->dict_locked);
pars_info_bind_id(info, true, "table_name", fts_name);
graph = fts_parse_sql(
@ -2894,7 +2892,7 @@ fts_delete(
into cache from last crash (delete Doc will not initialize the
sync). Avoid any added counter accounting until the FTS cache
is re-established and sync-ed */
if (table->fts->fts_status & ADDED_TABLE_SYNCED
if (table->fts->added_synced
&& doc_id > cache->synced_doc_id) {
mutex_enter(&table->fts->cache->deleted_lock);
@ -3347,7 +3345,7 @@ fts_add_doc_from_tuple(
ut_ad(cache->get_docs);
if (!(ftt->table->fts->fts_status & ADDED_TABLE_SYNCED)) {
if (!ftt->table->fts->added_synced) {
fts_init_index(ftt->table, FALSE);
}
@ -3432,7 +3430,7 @@ fts_add_doc_by_id(
/* If Doc ID has been supplied by the user, then the table
might not yet be sync-ed */
if (!(ftt->table->fts->fts_status & ADDED_TABLE_SYNCED)) {
if (!ftt->table->fts->added_synced) {
fts_init_index(ftt->table, FALSE);
}
@ -4853,7 +4851,7 @@ fts_init_doc_id(
fts_init_index((dict_table_t*) table, TRUE);
}
table->fts->fts_status |= ADDED_TABLE_SYNCED;
table->fts->added_synced = true;
table->fts->cache->first_doc_id = max_doc_id;
@ -5236,67 +5234,6 @@ fts_cache_append_deleted_doc_ids(
mutex_exit((ib_mutex_t*) &cache->deleted_lock);
}
/*********************************************************************//**
Wait for the background thread to start. We poll to detect change
of state, which is acceptable, since the wait should happen only
once during startup.
@return true if the thread started else FALSE (i.e timed out) */
ibool
fts_wait_for_background_thread_to_start(
/*====================================*/
dict_table_t* table, /*!< in: table to which the thread
is attached */
ulint max_wait) /*!< in: time in microseconds, if
set to 0 then it disables
timeout checking */
{
ulint count = 0;
ibool done = FALSE;
ut_a(max_wait == 0 || max_wait >= FTS_MAX_BACKGROUND_THREAD_WAIT);
for (;;) {
fts_t* fts = table->fts;
mutex_enter(&fts->bg_threads_mutex);
if (fts->fts_status & BG_THREAD_READY) {
done = TRUE;
}
mutex_exit(&fts->bg_threads_mutex);
if (!done) {
os_thread_sleep(FTS_MAX_BACKGROUND_THREAD_WAIT);
if (max_wait > 0) {
max_wait -= FTS_MAX_BACKGROUND_THREAD_WAIT;
/* We ignore the residual value. */
if (max_wait < FTS_MAX_BACKGROUND_THREAD_WAIT) {
break;
}
}
++count;
} else {
break;
}
if (count >= FTS_BACKGROUND_THREAD_WAIT_COUNT) {
ib::error() << "The background thread for the FTS"
" table " << table->name
<< " refuses to start";
count = 0;
}
}
return(done);
}
/*********************************************************************//**
Add the FTS document id hidden column. */
void
@ -5379,8 +5316,8 @@ fts_t::fts_t(
const dict_table_t* table,
mem_heap_t* heap)
:
in_queue(0), added_synced(0), dict_locked(0),
bg_threads(0),
fts_status(0),
add_wq(NULL),
cache(NULL),
doc_col(ULINT_UNDEFINED),
@ -5450,42 +5387,6 @@ fts_free(
table->fts = NULL;
}
#if 0 // TODO: Enable this in WL#6608
/*********************************************************************//**
Signal FTS threads to initiate shutdown. */
void
fts_start_shutdown(
/*===============*/
dict_table_t* table, /*!< in: table with FTS indexes */
fts_t* fts) /*!< in: fts instance that needs
to be informed about shutdown */
{
mutex_enter(&fts->bg_threads_mutex);
fts->fts_status |= BG_THREAD_STOP;
mutex_exit(&fts->bg_threads_mutex);
}
/*********************************************************************//**
Wait for FTS threads to shutdown. */
void
fts_shutdown(
/*=========*/
dict_table_t* table, /*!< in: table with FTS indexes */
fts_t* fts) /*!< in: fts instance to shutdown */
{
mutex_enter(&fts->bg_threads_mutex);
ut_a(fts->fts_status & BG_THREAD_STOP);
dict_table_wait_for_bg_threads_to_exit(table, 20000);
mutex_exit(&fts->bg_threads_mutex);
}
#endif
/*********************************************************************//**
Take a FTS savepoint. */
UNIV_INLINE
@ -7467,7 +7368,7 @@ fts_init_index(
}
rw_lock_x_unlock(&cache->init_lock);
if (table->fts->fts_status & ADDED_TABLE_SYNCED) {
if (table->fts->added_synced) {
goto func_exit;
}
@ -7509,7 +7410,7 @@ fts_init_index(
}
}
table->fts->fts_status |= ADDED_TABLE_SYNCED;
table->fts->added_synced = true;
fts_get_docs_clear(cache->get_docs);

View file

@ -2553,12 +2553,22 @@ void fts_optimize_add_table(dict_table_t* table)
return;
}
/* If there is no fts index present then don't add to
optimize queue. */
if (!ib_vector_size(table->fts->indexes)) {
return;
}
/* Make sure table with FTS index cannot be evicted */
dict_table_prevent_eviction(table);
msg = fts_optimize_create_msg(FTS_MSG_ADD_TABLE, table);
ib_wqueue_add(fts_optimize_wq, msg, msg->heap);
mutex_enter(&table->fts->bg_threads_mutex);
table->fts->in_queue = true;
mutex_exit(&table->fts->bg_threads_mutex);
}
/**********************************************************************//**
@ -2585,6 +2595,15 @@ fts_optimize_remove_table(
return;
}
fts_t* fts = table->fts;
mutex_enter(&fts->bg_threads_mutex);
bool is_in_optimize_queue = fts->in_queue;
mutex_exit(&fts->bg_threads_mutex);
if (!is_in_optimize_queue) {
return;
}
msg = fts_optimize_create_msg(FTS_MSG_DEL_TABLE, NULL);
/* We will wait on this event until signalled by the consumer. */
@ -2602,6 +2621,10 @@ fts_optimize_remove_table(
os_event_wait(event);
os_event_destroy(event);
mutex_enter(&fts->bg_threads_mutex);
fts->in_queue = false;
mutex_exit(&fts->bg_threads_mutex);
}
/** Send sync fts cache for the table.
@ -2633,6 +2656,10 @@ fts_optimize_request_sync_table(
msg->ptr = table_id;
ib_wqueue_add(fts_optimize_wq, msg, msg->heap);
mutex_enter(&table->fts->bg_threads_mutex);
table->fts->in_queue = true;
mutex_exit(&table->fts->bg_threads_mutex);
}
/** Add a table to fts_slots if it doesn't already exist. */
@ -2776,6 +2803,10 @@ static void fts_optimize_sync_table(table_id_t table_id)
fts_sync_table(table, false);
}
DBUG_EXECUTE_IF(
"ib_optimize_wq_hang",
os_thread_sleep(6000000););
dict_table_close(table, FALSE, FALSE);
}
}

View file

@ -154,8 +154,7 @@ fts_parse_sql(
str = ut_str3cat(fts_sql_begin, sql, fts_sql_end);
dict_locked = (fts_table && fts_table->table->fts
&& (fts_table->table->fts->fts_status
& TABLE_DICT_LOCKED));
&& fts_table->table->fts->dict_locked);
if (!dict_locked) {
ut_ad(!mutex_own(&dict_sys.mutex));

View file

@ -9928,10 +9928,10 @@ ha_innobase::ft_init_ext(
return(NULL);
}
if (!(ft_table->fts->fts_status & ADDED_TABLE_SYNCED)) {
if (!(ft_table->fts->added_synced)) {
fts_init_index(ft_table, FALSE);
ft_table->fts->fts_status |= ADDED_TABLE_SYNCED;
ft_table->fts->added_synced = true;
}
const byte* q = reinterpret_cast<const byte*>(

View file

@ -5933,7 +5933,7 @@ empty_table:
index->set_modified(mtr);
err = row_ins_clust_index_entry_low(
BTR_NO_LOCKING_FLAG, BTR_MODIFY_TREE, index,
index->n_uniq, entry, 0, thr, false);
index->n_uniq, entry, 0, thr);
} else {
err_exit:
err = DB_CORRUPTION;
@ -6997,15 +6997,13 @@ op_ok:
goto error_handling;
}
ctx->new_table->fts->fts_status
|= TABLE_DICT_LOCKED;
ctx->new_table->fts->dict_locked = true;
error = innobase_fts_load_stopword(
ctx->new_table, ctx->trx,
ctx->prebuilt->trx->mysql_thd)
? DB_SUCCESS : DB_ERROR;
ctx->new_table->fts->fts_status
&= ulint(~TABLE_DICT_LOCKED);
ctx->new_table->fts->dict_locked = false;
if (error != DB_SUCCESS) {
goto error_handling;
@ -10357,6 +10355,7 @@ commit_cache_norebuild(
|| (index->type
& DICT_CORRUPT));
DBUG_ASSERT(index->table->fts);
DEBUG_SYNC_C("norebuild_fts_drop");
fts_drop_index(index->table, index, trx);
}

View file

@ -968,17 +968,6 @@ dict_table_copy_types(
dtuple_t* tuple, /*!< in/out: data tuple */
const dict_table_t* table) /*!< in: table */
MY_ATTRIBUTE((nonnull));
/********************************************************************
Wait until all the background threads of the given table have exited, i.e.,
bg_threads == 0. Note: bg_threads_mutex must be reserved when
calling this. */
void
dict_table_wait_for_bg_threads_to_exit(
/*===================================*/
dict_table_t* table, /* in: table */
ulint delay) /* in: time in microseconds to wait between
checks of bg_threads. */
MY_ATTRIBUTE((nonnull));
/**********************************************************************//**
Looks for an index with the given id. NOTE that we do not reserve
the dictionary mutex: this function is for emergency purposes like

View file

@ -304,27 +304,6 @@ struct fts_table_t {
index auxiliary table */
};
enum fts_status {
BG_THREAD_STOP = 1, /*!< TRUE if the FTS background thread
has finished reading the ADDED table,
meaning more items can be added to
the table. */
BG_THREAD_READY = 2, /*!< TRUE if the FTS background thread
is ready */
ADD_THREAD_STARTED = 4, /*!< TRUE if the FTS add thread
has started */
ADDED_TABLE_SYNCED = 8, /*!< TRUE if the ADDED table record is
sync-ed after crash recovery */
TABLE_DICT_LOCKED = 16 /*!< Set if the table has
dict_sys.mutex */
};
typedef enum fts_status fts_status_t;
/** The state of the FTS sub system. */
class fts_t {
public:
@ -341,13 +320,19 @@ public:
/** Mutex protecting bg_threads* and fts_add_wq. */
ib_mutex_t bg_threads_mutex;
/** Whether the table was added to fts_optimize_wq();
protected by bg_threads_mutex */
unsigned in_queue:1;
/** Whether the ADDED table record sync-ed after
crash recovery; protected by bg_threads_mutex */
unsigned added_synced:1;
/** Whether the table holds dict_sys.mutex;
protected by bg_threads_mutex */
unsigned dict_locked:1;
/** Number of background threads accessing this table. */
ulint bg_threads;
/** Status bit regarding fts running state. TRUE if background
threads running should stop themselves. */
ulint fts_status;
/** Work queue for scheduling jobs for the FTS 'Add' thread, or NULL
if the thread has not yet been created. Each work item is a
fts_trx_doc_ids_t*. */
@ -632,28 +617,6 @@ void
fts_startup(void);
/*==============*/
#if 0 // TODO: Enable this in WL#6608
/******************************************************************//**
Signal FTS threads to initiate shutdown. */
void
fts_start_shutdown(
/*===============*/
dict_table_t* table, /*!< in: table with FTS
indexes */
fts_t* fts); /*!< in: fts instance to
shutdown */
/******************************************************************//**
Wait for FTS threads to shutdown. */
void
fts_shutdown(
/*=========*/
dict_table_t* table, /*!< in: table with FTS
indexes */
fts_t* fts); /*!< in: fts instance to
shutdown */
#endif
/******************************************************************//**
Create an instance of fts_t.
@return instance of fts_t */

View file

@ -442,19 +442,6 @@ fts_cache_append_deleted_doc_ids(
cache, /*!< in: cache to use */
ib_vector_t* vector); /*!< in: append to this vector */
/******************************************************************//**
Wait for the background thread to start. We poll to detect change
of state, which is acceptable, since the wait should happen only
once during startup.
@return true if the thread started else FALSE (i.e timed out) */
ibool
fts_wait_for_background_thread_to_start(
/*====================================*/
dict_table_t* table, /*!< in: table to which the thread
is attached */
ulint max_wait); /*!< in: time in microseconds, if set
to 0 then it disables timeout
checking */
/******************************************************************//**
Search the index specific cache for a particular FTS index.
@return the index specific cache else NULL */
fts_index_cache_t*

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2018, MariaDB Corporation.
Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -92,10 +92,7 @@ row_ins_clust_index_entry_low(
ulint n_uniq, /*!< in: 0 or index->n_uniq */
dtuple_t* entry, /*!< in/out: index entry to insert */
ulint n_ext, /*!< in: number of externally stored columns */
que_thr_t* thr, /*!< in: query thread or NULL */
bool dup_chk_only)
/*!< in: if true, just do duplicate check
and return. don't execute actual insert. */
que_thr_t* thr) /*!< in: query thread or NULL */
MY_ATTRIBUTE((warn_unused_result));
/***************************************************************//**
@ -120,10 +117,7 @@ row_ins_sec_index_entry_low(
dtuple_t* entry, /*!< in/out: index entry to insert */
trx_id_t trx_id, /*!< in: PAGE_MAX_TRX_ID during
row_log_table_apply(), or 0 */
que_thr_t* thr, /*!< in: query thread */
bool dup_chk_only)
/*!< in: if true, just do duplicate check
and return. don't execute actual insert. */
que_thr_t* thr) /*!< in: query thread */
MY_ATTRIBUTE((warn_unused_result));
/***************************************************************//**
@ -138,10 +132,7 @@ row_ins_clust_index_entry(
dict_index_t* index, /*!< in: clustered index */
dtuple_t* entry, /*!< in/out: index entry to insert */
que_thr_t* thr, /*!< in: query thread */
ulint n_ext, /*!< in: number of externally stored columns */
bool dup_chk_only)
/*!< in: if true, just do duplicate check
and return. don't execute actual insert. */
ulint n_ext) /*!< in: number of externally stored columns */
MY_ATTRIBUTE((warn_unused_result));
/***************************************************************//**
Inserts an entry into a secondary index. Tries first optimistic,
@ -154,10 +145,7 @@ row_ins_sec_index_entry(
/*====================*/
dict_index_t* index, /*!< in: secondary index */
dtuple_t* entry, /*!< in/out: index entry to insert */
que_thr_t* thr, /*!< in: query thread */
bool dup_chk_only)
/*!< in: if true, just do duplicate check
and return. don't execute actual insert. */
que_thr_t* thr) /*!< in: query thread */
MY_ATTRIBUTE((warn_unused_result));
/***********************************************************//**
Inserts a row to a table. This is a high-level function used in

View file

@ -6176,6 +6176,8 @@ lock_cancel_waiting_and_release(
}
lock_table_dequeue(lock);
/* Remove the lock from table lock vector too. */
lock_trx_table_locks_remove(lock);
}
/* Reset the wait flag and the back pointer to lock in trx. */

View file

@ -2577,10 +2577,7 @@ row_ins_clust_index_entry_low(
ulint n_uniq, /*!< in: 0 or index->n_uniq */
dtuple_t* entry, /*!< in/out: index entry to insert */
ulint n_ext, /*!< in: number of externally stored columns */
que_thr_t* thr, /*!< in: query thread */
bool dup_chk_only)
/*!< in: if true, just do duplicate check
and return. don't execute actual insert. */
que_thr_t* thr) /*!< in: query thread */
{
btr_pcur_t pcur;
btr_cur_t* cursor;
@ -2676,7 +2673,6 @@ row_ins_clust_index_entry_low(
ut_ad(flags == BTR_NO_LOCKING_FLAG);
ut_ad(index->is_instant());
ut_ad(!dict_index_is_online_ddl(index));
ut_ad(!dup_chk_only);
const rec_t* rec = btr_cur_get_rec(cursor);
@ -2732,11 +2728,6 @@ err_exit:
}
}
if (dup_chk_only) {
mtr_commit(&mtr);
goto func_exit;
}
/* Note: Allowing duplicates would qualify for modification of
an existing record as the new entry is exactly same as old entry. */
if (row_ins_must_modify_rec(cursor)) {
@ -2898,10 +2889,7 @@ row_ins_sec_index_entry_low(
dtuple_t* entry, /*!< in/out: index entry to insert */
trx_id_t trx_id, /*!< in: PAGE_MAX_TRX_ID during
row_log_table_apply(), or 0 */
que_thr_t* thr, /*!< in: query thread */
bool dup_chk_only)
/*!< in: if true, just do duplicate check
and return. don't execute actual insert. */
que_thr_t* thr) /*!< in: query thread */
{
DBUG_ENTER("row_ins_sec_index_entry_low");
@ -3098,10 +3086,6 @@ row_ins_sec_index_entry_low(
&cursor, 0, __FILE__, __LINE__, &mtr);
}
if (dup_chk_only) {
goto func_exit;
}
if (row_ins_must_modify_rec(&cursor)) {
/* There is already an index entry with a long enough common
prefix, we must convert the insert into a modify of an
@ -3190,10 +3174,7 @@ row_ins_clust_index_entry(
dict_index_t* index, /*!< in: clustered index */
dtuple_t* entry, /*!< in/out: index entry to insert */
que_thr_t* thr, /*!< in: query thread */
ulint n_ext, /*!< in: number of externally stored columns */
bool dup_chk_only)
/*!< in: if true, just do duplicate check
and return. don't execute actual insert. */
ulint n_ext) /*!< in: number of externally stored columns */
{
dberr_t err;
ulint n_uniq;
@ -3250,7 +3231,7 @@ row_ins_clust_index_entry(
err = row_ins_clust_index_entry_low(
flags, BTR_MODIFY_LEAF, index, n_uniq, entry,
n_ext, thr, dup_chk_only);
n_ext, thr);
entry->n_fields = orig_n_fields;
@ -3267,7 +3248,7 @@ row_ins_clust_index_entry(
err = row_ins_clust_index_entry_low(
flags, BTR_MODIFY_TREE, index, n_uniq, entry,
n_ext, thr, dup_chk_only);
n_ext, thr);
entry->n_fields = orig_n_fields;
@ -3285,10 +3266,7 @@ row_ins_sec_index_entry(
/*====================*/
dict_index_t* index, /*!< in: secondary index */
dtuple_t* entry, /*!< in/out: index entry to insert */
que_thr_t* thr, /*!< in: query thread */
bool dup_chk_only)
/*!< in: if true, just do duplicate check
and return. don't execute actual insert. */
que_thr_t* thr) /*!< in: query thread */
{
dberr_t err;
mem_heap_t* offsets_heap;
@ -3331,7 +3309,7 @@ row_ins_sec_index_entry(
err = row_ins_sec_index_entry_low(
flags, BTR_MODIFY_LEAF, index, offsets_heap, heap, entry,
trx_id, thr, dup_chk_only);
trx_id, thr);
if (err == DB_FAIL) {
mem_heap_empty(heap);
@ -3345,8 +3323,7 @@ row_ins_sec_index_entry(
err = row_ins_sec_index_entry_low(
flags, BTR_MODIFY_TREE, index,
offsets_heap, heap, entry, 0, thr,
dup_chk_only);
offsets_heap, heap, entry, 0, thr);
}
mem_heap_free(heap);
@ -3375,9 +3352,9 @@ row_ins_index_entry(
return(DB_LOCK_WAIT);});
if (index->is_primary()) {
return(row_ins_clust_index_entry(index, entry, thr, 0, false));
return row_ins_clust_index_entry(index, entry, thr, 0);
} else {
return(row_ins_sec_index_entry(index, entry, thr, false));
return row_ins_sec_index_entry(index, entry, thr);
}
}

View file

@ -1722,7 +1722,7 @@ row_log_table_apply_insert_low(
error = row_ins_clust_index_entry_low(
flags, BTR_MODIFY_TREE, index, index->n_uniq,
entry, 0, thr, false);
entry, 0, thr);
switch (error) {
case DB_SUCCESS:
@ -1746,7 +1746,7 @@ row_log_table_apply_insert_low(
error = row_ins_sec_index_entry_low(
flags, BTR_MODIFY_TREE,
index, offsets_heap, heap, entry,
thr_get_trx(thr)->id, thr, false);
thr_get_trx(thr)->id, thr);
if (error != DB_SUCCESS) {
if (error == DB_DUPLICATE_KEY) {
@ -2377,7 +2377,7 @@ func_exit_committed:
BTR_CREATE_FLAG | BTR_NO_LOCKING_FLAG
| BTR_NO_UNDO_LOG_FLAG | BTR_KEEP_SYS_FLAG,
BTR_MODIFY_TREE, index, offsets_heap, heap,
entry, thr_get_trx(thr)->id, thr, false);
entry, thr_get_trx(thr)->id, thr);
/* Report correct index name for duplicate key error. */
if (error == DB_DUPLICATE_KEY) {

View file

@ -3242,10 +3242,9 @@ row_drop_ancillary_fts_tables(
DICT_TF2_FTS flag set. So keep this out of above
dict_table_has_fts_index condition */
if (table->fts != NULL) {
/* Need to set TABLE_DICT_LOCKED bit, since
fts_que_graph_free_check_lock would try to acquire
/* fts_que_graph_free_check_lock would try to acquire
dict mutex lock */
table->fts->fts_status |= TABLE_DICT_LOCKED;
table->fts->dict_locked = true;
fts_free(table);
}

View file

@ -2509,7 +2509,7 @@ row_upd_sec_index_entry(
ut_a(entry);
/* Insert new index entry */
err = row_ins_sec_index_entry(index, entry, thr, false);
err = row_ins_sec_index_entry(index, entry, thr);
func_exit:
mem_heap_free(heap);
@ -2792,7 +2792,7 @@ check_fk:
err = row_ins_clust_index_entry(
index, entry, thr,
node->upd_ext ? node->upd_ext->n_ext : 0, false);
node->upd_ext ? node->upd_ext->n_ext : 0);
node->state = UPD_NODE_INSERT_CLUSTERED;
mem_heap_free(heap);

View file

@ -504,7 +504,7 @@ inline void trx_t::release_locks()
mem_heap_empty(lock.lock_heap);
}
lock.table_locks.clear(); /* outside "if" to work around MDEV-20483 */
lock.table_locks.clear();
}
/** At shutdown, frees a transaction object. */
@ -1152,26 +1152,14 @@ trx_finalize_for_fts_table(
fts_t* fts = ftt->table->fts;
fts_doc_ids_t* doc_ids = ftt->added_doc_ids;
mutex_enter(&fts->bg_threads_mutex);
ut_a(fts->add_wq);
if (fts->fts_status & BG_THREAD_STOP) {
/* The table is about to be dropped, no use
adding anything to its work queue. */
mem_heap_t* heap = static_cast<mem_heap_t*>(doc_ids->self_heap->arg);
mutex_exit(&fts->bg_threads_mutex);
} else {
mem_heap_t* heap;
mutex_exit(&fts->bg_threads_mutex);
ib_wqueue_add(fts->add_wq, doc_ids, heap);
ut_a(fts->add_wq);
heap = static_cast<mem_heap_t*>(doc_ids->self_heap->arg);
ib_wqueue_add(fts->add_wq, doc_ids, heap);
/* fts_trx_table_t no longer owns the list. */
ftt->added_doc_ids = NULL;
}
/* fts_trx_table_t no longer owns the list. */
ftt->added_doc_ids = NULL;
}
/******************************************************************//**
@ -1389,6 +1377,16 @@ trx_commit_in_memory(
DBUG_LOG("trx", "Autocommit in memory: " << trx);
trx->state = TRX_STATE_NOT_STARTED;
} else {
#ifdef UNIV_DEBUG
if (!UT_LIST_GET_LEN(trx->lock.trx_locks)) {
for (lock_list::iterator it
= trx->lock.table_locks.begin();
it != trx->lock.table_locks.end();
it++) {
ut_ad(!*it);
}
}
#endif /* UNIV_DEBUG */
trx->commit_state();
if (trx->id) {

View file

@ -292,37 +292,37 @@ b i421 l421
b m422 p422
explain select a1,a2,b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select a1,a2,b,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select a1,a2,b, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select a1, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select a1,a2,b,min(c),max(c) from t1 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select a1,a2,b, max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select a1,a2,b,min(c),max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select a1,a2,b, max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select a1,a2,b,min(c),max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select a1,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select a1, max(c) from t1 where a1 in ('a','b','d') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select a1,a2,b, max(c) from t2 where a1 < 'd' group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by
@ -1602,13 +1602,13 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
explain select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c < 'h112') or (c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122')) group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 17 Using where; Using index for group-by
explain select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122') or (c < 'h112') or (c = 'c111')) group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 17 Using where; Using index for group-by
explain select a1,a2,b,min(c) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select a1,a2,b,min(c) from t1 where (ord(a1) > 97) and (ord(a2) + ord(a1) > 194) and (b = 'c') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
@ -1728,7 +1728,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
explain select a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 17 Using where; Using index for group-by
explain select a1,a2,b from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_2 146 NULL # Using where; Using index for group-by
@ -1802,16 +1802,16 @@ Warnings:
Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`b` = 'a' and `test`.`t1`.`c` = 'i121' and `test`.`t1`.`a2` >= 'b'
explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 17 Using where; Using index for group-by
explain select distinct b from t1 where (a2 >= 'b') and (b = 'a');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index
explain select distinct a1 from t1 where a1 in ('a', 'd') and a2 = 'b';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 130 NULL 39 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 5 Using where; Using index for group-by
explain select distinct a1 from t1 where a1 in ('a', 'd') and a2 = 'e';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 130 NULL 39 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 5 Using where; Using index for group-by
explain select distinct a1,a2,b from t2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range NULL idx_t2_2 146 NULL # Using index for group-by
@ -1831,10 +1831,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL idx_t2_2 146 NULL 164 Using where; Using index
explain select distinct a1 from t2 where a1 in ('a', 'd') and a2 = 'b';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_2 129 NULL 37 Using where; Using index for group-by
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_2 129 NULL 6 Using where; Using index for group-by
explain select distinct a1 from t2 where a1 in ('a', 'd') and a2 = 'e';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_2 129 NULL 37 Using where; Using index for group-by
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_2 129 NULL 6 Using where; Using index for group-by
select distinct a1,a2,b from t1;
a1 a2 b
a a a
@ -1972,16 +1972,16 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 17 Using where; Using index for group-by
explain select distinct b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_2 147 NULL 17 Using where; Using index for group-by; Using temporary; Using filesort
explain select distinct a1 from t1 where a1 in ('a', 'd') and a2 = 'b' group by a1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 130 NULL 39 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 5 Using where; Using index for group-by
explain select distinct a1 from t1 where a1 in ('a', 'd') and a2 = 'e' group by a1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 130 NULL 39 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 5 Using where; Using index for group-by
explain select distinct a1,a2,b from t2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range NULL idx_t2_2 146 NULL # Using index for group-by
@ -2091,7 +2091,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 65 Using where; Using index for group-by
explain extended select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 133 100.00 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 17 100.00 Using where; Using index for group-by
Warnings:
Note 1003 select count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`) AS `count(distinct a1,a2,b)` from `test`.`t1` where `test`.`t1`.`b` = 'c' and `test`.`t1`.`a1` > 'a' and `test`.`t1`.`a2` > 'a'
explain select count(distinct b) from t1 where (a2 >= 'b') and (b = 'a');
@ -2099,7 +2099,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index
explain extended select 98 + count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 133 100.00 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 17 100.00 Using where; Using index for group-by
Warnings:
Note 1003 select 98 + count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`) AS `98 + count(distinct a1,a2,b)` from `test`.`t1` where `test`.`t1`.`a1` > 'a' and `test`.`t1`.`a2` > 'a'
select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
@ -2119,16 +2119,16 @@ select 98 + count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a');
104
explain select a1,a2,b, concat(min(c), max(c)) from t1 where a1 < 'd' group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select concat(a1,min(c)),b from t1 where a1 < 'd' group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select concat(a1,min(c)),b,max(c) from t1 where a1 < 'd' group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select concat(a1,a2),b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 133 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select concat(ord(min(b)),ord(max(b))),min(b),max(b) from t1 group by a1,a2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 9 Using index for group-by
@ -2207,19 +2207,19 @@ id select_type table type possible_keys key key_len ref rows Extra
explain extended select a1,a2,min(b),max(b) from t1
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 128 100.00 Using where; Using index
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 128 99.22 Using where; Using index
Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`c` > 'a111' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`
explain extended select a1,a2,b,min(c),max(c) from t1
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 100.00 Using where
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 130 NULL 128 75.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,min(`test`.`t1`.`c`) AS `min(c)`,max(`test`.`t1`.`c`) AS `max(c)` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`d` > 'xy2' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
explain extended select a1,a2,b,c from t1
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b,c;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 128 100.00 Using where
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 128 75.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`d` > 'xy2' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`,`test`.`t1`.`c`
explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b < 'b') group by a1;
@ -2236,7 +2236,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
explain extended select a1,a2,b from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 128 100.00 Using where; Using index
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 128 99.22 Using where; Using index
Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`c` > 'a111' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
explain select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1;
@ -2260,12 +2260,12 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using index
explain extended select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 100.00 Using where; Using index
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 128 100.00 Using where; Using index
Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,count(`test`.`t1`.`a2`) AS `count(a2)` from `test`.`t1` where `test`.`t1`.`a1` > 'a' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
explain extended select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 100.00 Using where; Using index
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 128 100.00 Using where; Using index
Warnings:
Note 1003 select sum(ord(`test`.`t1`.`a1`)) AS `sum(ord(a1))` from `test`.`t1` where `test`.`t1`.`a1` > 'a' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'a' or b = 'b') group by a1;
@ -2470,7 +2470,7 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
explain SELECT MAX(b), a FROM t1 WHERE b < 2 AND a = 1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b PRIMARY 8 NULL 500 Using where; Using index for group-by
1 SIMPLE t1 range PRIMARY,b PRIMARY 8 NULL 2 Using where; Using index for group-by
SELECT MAX(b), a FROM t1 WHERE b < 2 AND a = 1 GROUP BY a;
MAX(b) a
1 1
@ -2485,7 +2485,7 @@ test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
explain SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range PRIMARY PRIMARY 12 NULL 500 Using where; Using index for group-by
1 SIMPLE t2 range PRIMARY PRIMARY 12 NULL 2 Using where; Using index for group-by
SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a;
MIN(c)
2
@ -2557,7 +2557,7 @@ EXPLAIN SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
FROM t1 AS t1_outer;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
2 SUBQUERY t1 range a a 5 NULL 400 Using where; Using index for group-by
2 SUBQUERY t1 range a a 5 NULL 6 Using where; Using index for group-by
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
id select_type table type possible_keys key key_len ref rows Extra
@ -2566,32 +2566,32 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
2 SUBQUERY t1 range a a 5 NULL 400 Using where; Using index for group-by
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t1 range a a 5 NULL 6 Using where; Using index for group-by
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer index a a 10 NULL 15 Using where; Using index
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1_outer.a 1
2 MATERIALIZED t1 range a a 5 NULL 400 Using where; Using index for group-by
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 6
1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 3 Using index
2 MATERIALIZED t1 range a a 5 NULL 6 Using where; Using index for group-by
EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING
a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer range NULL a 5 NULL 6 Using index for group-by
2 SUBQUERY t1 range a a 5 NULL 400 Using where; Using index for group-by
2 SUBQUERY t1 range a a 5 NULL 6 Using where; Using index for group-by
EXPLAIN SELECT 1 FROM t1 AS t1_outer1 JOIN t1 AS t1_outer2
ON t1_outer1.a = (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2)
AND t1_outer1.b = t1_outer2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer1 ref a a 5 const 3 Using where; Using index
1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using where; Using index; Using join buffer (flat, BNL join)
2 SUBQUERY t1 range a a 5 NULL 400 Using where; Using index for group-by
1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using where; Using index
1 PRIMARY t1_outer1 ref a a 10 const,test.t1_outer2.b 1 Using where; Using index
2 SUBQUERY t1 range a a 5 NULL 6 Using where; Using index for group-by
EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using index
2 SUBQUERY t1_outer index NULL a 10 NULL 15 Using index
3 SUBQUERY t1 range a a 5 NULL 400 Using where; Using index for group-by
3 SUBQUERY t1 range a a 5 NULL 6 Using where; Using index for group-by
CREATE TABLE t3 LIKE t1;
FLUSH STATUS;
INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a;
@ -3322,14 +3322,14 @@ a c COUNT(DISTINCT c, a, b)
EXPLAIN SELECT COUNT(DISTINCT c, a, b) FROM t2
WHERE a > 5 AND b BETWEEN 10 AND 20 GROUP BY a, b, c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range a a 15 NULL 1062 Using where; Using index for group-by (scanning)
1 SIMPLE t2 range a a 15 NULL 17 Using where; Using index for group-by
SELECT COUNT(DISTINCT c, a, b) FROM t2
WHERE a > 5 AND b BETWEEN 10 AND 20 GROUP BY a, b, c;
COUNT(DISTINCT c, a, b)
EXPLAIN SELECT COUNT(DISTINCT b), SUM(DISTINCT b) FROM t2 WHERE a = 5
GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref a a 5 const 1000 Using where; Using index
1 SIMPLE t2 ref a a 5 const 16 Using where; Using index
SELECT COUNT(DISTINCT b), SUM(DISTINCT b) FROM t2 WHERE a = 5
GROUP BY b;
COUNT(DISTINCT b) SUM(DISTINCT b)
@ -3505,7 +3505,7 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN SELECT MAX(c2), c1 FROM t1 WHERE c1 = 4 GROUP BY c1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c1 c1 5 const 1000 Using index
1 SIMPLE t1 ref c1 c1 5 const 28 Using index
FLUSH STATUS;
SELECT MAX(c2), c1 FROM t1 WHERE c1 = 4 GROUP BY c1;
MAX(c2) c1

View file

@ -101,6 +101,7 @@ a b
SELECT * FROM t1 FORCE INDEX (kb);
a b
DROP TABLE t1;
set global rocksdb_compact_cf= 'default';
# Read filtering index scan tests (None of these queries should return any results)
CREATE TABLE t1 (
a int,

View file

@ -121,6 +121,9 @@ SELECT * FROM t1 FORCE INDEX (kb);
DROP TABLE t1;
# Compact away the dropped data
set global rocksdb_compact_cf= 'default';
--echo # Read filtering index scan tests (None of these queries should return any results)
CREATE TABLE t1 (
a int,

View file

@ -2163,7 +2163,7 @@ int ha_sphinx::Connect ( const char * sHost, ushort uPort )
#if MYSQL_VERSION_ID>=50515
struct addrinfo *hp = NULL;
tmp_errno = getaddrinfo ( sHost, NULL, NULL, &hp );
if ( !tmp_errno || !hp || !hp->ai_addr )
if ( tmp_errno || !hp || !hp->ai_addr )
{
bError = true;
if ( hp )
@ -2190,8 +2190,9 @@ int ha_sphinx::Connect ( const char * sHost, ushort uPort )
}
#if MYSQL_VERSION_ID>=50515
memcpy ( &sin.sin_addr, hp->ai_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->ai_addrlen ) );
freeaddrinfo ( hp );
struct sockaddr_in *in = (sockaddr_in *)hp->ai_addr;
memcpy ( &sin.sin_addr, &in->sin_addr, Min ( sizeof(sin.sin_addr), sizeof(in->sin_addr) ) );
freeaddrinfo ( hp );
#else
memcpy ( &sin.sin_addr, hp->h_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->h_length ) );
my_gethostbyname_r_free();

View file

@ -75,3 +75,23 @@ id w q
1 2 test;range=meta.foo_count,100,500
5 1 test;range=meta.foo_count,100,500
drop table ts;
#
# MDEV-19205: Sphinx unable to connect using a host name
#
create table ts ( id bigint unsigned not null, w int not null, q varchar(255) not null, index(q) ) engine=sphinx connection="sphinx://localhost:SPHINXSEARCH_PORT/*";
select * from ts where q=';filter=meta.foo_count,100';
id w q
1 1 ;filter=meta.foo_count,100
select * from ts where q='test;filter=meta.sub.int,7';
id w q
5 1 test;filter=meta.sub.int,7
select * from ts where q=';filter=meta.sub.list[0],4';
id w q
select * from ts where q=';filter=meta.sub.list[1],4';
id w q
5 1 ;filter=meta.sub.list[1],4
select * from ts where q='test;range=meta.foo_count,100,500';
id w q
1 2 test;range=meta.foo_count,100,500
5 1 test;range=meta.foo_count,100,500
drop table ts;

View file

@ -41,3 +41,16 @@ select * from ts where q=';filter=meta.sub.list[0],4';
select * from ts where q=';filter=meta.sub.list[1],4';
select * from ts where q='test;range=meta.foo_count,100,500';
drop table ts;
--echo #
--echo # MDEV-19205: Sphinx unable to connect using a host name
--echo #
--replace_result $SPHINXSEARCH_PORT SPHINXSEARCH_PORT
eval create table ts ( id bigint unsigned not null, w int not null, q varchar(255) not null, index(q) ) engine=sphinx connection="sphinx://localhost:$SPHINXSEARCH_PORT/*";
select * from ts where q=';filter=meta.foo_count,100';
select * from ts where q='test;filter=meta.sub.int,7';
select * from ts where q=';filter=meta.sub.list[0],4';
select * from ts where q=';filter=meta.sub.list[1],4';
select * from ts where q='test;range=meta.foo_count,100,500';
drop table ts;

View file

@ -55,6 +55,9 @@ ELSE()
DESTINATION ${INSTALL_MYSQLSHAREDIR} COMPONENT Server
)
MYSQL_ADD_PLUGIN(spider ${SPIDER_SOURCES} STORAGE_ENGINE MODULE_ONLY MODULE_OUTPUT_NAME "ha_spider")
IF(NOT TARGET spider)
RETURN()
ENDIF()
ENDIF()
IF(ORACLE_INCLUDE_DIR AND ORACLE_OCI_LIBRARY)

View file

@ -1,16 +1,22 @@
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. If you want to customize, the
# best way is to create a file "/etc/systemd/system/mariadb.service",
# containing
# .include /usr/lib/systemd/system/mariadb.service
# ...make your changes here...
# or create a file "/etc/systemd/system/mariadb.service.d/foo.conf",
# which doesn't need to include ".include" call and which will be parsed
# after the file mariadb.service itself is parsed.
#
# /etc/systemd/system/mariadb.service
# For more info about custom unit files, see systemd.unit(5) or
# https://mariadb.com/kb/en/mariadb/systemd/
#
# Copyright notice:
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Thanks to:
# Daniel Black
# Erkan Yanar
# David Strauss
# and probably others
[Unit]
Description=MariaDB @VERSION@ database server
@ -85,12 +91,15 @@ ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \
# Use the [Service] section and Environment="MYSQLD_OPTS=...".
# This isn't a replacement for my.cnf.
# _WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster
ExecStart=@sbindir@/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION
@SYSTEMD_EXECSTARTPOST@
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
# per bug https://bugzilla.redhat.com/show_bug.cgi?id=547485
ExecStart=@sbindir@/mysqld $MYSQLD_OPTS --basedir=@prefix@ $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION
# Unset _WSREP_START_POSITION environment variable.
ExecStartPost=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
@SYSTEMD_EXECSTARTPOST@
KillSignal=SIGTERM
# Don't want to see an automated SIGKILL ever

View file

@ -6,6 +6,19 @@
# scripts are needed.
#
#
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. If you want to customize, the
# best way is to create a file "/etc/systemd/system/mariadb@.service",
# containing
# .include /usr/lib/systemd/system/mariadb@.service
# ...make your changes here...
# or create a file "/etc/systemd/system/mariadb@.service.d/foo.conf",
# which doesn't need to include ".include" call and which will be parsed
# after the file mariadb@.service itself is parsed.
#
# For more info about custom unit files, see systemd.unit(5) or
# https://mariadb.com/kb/en/mariadb/systemd/
#
# Copyright notice:
#
# This file is free software; you can redistribute it and/or modify it
@ -131,7 +144,7 @@
# systemd.service(5)
[Unit]
Description=MariaDB @VERSION@ database server (multi-instance)
Description=MariaDB @VERSION@ database server (multi-instance %I)
Documentation=man:mysqld(8)
Documentation=https://mariadb.com/kb/en/library/systemd/
After=network.target
@ -195,6 +208,8 @@ ExecStartPre=@scriptdir@/mysql_install_db $MYSQLD_MULTI_INSTANCE
# Note 1: Place $MYSQLD_OPTS at the very end for its options to take precedence.
ExecStart=@sbindir@/mysqld $MYSQLD_MULTI_INSTANCE $MYSQLD_OPTS
@SYSTEMD_EXECSTARTPOST@
KillSignal=SIGTERM
# Don't want to see an automated SIGKILL ever

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