Merge branch '10.2' into 10.3

This commit is contained in:
Sergei Golubchik 2019-03-17 13:06:41 +01:00
commit b64fde8f38
147 changed files with 1449 additions and 781 deletions

View File

@ -3229,17 +3229,24 @@ err:
DBUG_RETURN(retval == ERROR_STOP ? 1 : 0);
}
uint e_key_get_latest_version_func(uint) { return 1; }
uint e_key_get_func(uint, uint, uchar*, uint*) { return 1; }
uint e_ctx_size_func(uint, uint) { return 1; }
int e_ctx_init_func(void *, const uchar*, uint, const uchar*, uint,
int, uint, uint) { return 1; }
int e_ctx_update_func(void *, const uchar*, uint, uchar*, uint*) { return 1; }
int e_ctx_finish_func(void *, uchar*, uint*) { return 1; }
uint e_encrypted_length_func(uint, uint, uint) { return 1; }
uint dummy1() { return 1; }
struct encryption_service_st encryption_handler=
{
(uint(*)(uint))dummy1,
(uint(*)(uint, uint, uchar*, uint*))dummy1,
(uint(*)(uint, uint))dummy1,
(int (*)(void*, const uchar*, uint, const uchar*, uint, int, uint, uint))dummy1,
(int (*)(void*, const uchar*, uint, uchar*, uint*))dummy1,
(int (*)(void*, uchar*, uint*))dummy1,
(uint (*)(uint, uint, uint))dummy1
e_key_get_latest_version_func,
e_key_get_func,
e_ctx_size_func,
e_ctx_init_func,
e_ctx_update_func,
e_ctx_finish_func,
e_encrypted_length_func
};
/*

View File

@ -968,7 +968,8 @@ static int handle_request_for_tables(char *tables, size_t length,
puts(query);
if (mysql_real_query(sock, query, (ulong)query_length))
{
sprintf(message, "when executing '%s%s... %s'", op, tab_view, options);
my_snprintf(message, sizeof(message), "when executing '%s%s... %s'",
op, tab_view, options);
DBerror(sock, message);
my_free(query);
DBUG_RETURN(1);

View File

@ -8302,6 +8302,12 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
DBUG_ENTER("run_query_stmt");
DBUG_PRINT("query", ("'%-.60s'", query));
if (!mysql)
{
handle_no_active_connection(command, cn, ds);
DBUG_VOID_RETURN;
}
/*
Init a new stmt if it's not already one created for this connection
*/
@ -8839,18 +8845,56 @@ void init_re(void)
*/
const char *ps_re_str =
"^("
"[[:space:]]*REPLACE[[:space:]]|"
"[[:space:]]*INSERT[[:space:]]|"
"[[:space:]]*UPDATE[[:space:]]|"
"[[:space:]]*DELETE[[:space:]]|"
"[[:space:]]*SELECT[[:space:]]|"
"[[:space:]]*ALTER[[:space:]]+SEQUENCE[[:space:]]|"
"[[:space:]]*ALTER[[:space:]]+TABLE[[:space:]]|"
"[[:space:]]*ALTER[[:space:]]+USER[[:space:]]|"
"[[:space:]]*ANALYZE[[:space:]]|"
"[[:space:]]*ASSIGN[[:space:]]|"
//"[[:space:]]*CALL[[:space:]]|" // XXX run_query_stmt doesn't read multiple result sets
"[[:space:]]*CHANGE[[:space:]]|"
"[[:space:]]*CHECKSUM[[:space:]]|"
"[[:space:]]*COMMIT[[:space:]]|"
"[[:space:]]*COMPOUND[[:space:]]|"
"[[:space:]]*CREATE[[:space:]]+DATABASE[[:space:]]|"
"[[:space:]]*CREATE[[:space:]]+INDEX[[:space:]]|"
"[[:space:]]*CREATE[[:space:]]+ROLE[[:space:]]|"
"[[:space:]]*CREATE[[:space:]]+SEQUENCE[[:space:]]|"
"[[:space:]]*CREATE[[:space:]]+TABLE[[:space:]]|"
"[[:space:]]*CREATE[[:space:]]+USER[[:space:]]|"
"[[:space:]]*CREATE[[:space:]]+VIEW[[:space:]]|"
"[[:space:]]*DELETE[[:space:]]|"
"[[:space:]]*DO[[:space:]]|"
"[[:space:]]*DROP[[:space:]]+DATABASE[[:space:]]|"
"[[:space:]]*DROP[[:space:]]+INDEX[[:space:]]|"
"[[:space:]]*DROP[[:space:]]+ROLE[[:space:]]|"
"[[:space:]]*DROP[[:space:]]+SEQUENCE[[:space:]]|"
"[[:space:]]*DROP[[:space:]]+TABLE[[:space:]]|"
"[[:space:]]*DROP[[:space:]]+USER[[:space:]]|"
"[[:space:]]*DROP[[:space:]]+VIEW[[:space:]]|"
"[[:space:]]*FLUSH[[:space:]]|"
"[[:space:]]*GRANT[[:space:]]|"
"[[:space:]]*HANDLER[[:space:]]+.*[[:space:]]+READ[[:space:]]|"
"[[:space:]]*INSERT[[:space:]]|"
"[[:space:]]*INSTALL[[:space:]]+|"
"[[:space:]]*KILL[[:space:]]|"
"[[:space:]]*OPTIMIZE[[:space:]]|"
"[[:space:]]*PRELOAD[[:space:]]|"
"[[:space:]]*RENAME[[:space:]]+TABLE[[:space:]]|"
"[[:space:]]*RENAME[[:space:]]+USER[[:space:]]|"
"[[:space:]]*REPAIR[[:space:]]|"
"[[:space:]]*REPLACE[[:space:]]|"
"[[:space:]]*RESET[[:space:]]|"
"[[:space:]]*REVOKE[[:space:]]|"
"[[:space:]]*ROLLBACK[[:space:]]|"
"[[:space:]]*SELECT[[:space:]]|"
"[[:space:]]*SET[[:space:]]+OPTION[[:space:]]|"
"[[:space:]]*DELETE[[:space:]]+MULTI[[:space:]]|"
"[[:space:]]*UPDATE[[:space:]]+MULTI[[:space:]]|"
"[[:space:]]*INSERT[[:space:]]+SELECT[[:space:]])";
"[[:space:]]*SHOW[[:space:]]|"
"[[:space:]]*SHUTDOWN[[:space:]]|"
"[[:space:]]*SLAVE[[:space:]]|"
"[[:space:]]*TRUNCATE[[:space:]]|"
"[[:space:]]*UNINSTALL[[:space:]]+|"
"[[:space:]]*UPDATE[[:space:]]"
")";
/*
Filter for queries that can be run using the

View File

@ -68,7 +68,6 @@ unsigned long mysql_server_version = 0;
/* server capabilities */
bool have_changed_page_bitmaps = false;
bool have_backup_locks = false;
bool have_backup_safe_binlog_info = false;
bool have_lock_wait_timeout = false;
bool have_galera_enabled = false;
bool have_flush_engine_logs = false;
@ -336,7 +335,6 @@ get_mysql_vars(MYSQL *connection)
char *version_comment_var = NULL;
char *innodb_version_var = NULL;
char *have_backup_locks_var = NULL;
char *have_backup_safe_binlog_info_var = NULL;
char *log_bin_var = NULL;
char *lock_wait_timeout_var= NULL;
char *wsrep_on_var = NULL;
@ -360,8 +358,6 @@ get_mysql_vars(MYSQL *connection)
mysql_variable mysql_vars[] = {
{"have_backup_locks", &have_backup_locks_var},
{"have_backup_safe_binlog_info",
&have_backup_safe_binlog_info_var},
{"log_bin", &log_bin_var},
{"lock_wait_timeout", &lock_wait_timeout_var},
{"gtid_mode", &gtid_mode_var},
@ -394,23 +390,12 @@ get_mysql_vars(MYSQL *connection)
}
if (opt_binlog_info == BINLOG_INFO_AUTO) {
if (have_backup_safe_binlog_info_var != NULL)
opt_binlog_info = BINLOG_INFO_LOCKLESS;
else if (log_bin_var != NULL && !strcmp(log_bin_var, "ON"))
if (log_bin_var != NULL && !strcmp(log_bin_var, "ON"))
opt_binlog_info = BINLOG_INFO_ON;
else
opt_binlog_info = BINLOG_INFO_OFF;
}
if (have_backup_safe_binlog_info_var == NULL &&
opt_binlog_info == BINLOG_INFO_LOCKLESS) {
msg("Error: --binlog-info=LOCKLESS is not supported by the "
"server");
return(false);
}
if (lock_wait_timeout_var != NULL) {
have_lock_wait_timeout = true;
}
@ -1822,4 +1807,3 @@ mdl_unlock_all()
mysql_close(mdl_con);
spaceid_to_tablename.clear();
}

View File

@ -363,9 +363,6 @@ struct ddl_tracker_t {
static ddl_tracker_t ddl_tracker;
/* Whether xtrabackup_binlog_info should be created on recovery */
static bool recover_binlog_info;
/* Simple datasink creation tracking...add datasinks in the reverse order you
want them destroyed. */
#define XTRABACKUP_MAX_DATASINKS 10
@ -2010,7 +2007,6 @@ xtrabackup_read_metadata(char *filename)
{
FILE *fp;
my_bool r = TRUE;
int t;
fp = fopen(filename,"r");
if(!fp) {
@ -2041,9 +2037,6 @@ xtrabackup_read_metadata(char *filename)
}
/* Optional fields */
if (fscanf(fp, "recover_binlog_info = %d\n", &t) == 1) {
recover_binlog_info = (t == 1);
}
end:
fclose(fp);
@ -2062,13 +2055,11 @@ xtrabackup_print_metadata(char *buf, size_t buf_len)
"backup_type = %s\n"
"from_lsn = " UINT64PF "\n"
"to_lsn = " UINT64PF "\n"
"last_lsn = " UINT64PF "\n"
"recover_binlog_info = %d\n",
"last_lsn = " UINT64PF "\n",
metadata_type,
metadata_from_lsn,
metadata_to_lsn,
metadata_last_lsn,
MY_TEST(opt_binlog_info == BINLOG_INFO_LOCKLESS));
metadata_last_lsn);
}
/***********************************************************************
@ -5279,27 +5270,6 @@ innodb_free_param()
}
/** Store the current binary log coordinates in a specified file.
@param[in] filename file name
@param[in] name binary log file name
@param[in] pos binary log file position
@return whether the operation succeeded */
static bool
store_binlog_info(const char* filename, const char* name, ulonglong pos)
{
FILE *fp = fopen(filename, "w");
if (!fp) {
msg("mariabackup: failed to open '%s'", filename);
return(false);
}
fprintf(fp, "%s\t%llu\n", name, pos);
fclose(fp);
return(true);
}
/** Check if file exists*/
static bool file_exists(std::string name)
{
@ -5565,20 +5535,6 @@ xtrabackup_prepare_func(char** argv)
msg("Last binlog file %s, position %lld",
trx_sys.recovered_binlog_filename,
longlong(trx_sys.recovered_binlog_offset));
/* output to xtrabackup_binlog_pos_innodb and
(if backup_safe_binlog_info was available on
the server) to xtrabackup_binlog_info. In the
latter case xtrabackup_binlog_pos_innodb
becomes redundant and is created only for
compatibility. */
ok = store_binlog_info("xtrabackup_binlog_pos_innodb",
trx_sys.recovered_binlog_filename,
trx_sys.recovered_binlog_offset)
&& (!recover_binlog_info
|| store_binlog_info(XTRABACKUP_BINLOG_INFO,
trx_sys.recovered_binlog_filename,
trx_sys.recovered_binlog_offset));
}
/* Check whether the log is applied enough or not. */

View File

