Commit 9a8d1d84 authored by Monty's avatar Monty

Merge remote-tracking branch 'origin/10.4' into 10.5

parents a868e799 ea771624
......@@ -408,3 +408,31 @@ test
test
drop procedure p1;
SET global secure_auth=default;
#
# MDEV-19282: Log more specific warning with log_warnings=2 if
# connection is aborted prior to authentication
# MDEV-19277: Add status variable that gets incremented if
# connection is aborted prior to authentication
#
flush status;
SHOW GLOBAL STATUS LIKE 'Aborted_connects%';
Variable_name Value
Aborted_connects 0
Aborted_connects_preauth 0
SET GLOBAL log_warnings=2;
NOT FOUND /This connection closed normally without authentication/ in mysqld.1.err
SHOW GLOBAL STATUS LIKE 'Aborted_connects%';
Variable_name Value
Aborted_connects 1
Aborted_connects_preauth 1
FOUND 1 /This connection closed normally without authentication/ in mysqld.1.err
SET @save_connect_timeout= @@connect_timeout;
SET GLOBAL connect_timeout=2;
SHOW GLOBAL STATUS LIKE 'Aborted_connects%';
Variable_name Value
Aborted_connects 2
Aborted_connects_preauth 2
FOUND 2 /This connection closed normally without authentication/ in mysqld.1.err
SET GLOBAL log_warnings=default;
SET GLOBAL connect_timeout= @save_connect_timeout;
# End of 10.4 tests
......@@ -453,3 +453,53 @@ call p1(2);
drop procedure p1;
SET global secure_auth=default;
--echo #
--echo # MDEV-19282: Log more specific warning with log_warnings=2 if
--echo # connection is aborted prior to authentication
--echo # MDEV-19277: Add status variable that gets incremented if
--echo # connection is aborted prior to authentication
--echo #
flush status;
SHOW GLOBAL STATUS LIKE 'Aborted_connects%';
SET GLOBAL log_warnings=2;
--let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err
--let SEARCH_PATTERN= This connection closed normally without authentication
--source include/search_pattern_in_file.inc
--perl
use Socket;
use autodie;
socket(SOCK, PF_INET, SOCK_STREAM, getprotobyname("tcp"));
connect(SOCK, pack_sockaddr_in($ENV{MASTER_MYPORT}, inet_aton("localhost")));
exit(0);
EOF
SHOW GLOBAL STATUS LIKE 'Aborted_connects%';
--let SEARCH_PATTERN= This connection closed normally without authentication
--source include/search_pattern_in_file.inc
SET @save_connect_timeout= @@connect_timeout;
SET GLOBAL connect_timeout=2;
--perl
use Socket;
use autodie;
socket(SOCK, PF_INET, SOCK_STREAM, getprotobyname("tcp"));
connect(SOCK, pack_sockaddr_in($ENV{MASTER_MYPORT}, inet_aton("localhost")));
sleep 3;
exit(0);
EOF
SHOW GLOBAL STATUS LIKE 'Aborted_connects%';
--let SEARCH_PATTERN= This connection closed normally without authentication
--source include/search_pattern_in_file.inc
SET GLOBAL log_warnings=default;
SET GLOBAL connect_timeout= @save_connect_timeout;
--echo # End of 10.4 tests
......@@ -1736,26 +1736,30 @@ SET DEBUG_SYNC= 'RESET';
# MDEV-19384 Deadlock between FTWRL under open HANDLER, LOCK TABLE
# and DROP DATABASE
#
SET DEBUG_SYNC= 'ftwrl_before_lock SIGNAL ready WAIT_FOR go';
CREATE DATABASE mysqltest;
CREATE TABLE mysqltest.t1(a INT);
HANDLER mysqltest.t1 OPEN as t1;
connect con1,localhost,root,,;
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready1';
LOCK TABLE mysqltest.t1 WRITE;
connect con2,localhost,root,,;
SET DEBUG_SYNC= 'now WAIT_FOR ready';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready';
SET DEBUG_SYNC= 'now WAIT_FOR ready1';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready2';
DROP DATABASE mysqltest;
connect con3,localhost,root,,;
SET DEBUG_SYNC= 'now WAIT_FOR ready2';
connection default;
FLUSH TABLES WITH READ LOCK;
connection con3;
SET DEBUG_SYNC= 'now WAIT_FOR ready';
disconnect con3;
connection con1;
SET DEBUG_SYNC= 'now SIGNAL go';
disconnect con1;
connection default;
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
HANDLER t1 CLOSE;
connection con1;
UNLOCK TABLES;
disconnect con1;
connection con2;
disconnect con2;
connection default;
......
......@@ -2100,32 +2100,40 @@ SET DEBUG_SYNC= 'RESET';
--echo # and DROP DATABASE
--echo #
SET DEBUG_SYNC= 'ftwrl_before_lock SIGNAL ready WAIT_FOR go';
CREATE DATABASE mysqltest;
CREATE TABLE mysqltest.t1(a INT);
HANDLER mysqltest.t1 OPEN as t1;
connect (con1,localhost,root,,);
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready1';
--send LOCK TABLE mysqltest.t1 WRITE
connect (con2,localhost,root,,);
SET DEBUG_SYNC= 'now WAIT_FOR ready';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready';
SET DEBUG_SYNC= 'now WAIT_FOR ready1';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready2';
--send DROP DATABASE mysqltest
connect (con3,localhost,root,,);
SET DEBUG_SYNC= 'now WAIT_FOR ready2';
connection default;
send FLUSH TABLES WITH READ LOCK;
connection con3;
SET DEBUG_SYNC= 'now WAIT_FOR ready';
disconnect con3;
connection default;
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
HANDLER t1 CLOSE;
connection con1;
--error 0,ER_NO_SUCH_TABLE
reap;
UNLOCK TABLES;
SET DEBUG_SYNC= 'now SIGNAL go';
disconnect con1;
connection default;
reap;
UNLOCK TABLES;
HANDLER t1 CLOSE;
connection con2;
reap;
disconnect con2;
......
--- main/myisam_mrr.result 2019-05-14 15:44:52.232663568 +0530
+++ main/myisam_mrr.reject 2019-05-14 15:51:37.123563538 +0530
@@ -617,8 +617,8 @@
show status like 'handler_mrr%';
Variable_name Value
Handler_mrr_init 1
-Handler_mrr_key_refills 1
-Handler_mrr_rowid_refills 1
+Handler_mrr_key_refills 0
+Handler_mrr_rowid_refills 0
set join_buffer_size=10;
explain select sum(t1.b) from t0,t1 where t0.a=t1.a;
id select_type table type possible_keys key key_len ref rows Extra
--- main/myisam_mrr.result 2019-04-27 21:46:07.000000000 +0530
+++ main/myisam_mrr,64bit.reject 2019-05-11 20:40:32.000000000 +0530
@@ -188,7 +188,7 @@
select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1'
or c='no-such-row2');
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t4 range idx1 idx1 29 NULL 10 Using index condition; Using where; Rowid-ordered scan
+1 SIMPLE t4 range idx1 idx1 29 NULL 10 Using index condition; Rowid-ordered scan
select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1'
or c='no-such-row2');
a b c filler
@@ -210,7 +210,7 @@
explain
select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2');
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t4 range idx1 idx1 29 NULL 20 Using index condition; Using where; Rowid-ordered scan
+1 SIMPLE t4 range idx1 idx1 29 NULL 20 Using index condition; Rowid-ordered scan
select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2');
a b c filler
b-1 NULL c-1 NULL-15
@@ -617,8 +617,8 @@
show status like 'handler_mrr%';
Variable_name Value
Handler_mrr_init 1
-Handler_mrr_key_refills 0
-Handler_mrr_rowid_refills 0
+Handler_mrr_key_refills 1
+Handler_mrr_rowid_refills 1
set join_buffer_size=10;
explain select sum(t1.b) from t0,t1 where t0.a=t1.a;
id select_type table type possible_keys key key_len ref rows Extra
......@@ -188,7 +188,7 @@ explain
select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1'
or c='no-such-row2');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 range idx1 idx1 29 NULL 10 Using index condition; Using where; Rowid-ordered scan
1 SIMPLE t4 range idx1 idx1 29 NULL 10 Using index condition; Rowid-ordered scan
select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1'
or c='no-such-row2');
a b c filler
......@@ -210,7 +210,7 @@ NULL NULL NULL NULL-1
explain
select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 range idx1 idx1 29 NULL 20 Using index condition; Using where; Rowid-ordered scan
1 SIMPLE t4 range idx1 idx1 29 NULL 20 Using index condition; Rowid-ordered scan
select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2');
a b c filler
b-1 NULL c-1 NULL-15
......@@ -617,8 +617,8 @@ sum(t1.b)
show status like 'handler_mrr%';
Variable_name Value
Handler_mrr_init 1
Handler_mrr_key_refills 0
Handler_mrr_rowid_refills 0
Handler_mrr_key_refills 1
Handler_mrr_rowid_refills 1
set join_buffer_size=10;
explain select sum(t1.b) from t0,t1 where t0.a=t1.a;
id select_type table type possible_keys key key_len ref rows Extra
......
......@@ -63,8 +63,9 @@ SET DEBUG_SYNC = "now WAIT_FOR agac_reached_2";
wsrep_last_seen_gtid_no_match
1
SET DEBUG_SYNC = "now SIGNAL agac_continue_1";
SET DEBUG_SYNC = "now SIGNAL agac_continue_2";
connection node_1;
connection ctrl;
SET DEBUG_SYNC = "now SIGNAL agac_continue_2";
connection node_1a;
connection ctrl;
SET DEBUG_SYNC = "RESET";
......
......@@ -124,10 +124,13 @@ SET DEBUG_SYNC = "now WAIT_FOR agac_reached_2";
--enable_query_log
SET DEBUG_SYNC = "now SIGNAL agac_continue_1";
SET DEBUG_SYNC = "now SIGNAL agac_continue_2";
--connection node_1
--reap
--connection ctrl
SET DEBUG_SYNC = "now SIGNAL agac_continue_2";
--connection node_1a
--reap
......
......@@ -1034,6 +1034,7 @@ bool Global_read_lock::lock_global_read_lock(THD *thd)
if another thread is trying to simultaneous drop the table
*/
mysql_ha_cleanup_no_free(thd);
DEBUG_SYNC(thd, "ftwrl_before_lock");
DBUG_ASSERT(! thd->mdl_context.is_lock_owner(MDL_key::BACKUP, "", "",
MDL_BACKUP_FTWRL1));
......
......@@ -492,7 +492,7 @@ ulonglong query_cache_size=0;
ulong query_cache_limit=0;
ulong executed_events=0;
query_id_t global_query_id;
ulong aborted_threads, aborted_connects;
ulong aborted_threads, aborted_connects, aborted_connects_preauth;
ulong delayed_insert_timeout, delayed_insert_limit, delayed_queue_size;
ulong delayed_insert_threads, delayed_insert_writes, delayed_rows_in_use;
ulong delayed_insert_errors,flush_time;
......@@ -2560,13 +2560,19 @@ static void network_init(void)
void close_connection(THD *thd, uint sql_errno)
{
int lvl= (thd->main_security_ctx.user ? 3 : 1);
DBUG_ENTER("close_connection");
if (sql_errno)
{
net_send_error(thd, sql_errno, ER_DEFAULT(sql_errno), NULL);
thd->print_aborted_warning(3, sql_errno ? ER_DEFAULT(sql_errno)
: "CLOSE_CONNECTION");
thd->print_aborted_warning(lvl, ER_DEFAULT(sql_errno));
}
else
thd->print_aborted_warning(lvl, (thd->main_security_ctx.user ?
"This connection closed normally" :
"This connection closed normally without"
" authentication"));
thd->disconnect();
......@@ -7615,6 +7621,7 @@ int show_threadpool_idle_threads(THD *thd, SHOW_VAR *var, char *buff,
SHOW_VAR status_vars[]= {
{"Aborted_clients", (char*) &aborted_threads, SHOW_LONG},
{"Aborted_connects", (char*) &aborted_connects, SHOW_LONG},
{"Aborted_connects_preauth", (char*) &aborted_connects_preauth, SHOW_LONG},
{"Acl", (char*) acl_statistics, SHOW_ARRAY},
{"Access_denied_errors", (char*) offsetof(STATUS_VAR, access_denied_errors), SHOW_LONG_STATUS},
{"Binlog_bytes_written", (char*) offsetof(STATUS_VAR, binlog_bytes_written), SHOW_LONGLONG_STATUS},
......@@ -8026,7 +8033,7 @@ static int mysql_init_variables(void)
opt_using_transactions= 0;
abort_loop= select_thread_in_use= signal_thread_in_use= 0;
grant_option= 0;
aborted_threads= aborted_connects= 0;
aborted_threads= aborted_connects= aborted_connects_preauth= 0;
subquery_cache_miss= subquery_cache_hit= 0;
delayed_insert_threads= delayed_insert_writes= delayed_rows_in_use= 0;
delayed_insert_errors= thread_created= 0;
......
......@@ -215,7 +215,7 @@ extern ulonglong thd_startup_options;
extern my_thread_id global_thread_id;
extern ulong binlog_cache_use, binlog_cache_disk_use;
extern ulong binlog_stmt_cache_use, binlog_stmt_cache_disk_use;
extern ulong aborted_threads,aborted_connects;
extern ulong aborted_threads, aborted_connects, aborted_connects_preauth;
extern ulong delayed_insert_timeout;
extern ulong delayed_insert_limit, delayed_queue_size;
extern ulong delayed_insert_threads, delayed_insert_writes;
......
......@@ -13718,6 +13718,8 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
Security_context * const sctx= thd->security_ctx;
const ACL_USER * acl_user= mpvio.acl_user;
if (!acl_user)
statistic_increment(aborted_connects_preauth, &LOCK_status);
if (acl_user)
{
......
......@@ -1036,12 +1036,16 @@ static int check_connection(THD *thd)
*/
statistic_increment(connection_errors_peer_addr, &LOCK_status);
my_error(ER_BAD_HOST_ERROR, MYF(0));
statistic_increment(aborted_connects_preauth, &LOCK_status);
return 1;
}
if (thd_set_peer_addr(thd, &net->vio->remote, ip, peer_port,
true, &connect_errors))
{
statistic_increment(aborted_connects_preauth, &LOCK_status);
return 1;
}
}
else /* Hostname given means that the connection was on a socket */
{
......@@ -1069,6 +1073,7 @@ static int check_connection(THD *thd)
*/
statistic_increment(aborted_connects,&LOCK_status);
statistic_increment(connection_errors_internal, &LOCK_status);
statistic_increment(aborted_connects_preauth, &LOCK_status);
return 1; /* The error is set by alloc(). */
}
......
......@@ -4352,20 +4352,28 @@ void wsrep_plugins_pre_init()
my_bool post_init_callback(THD *thd, void *)
{
DBUG_ASSERT(!current_thd);
if (thd->wsrep_applier)
{
// Save options_bits as it will get overwritten in plugin_thdvar_init()
// Save options_bits as it will get overwritten in
// plugin_thdvar_init() (verified)
ulonglong option_bits_saved= thd->variables.option_bits;
set_current_thd(thd);
plugin_thdvar_init(thd);
// Restore option_bits
thd->variables.option_bits= option_bits_saved;
}
set_current_thd(0);
return 0;
}
void wsrep_plugins_post_init()
{
mysql_mutex_lock(&LOCK_global_system_variables);
server_threads.iterate(post_init_callback);
mysql_mutex_unlock(&LOCK_global_system_variables);
}
#endif /* WITH_WSREP */
......@@ -33,7 +33,6 @@ MYSQL_CHECK_LZMA()
MYSQL_CHECK_BZIP2()
MYSQL_CHECK_SNAPPY()
MYSQL_CHECK_NUMA()
TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment