From 68889c8dfa4a1f580a611c174d0ef807cb87bbad Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 30 Oct 2018 19:04:54 +0100 Subject: Make mysqltest to use --ps-protocol more use prepared statements for everything that server supports with the exception of CALL (for now). Fix discovered test failures and bugs. tests: * PROCESSLIST shows Execute state, not Query * SHOW STATUS increments status variables more than in text protocol * multi-statements should be avoided (see tests with a wrong delimiter) * performance_schema events have different names in --ps-protocol mysqltest.cc: * make sure run_query_stmt() doesn't crash if there's no active connection (in wait_until_connected_again.inc) sql_acl.cc: * extract the functionality of getting the user for SHOW GRANTS from check_show_access(), so that mysql_test_show_grants() could generate the correct column names in the prepare step sql_class.cc: * result->prepare() can fail, don't ignore its return value * use the correct metadata when creating a column for ANALYZE SELECT. The actual value is always FLOAT(4,2), but the column was created as FLOAT(4,10), so --ps and text protocols were using different number of decimals. sql_parse.cc: * discard profiling for SHOW PROFILE. In text protocol it's done in prepare_schema_table(), but in --ps it is called on prepare only, so nothing was discarding profiling during execute. * move the permission checking code for SHOW CREATE VIEW to mysqld_show_create_get_fields(), so that it would be called during prepare step too. * only set sel_result when it was created here and needs to be destroyed in the same block. Avoid destroying lex->result. * use the correct number of tables in check_show_access(). Saying "as many as possible" doesn't work when first_not_own_table isn't set yet. sql_prepare.cc: * use correct user name for SHOW GRANTS columns * don't ignore verbose flag for SHOW SLAVE STATUS * support preparing REVOKE ALL and ROLLBACK TO SAVEPOINT * don't ignore errors from thd->prepare_explain_fields() sql_show.cc: * check grants for SHOW CREATE VIEW here, not in mysql_execute_command sql_tvc.cc: * allocate Type_holder and items in the correct arena sql_view.cc: * use the correct function to check privileges. Old code was doing check_access() for thd->security_ctx, which is invoker's sctx, not definer's sctx. Hide various view related errors from the invoker. --- mysql-test/main/kill_processlist-6619.test | 2 ++ mysql-test/main/log_tables.test | 2 ++ mysql-test/main/mysql_client_test.result | 8 ++--- mysql-test/main/old-mode.test | 3 +- mysql-test/main/partition.result | 2 +- mysql-test/main/partition.test | 2 +- mysql-test/main/show_check.test | 12 ++++++++ mysql-test/main/show_explain_ps.result | 7 ++--- mysql-test/main/show_explain_ps.test | 17 ++++++----- mysql-test/main/sp-ucs2.result | 34 +++++++++------------- mysql-test/main/sp-ucs2.test | 16 +++++----- mysql-test/main/sp.result | 2 +- mysql-test/main/sp.test | 2 +- mysql-test/main/sp_notembedded.result | 2 +- mysql-test/main/sp_notembedded.test | 2 +- mysql-test/main/sp_trans.result | 2 +- mysql-test/main/sp_trans.test | 2 +- mysql-test/main/subselect_sj_mat.test | 2 ++ mysql-test/main/temp_table.test | 2 ++ mysql-test/main/tmp_table_count-7586.test | 4 +++ mysql-test/main/userstat.result | 12 +++++--- mysql-test/main/userstat.test | 7 +++-- mysql-test/main/view.result | 5 ---- mysql-test/main/view.test | 6 +++- .../suite/funcs_1/datadict/processlist_priv.inc | 13 +++++++++ .../suite/funcs_1/datadict/processlist_val.inc | 7 +++++ mysql-test/suite/handler/ps.test | 2 ++ .../suite/innodb/t/innodb-corrupted-table.test | 1 + .../sys_vars/t/max_prepared_stmt_count_func.test | 2 +- .../suite/sys_vars/t/sql_buffer_result_func.test | 10 +++++++ mysql-test/suite/vcol/t/wrong_arena.test | 2 ++ 31 files changed, 126 insertions(+), 66 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/main/kill_processlist-6619.test b/mysql-test/main/kill_processlist-6619.test index d984924f9db..c272e68a877 100644 --- a/mysql-test/main/kill_processlist-6619.test +++ b/mysql-test/main/kill_processlist-6619.test @@ -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; diff --git a/mysql-test/main/log_tables.test b/mysql-test/main/log_tables.test index a4158ba6a24..f822ec8d758 100644 --- a/mysql-test/main/log_tables.test +++ b/mysql-test/main/log_tables.test @@ -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" diff --git a/mysql-test/main/mysql_client_test.result b/mysql-test/main/mysql_client_test.result index 6f65979517b..6ecf03946ab 100644 --- a/mysql-test/main/mysql_client_test.result +++ b/mysql-test/main/mysql_client_test.result @@ -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 diff --git a/mysql-test/main/old-mode.test b/mysql-test/main/old-mode.test index d7e8ce8ee55..e092ee78a2e 100644 --- a/mysql-test/main/old-mode.test +++ b/mysql-test/main/old-mode.test @@ -22,7 +22,8 @@ drop table t1,t2; --replace_column 1 3 6