@ -140,7 +140,7 @@ extern uint opt_safe_slave_backup_timeout;
extern const char *opt_history;
enum binlog_info_enum { BINLOG_INFO_OFF, BINLOG_INFO_LOCKLESS, BINLOG_INFO_ON,
enum binlog_info_enum { BINLOG_INFO_OFF, BINLOG_INFO_ON,
BINLOG_INFO_AUTO};
extern ulong opt_binlog_info;

View File

@ -114,6 +114,7 @@ extern struct wsrep_service_st {
int (*wsrep_trx_order_before_func)(MYSQL_THD, MYSQL_THD);
void (*wsrep_unlock_rollback_func)();
void (*wsrep_set_data_home_dir_func)(const char *data_dir);
my_bool (*wsrep_thd_is_applier_func)(MYSQL_THD);
} *wsrep_service;
#ifdef MYSQL_DYNAMIC_PLUGIN
@ -159,6 +160,7 @@ extern struct wsrep_service_st {
#define wsrep_trx_order_before(T1,T2) wsrep_service->wsrep_trx_order_before_func(T1,T2)
#define wsrep_unlock_rollback() wsrep_service->wsrep_unlock_rollback_func()
#define wsrep_set_data_home_dir(A) wsrep_service->wsrep_set_data_home_dir_func(A)
#define wsrep_thd_is_applier(T) wsrep_service->wsrep_thd_is_applier(T)
#define wsrep_debug get_wsrep_debug()
#define wsrep_log_conflicts get_wsrep_log_conflicts()
@ -220,7 +222,7 @@ void wsrep_thd_set_conflict_state(THD *thd, enum wsrep_conflict_state state);
bool wsrep_thd_ignore_table(THD *thd);
void wsrep_unlock_rollback();
void wsrep_set_data_home_dir(const char *data_dir);
my_bool wsrep_thd_is_applier(MYSQL_THD thd);
#endif
#ifdef __cplusplus

View File

@ -97,8 +97,6 @@ void mysql_audit_release(THD *thd);
bool thd_is_connection_alive(THD *thd);
/* Close connection with possible error code */
void close_connection(THD *thd, uint errcode);
/* End the connection before closing it */
void end_connection(THD *thd);
/* Decrement connection counter */
void dec_connection_count();
/* Destroy THD object */

View File

@ -50,9 +50,9 @@
#define WSREP_WARN(...) WSREP_LOG(sql_print_warning, ##__VA_ARGS__)
#define WSREP_ERROR(...) WSREP_LOG(sql_print_error, ##__VA_ARGS__)
#define WSREP_SYNC_WAIT(thd_, before_) \
{ if (WSREP_CLIENT(thd_) && \
wsrep_sync_wait(thd_, before_)) goto wsrep_error_label; }
#define WSREP_SYNC_WAIT(thd_, before_) \
do { if (WSREP_CLIENT(thd_) && \
wsrep_sync_wait(thd_, before_)) goto wsrep_error_label; } while(0)
#define WSREP_ERROR_LABEL wsrep_error_label
#else
#define IF_WSREP(A,B) B
@ -65,7 +65,7 @@
#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_)
#define WSREP_TO_ISOLATION_END
#define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_)
#define WSREP_SYNC_WAIT(thd_, before_)
#define WSREP_SYNC_WAIT(thd_, before_) do { } while(0)
#define WSREP_ERROR_LABEL goto wsrep_error_label; wsrep_error_label
#endif /* WITH_WSREP */

View File

@ -210,6 +210,30 @@ should be chosen from the following list:
.IP \(bu 2.3
.\}
t,
aa: Sort by rows affected or average rows affected
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
l,
ae: Sort by rows examined or aggregate rows examined
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
l,
at: Sort by query time or average query time
.RE
.sp

View File

@ -86,6 +86,7 @@ call mtr.check_testcase();
let $datadir=`select @@datadir`;
list_files $datadir mysql_upgrade_info;
list_files_write_file $datadir.tempfiles.txt $datadir/test #sql*;
--replace_regex /#sql-ib[0-9a-f]+-[0-9a-f]+\.ibd\n//
cat_file $datadir.tempfiles.txt;
remove_file $datadir.tempfiles.txt;
list_files $datadir/mysql #sql*;

View File

@ -247,7 +247,7 @@ drop table t1;
#
create table t1 (i int);
insert into t1 values (1);
analyze select * from t1 into @var;
analyze select * into @var from t1 ;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 NULL 100.00 NULL
drop table t1;
@ -281,10 +281,10 @@ drop table t1;
#
create table t1(a int);
insert into t1 values (1),(2);
analyze select a from t1 where a <2 into @var;
analyze select a into @var from t1 where a <2 ;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 100.00 50.00 Using where
analyze select a from t1 into @var;
analyze select a into @var from t1 ;
ERROR 42000: Result consisted of more than one row
analyze insert into t1 select * from t1;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra

View File

@ -196,7 +196,7 @@ drop table t1;
--echo #
create table t1 (i int);
insert into t1 values (1);
analyze select * from t1 into @var;
analyze select * into @var from t1 ;
drop table t1;
--echo #
@ -223,9 +223,9 @@ drop table t1;
create table t1(a int);
insert into t1 values (1),(2);
analyze select a from t1 where a <2 into @var;
analyze select a into @var from t1 where a <2 ;
--error ER_TOO_MANY_ROWS
analyze select a from t1 into @var;
analyze select a into @var from t1 ;
analyze insert into t1 select * from t1;

View File

@ -3421,6 +3421,36 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2;
#
# MDEV-14926 AddressSanitizer: heap-use-after-free in make_date_time on weird combination of functions
#
DO INET_ATON( FROM_UNIXTIME( @@timestamp, ( TRIM( UNHEX(HEX('%m.%d.%Y') ) ) ) ) );
CREATE TABLE t1 (d DATE);
INSERT INTO t1 VALUES ('1989-03-10');
SELECT TIME_FORMAT('23:59:43', BINARY d) AS f FROM t1 GROUP BY 'foo';
f
1989-03-10
DROP TABLE t1;
CREATE TABLE t1 (d DATE) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('1900-01-01');
SELECT LENGTH( DATE_FORMAT( d, BINARY DATABASE() ) ) AS f FROM t1 GROUP BY d;
f
4
DROP TABLE t1;
#
# MDEV-18667 ASAN heap-use-after-free in make_date_time / Arg_comparator::compare_string / Item_func_nullif::compare
#
SELECT NULLIF('foo', FROM_UNIXTIME('2012-12-12 12:12:12', TRIM(0)));
NULLIF('foo', FROM_UNIXTIME('2012-12-12 12:12:12', TRIM(0)))
foo
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2012-12-12 12:12:12'
#
# MDEV-18626 ASAN stack-buffer-overflow in int10_to_str / make_date_time upon DATE_FORMAT
#
SELECT DATE_FORMAT(100000000000, '%j');
DATE_FORMAT(100000000000, '%j')
NULL
#
# End of 10.1 tests
#
#

View File

@ -1907,6 +1907,36 @@ SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-14926 AddressSanitizer: heap-use-after-free in make_date_time on weird combination of functions
--echo #
DO INET_ATON( FROM_UNIXTIME( @@timestamp, ( TRIM( UNHEX(HEX('%m.%d.%Y') ) ) ) ) );
CREATE TABLE t1 (d DATE);
INSERT INTO t1 VALUES ('1989-03-10');
SELECT TIME_FORMAT('23:59:43', BINARY d) AS f FROM t1 GROUP BY 'foo';
DROP TABLE t1;
CREATE TABLE t1 (d DATE) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('1900-01-01');
SELECT LENGTH( DATE_FORMAT( d, BINARY DATABASE() ) ) AS f FROM t1 GROUP BY d;
DROP TABLE t1;
--echo #
--echo # MDEV-18667 ASAN heap-use-after-free in make_date_time / Arg_comparator::compare_string / Item_func_nullif::compare
--echo #
SELECT NULLIF('foo', FROM_UNIXTIME('2012-12-12 12:12:12', TRIM(0)));
--echo #
--echo # MDEV-18626 ASAN stack-buffer-overflow in int10_to_str / make_date_time upon DATE_FORMAT
--echo #
SELECT DATE_FORMAT(100000000000, '%j');
--echo #
--echo # End of 10.1 tests
--echo #

View File

@ -6,6 +6,7 @@
--connect (con1,localhost,root,,)
--let $con_id = `SELECT CONNECTION_ID()`
--replace_result Execute Query
--replace_column 1 # 3 # 6 # 7 #
SHOW PROCESSLIST;
SET DEBUG_SYNC='before_execute_sql_command SIGNAL ready WAIT_FOR go';
@ -29,5 +30,6 @@ let $wait_condition=
WHERE info is NULL;
--source include/wait_condition.inc
--replace_result Execute Query
--replace_column 1 # 3 # 6 # 7 #
SHOW PROCESSLIST;

View File

@ -0,0 +1,142 @@
SET @org_slow_query_log= @@global.slow_query_log;
SET @org_log_output= @@global.log_output;
SET @org_log_slow_admin_statements= @@global.log_slow_admin_statements;
SET @@GLOBAL.slow_query_log=OFF;
SET @@GLOBAL.log_output='TABLE';
FLUSH SLOW LOGS;
SET @@GLOBAL.slow_query_log=ON;
SET @@GLOBAL.log_slow_admin_statements=ON;
SET SESSION debug_dbug="+d,simulate_slow_query";
CREATE PROCEDURE show_slow_log()
BEGIN
SELECT CONCAT('[slow] ', sql_text) AS sql_text
FROM mysql.slow_log
WHERE sql_text NOT LIKE '%debug_dbug%';
END
$$
#
# Expect all admin statements in the slow log (ON,DEFAULT)
#
SET @@GLOBAL.log_slow_admin_statements=ON;
SET log_slow_filter=DEFAULT;
TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT);
CREATE INDEX t1a ON t1 (a);
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CALL show_slow_log();
sql_text
[slow] TRUNCATE TABLE mysql.slow_log
[slow] CREATE TABLE t1 (a INT)
[slow] CREATE INDEX t1a ON t1 (a)
[slow] DROP INDEX t1a ON t1
[slow] DROP TABLE t1
[slow] CREATE TABLE t2 (a INT)
[slow] ALTER TABLE t2 RENAME t2
[slow] RENAME TABLE t2 TO t3
[slow] DROP TABLE t3
[slow] CREATE TABLE t4 (a INT)
[slow] PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'
[slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1
[slow] DEALLOCATE PREPARE stmt
[slow] DROP TABLE t4
#
# Expect all admin statements in the slow log (ON,admin)
#
SET @@GLOBAL.log_slow_admin_statements=ON;
SET log_slow_filter=admin;
TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT);
CREATE INDEX t1a ON t1 (a);
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CALL show_slow_log();
sql_text
[slow] CREATE INDEX t1a ON t1 (a)
[slow] DROP INDEX t1a ON t1
[slow] ALTER TABLE t2 RENAME t2
[slow] RENAME TABLE t2 TO t3
[slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1
#
# Expect none of admin DDL statements in the slow log (ON,filesort)
#
SET @@GLOBAL.log_slow_admin_statements=ON;
SET log_slow_filter=filesort;
TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT);
CREATE INDEX t1a ON t1 (a);
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CALL show_slow_log();
sql_text
#
# Expect none of admin statements in the slow log (OFF,DEFAULT)
#
SET @@GLOBAL.log_slow_admin_statements=OFF;
SET log_slow_filter=DEFAULT;
TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT);
CREATE INDEX t1a ON t1 (a);
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CALL show_slow_log();
sql_text
[slow] TRUNCATE TABLE mysql.slow_log
[slow] CREATE TABLE t1 (a INT)
[slow] CREATE INDEX t1a ON t1 (a)
[slow] DROP INDEX t1a ON t1
[slow] DROP TABLE t1
[slow] CREATE TABLE t2 (a INT)
[slow] ALTER TABLE t2 RENAME t2
[slow] RENAME TABLE t2 TO t3
[slow] DROP TABLE t3
[slow] CREATE TABLE t4 (a INT)
[slow] PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'
[slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1
[slow] DEALLOCATE PREPARE stmt
[slow] DROP TABLE t4
#
# Clean up
#
SET SESSION debug_dbug="-d,simulate_slow_query";
TRUNCATE mysql.slow_log;
SET @@global.slow_query_log= @org_slow_query_log;
SET @@global.log_output= @org_log_output;
SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements;
DROP PROCEDURE show_slow_log;

View File

@ -0,0 +1,126 @@
-- source include/have_debug.inc
SET @org_slow_query_log= @@global.slow_query_log;
SET @org_log_output= @@global.log_output;
SET @org_log_slow_admin_statements= @@global.log_slow_admin_statements;
SET @@GLOBAL.slow_query_log=OFF;
SET @@GLOBAL.log_output='TABLE';
FLUSH SLOW LOGS;
SET @@GLOBAL.slow_query_log=ON;
SET @@GLOBAL.log_slow_admin_statements=ON;
SET SESSION debug_dbug="+d,simulate_slow_query";
DELIMITER $$;
CREATE PROCEDURE show_slow_log()
BEGIN
SELECT CONCAT('[slow] ', sql_text) AS sql_text
FROM mysql.slow_log
WHERE sql_text NOT LIKE '%debug_dbug%';
END
$$
DELIMITER ;$$
--echo #
--echo # Expect all admin statements in the slow log (ON,DEFAULT)
--echo #
SET @@GLOBAL.log_slow_admin_statements=ON;
SET log_slow_filter=DEFAULT;
TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT);
CREATE INDEX t1a ON t1 (a);
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CALL show_slow_log();
--echo #
--echo # Expect all admin statements in the slow log (ON,admin)
--echo #
SET @@GLOBAL.log_slow_admin_statements=ON;
SET log_slow_filter=admin;
TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT);
CREATE INDEX t1a ON t1 (a);
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CALL show_slow_log();
--echo #
--echo # Expect none of admin DDL statements in the slow log (ON,filesort)
--echo #
SET @@GLOBAL.log_slow_admin_statements=ON;
SET log_slow_filter=filesort;
TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT);
CREATE INDEX t1a ON t1 (a);
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CALL show_slow_log();
--echo #
--echo # Expect none of admin statements in the slow log (OFF,DEFAULT)
--echo #
SET @@GLOBAL.log_slow_admin_statements=OFF;
SET log_slow_filter=DEFAULT;
TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT);
CREATE INDEX t1a ON t1 (a);
DROP INDEX t1a ON t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT);
ALTER TABLE t2 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
CREATE TABLE t4 (a INT);
PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
CALL show_slow_log();
--echo #
--echo # Clean up
--echo #
SET SESSION debug_dbug="-d,simulate_slow_query";
TRUNCATE mysql.slow_log;
SET @@global.slow_query_log= @org_slow_query_log;
SET @@global.log_output= @org_log_output;
SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements;
DROP PROCEDURE show_slow_log;

