Commit a4b3a9d3 authored by Kristofer.Pettersson@naruto's avatar Kristofer.Pettersson@naruto

Merge naruto.:C:/cpp/bug26174/my51-bug26174

into  naruto.:C:/cpp/mysql-5.1-runtime
parents c392623b f85f0950
...@@ -1408,4 +1408,32 @@ select user,db from information_schema.processlist; ...@@ -1408,4 +1408,32 @@ select user,db from information_schema.processlist;
user db user db
user3148 test user3148 test
drop user user3148@localhost; drop user user3148@localhost;
DROP TABLE IF EXISTS thread_status;
CREATE TABLE thread_status (variable_name VARCHAR(64),
variable_value DECIMAL(22,7));
CREATE TABLE server_status (variable_name VARCHAR(64),
variable_value DECIMAL(22,7));
DROP EVENT IF EXISTS log_status;
CREATE EVENT log_status
ON SCHEDULE EVERY 1 SECOND
DO
BEGIN
INSERT INTO thread_status SELECT variable_name, variable_value FROM
information_schema.session_status;
INSERT INTO server_status SELECT variable_name, variable_value FROM
information_schema.global_status;
END$$
SET GLOBAL event_scheduler=1;
SELECT * FROM thread_status WHERE variable_name LIKE 'SSL%' LIMIT 1,2;
variable_name variable_value
SSL_ACCEPTS 0.0000000
SSL_CALLBACK_CACHE_HITS 0.0000000
SELECT variable_name FROM server_status LIMIT 1,2;
variable_name
ABORTED_CONNECTS
BINLOG_CACHE_DISK_USE
DROP EVENT log_status;
DROP TABLE thread_status;
DROP TABLE server_status;
SET GLOBAL event_scheduler=0;
End of 5.1 tests. End of 5.1 tests.
...@@ -1042,5 +1042,45 @@ select user,db from information_schema.processlist; ...@@ -1042,5 +1042,45 @@ select user,db from information_schema.processlist;
connection default; connection default;
drop user user3148@localhost; drop user user3148@localhost;
#
# Bug #26174 Server Crash: INSERT ... SELECT ... FROM I_S.GLOBAL_STATUS in Event
#
--disable_warnings
DROP TABLE IF EXISTS thread_status;
CREATE TABLE thread_status (variable_name VARCHAR(64),
variable_value DECIMAL(22,7));
CREATE TABLE server_status (variable_name VARCHAR(64),
variable_value DECIMAL(22,7));
DROP EVENT IF EXISTS log_status;
--enable_warnings
DELIMITER $$;
CREATE EVENT log_status
ON SCHEDULE EVERY 1 SECOND
DO
BEGIN
INSERT INTO thread_status SELECT variable_name, variable_value FROM
information_schema.session_status;
INSERT INTO server_status SELECT variable_name, variable_value FROM
information_schema.global_status;
END$$
DELIMITER ;$$
SET GLOBAL event_scheduler=1;
sleep 1;
SELECT * FROM thread_status WHERE variable_name LIKE 'SSL%' LIMIT 1,2;
SELECT variable_name FROM server_status LIMIT 1,2;
DROP EVENT log_status;
DROP TABLE thread_status;
DROP TABLE server_status;
SET GLOBAL event_scheduler=0;
--echo End of 5.1 tests. --echo End of 5.1 tests.
...@@ -6729,12 +6729,20 @@ static int show_ssl_ctx_get_session_cache_mode(THD *thd, SHOW_VAR *var, char *bu ...@@ -6729,12 +6729,20 @@ static int show_ssl_ctx_get_session_cache_mode(THD *thd, SHOW_VAR *var, char *bu
return 0; return 0;
} }
/* Functions relying on SSL */ /*
Functions relying on SSL
Note: In the show_ssl_* functions, we need to check if we have a
valid vio-object since this isn't always true, specifically
when session_status or global_status is requested from
inside an Event.
*/
static int show_ssl_get_version(THD *thd, SHOW_VAR *var, char *buff) static int show_ssl_get_version(THD *thd, SHOW_VAR *var, char *buff)
{ {
var->type= SHOW_CHAR; var->type= SHOW_CHAR;
var->value= const_cast<char*>(thd->net.vio->ssl_arg ? if( thd->vio_ok() && thd->net.vio->ssl_arg )
SSL_get_version((SSL*) thd->net.vio->ssl_arg) : ""); var->value= const_cast<char*>(SSL_get_version((SSL*) thd->net.vio->ssl_arg));
else
var->value= "";
return 0; return 0;
} }
...@@ -6742,9 +6750,10 @@ static int show_ssl_session_reused(THD *thd, SHOW_VAR *var, char *buff) ...@@ -6742,9 +6750,10 @@ static int show_ssl_session_reused(THD *thd, SHOW_VAR *var, char *buff)
{ {
var->type= SHOW_LONG; var->type= SHOW_LONG;
var->value= buff; var->value= buff;
*((long *)buff)= (long)thd->net.vio->ssl_arg ? if( thd->vio_ok() && thd->net.vio->ssl_arg )
SSL_session_reused((SSL*) thd->net.vio->ssl_arg) : *((long *)buff)= (long)SSL_session_reused((SSL*) thd->net.vio->ssl_arg);
0; else
*((long *)buff)= 0;
return 0; return 0;
} }
...@@ -6752,9 +6761,10 @@ static int show_ssl_get_default_timeout(THD *thd, SHOW_VAR *var, char *buff) ...@@ -6752,9 +6761,10 @@ static int show_ssl_get_default_timeout(THD *thd, SHOW_VAR *var, char *buff)
{ {
var->type= SHOW_LONG; var->type= SHOW_LONG;
var->value= buff; var->value= buff;
*((long *)buff)= (long)thd->net.vio->ssl_arg ? if( thd->vio_ok() && thd->net.vio->ssl_arg )
SSL_get_default_timeout((SSL*)thd->net.vio->ssl_arg) : *((long *)buff)= (long)SSL_get_default_timeout((SSL*)thd->net.vio->ssl_arg);
0; else
*((long *)buff)= 0;
return 0; return 0;
} }
...@@ -6762,9 +6772,10 @@ static int show_ssl_get_verify_mode(THD *thd, SHOW_VAR *var, char *buff) ...@@ -6762,9 +6772,10 @@ static int show_ssl_get_verify_mode(THD *thd, SHOW_VAR *var, char *buff)
{ {
var->type= SHOW_LONG; var->type= SHOW_LONG;
var->value= buff; var->value= buff;
*((long *)buff)= (long)thd->net.vio->ssl_arg ? if( thd->net.vio && thd->net.vio->ssl_arg )
SSL_get_verify_mode((SSL*)thd->net.vio->ssl_arg) : *((long *)buff)= (long)SSL_get_verify_mode((SSL*)thd->net.vio->ssl_arg);
0; else
*((long *)buff)= 0;
return 0; return 0;
} }
...@@ -6772,17 +6783,20 @@ static int show_ssl_get_verify_depth(THD *thd, SHOW_VAR *var, char *buff) ...@@ -6772,17 +6783,20 @@ static int show_ssl_get_verify_depth(THD *thd, SHOW_VAR *var, char *buff)
{ {
var->type= SHOW_LONG; var->type= SHOW_LONG;
var->value= buff; var->value= buff;
*((long *)buff)= (long)thd->net.vio->ssl_arg ? if( thd->vio_ok() && thd->net.vio->ssl_arg )
SSL_get_verify_depth((SSL*)thd->net.vio->ssl_arg) : *((long *)buff)= (long)SSL_get_verify_depth((SSL*)thd->net.vio->ssl_arg);
0; else
*((long *)buff)= 0;
return 0; return 0;
} }
static int show_ssl_get_cipher(THD *thd, SHOW_VAR *var, char *buff) static int show_ssl_get_cipher(THD *thd, SHOW_VAR *var, char *buff)
{ {
var->type= SHOW_CHAR; var->type= SHOW_CHAR;
var->value= const_cast<char*>(thd->net.vio->ssl_arg ? if( thd->vio_ok() && thd->net.vio->ssl_arg )
SSL_get_cipher((SSL*) thd->net.vio->ssl_arg) : ""); var->value= const_cast<char*>(SSL_get_cipher((SSL*) thd->net.vio->ssl_arg));
else
var->value= "";
return 0; return 0;
} }
...@@ -6790,7 +6804,7 @@ static int show_ssl_get_cipher_list(THD *thd, SHOW_VAR *var, char *buff) ...@@ -6790,7 +6804,7 @@ static int show_ssl_get_cipher_list(THD *thd, SHOW_VAR *var, char *buff)
{ {
var->type= SHOW_CHAR; var->type= SHOW_CHAR;
var->value= buff; var->value= buff;
if (thd->net.vio->ssl_arg) if (thd->vio_ok() && thd->net.vio->ssl_arg)
{ {
int i; int i;
const char *p; const char *p;
......
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