Commit 326a8dcd authored by Sergei Golubchik's avatar Sergei Golubchik

Merge branch '10.0' into 10.1

parents 64583629 c6fdb92c
...@@ -45,7 +45,7 @@ C_MODE_START ...@@ -45,7 +45,7 @@ C_MODE_START
#if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE) #if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)
void my_init_stacktrace(); void my_init_stacktrace();
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack); void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack);
void my_safe_print_str(const char* val, int max_len); int my_safe_print_str(const char* val, int max_len);
void my_write_core(int sig); void my_write_core(int sig);
#if BACKTRACE_DEMANGLE #if BACKTRACE_DEMANGLE
char *my_demangle(const char *mangled_name, int *status); char *my_demangle(const char *mangled_name, int *status);
......
...@@ -58,8 +58,8 @@ mysqltest: Could not open connection 'default': 2026 SSL connection error: Unabl ...@@ -58,8 +58,8 @@ mysqltest: Could not open connection 'default': 2026 SSL connection error: Unabl
SHOW STATUS LIKE 'Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA Ssl_cipher DHE-RSA-AES256-SHA
Variable_name Value have_ssl
Ssl_cipher DHE-RSA-AES256-SHA 1
End of 5.0 tests End of 5.0 tests
DROP TABLE IF EXISTS thread_status; DROP TABLE IF EXISTS thread_status;
DROP EVENT IF EXISTS event_status; DROP EVENT IF EXISTS event_status;
...@@ -204,9 +204,9 @@ result ...@@ -204,9 +204,9 @@ result
is still running; no cipher request crashed the server is still running; no cipher request crashed the server
GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509; GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509;
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
SHOW STATUS LIKE 'Ssl_cipher'; SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
Variable_name Value have_ssl
Ssl_cipher DHE-RSA-AES256-SHA 1
DROP USER bug42158@localhost; DROP USER bug42158@localhost;
set global sql_mode=default; set global sql_mode=default;
End of 5.1 tests End of 5.1 tests
......
...@@ -789,3 +789,5 @@ execute stmt1; ...@@ -789,3 +789,5 @@ execute stmt1;
1 1
drop prepare stmt1; drop prepare stmt1;
drop table t1; drop table t1;
select ?+1;
Got one of the listed errors
SHOW STATUS LIKE 'Ssl_cipher'; SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
Variable_name Value have_ssl
Ssl_cipher DHE-RSA-AES256-SHA 1
SHOW STATUS LIKE 'Ssl_server_not_before'; SHOW STATUS LIKE 'Ssl_server_not_before';
Variable_name Value Variable_name Value
Ssl_server_not_before Apr 25 14:55:05 2015 GMT Ssl_server_not_before Apr 25 14:55:05 2015 GMT
...@@ -2163,9 +2163,9 @@ Privat (Private Nutzung) Mobilfunk ...@@ -2163,9 +2163,9 @@ Privat (Private Nutzung) Mobilfunk
Warnings: Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous Warning 1052 Column 'kundentyp' in group statement is ambiguous
drop table t1; drop table t1;
SHOW STATUS LIKE 'Ssl_cipher'; SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
Variable_name Value have_ssl
Ssl_cipher DHE-RSA-AES256-SHA 1
select aes_decrypt('MySQL','adf'); select aes_decrypt('MySQL','adf');
aes_decrypt('MySQL','adf') aes_decrypt('MySQL','adf')
NULL NULL
......
...@@ -4,21 +4,21 @@ ...@@ -4,21 +4,21 @@
# try to connect with wrong '--ssl-ca' path : should fail # try to connect with wrong '--ssl-ca' path : should fail
ERROR 2026 (HY000): SSL connection error: SSL_CTX_set_default_verify_paths failed ERROR 2026 (HY000): SSL connection error: SSL_CTX_set_default_verify_paths failed
# try to connect with correct '--ssl-ca' path : should connect # try to connect with correct '--ssl-ca' path : should connect
Variable_name Value have_ssl
Ssl_cipher DHE-RSA-AES256-SHA 1
# #
# Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY # Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY
# PATH SUBSTITUTION # PATH SUBSTITUTION
# #
# try to connect with '--ssl-ca' option using tilde home directoy # try to connect with '--ssl-ca' option using tilde home directoy
# path substitution : should connect # path substitution : should connect
Variable_name Value have_ssl
Ssl_cipher DHE-RSA-AES256-SHA 1
# try to connect with '--ssl-key' option using tilde home directoy # try to connect with '--ssl-key' option using tilde home directoy
# path substitution : should connect # path substitution : should connect
Variable_name Value have_ssl
Ssl_cipher DHE-RSA-AES256-SHA 1
# try to connect with '--ssl-cert' option using tilde home directoy # try to connect with '--ssl-cert' option using tilde home directoy
# path substitution : should connect # path substitution : should connect
Variable_name Value have_ssl
Ssl_cipher DHE-RSA-AES256-SHA 1
SHOW STATUS LIKE 'Ssl_cipher'; SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
Variable_name Value have_ssl
Ssl_cipher DHE-RSA-AES256-SHA 1
SHOW STATUS LIKE 'Compression'; SHOW STATUS LIKE 'Compression';
Variable_name Value Variable_name Value
Compression ON Compression ON
...@@ -2160,9 +2160,9 @@ Privat (Private Nutzung) Mobilfunk ...@@ -2160,9 +2160,9 @@ Privat (Private Nutzung) Mobilfunk
Warnings: Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous Warning 1052 Column 'kundentyp' in group statement is ambiguous
drop table t1; drop table t1;
SHOW STATUS LIKE 'Ssl_cipher'; SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
Variable_name Value have_ssl
Ssl_cipher DHE-RSA-AES256-SHA 1
SHOW STATUS LIKE 'Compression'; SHOW STATUS LIKE 'Compression';
Variable_name Value Variable_name Value
Compression ON Compression ON
# connect with read timeout so SLEEP() should timeout # connect with read timeout so SLEEP() should timeout
# Check ssl turned on # Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher'; SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
Variable_name Value have_ssl
Ssl_cipher DHE-RSA-AES256-SHA 1
SELECT SLEEP(600); SELECT SLEEP(600);
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
...@@ -152,7 +152,7 @@ connection default; ...@@ -152,7 +152,7 @@ connection default;
let $wait_timeout= 10; let $wait_timeout= 10;
let $wait_condition= let $wait_condition=
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE DB = 'information_schema' AND COMMAND = 'Sleep' AND USER = 'ddicttestuser1'; WHERE DB = 'information_schema' AND COMMAND = 'Sleep' AND USER = 'ddicttestuser1' AND state='';
--source include/wait_condition.inc --source include/wait_condition.inc
--replace_result ENGINE=MyISAM "" ENGINE=Aria "" " PAGE_CHECKSUM=1" "" " PAGE_CHECKSUM=0" "" --replace_result ENGINE=MyISAM "" ENGINE=Aria "" " PAGE_CHECKSUM=1" "" " PAGE_CHECKSUM=0" ""
eval SHOW CREATE TABLE $table; eval SHOW CREATE TABLE $table;
......
set names utf8;
create table t1 (
a int,
b varchar(100) as (if(a,collation('й'),hex('ю')))
) character set koi8r;
insert t1 (a) values (0),(1);
select * from t1;
a b
0 D18E
1 utf8_general_ci
set names latin1;
select * from t1;
a b
0 D18E
1 utf8_general_ci
flush tables;
select * from t1;
a b
0 D18E
1 latin1_swedish_ci
set names koi8r;
select * from t1;
a b
0 D18E
1 latin1_swedish_ci
flush tables;
select * from t1;
a b
0 D18E
1 koi8r_general_ci
drop table t1;
#
# This shows a bug in vcol charset handling.
# vcol definition is stored in the connection charset when a table was created
# vcol is parsed in the connection charset when a table was opened
#
# this cannot be fixed without changing frm format, so we only
# fix it in 10.2.
#
set names utf8;
create table t1 (
a int,
b varchar(100) as (if(a,collation('й'),hex('ю')))
) character set koi8r;
insert t1 (a) values (0),(1);
select * from t1;
set names latin1;
select * from t1;
flush tables;
select * from t1;
set names koi8r;
select * from t1;
flush tables;
select * from t1;
drop table t1;
...@@ -134,8 +134,7 @@ drop table t1; ...@@ -134,8 +134,7 @@ drop table t1;
# verification of servers certificate by setting both ca certificate # verification of servers certificate by setting both ca certificate
# and ca path to NULL # and ca path to NULL
# #
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA --exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" 2>&1
--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1
--echo End of 5.0 tests --echo End of 5.0 tests
# #
...@@ -259,8 +258,7 @@ select 'is still running; no cipher request crashed the server' as result from d ...@@ -259,8 +258,7 @@ select 'is still running; no cipher request crashed the server' as result from d
GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509; GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509;
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
connect(con1,localhost,bug42158,,,,,SSL); connect(con1,localhost,bug42158,,,,,SSL);
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
SHOW STATUS LIKE 'Ssl_cipher';
disconnect con1; disconnect con1;
connection default; connection default;
DROP USER bug42158@localhost; DROP USER bug42158@localhost;
......
...@@ -935,3 +935,10 @@ drop table t1; ...@@ -935,3 +935,10 @@ drop table t1;
# Matthias # Matthias
# End of 4.1 tests # End of 4.1 tests
#
# MDEV-10318 unset params in --ps --embedded
#
--error ER_PARSE_ERROR,2031
select ?+1;
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
connect (ssl_con,localhost,root,,,,,SSL); connect (ssl_con,localhost,root,,,,,SSL);
# Check ssl turned on # Check ssl turned on
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
SHOW STATUS LIKE 'Ssl_cipher';
# Check ssl expiration # Check ssl expiration
SHOW STATUS LIKE 'Ssl_server_not_before'; SHOW STATUS LIKE 'Ssl_server_not_before';
...@@ -22,8 +21,7 @@ SHOW STATUS LIKE 'Ssl_server_not_after'; ...@@ -22,8 +21,7 @@ SHOW STATUS LIKE 'Ssl_server_not_after';
-- source include/common-tests.inc -- source include/common-tests.inc
# Check ssl turned on # Check ssl turned on
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
SHOW STATUS LIKE 'Ssl_cipher';
# #
# MDEV-7697 Client reports ERROR 2006 (MySQL server has gone away) or ERROR 2013 (Lost connection to MySQL server during query) while executing AES* functions under SSL # MDEV-7697 Client reports ERROR 2006 (MySQL server has gone away) or ERROR 2013 (Lost connection to MySQL server during query) while executing AES* functions under SSL
......
...@@ -7,11 +7,10 @@ ...@@ -7,11 +7,10 @@
--echo # try to connect with wrong '--ssl-ca' path : should fail --echo # try to connect with wrong '--ssl-ca' path : should fail
--error 1 --error 1
--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/wrong-cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1 --exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/wrong-cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" 2>&1
--echo # try to connect with correct '--ssl-ca' path : should connect --echo # try to connect with correct '--ssl-ca' path : should connect
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA --exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'"
--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'"
--echo # --echo #
--echo # Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY --echo # Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY
...@@ -22,15 +21,12 @@ ...@@ -22,15 +21,12 @@
--echo # try to connect with '--ssl-ca' option using tilde home directoy --echo # try to connect with '--ssl-ca' option using tilde home directoy
--echo # path substitution : should connect --echo # path substitution : should connect
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA --exec $MYSQL --ssl-ca$mysql_test_dir_path/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'"
--exec $MYSQL --ssl-ca$mysql_test_dir_path/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'"
--echo # try to connect with '--ssl-key' option using tilde home directoy --echo # try to connect with '--ssl-key' option using tilde home directoy
--echo # path substitution : should connect --echo # path substitution : should connect
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA --exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key$mysql_test_dir_path/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'"
--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key$mysql_test_dir_path/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'"
--echo # try to connect with '--ssl-cert' option using tilde home directoy --echo # try to connect with '--ssl-cert' option using tilde home directoy
--echo # path substitution : should connect --echo # path substitution : should connect
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA --exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert$mysql_test_dir_path/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'"
--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert$mysql_test_dir_path/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'"
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS); connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS);
# Check ssl turned on # Check ssl turned on
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on # Check compression turned on
SHOW STATUS LIKE 'Compression'; SHOW STATUS LIKE 'Compression';
...@@ -21,8 +20,7 @@ SHOW STATUS LIKE 'Compression'; ...@@ -21,8 +20,7 @@ SHOW STATUS LIKE 'Compression';
-- source include/common-tests.inc -- source include/common-tests.inc
# Check ssl turned on # Check ssl turned on
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on # Check compression turned on
SHOW STATUS LIKE 'Compression'; SHOW STATUS LIKE 'Compression';
......
...@@ -7,8 +7,7 @@ ...@@ -7,8 +7,7 @@
connect (ssl_con,localhost,root,,,,,SSL read_timeout=5); connect (ssl_con,localhost,root,,,,,SSL read_timeout=5);
--echo # Check ssl turned on --echo # Check ssl turned on
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
SHOW STATUS LIKE 'Ssl_cipher';
# --error CR_SERVER_LOST # --error CR_SERVER_LOST
--error 2013 --error 2013
......
...@@ -129,13 +129,32 @@ static int safe_print_str(const char *addr, int max_len) ...@@ -129,13 +129,32 @@ static int safe_print_str(const char *addr, int max_len)
#endif #endif
void my_safe_print_str(const char* val, int max_len) /*
Attempt to print a char * pointer as a string.
SYNOPSIS
Prints either until the end of string ('\0'), or max_len characters have
been printed.
RETURN VALUE
0 Pointer was within the heap address space.
The string was printed fully, or until the end of the heap address space.
1 Pointer is outside the heap address space. Printed as invalid.
NOTE
On some systems, we can have valid pointers outside the heap address space.
This is through the use of mmap inside malloc calls. When this function
returns 1, it does not mean 100% that the pointer is corrupted.
*/
int my_safe_print_str(const char* val, int max_len)
{ {
char *heap_end; char *heap_end;
#ifdef __linux__ #ifdef __linux__
// Try and make use of /proc filesystem to safely print memory contents.
if (!safe_print_str(val, max_len)) if (!safe_print_str(val, max_len))
return; return 0;
#endif #endif
heap_end= (char*) sbrk(0); heap_end= (char*) sbrk(0);
...@@ -143,12 +162,14 @@ void my_safe_print_str(const char* val, int max_len) ...@@ -143,12 +162,14 @@ void my_safe_print_str(const char* val, int max_len)
if (!PTR_SANE(val)) if (!PTR_SANE(val))
{ {
my_safe_printf_stderr("%s", "is an invalid pointer"); my_safe_printf_stderr("%s", "is an invalid pointer");
return; return 1;
} }
for (; max_len && PTR_SANE(val) && *val; --max_len) for (; max_len && PTR_SANE(val) && *val; --max_len)
my_write_stderr((val++), 1); my_write_stderr((val++), 1);
my_safe_printf_stderr("%s", "\n"); my_safe_printf_stderr("%s", "\n");
return 0;
} }
#if defined(HAVE_PRINTSTACK) #if defined(HAVE_PRINTSTACK)
...@@ -727,7 +748,7 @@ void my_write_core(int unused) ...@@ -727,7 +748,7 @@ void my_write_core(int unused)
} }
void my_safe_print_str(const char *val, int len) int my_safe_print_str(const char *val, int len)
{ {
__try __try
{ {
...@@ -737,6 +758,7 @@ void my_safe_print_str(const char *val, int len) ...@@ -737,6 +758,7 @@ void my_safe_print_str(const char *val, int len)
{ {
my_safe_printf_stderr("%s", "is an invalid string pointer"); my_safe_printf_stderr("%s", "is an invalid string pointer");
} }
return 0;
} }
#endif /*__WIN__*/ #endif /*__WIN__*/
......
...@@ -65,6 +65,12 @@ extern "C" sig_handler handle_fatal_signal(int sig) ...@@ -65,6 +65,12 @@ extern "C" sig_handler handle_fatal_signal(int sig)
#ifdef HAVE_STACKTRACE #ifdef HAVE_STACKTRACE
THD *thd; THD *thd;
#endif #endif
/*
This flag remembers if the query pointer was found invalid.
We will try and print the query at the end of the signal handler, in case
we're wrong.
*/
bool print_invalid_query_pointer= false;
if (segfaulted) if (segfaulted)
{ {
...@@ -201,7 +207,12 @@ extern "C" sig_handler handle_fatal_signal(int sig) ...@@ -201,7 +207,12 @@ extern "C" sig_handler handle_fatal_signal(int sig)
"Some pointers may be invalid and cause the dump to abort.\n"); "Some pointers may be invalid and cause the dump to abort.\n");
my_safe_printf_stderr("Query (%p): ", thd->query()); my_safe_printf_stderr("Query (%p): ", thd->query());
my_safe_print_str(thd->query(), MY_MIN(65536U, thd->query_length())); if (my_safe_print_str(thd->query(), MY_MIN(65536U, thd->query_length())))
{
// Query was found invalid. We will try to print it at the end.
print_invalid_query_pointer= true;
}
my_safe_printf_stderr("\nConnection ID (thread ID): %lu\n", my_safe_printf_stderr("\nConnection ID (thread ID): %lu\n",
(ulong) thd->thread_id); (ulong) thd->thread_id);
my_safe_printf_stderr("Status: %s\n\n", kreason); my_safe_printf_stderr("Status: %s\n\n", kreason);
...@@ -265,6 +276,16 @@ extern "C" sig_handler handle_fatal_signal(int sig) ...@@ -265,6 +276,16 @@ extern "C" sig_handler handle_fatal_signal(int sig)
"\"mlockall\" bugs.\n"); "\"mlockall\" bugs.\n");
} }
if (print_invalid_query_pointer)
{
my_safe_printf_stderr(
"\nWe think the query pointer is invalid, but we will try "
"to print it anyway. \n"
"Query: ");
my_write_stderr(thd->query(), MY_MIN(65536U, thd->query_length()));
my_safe_printf_stderr("\n\n");
}
#ifdef HAVE_WRITE_CORE #ifdef HAVE_WRITE_CORE
if (test_flags & TEST_CORE_ON_SIGNAL) if (test_flags & TEST_CORE_ON_SIGNAL)
{ {
......
...@@ -767,7 +767,7 @@ bool JOUTSTR::Escape(const char *s) ...@@ -767,7 +767,7 @@ bool JOUTSTR::Escape(const char *s)
{ {
WriteChr('"'); WriteChr('"');
for (unsigned int i = 0; i < strlen(s); i++) for (unsigned int i = 0; s[i]; i++)
switch (s[i]) { switch (s[i]) {
case '"': case '"':
case '\\': case '\\':
...@@ -816,7 +816,7 @@ bool JOUTFILE::Escape(const char *s) ...@@ -816,7 +816,7 @@ bool JOUTFILE::Escape(const char *s)
// This is temporary // This is temporary
fputc('"', Stream); fputc('"', Stream);
for (unsigned int i = 0; i < strlen(s); i++) for (unsigned int i = 0; s[i]; i++)
switch (s[i]) { switch (s[i]) {
case '"': fputs("\\\"", Stream); break; case '"': fputs("\\\"", Stream); break;
case '\\': fputs("\\\\", Stream); break; case '\\': fputs("\\\\", Stream); break;
......
...@@ -4837,10 +4837,20 @@ buf_all_freed_instance( ...@@ -4837,10 +4837,20 @@ buf_all_freed_instance(
if (UNIV_LIKELY_NULL(block)) { if (UNIV_LIKELY_NULL(block)) {
if (block->page.key_version == 0) { if (block->page.key_version == 0) {
fprintf(stderr, fil_space_t* space = fil_space_get(block->page.space);
"Page %lu %lu still fixed or dirty\n", ib_logf(IB_LOG_LEVEL_ERROR,
"Page %lu %lu still fixed or dirty.",
(ulong) block->page.space, (ulong) block->page.space,
(ulong) block->page.offset); (ulong) block->page.offset);
ib_logf(IB_LOG_LEVEL_ERROR,
"Page oldest_modification %lu fix_count %d io_fix %d.",
block->page.oldest_modification,
block->page.buf_fix_count,
buf_page_get_io_fix(&block->page));
ib_logf(IB_LOG_LEVEL_ERROR,
"Page space_id %lu name %s.",
(ulong)block->page.space,
(space && space->name) ? space->name : "NULL");
ut_error; ut_error;
} }
} }
......
...@@ -1395,6 +1395,28 @@ fil_space_free( ...@@ -1395,6 +1395,28 @@ fil_space_free(
return(TRUE); return(TRUE);
} }
/*******************************************************************//**
Returns a pointer to the file_space_t that is in the memory cache
associated with a space id.
@return file_space_t pointer, NULL if space not found */
fil_space_t*
fil_space_get(
/*==========*/
ulint id) /*!< in: space id */
{
fil_space_t* space;
ut_ad(fil_system);
mutex_enter(&fil_system->mutex);
space = fil_space_get_by_id(id);
mutex_exit(&fil_system->mutex);
return (space);
}
/*******************************************************************//** /*******************************************************************//**
Returns a pointer to the file_space_t that is in the memory cache Returns a pointer to the file_space_t that is in the memory cache
associated with a space id. The caller must lock fil_system->mutex. associated with a space id. The caller must lock fil_system->mutex.
......
...@@ -1261,6 +1261,14 @@ fil_space_flags( ...@@ -1261,6 +1261,14 @@ fil_space_flags(
/*===========*/ /*===========*/
fil_space_t* space); /*!< in: space */ fil_space_t* space); /*!< in: space */
/*******************************************************************//**
Returns a pointer to the file_space_t that is in the memory cache
associated with a space id.
@return file_space_t pointer, NULL if space not found */
fil_space_t*
fil_space_get(
/*==========*/
ulint id); /*!< in: space id */
#endif /* !UNIV_INNOCHECKSUM */ #endif /* !UNIV_INNOCHECKSUM */
/****************************************************************//** /****************************************************************//**
......
This diff is collapsed.
This diff is collapsed.
...@@ -1265,6 +1265,14 @@ fil_user_tablespace_restore_page( ...@@ -1265,6 +1265,14 @@ fil_user_tablespace_restore_page(
ulint page_no); /* in: page_no to obtain from double ulint page_no); /* in: page_no to obtain from double
write buffer */ write buffer */
/*******************************************************************//**
Returns a pointer to the file_space_t that is in the memory cache
associated with a space id.
@return file_space_t pointer, NULL if space not found */
fil_space_t*
fil_space_get(
/*==========*/
ulint id); /*!< in: space id */
#endif /* !UNIV_INNOCHECKSUM */ #endif /* !UNIV_INNOCHECKSUM */
/************************************************************************* /*************************************************************************
......
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