View File

@ -855,7 +855,9 @@ SET GLOBAL slow_query_log = @old_slow_query_log;
#
select CONNECTION_ID() into @thread_id;
--disable_ps_protocol
truncate table mysql.general_log;
--enable_ps_protocol
set global general_log = on;
--disable_result_log
set @lparam = "000 001 002 003 004 005 006 007 008 009"

View File

@ -149,7 +149,7 @@ ANALYZE number of fields: 13
- 6: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39
- 7: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39
- 8: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 10; max_length: 0; type: 8; decimals: 0
- 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 10
- 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
- 10: name: 'filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
- 11: name: 'r_filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
- 12: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39
@ -178,7 +178,7 @@ ANALYZE INSERT number of fields: 13
- 6: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39
- 7: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39
- 8: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 10; max_length: 0; type: 8; decimals: 0
- 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 10
- 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
- 10: name: 'filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
- 11: name: 'r_filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
- 12: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39
@ -207,7 +207,7 @@ ANALYZE UPDATE number of fields: 13
- 6: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39
- 7: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39
- 8: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 10; max_length: 0; type: 8; decimals: 0
- 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 10
- 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
- 10: name: 'filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
- 11: name: 'r_filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
- 12: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39
@ -236,7 +236,7 @@ ANALYZE DELETE number of fields: 13
- 6: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39
- 7: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39
- 8: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 10; max_length: 0; type: 8; decimals: 0
- 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 10
- 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
- 10: name: 'filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
- 11: name: 'r_filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
- 12: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39

View File

@ -22,7 +22,8 @@ drop table t1,t2;
--replace_column 1 <Id> 3 <Host> 6 <Time> 7 <State>
# Embedded server is hardcoded to show "Writing to net" as STATE.
--replace_result "Writing to net" "NULL"
# ps-protocol will have Execute not Query
--replace_result "Writing to net" "NULL" "Execute" "Query"
--replace_regex /localhost[:0-9]*/localhost/
SHOW PROCESSLIST;

View File

@ -1321,7 +1321,7 @@ partition p2 values in (1));
end//
call p()//
drop procedure p//
drop table t1;
drop table t1//
create procedure p ()
begin
create table t1 (a int not null,b int not null,c int not null,primary key (a,b))

View File

@ -1198,7 +1198,7 @@ end//
call p()//
drop procedure p//
drop table t1;
drop table t1//
create procedure p ()
begin

View File

@ -47,7 +47,9 @@ insert into t1 values (5,5,5);
check table t1 changed;
check table t1 medium;
check table t1 extended;
--disable_ps_protocol
show index from t1;
--enable_ps_protocol
--disable_metadata
--error ER_DUP_ENTRY
insert into t1 values (5,5,5);
@ -72,7 +74,9 @@ drop table t1;
show variables like "wait_timeout%";
show variables like "WAIT_timeout%";
show variables like "this_doesn't_exists%";
--disable_ps_protocol
show table status from test like "this_doesn't_exists%";
--enable_ps_protocol
show databases;
show databases like "test%";
--disable_metadata
@ -409,7 +413,9 @@ CREATE TABLE t1(
PRIMARY KEY(field1(1000))
);
--enable_metadata
--disable_ps_protocol
show index from t1;
--enable_ps_protocol
--disable_metadata
drop table t1;
@ -707,11 +713,15 @@ set names utf8;
--echo ----------------------------------------------------------------
--disable_ps_protocol
SHOW CHARACTER SET LIKE 'utf8';
--enable_ps_protocol
--echo ----------------------------------------------------------------
--disable_ps_protocol
SHOW COLLATION LIKE 'latin1_bin';
--enable_ps_protocol
--echo ----------------------------------------------------------------
@ -727,7 +737,9 @@ SHOW CREATE TABLE t1;
--echo ----------------------------------------------------------------
--disable_ps_protocol
SHOW INDEX FROM t1;
--enable_ps_protocol
--echo ----------------------------------------------------------------
@ -774,8 +786,10 @@ SHOW COLUMNS FROM t1;
--echo ----------------------------------------------------------------
--disable_ps_protocol
--replace_column 6 #
SHOW TRIGGERS LIKE 't1';
--enable_ps_protocol
--echo ----------------------------------------------------------------
@ -1364,9 +1378,11 @@ let $wait_timeout= 10;
let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%GET_LOCK%' AND ID != CONNECTION_ID();
--source include/wait_condition.inc
--replace_column 1 ### 3 ### 6 ### 7 ###
--replace_result "Execute" "Query"
SHOW PROCESSLIST;
SET NAMES utf8;
--replace_column 1 ### 3 ### 6 ### 7 ###
--replace_result "Execute" "Query"
SHOW PROCESSLIST;
SELECT RELEASE_LOCK('t');
--connection con1

View File

@ -31,12 +31,11 @@ count(*)
set debug_dbug='';
select event_name
from
performance_schema.events_stages_history_long
performance_schema.events_stages_history_long join
performance_schema.threads using (thread_id)
where
event_name like '%show explain' and
thread_id in(select thread_id
from performance_schema.events_statements_history_long
where EVENT_NAME='statement/sql/show_explain');
processlist_id=$thr1;
event_name
stage/sql/Show explain
drop table t0;

View File

@ -49,12 +49,12 @@ reap;
set debug_dbug='';
select event_name
from
performance_schema.events_stages_history_long
where
event_name like '%show explain' and
thread_id in(select thread_id
from performance_schema.events_statements_history_long
where EVENT_NAME='statement/sql/show_explain');
evalp select event_name
from
performance_schema.events_stages_history_long join
performance_schema.threads using (thread_id)
where
event_name like '%show explain' and
processlist_id=$thr1;
drop table t0;

View File

@ -32,61 +32,55 @@ RETURNS VARCHAR(64) UNICODE BINARY
BEGIN
RETURN '';
END|
SHOW CREATE FUNCTION f;
DROP FUNCTION f;
SHOW CREATE FUNCTION f|
Function sql_mode Create Function character_set_client collation_connection Database Collation
f STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET ucs2 COLLATE ucs2_bin
BEGIN
RETURN '';
END latin1 latin1_swedish_ci latin1_swedish_ci
DROP FUNCTION f|
CREATE FUNCTION f()
RETURNS VARCHAR(64) BINARY UNICODE
BEGIN
RETURN '';
END|
SHOW CREATE FUNCTION f|
Function sql_mode Create Function character_set_client collation_connection Database Collation
f STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET ucs2 COLLATE ucs2_bin
BEGIN
RETURN '';
END latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE FUNCTION f;
DROP FUNCTION f;
#
# Testing keywords ASCII + BINARY
#
DROP FUNCTION f|
CREATE FUNCTION f()
RETURNS VARCHAR(64) ASCII BINARY
BEGIN
RETURN '';
END|
Function sql_mode Create Function character_set_client collation_connection Database Collation
f STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET ucs2 COLLATE ucs2_bin
BEGIN
RETURN '';
END latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE FUNCTION f;
DROP FUNCTION f;
CREATE FUNCTION f()
RETURNS VARCHAR(64) BINARY ASCII
BEGIN
RETURN '';
END|
SHOW CREATE FUNCTION f|
Function sql_mode Create Function character_set_client collation_connection Database Collation
f STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_bin
BEGIN
RETURN '';
END latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE FUNCTION f;
DROP FUNCTION f;
#
# Testing COLLATE in OUT parameter
#
DROP FUNCTION f|
CREATE FUNCTION f()
RETURNS VARCHAR(64) BINARY ASCII
BEGIN
RETURN '';
END|
SHOW CREATE FUNCTION f|
Function sql_mode Create Function character_set_client collation_connection Database Collation
f STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_bin
BEGIN
RETURN '';
END latin1 latin1_swedish_ci latin1_swedish_ci
DROP FUNCTION f|
CREATE PROCEDURE p1(IN f1 VARCHAR(64) CHARACTER SET ucs2 COLLATE ucs2_czech_ci,
OUT f2 VARCHAR(64) CHARACTER SET ucs2 COLLATE ucs2_polish_ci)
BEGIN
SET f2= f1;
SET f2= concat(collation(f1), ' ', collation(f2));
END|
Function sql_mode Create Function character_set_client collation_connection Database Collation
f STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_bin
BEGIN
RETURN '';
END latin1 latin1_swedish_ci latin1_swedish_ci
CREATE FUNCTION f1()
RETURNS VARCHAR(64) CHARACTER SET ucs2
BEGIN

View File

@ -52,16 +52,16 @@ CREATE FUNCTION f()
BEGIN
RETURN '';
END|
SHOW CREATE FUNCTION f;
DROP FUNCTION f;
SHOW CREATE FUNCTION f|
DROP FUNCTION f|
CREATE FUNCTION f()
RETURNS VARCHAR(64) BINARY UNICODE
BEGIN
RETURN '';
END|
SHOW CREATE FUNCTION f;
DROP FUNCTION f;
SHOW CREATE FUNCTION f|
DROP FUNCTION f|
#
@ -72,16 +72,16 @@ CREATE FUNCTION f()
BEGIN
RETURN '';
END|
SHOW CREATE FUNCTION f;
DROP FUNCTION f;
SHOW CREATE FUNCTION f|
DROP FUNCTION f|
CREATE FUNCTION f()
RETURNS VARCHAR(64) BINARY ASCII
BEGIN
RETURN '';
END|
SHOW CREATE FUNCTION f;
DROP FUNCTION f;
SHOW CREATE FUNCTION f|
DROP FUNCTION f|
#
# Testing COLLATE in OUT parameter

View File

@ -6798,7 +6798,7 @@ ERROR 42S02: Table 'test.t1' doesn't exist
create table t1 (a integer)$
call p1$
a
alter table t1 add b integer;
alter table t1 add b integer$
call p1$
a
drop table t1;

View File

@ -8053,7 +8053,7 @@ create procedure p1() begin select * from t1; end$
call p1$
create table t1 (a integer)$
call p1$
alter table t1 add b integer;
alter table t1 add b integer$
call p1$
delimiter ;$

View File

@ -74,7 +74,7 @@ select res;
end|
create table t3 (a int)|
insert into t3 values (0)|
create view v1 as select a from t3;
create view v1 as select a from t3|
create procedure bug10100pt(level int, lim int)
begin
if level < lim then

View File

@ -118,7 +118,7 @@ end|
# a procedure which use tables and recursion
create table t3 (a int)|
insert into t3 values (0)|
create view v1 as select a from t3;
create view v1 as select a from t3|
create procedure bug10100pt(level int, lim int)
begin
if level < lim then

View File

@ -640,7 +640,7 @@ TRUNCATE TABLE t1;
END|
LOCK TABLES t1 WRITE|
CALL p1()|
FLUSH TABLES;
FLUSH TABLES|
UNLOCK TABLES|
CALL p1()|
DROP PROCEDURE p1|

View File

@ -689,7 +689,7 @@ END|
LOCK TABLES t1 WRITE|
CALL p1()|
FLUSH TABLES;
FLUSH TABLES|
UNLOCK TABLES|
CALL p1()|

View File

@ -1570,7 +1570,9 @@ INSERT INTO t2 values(1),(2);
EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1);
flush status;
CREATE TABLE t3 SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1);
--disable_ps_protocol
SHOW STATUS LIKE 'Created_tmp_tables';
--enable_ps_protocol
DROP TABLE t1,t2,t3;
--echo #

View File

