Commit a117dfb0 authored by Sergei Golubchik's avatar Sergei Golubchik

fixes for the status_user.test in ps protocol

sql/sql_class.cc:
  reset userstat_running after the data were colleced to prevent double accounting.
  don't assert for COM_QUERY, many more are possible.
  don't update_stats() here, it's too late, lex->sql_command may be already reset
sql/sql_parse.cc:
  update_stats() here, when the current arena is still valid
parent 5f47217e
......@@ -127,20 +127,40 @@ test t1 6 13 13
show index_statistics;
Table_schema Table_name Index_name Rows_read
test t1 PRIMARY 2
select TOTAL_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;
TOTAL_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
1 0 6 2 1 8 5 3 11 9 10 2 0 0 0 1
select TOTAL_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;
TOTAL_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
1 0 6 2 1 8 5 3 11 9 10 2 0 0 0 1
select TOTAL_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;;
TOTAL_CONNECTIONS 1
CONCURRENT_CONNECTIONS 0
ROWS_READ 6
ROWS_SENT 2
ROWS_DELETED 1
ROWS_INSERTED 8
ROWS_UPDATED 5
SELECT_COMMANDS 3
UPDATE_COMMANDS 11
OTHER_COMMANDS 9
COMMIT_TRANSACTIONS 10
ROLLBACK_TRANSACTIONS 2
DENIED_CONNECTIONS 0
LOST_CONNECTIONS 0
ACCESS_DENIED 0
EMPTY_QUERIES 1
select TOTAL_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;;
TOTAL_CONNECTIONS 1
CONCURRENT_CONNECTIONS 0
ROWS_READ 6
ROWS_SENT 2
ROWS_DELETED 1
ROWS_INSERTED 8
ROWS_UPDATED 5
SELECT_COMMANDS 3
UPDATE_COMMANDS 11
OTHER_COMMANDS 9
COMMIT_TRANSACTIONS 10
ROLLBACK_TRANSACTIONS 2
DENIED_CONNECTIONS 0
LOST_CONNECTIONS 0
ACCESS_DENIED 0
EMPTY_QUERIES 1
flush table_statistics;
flush index_statistics;
select * from information_schema.index_statistics;
......
......@@ -161,9 +161,9 @@ SELECT * FROM mysql.procs_priv;
Host Db User Routine_name Routine_type Grantor Proc_priv Timestamp
SELECT upgrade_alter_func();
ERROR HY000: The user specified as a definer ('create_rout_db'@'localhost') does not exist
USE bug42217_db;
DROP FUNCTION upgrade_del_func;
DROP FUNCTION upgrade_alter_func;
USE test;
DROP FUNCTION bug42217_db.upgrade_del_func;
DROP FUNCTION bug42217_db.upgrade_alter_func;
DROP DATABASE bug42217_db;
DROP USER 'create_rout_db'@'localhost';
call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396");
......
......@@ -205,9 +205,9 @@ SELECT upgrade_alter_func();
disconnect create_rout_db_master;
disconnect create_rout_db_slave;
connection master;
USE bug42217_db;
DROP FUNCTION upgrade_del_func;
DROP FUNCTION upgrade_alter_func;
USE test;
DROP FUNCTION bug42217_db.upgrade_del_func;
DROP FUNCTION bug42217_db.upgrade_alter_func;
DROP DATABASE bug42217_db;
DROP USER 'create_rout_db'@'localhost';
......
......@@ -66,16 +66,8 @@ select * from information_schema.index_statistics;
select * from information_schema.table_statistics;
show table_statistics;
show index_statistics;
select TOTAL_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, 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, 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, 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;
flush table_statistics;
flush index_statistics;
select * from information_schema.index_statistics;
......
......@@ -921,9 +921,6 @@ void THD::update_stats(void)
/* sql_command == SQLCOM_END in case of parse errors or quit */
if (lex->sql_command != SQLCOM_END)
{
/* The replication thread has the COM_CONNECT command */
DBUG_ASSERT(command == COM_QUERY || command == COM_CONNECT);
/* A SQL query. */
if (lex->sql_command == SQLCOM_SELECT)
select_commands++;
......@@ -959,9 +956,8 @@ void THD::update_all_stats()
status_var_add(status_var.cpu_time, cpu_time);
status_var_add(status_var.busy_time, busy_time);
/* Updates THD stats and the global user stats. */
update_stats();
update_global_user_stats(this, TRUE, save_time);
userstat_running= 0;
}
......
......@@ -5040,6 +5040,7 @@ create_sp_error:
break;
}
thd_proc_info(thd, "query end");
thd->update_stats();
/*
Binlog-related cleanup:
......
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