@ -115,8 +115,10 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES ('2002-10-24 14:50:32'),('2002-10-24 14:50:33'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40');
flush status;
--disable_ps_protocol
select * from t1 group by d;
show status like "created_tmp%tables";
--enable_ps_protocol
drop table t1;
# Fix for BUG#8921: Check that temporary table is ingored by view commands.

View File

@ -9,12 +9,16 @@ create view v2 as select a from t2;
flush status;
select * from v2;
--disable_ps_protocol
show status like '%Created_tmp%';
--enable_ps_protocol
explain select * from v2;
select * from (select * from t2) T1;
--disable_ps_protocol
show status like '%Created_tmp%';
--enable_ps_protocol
explain select * from (select * from t2) T1;

View File

@ -444,6 +444,15 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010
DROP TABLE t1;
#
# MDEV-16958 Assertion `field_length < 5' failed in Field_year::val_str or data corruption upon SELECT with UNION and aggregate functions
#
CREATE TABLE t1 (f YEAR);
INSERT IGNORE INTO t1 VALUES (1971),(1972);
SELECT MAX( NULLIF( f, '1900' ) ) AS f FROM t1 UNION SELECT MAX( NULLIF( f, '1900' ) ) AS f FROM t1;
f
1972
DROP TABLE t1;
#
# End of 10.1 tests
#
#

View File

@ -214,6 +214,17 @@ SELECT * FROM t1 WHERE a=10 AND a>=10;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND a>=10;
DROP TABLE t1;
--echo #
--echo # MDEV-16958 Assertion `field_length < 5' failed in Field_year::val_str or data corruption upon SELECT with UNION and aggregate functions
--echo #
CREATE TABLE t1 (f YEAR);
INSERT IGNORE INTO t1 VALUES (1971),(1972);
SELECT MAX( NULLIF( f, '1900' ) ) AS f FROM t1 UNION SELECT MAX( NULLIF( f, '1900' ) ) AS f FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
--echo #

View File

@ -146,7 +146,7 @@ show table_statistics;
Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes
show index_statistics;
Table_schema Table_name Index_name Rows_read
select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;;
select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;;
TOTAL_CONNECTIONS 2
TOTAL_SSL_CONNECTIONS 1
CONCURRENT_CONNECTIONS 0
@ -157,14 +157,13 @@ ROWS_INSERTED 7
ROWS_UPDATED 5
SELECT_COMMANDS 4
UPDATE_COMMANDS 11
OTHER_COMMANDS 7
COMMIT_TRANSACTIONS 19
ROLLBACK_TRANSACTIONS 2
DENIED_CONNECTIONS 0
LOST_CONNECTIONS 0
ACCESS_DENIED 0
EMPTY_QUERIES 1
select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics;;
select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics;;
TOTAL_CONNECTIONS 2
TOTAL_SSL_CONNECTIONS 1
CONCURRENT_CONNECTIONS 0
@ -175,13 +174,18 @@ ROWS_INSERTED 7
ROWS_UPDATED 5
SELECT_COMMANDS 4
UPDATE_COMMANDS 11
OTHER_COMMANDS 7
COMMIT_TRANSACTIONS 19
ROLLBACK_TRANSACTIONS 2
DENIED_CONNECTIONS 0
LOST_CONNECTIONS 0
ACCESS_DENIED 0
EMPTY_QUERIES 1
select OTHER_COMMANDS IN (7,8) from information_schema.client_statistics;
OTHER_COMMANDS IN (7,8)
1
select OTHER_COMMANDS IN (7,8) from information_schema.user_statistics;
OTHER_COMMANDS IN (7,8)
1
flush table_statistics;
flush index_statistics;
select * from information_schema.index_statistics;

View File

@ -73,8 +73,11 @@ select * from information_schema.index_statistics;
select * from information_schema.table_statistics;
show table_statistics;
show index_statistics;
--query_vertical select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;
--query_vertical select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics;
--query_vertical select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;
--query_vertical select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics;
# different values in --ps-protocol
select OTHER_COMMANDS IN (7,8) from information_schema.client_statistics;
select OTHER_COMMANDS IN (7,8) from information_schema.user_statistics;
flush table_statistics;
flush index_statistics;
select * from information_schema.index_statistics;

View File

@ -6694,6 +6694,20 @@ testcase
drop view v1;
drop table t1;
#
# MDEV-18502: Server crash in find_field_in_tables upon 2nd execution of SP which causes ER_WRONG_GROUP_FIELD
#
CREATE TABLE t1 (id INT, f VARCHAR(1));
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1,'a'),(2,'b');
CREATE PROCEDURE sp() SELECT f AS f1, MAX(id) AS f2 FROM v1 GROUP BY f1, f2 ORDER BY f1;
CALL sp;
ERROR 42000: Can't group on 'f2'
CALL sp;
ERROR 42000: Can't group on 'f2'
DROP PROCEDURE sp;
DROP VIEW v1;
DROP TABLE t1;
#
# End of 10.2 tests
#
#

View File

@ -2369,6 +2369,7 @@ DROP TABLE t1;
# Bug#15943 mysql_next_result hangs on invalid SHOW CREATE VIEW
#
--disable_ps_protocol
delimiter //;
drop table if exists t1;
drop view if exists v1;
@ -2379,6 +2380,7 @@ show create view v1;
drop view v1;
//
delimiter ;//
--enable_ps_protocol
#
@ -3889,7 +3891,9 @@ CREATE VIEW v1 AS SELECT f1() FROM t1;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
copy_file std_data/bug48449.frm $MYSQLD_DATADIR/test/v2.frm;
enable_prepare_warnings;
SHOW CREATE VIEW v1;
disable_prepare_warnings;
DROP VIEW v1,v2;
DROP TABLE t1,t2;
@ -6398,6 +6402,22 @@ SELECT * FROM v1;
drop view v1;
drop table t1;
--echo #
--echo # MDEV-18502: Server crash in find_field_in_tables upon 2nd execution of SP which causes ER_WRONG_GROUP_FIELD
--echo #
CREATE TABLE t1 (id INT, f VARCHAR(1));
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1,'a'),(2,'b');
CREATE PROCEDURE sp() SELECT f AS f1, MAX(id) AS f2 FROM v1 GROUP BY f1, f2 ORDER BY f1;
--error ER_WRONG_GROUP_FIELD
CALL sp;
--error ER_WRONG_GROUP_FIELD
CALL sp;
DROP PROCEDURE sp;
DROP VIEW v1;
DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -3489,6 +3489,23 @@ ifnull(max(n1) over (partition by n1),'aaa')
drop table t1;
drop view v1;
#
# MDEV-18431: Select max + row_number giving incorrect result
#
create table t1 (id int, v int);
insert into t1 values (1, 1), (1,2), (1,3), (2, 1), (2, 2);
select e.id,
(select max(t1.v) from t1 where t1.id=e.id) as a,
row_number() over (partition by e.id order by e.v) as b,
(select max(t1.v) from t1 where t1.id=e.id) + (row_number() over (partition by e.id order by e.v)) as sum_a_b
from t1 e;
id a b sum_a_b
1 3 1 4
1 3 2 5
1 3 3 6
2 2 1 3
2 2 2 4
drop table t1;
#
# End of 10.2 tests
#
#

View File

@ -2241,6 +2241,20 @@ select * from v1;
drop table t1;
drop view v1;
--echo #
--echo # MDEV-18431: Select max + row_number giving incorrect result
--echo #
create table t1 (id int, v int);
insert into t1 values (1, 1), (1,2), (1,3), (2, 1), (2, 2);
select e.id,
(select max(t1.v) from t1 where t1.id=e.id) as a,
row_number() over (partition by e.id order by e.v) as b,
(select max(t1.v) from t1 where t1.id=e.id) + (row_number() over (partition by e.id order by e.v)) as sum_a_b
from t1 e;
drop table t1;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -156,6 +156,7 @@ WHERE DB = 'information_schema' AND COMMAND = 'Sleep' AND USER = 'ddicttestuser1
--source include/wait_condition.inc
--replace_result ENGINE=MyISAM "" ENGINE=Aria "" " PAGE_CHECKSUM=1" "" " PAGE_CHECKSUM=0" ""
eval SHOW CREATE TABLE $table;
--replace_result Execute Query
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
eval SHOW $table;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 MAX_MEMORY 15 ROWS 16 QUERY_ID 18 TID
@ -176,6 +177,7 @@ connection con100;
# but "ddicttestuser1" must not see anything of the root session.
--replace_result ENGINE=MyISAM "" ENGINE=Aria "" " PAGE_CHECKSUM=1" "" " PAGE_CHECKSUM=0" ""
eval SHOW CREATE TABLE $table;
--replace_result Execute Query
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
eval SHOW $table;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 MAX_MEMORY 15 ROWS 16 QUERY_ID 18 TID
@ -202,6 +204,7 @@ GRANT PROCESS ON *.* TO ddicttestuser1@'localhost' IDENTIFIED BY 'ddictpass';
--echo ####################################################################################
connection con100;
SHOW GRANTS;
--replace_result Execute Query
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 MAX_MEMORY 15 ROWS 16 QUERY_ID 18 TID
@ -214,6 +217,7 @@ SELECT * FROM information_schema.processlist;
--echo ####################################################################################
connect (con101,localhost,ddicttestuser1,ddictpass,information_schema);
SHOW GRANTS;
--replace_result Execute Query
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 MAX_MEMORY 15 ROWS 16 QUERY_ID 18 TID
@ -237,6 +241,7 @@ GRANT PROCESS ON *.* TO ''@'localhost';
--echo ####################################################################################
connect (anonymous1,localhost,"''",,information_schema);
SHOW GRANTS;
--replace_result Execute Query
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 MAX_MEMORY 15 ROWS 16 QUERY_ID 18 TID
@ -259,6 +264,7 @@ connect (con102,localhost,ddicttestuser1,ddictpass,information_schema);
--echo ddicttestuser1 are visible.
--echo ####################################################################################
SHOW GRANTS;
--replace_result Execute Query
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 MAX_MEMORY 15 ROWS 16 QUERY_ID 18 TID
@ -284,6 +290,7 @@ SHOW GRANTS FOR ''@'localhost';
if ($fixed_bug_30395)
{
# Bug#30395 strange results after REVOKE PROCESS ON *.* FROM ...
--replace_result Execute Query
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
}
@ -306,6 +313,7 @@ connect (con103,localhost,ddicttestuser1,ddictpass,information_schema);
--echo Only the processes of ddicttestuser1 user are visible.
--echo ####################################################################################
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
--replace_result Execute Query
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 MAX_MEMORY 15 ROWS 16 QUERY_ID 18 TID
@ -328,6 +336,7 @@ connect (con104,localhost,ddicttestuser1,ddictpass,information_schema);
--echo Only the processes of ddicttestuser1 are visible.
--echo ####################################################################################
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
--replace_result Execute Query
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 MAX_MEMORY 15 ROWS 16 QUERY_ID 18 TID
@ -375,6 +384,7 @@ connect (con200,localhost,ddicttestuser2,ddictpass,information_schema);
--echo ddicttestuser2 has now the PROCESS privilege and sees all connections
--echo ####################################################################################
SHOW GRANTS FOR 'ddicttestuser2'@'localhost';
--replace_result Execute Query
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 MAX_MEMORY 15 ROWS 16 QUERY_ID 18 TID
@ -396,6 +406,7 @@ connect (con201,localhost,ddicttestuser2,ddictpass,information_schema);
--echo ddicttestuser2 has no more the PROCESS privilege and can only see own connects
--echo ####################################################################################
SHOW GRANTS;
--replace_result Execute Query
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 MAX_MEMORY 15 ROWS 16 QUERY_ID 18 TID
@ -419,6 +430,7 @@ connect (con107,localhost,ddicttestuser1,ddictpass,information_schema);
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
--error ER_ACCESS_DENIED_ERROR
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
--replace_result Execute Query
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 MAX_MEMORY 15 ROWS 16 QUERY_ID 18 TID
@ -443,6 +455,7 @@ connect (con108,localhost,ddicttestuser1,ddictpass,information_schema);
--echo Therefore the missing SELECT privilege does not affect SELECTs on PROCESSLIST.
--echo ####################################################################################
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
--replace_result Execute Query
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 MAX_MEMORY 15 ROWS 16 QUERY_ID 18 TID

View File

@ -94,6 +94,7 @@ echo
# 1. Just dump what we get
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <MAX_MEMORY> 15 <ROWS> 16 <QUERY_ID> 18 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_result Execute Query
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS>
SHOW FULL PROCESSLIST;
#
@ -161,6 +162,7 @@ let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
# 1. Just dump what we get
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 7 <STATE> 9 <TIME_MS> 13 <MEMORY> 14 <MAX_MEMORY> 15 <ROWS> 16 <QUERY_ID> 18 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_result Execute Query
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
SHOW FULL PROCESSLIST;
#
@ -203,6 +205,7 @@ echo
connection con1;
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <MAX_MEMORY> 15 <ROWS> 16 <QUERY_ID> 18 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_result Execute Query
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
SHOW FULL PROCESSLIST;
@ -228,6 +231,7 @@ connection con2;
# Just dump what we get
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <MAX_MEMORY> 15 <ROWS> 16 <QUERY_ID> 18 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_result Execute Query
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
SHOW FULL PROCESSLIST;
#
@ -279,6 +283,7 @@ WHERE ID = @test_user_con2_id AND Command IN('Query','Execute')
# 1. Just dump what we get
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <MAX_MEMORY> 15 <ROWS> 16 <QUERY_ID> 18 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_result Execute Query
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
SHOW FULL PROCESSLIST;
#
@ -385,8 +390,10 @@ echo
;
--replace_column 1 <ID> 3 <HOST_NAME> 5 <COMMAND> 6 <TIME> 7 <STATE> 9 <TIME_MS> 13 <MEMORY> 14 <MAX_MEMORY> 15 <ROWS> 16 <QUERY_ID> 18 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_result Execute Query
--replace_column 1 <ID> 3 <HOST_NAME> 5 <COMMAND> 6 <TIME> 7 <STATE>
SHOW FULL PROCESSLIST;
--replace_result Execute Query
--replace_column 1 <ID> 3 <HOST_NAME> 5 <COMMAND> 6 <TIME> 7 <STATE>
SHOW PROCESSLIST;
UNLOCK TABLES;

View File

@ -1,8 +1,7 @@
call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*");
connection node_1;
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10),(11);
CREATE TABLE t1 (f1 VARCHAR(128)) ENGINE=InnoDB;
connection node_2;
Killing server ...
@ -10,12 +9,11 @@ connection node_1;
INSERT INTO t1 SELECT REPEAT('a', 128) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;
connection node_2;
connection node_2a;
SELECT COUNT(*) = 1000000 FROM t1;
COUNT(*) = 1000000
1
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
1771561
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE
2
DROP TABLE t1;
DROP TABLE ten;

View File

@ -10,10 +10,10 @@ SET SESSION wsrep_sync_wait = 0;
SET SESSION wsrep_sync_wait = DEFAULT;
connection node_2;
connection node_2a;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
SELECT COUNT(*) FROM t1;
COUNT(*)
1
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE
2
DROP TABLE t1;

View File

@ -1,4 +1,5 @@
call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*");
connection node_1;
connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
@ -8,8 +9,8 @@ connection node_1;
INSERT INTO t1 VALUES (1);
connection node_2;
connection node_2a;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
SELECT COUNT(*) FROM t1;
COUNT(*)
1
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2

File diff suppressed because one or more lines are too long

View File

@ -77,6 +77,7 @@ push @::global_suppressions,
qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored.|,
qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled. Expect abort.|,
qr(WSREP: Action message in non-primary configuration from member [0-9]*),
qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*),
qr(WSREP: discarding established .*),
qr|WSREP: .*core_handle_uuid_msg.*|,
qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on),

View File

@ -4,9 +4,11 @@
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*");
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_1
# Enable the master to continue running during the split-brain situation that
@ -14,8 +16,8 @@ call mtr.add_suppression("WSREP: Last Applied Action message in non-primary conf
--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10),(11);
CREATE TABLE t1 (f1 VARCHAR(128)) ENGINE=InnoDB;
--connection node_2
@ -33,13 +35,16 @@ INSERT INTO t1 SELECT REPEAT('a', 128) FROM ten AS a1, ten AS a2, ten AS a3, ten
--source include/galera_connect.inc
--connection node_2a
SELECT COUNT(*) = 1000000 FROM t1;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
SELECT COUNT(*) FROM t1;
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--connection node_1
--disable_query_log
--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig';
--enable_query_log
--let $node_2=node_2a
--source include/auto_increment_offset_restore.inc
DROP TABLE t1;
DROP TABLE ten;

View File

@ -20,6 +20,7 @@ INSERT INTO t1 VALUES (1);
SET SESSION wsrep_sync_wait = 0;
--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'
--source include/wait_condition.inc
SET SESSION wsrep_sync_wait = DEFAULT;
--connection node_2
@ -30,8 +31,8 @@ SET SESSION wsrep_sync_wait = DEFAULT;
--source include/galera_connect.inc
--connection node_2a
SELECT COUNT(*) = 1 FROM t1;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
SELECT COUNT(*) FROM t1;
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--let $node_2=node_2a
--source include/auto_increment_offset_restore.inc

View File

@ -3,9 +3,11 @@
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*");
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_1
@ -30,7 +32,7 @@ INSERT INTO t1 VALUES (1);
--source include/galera_connect.inc
--connection node_2a
SELECT COUNT(*) = 1 FROM t1;
SELECT COUNT(*) FROM t1;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--connection node_1
@ -38,4 +40,7 @@ SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_N
--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig';
--enable_query_log
--let $node_2=node_2a
--source include/auto_increment_offset_restore.inc
DROP TABLE t1;

View File

@ -0,0 +1,10 @@
!include ../galera_2nodes.cnf
[mysqld]
secure-file-priv = ""
innodb_file_format ='Barracuda'
innodb_file_per_table = ON
innodb_stats_persistent=ON
innodb_stats_auto_recalc=ON
innodb_stats_persistent_sample_pages=20
innodb_stats_sample_pages=8

File diff suppressed because one or more lines are too long

View File

@ -7,5 +7,7 @@ flush status;
handler handler_a read first;
# handler...read must be prepared in --ps-protocol mode
--replace_result $PS_PROTOCOL OK
--disable_ps_protocol
show status like 'Com_stmt_prepare%';
--enable_ps_protocol
drop table t1;

View File

@ -231,7 +231,7 @@ set global innodb_buf_flush_list_now = 1;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
FOUND 1 /\[ERROR\] InnoDB: .*test.t1\.ibd.*/ in mysqld.1.err
FOUND 1 /InnoDB: .*test.t1\.ibd/ in mysqld.1.err
select f1, f2 from t1;
f1 f2
1 ############

View File

@ -48,7 +48,7 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /\[ERROR\] InnoDB: Cannot read first page of .*t2.ibd/ in mysqld.1.err
NOT FOUND /\[Note\] InnoDB: Cannot read first page of .*t2.ibd/ in mysqld.1.err
FOUND 1 /\[ERROR\] InnoDB: Datafile .*t2.*\. Cannot determine the space ID from the first 64 pages/ in mysqld.1.err
SELECT * FROM t2;
a
@ -82,18 +82,18 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /\[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd/ in mysqld.1.err
FOUND 1 /\[Note\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd/ in mysqld.1.err
FOUND 1 /\[ERROR\] InnoDB: Datafile .*u1.*\. Cannot determine the space ID from the first 64 pages/ in mysqld.1.err
FOUND 1 /\[ERROR\] InnoDB: Cannot read first page of .*u2.ibd/ in mysqld.1.err
NOT FOUND /\[Note\] InnoDB: Cannot read first page of .*u2.ibd/ in mysqld.1.err
# Fault 7: Missing or wrong data file and innodb_force_recovery
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /\[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd/ in mysqld.1.err
FOUND 1 /\[Note\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd/ in mysqld.1.err
FOUND 1 /InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace/ in mysqld.1.err
FOUND 1 /\[ERROR\] InnoDB: Cannot rename '.*u5.ibd' to '.*u6.ibd' because the target file exists/ in mysqld.1.err
FOUND 1 /\[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd/ in mysqld.1.err
FOUND 1 /\[Note\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd/ in mysqld.1.err
FOUND 1 /InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace/ in mysqld.1.err
FOUND 1 /\[Warning\] InnoDB: Tablespace \d+ was not found at .*u[1-5].ibd, and innodb_force_recovery was set. All redo log for this tablespace will be ignored!/ in mysqld.1.err
DROP TABLE u1,u2,u3,u6;

View File

@ -5,7 +5,6 @@
# of tables with .isl file or DATA DIRECTORY attribute.
call mtr.add_suppression("\\[ERROR\\] InnoDB: Invalid flags 0x7a207879 in .*td\\.ibd");
# FIXME: This is much more noisy than MariaDB 10.1!
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot read first page in datafile: .*td\\.ibd, Space ID:2048948345, Flags: 2048948345");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number .* in a file operation\\.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: The error means the system cannot find the path specified\\.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them\\.");

View File

@ -8,8 +8,6 @@ let PAGE_SIZE=`select @@innodb_page_size`;
-- disable_query_log
call mtr.add_suppression("InnoDB: innodb_force_recovery is on.");
call mtr.add_suppression("InnoDB: Header page contains inconsistent data in .*bug16720368.ibd");
call mtr.add_suppression("InnoDB: Checksum mismatch in datafile:.*bug16720368");
call mtr.add_suppression("InnoDB: Ignoring tablespace for.*bug16720368");
call mtr.add_suppression("Found 1 prepared XA transactions");
call mtr.add_suppression("InnoDB: Operating system error.*in a file operation");

View File

@ -11,8 +11,6 @@
# Slow shutdown and restart to make sure ibuf merge is finished
SET GLOBAL innodb_fast_shutdown = 0;
--disable_query_log
call mtr.add_suppression("InnoDB: Header page consists of zero bytes");
call mtr.add_suppression("InnoDB: Checksum mismatch in datafile: .*, Space ID:0, Flags: 0");
call mtr.add_suppression("InnoDB: Data file .* uses page size .* but the innodb_page_size start-up parameter is");
call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS");
call mtr.add_suppression("InnoDB: New log files created");
@ -403,7 +401,7 @@ EOF
--source include/start_mysqld.inc
check table t1;
--let SEARCH_PATTERN= \[ERROR\] InnoDB: .*test.t1\\.ibd.*
--let SEARCH_PATTERN= InnoDB: .*test.t1\\.ibd
--source include/search_pattern_in_file.inc
select f1, f2 from t1;

View File

@ -34,6 +34,7 @@ alter table t1 add primary key (pk);
--enable_reconnect
--source include/wait_until_connected_again.inc
--enable_prepare_warnings
show create table t1;
select * from t1;
alter table t1 add j int;

View File

@ -1166,7 +1166,9 @@ DROP TABLE t;
CREATE TABLE t (a INT) ENGINE=INNODB;
-- remove_file $MYSQL_DATA_DIR/test/t.frm
-- move_file $MYSQL_DATA_DIR/test/t.fr_ $MYSQL_DATA_DIR/test/t.frm
--enable_prepare_warnings
SHOW CREATE TABLE t;
--disable_prepare_warnings
DROP TABLE t;
--disable_query_log

View File

@ -107,7 +107,7 @@ let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t[12].ibd.
eval $check_no_innodb;
--source include/shutdown_mysqld.inc
# On Windows, this error message is not output when t2.ibd is a directory!
#let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot read first page of .*t2.ibd;
#let SEARCH_PATTERN= \[Note\] InnoDB: Cannot read first page of .*t2.ibd;
#--source include/search_pattern_in_file.inc
--rmdir $MYSQLD_DATADIR/test/t2.ibd
@ -120,7 +120,7 @@ EOF
eval $check_no_innodb;
--source include/shutdown_mysqld.inc
let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot read first page of .*t2.ibd;
let SEARCH_PATTERN= \[Note\] InnoDB: Cannot read first page of .*t2.ibd;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= \[ERROR\] InnoDB: Datafile .*t2.*\. Cannot determine the space ID from the first 64 pages;
--source include/search_pattern_in_file.inc
@ -156,13 +156,11 @@ call mtr.add_suppression("InnoDB: Cannot open datafile for read-write: '.*t2\.ib
call mtr.add_suppression("InnoDB: Tablespace .* was not found at .*test");
call mtr.add_suppression("InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace");
call mtr.add_suppression("InnoDB: Cannot read first page of '.*test.[tu]2.ibd' I/O error");
call mtr.add_suppression("InnoDB: Cannot read first page in datafile: .*test.*ibd");
call mtr.add_suppression("InnoDB: Datafile '.*test.*ibd' is corrupted");
call mtr.add_suppression("InnoDB: Cannot replay file rename. Remove either file and try again");
call mtr.add_suppression("InnoDB: Cannot rename.*because the target file exists");
call mtr.add_suppression("InnoDB: Log scan aborted at LSN");
# The following are for the --innodb-force-recovery=1 with broken u* tables:
call mtr.add_suppression("InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd");
call mtr.add_suppression("InnoDB: The size of the file .*u1\\.ibd is only 16384 bytes, should be at least 65536");
call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified");
call mtr.add_suppression("InnoDB: .*you must create directories");
@ -216,7 +214,7 @@ EOF
--source include/start_mysqld.inc
eval $check_no_innodb;
let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd;
let SEARCH_PATTERN= \[Note\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= \[ERROR\] InnoDB: Datafile .*u1.*\. Cannot determine the space ID from the first 64 pages;
@ -226,7 +224,7 @@ let SEARCH_PATTERN= \[ERROR\] InnoDB: Datafile .*u1.*\. Cannot determine the spa
# in innodb-force-recovery mode once
# Bug#18131883 IMPROVE INNODB ERROR MESSAGES REGARDING FILES
# has been fixed:
let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot read first page of .*u2.ibd;
let SEARCH_PATTERN= \[Note\] InnoDB: Cannot read first page of .*u2.ibd;
--source include/search_pattern_in_file.inc
--source include/shutdown_mysqld.inc
@ -241,7 +239,7 @@ let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot read first page of .*u2.ibd;
--source include/start_mysqld.inc
eval $check_no_innodb;
let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd;
let SEARCH_PATTERN= \[Note\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace;
@ -254,7 +252,7 @@ let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot rename '.*u5.ibd' to '.*u6.ibd' bec
--source include/restart_mysqld.inc
let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd;
let SEARCH_PATTERN= \[Note\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace;

View File

@ -16,7 +16,6 @@ let page_size= `select @@innodb_page_size`;
--echo # of tables with .isl file or DATA DIRECTORY attribute.
call mtr.add_suppression("\\[ERROR\\] InnoDB: Invalid flags 0x7a207879 in .*td\\.ibd");
--echo # FIXME: This is much more noisy than MariaDB 10.1!
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot read first page in datafile: .*td\\.ibd, Space ID:2048948345, Flags: 2048948345");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number .* in a file operation\\.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: The error means the system cannot find the path specified\\.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them\\.");

View File

@ -292,6 +292,44 @@ t1 CREATE TABLE `t1` (
) ENGINE=Aria AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
insert into t1 values(null, "f");
drop table t1;
Test that bulk insert works with recovery
CREATE TABLE t1 (i int, key(i)) TRANSACTIONAL=1 ENGINE=ARIA;
CREATE TABLE t2 (i int, key(i)) TRANSACTIONAL=1 ENGINE=ARIA;
connection admin;
* copied t2 for feeding_recovery
* copied t1 for feeding_recovery
connection default;
insert into t2 values
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (3), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
insert into t1 select * from t2;
insert into t2 select * from t2;
connection admin;
SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_crash";
* crashing mysqld intentionally
set global aria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
connection default;
use mysqltest;
select count(*) from t1;
count(*)
100
select count(*) from t2;
count(*)
200
check table t2;
Table Op Msg_type Msg_text
mysqltest.t2 check status OK
drop table t1,t2;
drop database mysqltest_for_feeding_recovery;
drop database mysqltest_for_comparison;
drop database mysqltest;

View File

@ -195,6 +195,36 @@ show create table t1;
insert into t1 values(null, "f");
drop table t1;
--echo Test that bulk insert works with recovery
let $mms_tables=2;
CREATE TABLE t1 (i int, key(i)) TRANSACTIONAL=1 ENGINE=ARIA;
CREATE TABLE t2 (i int, key(i)) TRANSACTIONAL=1 ENGINE=ARIA;
-- source include/maria_make_snapshot_for_feeding_recovery.inc
insert into t2 values
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (3), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
insert into t1 select * from t2;
insert into t2 select * from t2;
let $mvr_restore_old_snapshot=0;
let $mms_compare_physically=0;
let $mvr_debug_option="+d,maria_flush_whole_log,maria_crash";
let $mvr_crash_statement= set global aria_checkpoint_interval=1;
let $mms_tables=0;
-- source include/maria_verify_recovery.inc
select count(*) from t1;
select count(*) from t2;
check table t2;
drop table t1,t2;
# clean up everything
let $mms_purpose=feeding_recovery;
eval drop database mysqltest_for_$mms_purpose;

View File

@ -296,7 +296,9 @@ if ($CRC_RET_stmt_sidef) {
--echo
--echo Invoking $CRC_RET_desc.
if ($CRC_create) {
--disable_ps_protocol
--eval $CRC_create
--enable_ps_protocol
}
--echo * binlog_format = STATEMENT: expect $CRC_ARG_expected_number_of_warnings warnings.

View File

@ -19,7 +19,7 @@
# option_mysqld_max_prepared_stmt_count #
# #
################################################################################
--source include/no_protocol.inc
--echo ** Setup **
--echo

View File

@ -46,17 +46,23 @@ INSERT INTO t1 VALUES('aa','bb');
SET SESSION sql_buffer_result = 1;
--disable_ps_protocol
SHOW STATUS LIKE 'Created_tmp_tables';
--enable_ps_protocol
--echo Expected value : 0.
SELECT * FROM t1;
--disable_ps_protocol
SHOW STATUS LIKE 'Created_tmp_tables';
--enable_ps_protocol
--echo Expected value : 1.
SELECT * FROM t1;
--disable_ps_protocol
SHOW STATUS LIKE 'Created_tmp_tables';
--enable_ps_protocol
--echo Expected value : 2.
--echo '#--------------------FN_DYNVARS_156_02-------------------------#'
@ -66,12 +72,16 @@ SHOW STATUS LIKE 'Created_tmp_tables';
SET SESSION sql_buffer_result = 0;
--disable_ps_protocol
SHOW STATUS LIKE 'Created_tmp_tables';
--enable_ps_protocol
--echo Expected value : 2.
SELECT * FROM t1;
--disable_ps_protocol
SHOW STATUS LIKE 'Created_tmp_tables';
--enable_ps_protocol
--echo Expected value : 2.
--echo '#--------------------FN_DYNVARS_156_03-------------------------#'

View File

@ -14,7 +14,9 @@ create table t1 (a datetime,
# other issues
e int as ((a,1) in ((1,1),(2,1),(NULL,1))) # cmp_item_row::alloc_comparators()
);
enable_prepare_warnings;
show create table t1;
disable_prepare_warnings;
connect con1, localhost, root;
disable_warnings;
insert t1 (a) values ('2010-10-10 10:10:10');

View File

@ -38,7 +38,7 @@ GetOptions(\%opt,
'v|verbose+',# verbose
'help+', # write usage info
'd|debug+', # debug
's=s', # what to sort by (al, at, ar, ae, c, t, l, r, e)
's=s', # what to sort by (aa, ae, al, ar, at, a, c, e, l, r, t)
'r!', # reverse the sort order (largest last instead of first)
't=i', # just show the top n queries
'a!', # don't abstract all numbers to N and strings to 'S'
@ -202,12 +202,15 @@ Parse and summarize the MySQL slow query log. Options are
-v verbose
-d debug
-s ORDER what to sort by (al, at, ar, ae, c, l, r, e, t), 'at' is default
-s ORDER what to sort by (aa, ae, al, ar, at, a, c, e, l, r, t), 'at' is default
aa: average rows affected
ae: aggregated rows examined
al: average lock time
ar: average rows sent
at: average query time
aa: average rows affected
a: rows affected
c: count
e: rows examined
l: lock time
r: rows sent
t: query time

View File

@ -584,7 +584,7 @@ static void debug_sync_remove_action(st_debug_sync_control *ds_control,
memmove(save_action, action, sizeof(st_debug_sync_action));
/* Move actions down. */
memmove(ds_control->ds_action + dsp_idx,
memmove((void*)(ds_control->ds_action + dsp_idx),
ds_control->ds_action + dsp_idx + 1,
(ds_control->ds_active - dsp_idx) *
sizeof(st_debug_sync_action));
@ -595,8 +595,8 @@ static void debug_sync_remove_action(st_debug_sync_control *ds_control,
produced by the shift. Again do not use an assignment operator to
avoid string allocation/copy.
*/
memmove(ds_control->ds_action + ds_control->ds_active, save_action,
sizeof(st_debug_sync_action));
memmove((void*)(ds_control->ds_action + ds_control->ds_active),
save_action, sizeof(st_debug_sync_action));
}
DBUG_VOID_RETURN;

View File

@ -25,6 +25,10 @@ struct encryption_service_st encryption_handler;
extern "C" {
uint no_get_key(uint, uint, uchar*, uint*)
{
return ENCRYPTION_KEY_VERSION_INVALID;
}
uint no_key(uint)
{
return ENCRYPTION_KEY_VERSION_INVALID;
@ -47,6 +51,11 @@ static unsigned int get_length(unsigned int slen, unsigned int key_id,
return my_aes_get_size(MY_AES_CBC, slen);
}
uint ctx_size(unsigned int, unsigned int)
{
return MY_AES_CTX_SIZE;
}
} /* extern "C" */
int initialize_encryption_plugin(st_plugin_int *plugin)
@ -72,8 +81,7 @@ int initialize_encryption_plugin(st_plugin_int *plugin)
if (handle->crypt_ctx_size)
encryption_handler.encryption_ctx_size_func= handle->crypt_ctx_size;
else
encryption_handler.encryption_ctx_size_func=
(uint (*)(unsigned int, unsigned int))my_aes_ctx_size;
encryption_handler.encryption_ctx_size_func= ctx_size;
encryption_handler.encryption_ctx_init_func=
handle->crypt_ctx_init ? handle->crypt_ctx_init : ctx_init;
@ -102,8 +110,7 @@ int finalize_encryption_plugin(st_plugin_int *plugin)
if (used)
{
encryption_handler.encryption_key_get_func=
(uint (*)(uint, uint, uchar*, uint*))no_key;
encryption_handler.encryption_key_get_func= no_get_key;
encryption_handler.encryption_key_get_latest_version_func= no_key;
encryption_handler.encryption_ctx_size_func= zero_size;
}

View File

@ -2072,6 +2072,7 @@ struct Table_scope_and_contents_source_pod_st // For trivial members
/* The following is used to remember the old state for CREATE OR REPLACE */
TABLE *table;
TABLE_LIST *pos_in_locked_tables;
TABLE_LIST *merge_list;
MDL_ticket *mdl_ticket;
bool table_was_deleted;
sequence_definition *seq_create_info;
@ -2099,14 +2100,11 @@ struct Table_scope_and_contents_source_pod_st // For trivial members
struct Table_scope_and_contents_source_st:
public Table_scope_and_contents_source_pod_st
{
SQL_I_List<TABLE_LIST> merge_list;
Vers_parse_info vers_info;
void init()
{
Table_scope_and_contents_source_pod_st::init();
merge_list.empty();
vers_info.init();
}

View File

@ -2401,7 +2401,6 @@ void Item::split_sum_func2(THD *thd, Ref_ptr_array ref_pointer_array,
}
if (unlikely((!(used_tables() & ~PARAM_TABLE_BIT) ||
type() == SUBSELECT_ITEM ||
(type() == REF_ITEM &&
((Item_ref*)this)->ref_type() != Item_ref::VIEW_REF))))
return;

View File

@ -680,11 +680,11 @@ static int alloc_tmp_paths(THD *thd, uint n_paths,
*paths= (json_path_with_flags *) alloc_root(root,
sizeof(json_path_with_flags) * n_paths);
*tmp_paths= (String *) alloc_root(root, sizeof(String) * n_paths);
*tmp_paths= new (root) String[n_paths];
if (*paths == 0 || *tmp_paths == 0)
return 1;
bzero(*tmp_paths, sizeof(String) * n_paths);
for (uint c_path=0; c_path < n_paths; c_path++)
(*tmp_paths)[c_path].set_charset(&my_charset_utf8_general_ci);
}

View File

@ -456,7 +456,7 @@ err:
Create a formated date/time value in a string.
*/
static bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
static bool make_date_time(const LEX_CSTRING &format, MYSQL_TIME *l_time,
timestamp_type type, const MY_LOCALE *locale,
String *str)
{
@ -471,7 +471,7 @@ static bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
if (l_time->neg)
str->append('-');
end= (ptr= format->format.str) + format->format.length;
end= (ptr= format.str) + format.length;
for (; ptr != end ; ptr++)
{
if (*ptr != '%' || ptr+1 == end)
@ -591,7 +591,7 @@ static bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
str->append_with_prefill(intbuff, length, 2, '0');
break;
case 'j':
if (type == MYSQL_TIMESTAMP_TIME)
if (type == MYSQL_TIMESTAMP_TIME || !l_time->month || !l_time->year)
return 1;
length= (uint) (int10_to_str(calc_daynr(l_time->year,l_time->month,
l_time->day) -
@ -1992,6 +1992,7 @@ uint Item_func_date_format::format_length(const String *format)
String *Item_func_date_format::val_str(String *str)
{
StringBuffer<64> format_buffer;
String *format;
MYSQL_TIME l_time;
uint size;
@ -2001,7 +2002,7 @@ String *Item_func_date_format::val_str(String *str)
if ((null_value= args[0]->get_date(&l_time, is_time_format ? TIME_TIME_ONLY : 0)))
return 0;
if (!(format = args[1]->val_str(str)) || !format->length())
if (!(format= args[1]->val_str(&format_buffer)) || !format->length())
goto null_date;
if (!is_time_format && !(lc= locale) && !(lc= args[2]->locale_from_val_str()))
@ -2015,18 +2016,13 @@ String *Item_func_date_format::val_str(String *str)
if (size < MAX_DATE_STRING_REP_LENGTH)
size= MAX_DATE_STRING_REP_LENGTH;
if (format == str)
str= &value; // Save result here
DBUG_ASSERT(format != str);
if (str->alloc(size))
goto null_date;
DATE_TIME_FORMAT date_time_format;
date_time_format.format.str= (char*) format->ptr();
date_time_format.format.length= format->length();
/* Create the result string */
str->set_charset(collation.collation);
if (!make_date_time(&date_time_format, &l_time,
if (!make_date_time(format->lex_cstring(), &l_time,
is_time_format ? MYSQL_TIMESTAMP_TIME :
MYSQL_TIMESTAMP_DATE,
lc, str))

View File

@ -38,6 +38,7 @@
#define QPLAN_TMP_DISK (1U << 10)
/* ... */
#define QPLAN_STATUS (1UL << 31) /* not in the slow_log_filter */
#define QPLAN_MAX (1UL << 31) /* reserved as placeholder */
/* Bits for log_slow_disabled_statements */

View File

@ -470,6 +470,16 @@ public:
DBUG_ASSERT(ticket == NULL);
type= type_arg;
}
void move_from(MDL_request &from)
{
type= from.type;
duration= from.duration;
ticket= from.ticket;
next_in_list= from.next_in_list;
prev_in_list= from.prev_in_list;
key.mdl_key_init(&from.key);
from.ticket= NULL; // that's what "move" means
}
/**
Is this a request for a lock which allow data to be updated?

View File

@ -9769,7 +9769,7 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
global_system_variables.binlog_format= BINLOG_FORMAT_ROW;
}
if (!opt_bootstrap && WSREP_PROVIDER_EXISTS &&
if (!opt_bootstrap && WSREP_PROVIDER_EXISTS && WSREP_ON &&
global_system_variables.binlog_format != BINLOG_FORMAT_ROW)
{

View File

@ -1344,14 +1344,12 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT()
- Use rowids from unique to run a disk-ordered sweep
*/
QUICK_INDEX_SORT_SELECT::QUICK_INDEX_SORT_SELECT(THD *thd_param,
TABLE *table)
QUICK_INDEX_SORT_SELECT::QUICK_INDEX_SORT_SELECT(THD *thd_param, TABLE *table)
:unique(NULL), pk_quick_select(NULL), thd(thd_param)
{
DBUG_ENTER("QUICK_INDEX_SORT_SELECT::QUICK_INDEX_SORT_SELECT");
index= MAX_KEY;
head= table;
bzero(&read_record, sizeof(read_record));
init_sql_alloc(&alloc, "QUICK_INDEX_SORT_SELECT",
thd->variables.range_alloc_block_size, 0,
MYF(MY_THREAD_SPECIFIC));
@ -5109,6 +5107,16 @@ typedef struct st_partial_index_intersect_info
key_map filtered_scans; /* scans to be filtered by cpk conditions */
MY_BITMAP *intersect_fields; /* bitmap of fields used in intersection */
void init()
{
common_info= NULL;
intersect_fields= NULL;
records_sent_to_unique= records= length= in_memory= use_cpk_filter= 0;
cost= index_read_cost= in_memory_cost= 0.0;
filtered_scans.init();
filtered_scans.clear_all();
}
} PARTIAL_INDEX_INTERSECT_INFO;
@ -5245,8 +5253,7 @@ bool prepare_search_best_index_intersect(PARAM *param,
if (!n_index_scans)
return 1;
bzero(init, sizeof(*init));
init->filtered_scans.init();
init->init();
init->common_info= common;
init->cost= cutoff_cost;

View File

@ -64,7 +64,7 @@ partition_info *partition_info::get_clone(THD *thd)
if (!part_clone)
DBUG_RETURN(NULL);
memcpy(part_clone, part, sizeof(partition_element));
*part_clone= *part;
part_clone->subpartitions.empty();
while ((subpart= (subpart_it++)))
{
@ -72,7 +72,7 @@ partition_info *partition_info::get_clone(THD *thd)
if (!subpart_clone)
DBUG_RETURN(NULL);
memcpy(subpart_clone, subpart, sizeof(partition_element));
*subpart_clone= *subpart;
part_clone->subpartitions.push_back(subpart_clone, mem_root);
}
clone->partitions.push_back(part_clone, mem_root);
@ -1432,12 +1432,11 @@ void partition_info::print_no_partition_found(TABLE *table_arg, myf errflag)
TABLE_LIST table_list;
THD *thd= current_thd;
bzero(&table_list, sizeof(table_list));
table_list.reset();
table_list.db= table_arg->s->db;
table_list.table_name= table_arg->s->table_name;
if (check_single_table_access(thd,
SELECT_ACL, &table_list, TRUE))
if (check_single_table_access(thd, SELECT_ACL, &table_list, TRUE))
{
my_message(ER_NO_PARTITION_FOR_GIVEN_VALUE,
ER_THD(thd, ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT), errflag);

View File

@ -230,60 +230,29 @@ class Protocol_discard : public Protocol_text
{
public:
Protocol_discard(THD *thd_arg) : Protocol_text(thd_arg) {}
/* The real writing is done only in write() */
virtual bool write() { return 0; }
virtual bool send_result_set_metadata(List<Item> *list, uint flags)
{
// Don't pas Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF flags
return Protocol_text::send_result_set_metadata(list, 0);
}
// send_error is intentionally not overloaded.
virtual bool send_eof(uint server_status, uint statement_warn_count)
{
return 0;
}
void prepare_for_resend()
{
#ifndef DBUG_OFF
field_pos= 0;
#endif
}
bool write() { return 0; }
bool send_result_set_metadata(List<Item> *, uint) { return 0; }
bool send_eof(uint, uint) { return 0; }
void prepare_for_resend() { IF_DBUG(field_pos= 0,); }
/*
Provide dummy overrides for any storage methods so that we
avoid allocating and copying of data
*/
virtual bool store_null()
{ return false; }
virtual bool store_tiny(longlong from)
{ return false; }
virtual bool store_short(longlong from)
{ return false; }
virtual bool store_long(longlong from)
{ return false; }
virtual bool store_longlong(longlong from, bool unsigned_flag)
{ return false; }
virtual bool store_decimal(const my_decimal *)
{ return false; }
virtual bool store(const char *from, size_t length, CHARSET_INFO *cs)
{ return false; }
virtual bool store(const char *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
{ return false; }
virtual bool store(MYSQL_TIME *time, int decimals)
{ return false; }
virtual bool store_date(MYSQL_TIME *time)
{ return false; }
virtual bool store_time(MYSQL_TIME *time, int decimals)
{ return false; }
virtual bool store(float nr, uint32 decimals, String *buffer)
{ return false; }
virtual bool store(double from, uint32 decimals, String *buffer)
{ return false; }
virtual bool store(Field *field)
{ return false; }
bool store_null() { return false; }
bool store_tiny(longlong) { return false; }
bool store_short(longlong) { return false; }
bool store_long(longlong) { return false; }
bool store_longlong(longlong, bool) { return false; }
bool store_decimal(const my_decimal *) { return false; }
bool store(const char *, size_t, CHARSET_INFO *) { return false; }
bool store(const char *, size_t, CHARSET_INFO *, CHARSET_INFO *) { return false; }
bool store(MYSQL_TIME *, int) { return false; }
bool store_date(MYSQL_TIME *) { return false; }
bool store_time(MYSQL_TIME *, int) { return false; }
bool store(float, uint32, String *) { return false; }
bool store(double, uint32, String *) { return false; }
bool store(Field *) { return false; }
};

View File

@ -681,7 +681,7 @@ enum enum_acl_tables
ROLES_MAPPING_TABLE,
TABLES_MAX // <== always the last
};
// bits for open_grant_tables
static const int Table_user= 1 << USER_TABLE;
static const int Table_db= 1 << DB_TABLE;
static const int Table_tables_priv= 1 << TABLES_PRIV_TABLE;
@ -762,7 +762,7 @@ class Grant_table_base
Grant_table_base() : start_privilege_column(0), num_privilege_cols(0)
{
bzero(&tl, sizeof(tl));
tl.reset();
};
/* Initialization sequence common for all grant tables. This should be called
@ -8483,60 +8483,6 @@ static bool print_grants_for_role(THD *thd, ACL_ROLE * role)
}
/** checks privileges for SHOW GRANTS and SHOW CREATE USER
@note that in case of SHOW CREATE USER the parser guarantees
that a role can never happen here, so *rolename will never
be assigned to
*/
static bool check_show_access(THD *thd, LEX_USER *lex_user,
const char **username,
const char **hostname, const char **rolename)
{
DBUG_ENTER("check_show_access");
if (lex_user->user.str == current_user.str)
{
*username= thd->security_ctx->priv_user;
*hostname= thd->security_ctx->priv_host;
}
else if (lex_user->user.str == current_role.str)
{
*rolename= thd->security_ctx->priv_role;
}
else if (lex_user->user.str == current_user_and_current_role.str)
{
*username= thd->security_ctx->priv_user;
*hostname= thd->security_ctx->priv_host;
*rolename= thd->security_ctx->priv_role;
}
else
{
Security_context *sctx= thd->security_ctx;
bool do_check_access;
lex_user= get_current_user(thd, lex_user);
if (!lex_user)
DBUG_RETURN(TRUE);
if (lex_user->is_role())
{
*rolename= lex_user->user.str;
do_check_access= strcmp(*rolename, sctx->priv_role);
}
else
{
*username= lex_user->user.str;
*hostname= lex_user->host.str;
do_check_access= strcmp(*username, sctx->priv_user) ||
strcmp(*hostname, sctx->priv_host);
}
if (do_check_access && check_access(thd, SELECT_ACL, "mysql", 0, 0, 1, 0))
DBUG_RETURN(TRUE);
}
DBUG_RETURN(FALSE);
}
bool mysql_show_create_user(THD *thd, LEX_USER *lex_user)
{
@ -8548,7 +8494,7 @@ bool mysql_show_create_user(THD *thd, LEX_USER *lex_user)
uint head_length;
DBUG_ENTER("mysql_show_create_user");
if (check_show_access(thd, lex_user, &username, &hostname, NULL))
if (get_show_user(thd, lex_user, &username, &hostname, NULL))
DBUG_RETURN(TRUE);
List<Item> field_list;
@ -8624,6 +8570,57 @@ void mysql_show_grants_get_fields(THD *thd, List<Item> *fields,
fields->push_back(field, thd->mem_root);
}
/** checks privileges for SHOW GRANTS and SHOW CREATE USER
@note that in case of SHOW CREATE USER the parser guarantees
that a role can never happen here, so *rolename will never
be assigned to
*/
bool get_show_user(THD *thd, LEX_USER *lex_user, const char **username,
const char **hostname, const char **rolename)
{
if (lex_user->user.str == current_user.str)
{
*username= thd->security_ctx->priv_user;
*hostname= thd->security_ctx->priv_host;
return 0;
}
if (lex_user->user.str == current_role.str)
{
*rolename= thd->security_ctx->priv_role;
return 0;
}
if (lex_user->user.str == current_user_and_current_role.str)
{
*username= thd->security_ctx->priv_user;
*hostname= thd->security_ctx->priv_host;
*rolename= thd->security_ctx->priv_role;
return 0;
}
Security_context *sctx= thd->security_ctx;
bool do_check_access;
if (!(lex_user= get_current_user(thd, lex_user)))
return 1;
if (lex_user->is_role())
{
*rolename= lex_user->user.str;
do_check_access= strcmp(*rolename, sctx->priv_role);
}
else
{
*username= lex_user->user.str;
*hostname= lex_user->host.str;
do_check_access= strcmp(*username, sctx->priv_user) ||
strcmp(*hostname, sctx->priv_host);
}
if (do_check_access && check_access(thd, SELECT_ACL, "mysql", 0, 0, 1, 0))
return 1;
return 0;
}
/*
SHOW GRANTS; Send grants for a user to the client
@ -8648,15 +8645,16 @@ bool mysql_show_grants(THD *thd, LEX_USER *lex_user)
DBUG_RETURN(TRUE);
}
if (check_show_access(thd, lex_user, &username, &hostname, &rolename))
if (get_show_user(thd, lex_user, &username, &hostname, &rolename))
DBUG_RETURN(TRUE);
DBUG_ASSERT(rolename || username);
List<Item> field_list;
if (!username)
end= strxmov(buff,"Grants for ",rolename, NullS);
else
if (username)
end= strxmov(buff,"Grants for ",username,"@",hostname, NullS);
else
end= strxmov(buff,"Grants for ",rolename, NullS);
mysql_show_grants_get_fields(thd, &field_list, buff, (uint) (end-buff));

View File

@ -254,6 +254,8 @@ ulong get_table_grant(THD *thd, TABLE_LIST *table);
ulong get_column_grant(THD *thd, GRANT_INFO *grant,
const char *db_name, const char *table_name,
const char *field_name);
bool get_show_user(THD *thd, LEX_USER *lex_user, const char **username,
const char **hostname, const char **rolename);
void mysql_show_grants_get_fields(THD *thd, List<Item> *fields,
const char *name, size_t length);
bool mysql_show_grants(THD *thd, LEX_USER *user);

View File

@ -452,8 +452,6 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
DBUG_ENTER("mysql_admin_table");
DBUG_PRINT("enter", ("extra_open_options: %u", extra_open_options));
thd->prepare_logs_for_admin_command();
field_list.push_back(item= new (thd->mem_root)
Item_empty_string(thd, "Table",
NAME_CHAR_LEN * 2), thd->mem_root);

View File

@ -28,7 +28,7 @@ int reassign_keycache_tables(THD* thd, KEY_CACHE *src_cache,
/**
Sql_cmd_analyze_table represents the ANALYZE TABLE statement.
*/
class Sql_cmd_analyze_table : public Sql_cmd_admin
class Sql_cmd_analyze_table : public Sql_cmd
{
public:
/**
@ -53,7 +53,7 @@ public:
/**
Sql_cmd_check_table represents the CHECK TABLE statement.
*/
class Sql_cmd_check_table : public Sql_cmd_admin
class Sql_cmd_check_table : public Sql_cmd
{
public:
/**
@ -77,7 +77,7 @@ public:
/**
Sql_cmd_optimize_table represents the OPTIMIZE TABLE statement.
*/
class Sql_cmd_optimize_table : public Sql_cmd_admin
class Sql_cmd_optimize_table : public Sql_cmd
{
public:
/**
@ -102,7 +102,7 @@ public:
/**
Sql_cmd_repair_table represents the REPAIR TABLE statement.
*/
class Sql_cmd_repair_table : public Sql_cmd_admin
class Sql_cmd_repair_table : public Sql_cmd
{
public:
/**

View File

@ -402,7 +402,7 @@ bool Sql_cmd_alter_table::execute(THD *thd)
DBUG_RETURN(TRUE); /* purecov: inspected */
/* If it is a merge table, check privileges for merge children. */
if (create_info.merge_list.first)
if (create_info.merge_list)
{
/*
The user must have (SELECT_ACL | UPDATE_ACL | DELETE_ACL) on the
@ -440,7 +440,7 @@ bool Sql_cmd_alter_table::execute(THD *thd)
*/
if (check_table_access(thd, SELECT_ACL | UPDATE_ACL | DELETE_ACL,
create_info.merge_list.first, FALSE, UINT_MAX, FALSE))
create_info.merge_list, FALSE, UINT_MAX, FALSE))
DBUG_RETURN(TRUE);
}
@ -451,9 +451,7 @@ bool Sql_cmd_alter_table::execute(THD *thd)
{
// Rename of table
TABLE_LIST tmp_table;
memset(&tmp_table, 0, sizeof(tmp_table));
tmp_table.table_name= lex->name;
tmp_table.db= select_lex->db;
tmp_table.init_one_table(&select_lex->db, &lex->name, 0, TL_IGNORE);
tmp_table.grant.privilege= priv;
if (check_grant(thd, INSERT_ACL | CREATE_ACL, &tmp_table, FALSE,
UINT_MAX, FALSE))
@ -471,7 +469,6 @@ bool Sql_cmd_alter_table::execute(THD *thd)
"INDEX DIRECTORY");
create_info.data_file_name= create_info.index_file_name= NULL;
thd->prepare_logs_for_admin_command();
#ifdef WITH_PARTITION_STORAGE_ENGINE
thd->work_part_info= 0;
#endif
@ -519,8 +516,6 @@ bool Sql_cmd_discard_import_tablespace::execute(THD *thd)
if (check_grant(thd, ALTER_ACL, table_list, false, UINT_MAX, false))
return true;
thd->prepare_logs_for_admin_command();
/*
Check if we attempt to alter mysql.slow_log or
mysql.general_log table and return an error if

View File

@ -333,7 +333,7 @@ private:
statements.
@todo move Alter_info and other ALTER generic structures from Lex here.
*/
class Sql_cmd_common_alter_table : public Sql_cmd_admin
class Sql_cmd_common_alter_table : public Sql_cmd
{
protected:
/**

View File

@ -298,9 +298,9 @@ bool get_ev_num_info(EV_NUM_INFO *ev_info, NUM_INFO *info, const char *num)
} // get_ev_num_info
int free_string(String *s)
int free_string(void* str, TREE_FREE, void*)
{
s->free();
((String*)str)->free();
return 0;
}
@ -1242,4 +1242,3 @@ uint check_ulonglong(const char *str, uint length)
while (*cmp && *cmp++ == *str++) ;
return ((uchar) str[-1] <= (uchar) cmp[-1]) ? smaller : bigger;
} /* check_ulonlong */

View File

@ -68,7 +68,7 @@ int compare_ulonglong2(void* cmp_arg __attribute__((unused)),
int compare_decimal2(int* len, const char *s, const char *t);
Procedure *proc_analyse_init(THD *thd, ORDER *param, select_result *result,
List<Item> &field_list);
int free_string(String*);
int free_string(void* str, TREE_FREE, void*);
class analyse;
class field_info :public Sql_alloc
@ -121,8 +121,7 @@ public:
must_be_blob(0), was_zero_fill(0),
was_maybe_zerofill(0), can_be_still_num(1)
{ init_tree(&tree, 0, 0, sizeof(String), (qsort_cmp2) sortcmp2,
(tree_element_free) free_string, NULL,
MYF(MY_THREAD_SPECIFIC)); };
free_string, NULL, MYF(MY_THREAD_SPECIFIC)); };
void add();
void get_opt_type(String*, ha_rows);

View File

@ -2586,17 +2586,15 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(const char *key, size_t key_length)
}
void THD::prepare_explain_fields(select_result *result,
List<Item> *field_list,
uint8 explain_flags,
bool is_analyze)
int THD::prepare_explain_fields(select_result *result, List<Item> *field_list,
uint8 explain_flags, bool is_analyze)
{
if (lex->explain_json)
make_explain_json_field_list(*field_list, is_analyze);
else
make_explain_field_list(*field_list, explain_flags, is_analyze);
result->prepare(*field_list, NULL);
return result->prepare(*field_list, NULL);
}
@ -2606,11 +2604,10 @@ int THD::send_explain_fields(select_result *result,
{
List<Item> field_list;
int rc;
prepare_explain_fields(result, &field_list, explain_flags, is_analyze);
rc= result->send_result_set_metadata(field_list,
Protocol::SEND_NUM_ROWS |
Protocol::SEND_EOF);
return(rc);
rc= prepare_explain_fields(result, &field_list, explain_flags, is_analyze) ||
result->send_result_set_metadata(field_list, Protocol::SEND_NUM_ROWS |
Protocol::SEND_EOF);
return rc;
}
@ -2685,7 +2682,7 @@ void THD::make_explain_field_list(List<Item> &field_list, uint8 explain_flags,
if (is_analyze)
{
field_list.push_back(item= new (mem_root)
Item_float(this, "r_rows", 0.1234, 10, 4),
Item_float(this, "r_rows", 0.1234, 2, 4),
mem_root);
item->maybe_null=1;
}

View File

@ -3801,8 +3801,8 @@ public:
void add_changed_table(TABLE *table);
void add_changed_table(const char *key, size_t key_length);
CHANGED_TABLE_LIST * changed_table_dup(const char *key, size_t key_length);
void prepare_explain_fields(select_result *result, List<Item> *field_list,
uint8 explain_flags, bool is_analyze);
int prepare_explain_fields(select_result *result, List<Item> *field_list,
uint8 explain_flags, bool is_analyze);
int send_explain_fields(select_result *result, uint8 explain_flags,
bool is_analyze);
void make_explain_field_list(List<Item> &field_list, uint8 explain_flags,
@ -4836,11 +4836,6 @@ public:
Item *sp_fix_func_item(Item **it_addr);
Item *sp_prepare_func_item(Item **it_addr, uint cols= 1);
bool sp_eval_expr(Field *result_field, Item **expr_item_ptr);
inline void prepare_logs_for_admin_command()
{
query_plan_flags|= QPLAN_ADMIN;
}
};
inline void add_to_active_threads(THD *thd)
@ -4945,6 +4940,7 @@ public:
void reset(THD *thd_arg) { thd= thd_arg; }
};
class select_result_interceptor;
/*
Interface for sending tabular data, together with some other stuff:
@ -5043,11 +5039,10 @@ public:
/*
This returns
- FALSE if the class sends output row to the client
- TRUE if the output is set elsewhere (a file, @variable, or table).
Currently all intercepting classes derive from select_result_interceptor.
- NULL if the class sends output row to the client
- this if the output is set elsewhere (a file, @variable, or table).
*/
virtual bool is_result_interceptor()=0;
virtual select_result_interceptor *result_interceptor()=0;
/*
This method is used to distinguish an normal SELECT from the cursor
@ -5123,7 +5118,7 @@ public:
} /* Remove gcc warning */
uint field_count(List<Item> &fields) const { return 0; }
bool send_result_set_metadata(List<Item> &fields, uint flag) { return FALSE; }
bool is_result_interceptor() { return true; }
select_result_interceptor *result_interceptor() { return this; }
/*
Instruct the object to not call my_ok(). Client output will be handled
@ -5257,7 +5252,7 @@ public:
virtual bool check_simple_select() const { return FALSE; }
void abort_result_set();
virtual void cleanup();
bool is_result_interceptor() { return false; }
select_result_interceptor *result_interceptor() { return NULL; }
};
@ -6296,22 +6291,27 @@ public:
*/
#define CF_UPDATES_DATA (1U << 18)
/**
Not logged into slow log as "admin commands"
*/
#define CF_ADMIN_COMMAND (1U << 19)
/**
SP Bulk execution safe
*/
#define CF_SP_BULK_SAFE (1U << 19)
#define CF_SP_BULK_SAFE (1U << 20)
/**
SP Bulk execution optimized
*/
#define CF_SP_BULK_OPTIMIZED (1U << 20)
#define CF_SP_BULK_OPTIMIZED (1U << 21)
/**
If command creates or drops a table
*/
#define CF_SCHEMA_CHANGE (1U << 21)
#define CF_SCHEMA_CHANGE (1U << 22)
/**
If command creates or drops a database
*/
#define CF_DB_CHANGE (1U << 22)
#define CF_DB_CHANGE (1U << 23)
/* Bits in server_command_flags */

View File

@ -160,8 +160,6 @@ public:
*/
virtual bool execute(THD *thd) = 0;
virtual bool log_slow_enabled_statement(const THD *thd) const;
protected:
Sql_cmd()
{}
@ -179,17 +177,6 @@ protected:
};
class Sql_cmd_admin: public Sql_cmd
{
public:
Sql_cmd_admin()
{}
~Sql_cmd_admin()
{}
bool log_slow_enabled_statement(const THD *thd) const;
};
/**
Sql_cmd_call represents the CALL statement.
*/
@ -219,5 +206,4 @@ public:
}
};
#endif // SQL_CMD_INCLUDED

View File

@ -1189,7 +1189,6 @@ void end_connection(THD *thd)
}
thd->wsrep_client_thread= 0;
#endif
plugin_thdvar_cleanup(thd);
if (thd->user_connect)
{

View File

@ -706,6 +706,7 @@ void With_element::move_anchors_ahead()
}
}
first_recursive= new_pos;
spec->first_select()->linkage= DERIVED_TABLE_TYPE;
}

View File

@ -417,8 +417,6 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, SQL_HANDLER *reopen)
sql_handler->reset();
}
sql_handler->table= table;
memcpy(&sql_handler->mdl_request, &tables->mdl_request,
sizeof(tables->mdl_request));
if (!(sql_handler->lock= get_lock_data(thd, &sql_handler->table, 1,
GET_LOCK_STORE_LOCKS)))
@ -431,6 +429,8 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, SQL_HANDLER *reopen)
if (unlikely(error))
goto err;
sql_handler->mdl_request.move_from(tables->mdl_request);
/* Always read all columns */
table->read_set= &table->s->all_set;
if (table->vcol_set)
@ -470,9 +470,6 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, SQL_HANDLER *reopen)
table_list->table->open_by_handler= 1;
}
/* Safety, cleanup the pointer to satisfy MDL assertions. */
tables->mdl_request.ticket= NULL;
if (! reopen)
my_ok(thd);
DBUG_PRINT("exit",("OK"));

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