diff options
author | Sergei Golubchik <serg@mariadb.org> | 2014-08-25 19:08:55 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2014-10-11 18:53:05 +0200 |
commit | 3182938d22b705d616b83d83dd72c31f24bc365f (patch) | |
tree | e19a2418f4ad49ddcc7db11ac300d9d45e44f455 /sql | |
parent | db8af31831beb949dfcf7675b3c6392dc52dc38c (diff) | |
download | mariadb-git-3182938d22b705d616b83d83dd72c31f24bc365f.tar.gz |
move userstat tables to a plugin
Diffstat (limited to 'sql')
-rw-r--r-- | sql/handler.h | 4 | ||||
-rw-r--r-- | sql/innodb_priv.h | 1 | ||||
-rw-r--r-- | sql/sql_acl.cc | 5 | ||||
-rw-r--r-- | sql/sql_acl.h | 8 | ||||
-rw-r--r-- | sql/sql_parse.cc | 4 | ||||
-rw-r--r-- | sql/sql_parse.h | 13 | ||||
-rw-r--r-- | sql/sql_show.cc | 347 |
7 files changed, 9 insertions, 373 deletions
diff --git a/sql/handler.h b/sql/handler.h index 4c7648b390c..69f7481e2c6 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -720,7 +720,6 @@ enum enum_schema_tables SCH_ALL_PLUGINS, SCH_APPLICABLE_ROLES, SCH_CHARSETS, - SCH_CLIENT_STATS, SCH_COLLATIONS, SCH_COLLATION_CHARACTER_SET_APPLICABILITY, SCH_COLUMNS, @@ -732,7 +731,6 @@ enum enum_schema_tables SCH_FILES, SCH_GLOBAL_STATUS, SCH_GLOBAL_VARIABLES, - SCH_INDEX_STATS, SCH_KEY_CACHES, SCH_KEY_COLUMN_USAGE, SCH_OPEN_TABLES, @@ -754,10 +752,8 @@ enum enum_schema_tables SCH_TABLE_CONSTRAINTS, SCH_TABLE_NAMES, SCH_TABLE_PRIVILEGES, - SCH_TABLE_STATS, SCH_TRIGGERS, SCH_USER_PRIVILEGES, - SCH_USER_STATS, SCH_VIEWS }; diff --git a/sql/innodb_priv.h b/sql/innodb_priv.h index b9e471b3b13..ec85aa352f8 100644 --- a/sql/innodb_priv.h +++ b/sql/innodb_priv.h @@ -25,7 +25,6 @@ class THD; int get_quote_char_for_identifier(THD *thd, const char *name, uint length); bool schema_table_store_record(THD *thd, TABLE *table); void localtime_to_TIME(MYSQL_TIME *to, struct tm *from); -bool check_global_access(THD *thd, ulong want_access, bool no_errors=false); uint strconvert(CHARSET_INFO *from_cs, const char *from, uint from_length, CHARSET_INFO *to_cs, char *to, uint to_length, uint *errors); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index cc2a2549daf..3d3c0bc835a 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -10206,6 +10206,11 @@ applicable_roles_insert(ACL_USER_BASE *grantee, ACL_ROLE *role, void *ptr) return 0; } +#else +bool check_grant(THD *, ulong, TABLE_LIST *, bool, uint, bool) +{ + return 0; +} #endif /*NO_EMBEDDED_ACCESS_CHECKS */ int fill_schema_enabled_roles(THD *thd, TABLE_LIST *tables, COND *cond) diff --git a/sql/sql_acl.h b/sql/sql_acl.h index 7833fb8736b..28eb7a7f933 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -235,6 +235,10 @@ bool check_grant_all_columns(THD *thd, ulong want_access, bool check_grant_routine(THD *thd, ulong want_access, TABLE_LIST *procs, bool is_proc, bool no_error); bool check_grant_db(THD *thd,const char *db); +bool check_global_access(THD *thd, ulong want_access, bool no_errors= false); +bool check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv, + GRANT_INTERNAL_INFO *grant_internal_info, + bool dont_check_global_grants, bool no_errors); ulong get_table_grant(THD *thd, TABLE_LIST *table); ulong get_column_grant(THD *thd, GRANT_INFO *grant, const char *db_name, const char *table_name, @@ -263,10 +267,6 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond); int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond); int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr); int check_password_policy(String *password); -#ifdef NO_EMBEDDED_ACCESS_CHECKS -#define check_grant(A,B,C,D,E,F) 0 -#define check_grant_db(A,B) 0 -#endif /** Result of an access check for an internal schema or table. diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 452252788a9..d8906b2d578 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2115,10 +2115,6 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident, thd->profiling.discard_current_query(); #endif break; - case SCH_USER_STATS: - case SCH_CLIENT_STATS: - if (check_global_access(thd, SUPER_ACL | PROCESS_ACL, true)) - DBUG_RETURN(1); default: break; } diff --git a/sql/sql_parse.h b/sql/sql_parse.h index 3bbddc8ba4d..da024a5e746 100644 --- a/sql/sql_parse.h +++ b/sql/sql_parse.h @@ -148,15 +148,6 @@ inline bool check_identifier_name(LEX_STRING *str) return check_identifier_name(str, NAME_CHAR_LEN, 0, ""); } - -/* - check_access() is needed for the connect engine. - It cannot be inlined - it must be exported. -*/ -bool check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv, - GRANT_INTERNAL_INFO *grant_internal_info, - bool dont_check_global_grants, bool no_errors); - #ifndef NO_EMBEDDED_ACCESS_CHECKS bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables); bool check_single_table_access(THD *thd, ulong privilege, @@ -194,8 +185,4 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables, { return false; } #endif /*NO_EMBEDDED_ACCESS_CHECKS*/ -/* These were under the INNODB_COMPATIBILITY_HOOKS */ - -bool check_global_access(THD *thd, ulong want_access, bool no_errors= false); - #endif /* SQL_PARSE_INCLUDED */ diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 07ddb3fbea7..fcca91c456b 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3125,267 +3125,6 @@ end: DBUG_RETURN(res); } -/* - Write result to network for SHOW USER_STATISTICS - - SYNOPSIS - send_user_stats - all_user_stats - values to return - table - I_S table - - RETURN - 0 - OK - 1 - error -*/ - -int send_user_stats(THD* thd, HASH *all_user_stats, TABLE *table) -{ - DBUG_ENTER("send_user_stats"); - - for (uint i= 0; i < all_user_stats->records; i++) - { - uint j= 0; - USER_STATS *user_stats= (USER_STATS*) my_hash_element(all_user_stats, i); - - table->field[j++]->store(user_stats->user, user_stats->user_name_length, - system_charset_info); - table->field[j++]->store((longlong)user_stats->total_connections,TRUE); - table->field[j++]->store((longlong)user_stats->concurrent_connections, TRUE); - table->field[j++]->store((longlong)user_stats->connected_time, TRUE); - table->field[j++]->store((double)user_stats->busy_time); - table->field[j++]->store((double)user_stats->cpu_time); - table->field[j++]->store((longlong)user_stats->bytes_received, TRUE); - table->field[j++]->store((longlong)user_stats->bytes_sent, TRUE); - table->field[j++]->store((longlong)user_stats->binlog_bytes_written, TRUE); - table->field[j++]->store((longlong)user_stats->rows_read, TRUE); - table->field[j++]->store((longlong)user_stats->rows_sent, TRUE); - table->field[j++]->store((longlong)user_stats->rows_deleted, TRUE); - table->field[j++]->store((longlong)user_stats->rows_inserted, TRUE); - table->field[j++]->store((longlong)user_stats->rows_updated, TRUE); - table->field[j++]->store((longlong)user_stats->select_commands, TRUE); - table->field[j++]->store((longlong)user_stats->update_commands, TRUE); - table->field[j++]->store((longlong)user_stats->other_commands, TRUE); - table->field[j++]->store((longlong)user_stats->commit_trans, TRUE); - table->field[j++]->store((longlong)user_stats->rollback_trans, TRUE); - table->field[j++]->store((longlong)user_stats->denied_connections, TRUE); - table->field[j++]->store((longlong)user_stats->lost_connections, TRUE); - table->field[j++]->store((longlong)user_stats->access_denied_errors, TRUE); - table->field[j++]->store((longlong)user_stats->empty_queries, TRUE); - table->field[j++]->store((longlong)user_stats->max_statement_time_exceeded, TRUE); - if (schema_table_store_record(thd, table)) - { - DBUG_PRINT("error", ("store record error")); - DBUG_RETURN(1); - } - } - DBUG_RETURN(0); -} - -/* - Process SHOW USER_STATISTICS - - SYNOPSIS - mysqld_show_user_stats - thd - current thread - wild - limit results to the entry for this user - with_roles - when true, display role for mapped users - - RETURN - 0 - OK - 1 - error -*/ - -int fill_schema_user_stats(THD* thd, TABLE_LIST* tables, COND* cond) -{ - TABLE *table= tables->table; - int result; - DBUG_ENTER("fill_schema_user_stats"); - - if (check_global_access(thd, SUPER_ACL | PROCESS_ACL, true)) - DBUG_RETURN(0); - - /* - Iterates through all the global stats and sends them to the client. - Pattern matching on the client IP is supported. - */ - - mysql_mutex_lock(&LOCK_global_user_client_stats); - result= send_user_stats(thd, &global_user_stats, table) != 0; - mysql_mutex_unlock(&LOCK_global_user_client_stats); - - DBUG_PRINT("exit", ("result: %d", result)); - DBUG_RETURN(result); -} - -/* - Process SHOW CLIENT_STATISTICS - - SYNOPSIS - mysqld_show_client_stats - thd - current thread - wild - limit results to the entry for this client - - RETURN - 0 - OK - 1 - error -*/ - -int fill_schema_client_stats(THD* thd, TABLE_LIST* tables, COND* cond) -{ - TABLE *table= tables->table; - int result; - DBUG_ENTER("fill_schema_client_stats"); - - if (check_global_access(thd, SUPER_ACL | PROCESS_ACL, true)) - DBUG_RETURN(0); - - /* - Iterates through all the global stats and sends them to the client. - Pattern matching on the client IP is supported. - */ - - mysql_mutex_lock(&LOCK_global_user_client_stats); - result= send_user_stats(thd, &global_client_stats, table) != 0; - mysql_mutex_unlock(&LOCK_global_user_client_stats); - - DBUG_PRINT("exit", ("result: %d", result)); - DBUG_RETURN(result); -} - - -/* Fill information schema table with table statistics */ - -int fill_schema_table_stats(THD *thd, TABLE_LIST *tables, COND *cond) -{ - TABLE *table= tables->table; - DBUG_ENTER("fill_schema_table_stats"); - - mysql_mutex_lock(&LOCK_global_table_stats); - for (uint i= 0; i < global_table_stats.records; i++) - { - char *end_of_schema; - TABLE_STATS *table_stats= - (TABLE_STATS*)my_hash_element(&global_table_stats, i); - TABLE_LIST tmp_table; - size_t schema_length, table_name_length; - - end_of_schema= strend(table_stats->table); - schema_length= (size_t) (end_of_schema - table_stats->table); - table_name_length= strlen(table_stats->table + schema_length + 1); - - bzero((char*) &tmp_table,sizeof(tmp_table)); - tmp_table.db= table_stats->table; - tmp_table.table_name= end_of_schema+1; - tmp_table.grant.privilege= 0; - if (check_access(thd, SELECT_ACL, tmp_table.db, - &tmp_table.grant.privilege, NULL, 0, 1) || - check_grant(thd, SELECT_ACL, &tmp_table, 1, UINT_MAX, - 1)) - continue; - - table->field[0]->store(table_stats->table, schema_length, - system_charset_info); - table->field[1]->store(table_stats->table + schema_length+1, - table_name_length, system_charset_info); - table->field[2]->store((longlong)table_stats->rows_read, TRUE); - table->field[3]->store((longlong)table_stats->rows_changed, TRUE); - table->field[4]->store((longlong)table_stats->rows_changed_x_indexes, - TRUE); - if (schema_table_store_record(thd, table)) - { - mysql_mutex_unlock(&LOCK_global_table_stats); - DBUG_RETURN(1); - } - } - mysql_mutex_unlock(&LOCK_global_table_stats); - DBUG_RETURN(0); -} - - -/* Fill information schema table with index statistics */ - -int fill_schema_index_stats(THD *thd, TABLE_LIST *tables, COND *cond) -{ - TABLE *table= tables->table; - DBUG_ENTER("fill_schema_index_stats"); - - mysql_mutex_lock(&LOCK_global_index_stats); - for (uint i= 0; i < global_index_stats.records; i++) - { - INDEX_STATS *index_stats = - (INDEX_STATS*) my_hash_element(&global_index_stats, i); - TABLE_LIST tmp_table; - char *index_name; - size_t schema_name_length, table_name_length, index_name_length; - - bzero((char*) &tmp_table,sizeof(tmp_table)); - tmp_table.db= index_stats->index; - tmp_table.table_name= strend(index_stats->index)+1; - tmp_table.grant.privilege= 0; - if (check_access(thd, SELECT_ACL, tmp_table.db, - &tmp_table.grant.privilege, NULL, 0, 1) || - check_grant(thd, SELECT_ACL, &tmp_table, 1, UINT_MAX, 1)) - continue; - - index_name= strend(tmp_table.table_name)+1; - schema_name_length= (tmp_table.table_name - index_stats->index) -1; - table_name_length= (index_name - tmp_table.table_name)-1; - index_name_length= (index_stats->index_name_length - schema_name_length - - table_name_length - 3); - - table->field[0]->store(tmp_table.db, schema_name_length, - system_charset_info); - table->field[1]->store(tmp_table.table_name, table_name_length, - system_charset_info); - table->field[2]->store(index_name, index_name_length, system_charset_info); - table->field[3]->store((longlong)index_stats->rows_read, TRUE); - - if (schema_table_store_record(thd, table)) - { - mysql_mutex_unlock(&LOCK_global_index_stats); - DBUG_RETURN(1); - } - } - mysql_mutex_unlock(&LOCK_global_index_stats); - DBUG_RETURN(0); -} - -static int reset_schema_user_stats() -{ - mysql_mutex_lock(&LOCK_global_user_client_stats); - free_global_user_stats(); - init_global_user_stats(); - mysql_mutex_unlock(&LOCK_global_user_client_stats); - return 0; -} - -static int reset_schema_client_stats() -{ - mysql_mutex_lock(&LOCK_global_user_client_stats); - free_global_client_stats(); - init_global_client_stats(); - mysql_mutex_unlock(&LOCK_global_user_client_stats); - return 0; -} - -static int reset_schema_table_stats() -{ - mysql_mutex_lock(&LOCK_global_table_stats); - free_global_table_stats(); - init_global_table_stats(); - mysql_mutex_unlock(&LOCK_global_table_stats); - return 0; -} - -static int reset_schema_index_stats() -{ - mysql_mutex_lock(&LOCK_global_index_stats); - free_global_index_stats(); - init_global_index_stats(); - mysql_mutex_unlock(&LOCK_global_index_stats); - return 0; -} - /* collect status for all running threads */ void calc_sum_of_all_status(STATUS_VAR *to) @@ -7312,84 +7051,6 @@ struct schema_table_ref ST_SCHEMA_TABLE *schema_table; }; -ST_FIELD_INFO user_stats_fields_info[]= -{ - {"USER", USERNAME_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, "User", SKIP_OPEN_TABLE}, - {"TOTAL_CONNECTIONS", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Total_connections",SKIP_OPEN_TABLE}, - {"CONCURRENT_CONNECTIONS", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Concurrent_connections",SKIP_OPEN_TABLE}, - {"CONNECTED_TIME", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Connected_time",SKIP_OPEN_TABLE}, - {"BUSY_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_DOUBLE, 0, 0, "Busy_time",SKIP_OPEN_TABLE}, - {"CPU_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_DOUBLE, 0, 0, "Cpu_time",SKIP_OPEN_TABLE}, - {"BYTES_RECEIVED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Bytes_received",SKIP_OPEN_TABLE}, - {"BYTES_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Bytes_sent",SKIP_OPEN_TABLE}, - {"BINLOG_BYTES_WRITTEN", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Binlog_bytes_written",SKIP_OPEN_TABLE}, - {"ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_read",SKIP_OPEN_TABLE}, - {"ROWS_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_sent",SKIP_OPEN_TABLE}, - {"ROWS_DELETED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_deleted",SKIP_OPEN_TABLE}, - {"ROWS_INSERTED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_inserted",SKIP_OPEN_TABLE}, - {"ROWS_UPDATED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_updated",SKIP_OPEN_TABLE}, - {"SELECT_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Select_commands",SKIP_OPEN_TABLE}, - {"UPDATE_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Update_commands",SKIP_OPEN_TABLE}, - {"OTHER_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Other_commands",SKIP_OPEN_TABLE}, - {"COMMIT_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Commit_transactions",SKIP_OPEN_TABLE}, - {"ROLLBACK_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rollback_transactions",SKIP_OPEN_TABLE}, - {"DENIED_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Denied_connections",SKIP_OPEN_TABLE}, - {"LOST_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Lost_connections",SKIP_OPEN_TABLE}, - {"ACCESS_DENIED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Access_denied",SKIP_OPEN_TABLE}, - {"EMPTY_QUERIES", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Empty_queries",SKIP_OPEN_TABLE}, - {"MAX_STATEMENT_TIME_EXCEEDED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Max_statement_time_exceeded",SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} -}; - -ST_FIELD_INFO client_stats_fields_info[]= -{ - {"CLIENT", LIST_PROCESS_HOST_LEN, MYSQL_TYPE_STRING, 0, 0, "Client",SKIP_OPEN_TABLE}, - {"TOTAL_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Total_connections",SKIP_OPEN_TABLE}, - {"CONCURRENT_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Concurrent_connections",SKIP_OPEN_TABLE}, - {"CONNECTED_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Connected_time",SKIP_OPEN_TABLE}, - {"BUSY_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_DOUBLE, 0, 0, "Busy_time",SKIP_OPEN_TABLE}, - {"CPU_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_DOUBLE, 0, 0, "Cpu_time",SKIP_OPEN_TABLE}, - {"BYTES_RECEIVED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Bytes_received",SKIP_OPEN_TABLE}, - {"BYTES_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Bytes_sent",SKIP_OPEN_TABLE}, - {"BINLOG_BYTES_WRITTEN", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Binlog_bytes_written",SKIP_OPEN_TABLE}, - {"ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_read",SKIP_OPEN_TABLE}, - {"ROWS_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_sent",SKIP_OPEN_TABLE}, - {"ROWS_DELETED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_deleted",SKIP_OPEN_TABLE}, - {"ROWS_INSERTED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_inserted",SKIP_OPEN_TABLE}, - {"ROWS_UPDATED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_updated",SKIP_OPEN_TABLE}, - {"SELECT_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Select_commands",SKIP_OPEN_TABLE}, - {"UPDATE_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Update_commands",SKIP_OPEN_TABLE}, - {"OTHER_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Other_commands",SKIP_OPEN_TABLE}, - {"COMMIT_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Commit_transactions",SKIP_OPEN_TABLE}, - {"ROLLBACK_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rollback_transactions",SKIP_OPEN_TABLE}, - {"DENIED_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Denied_connections",SKIP_OPEN_TABLE}, - {"LOST_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Lost_connections",SKIP_OPEN_TABLE}, - {"ACCESS_DENIED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Access_denied",SKIP_OPEN_TABLE}, - {"EMPTY_QUERIES", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Empty_queries",SKIP_OPEN_TABLE}, - {"MAX_STATEMENT_TIME_EXCEEDED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Max_statement_time_exceeded",SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} -}; - - -ST_FIELD_INFO table_stats_fields_info[]= -{ - {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_schema",SKIP_OPEN_TABLE}, - {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_name",SKIP_OPEN_TABLE}, - {"ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_read",SKIP_OPEN_TABLE}, - {"ROWS_CHANGED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_changed",SKIP_OPEN_TABLE}, - {"ROWS_CHANGED_X_INDEXES", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_changed_x_#indexes",SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} -}; - -ST_FIELD_INFO index_stats_fields_info[]= -{ - {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_schema",SKIP_OPEN_TABLE}, - {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_name",SKIP_OPEN_TABLE}, - {"INDEX_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Index_name",SKIP_OPEN_TABLE}, - {"ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_read",SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0,0} -}; - /* Find schema_tables elment by name @@ -9062,8 +8723,6 @@ ST_SCHEMA_TABLE schema_tables[]= fill_schema_applicable_roles, 0, 0, -1, -1, 0, 0}, {"CHARACTER_SETS", charsets_fields_info, 0, fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0, 0}, - {"CLIENT_STATISTICS", client_stats_fields_info, reset_schema_client_stats, - fill_schema_client_stats, make_old_format, 0, -1, -1, 0, 0}, {"COLLATIONS", collation_fields_info, 0, fill_schema_collation, make_old_format, 0, -1, -1, 0, 0}, {"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info, @@ -9092,8 +8751,6 @@ ST_SCHEMA_TABLE schema_tables[]= fill_status, make_old_format, 0, 0, -1, 0, 0}, {"GLOBAL_VARIABLES", variables_fields_info, 0, fill_variables, make_old_format, 0, 0, -1, 0, 0}, - {"INDEX_STATISTICS", index_stats_fields_info, reset_schema_index_stats, - fill_schema_index_stats, make_old_format, 0, -1, -1, 0, 0}, {"KEY_CACHES", keycache_fields_info, 0, fill_key_cache_tables, 0, 0, -1,-1, 0, 0}, {"KEY_COLUMN_USAGE", key_column_usage_fields_info, 0, @@ -9143,15 +8800,11 @@ ST_SCHEMA_TABLE schema_tables[]= get_all_tables, make_table_names_old_format, 0, 1, 2, 1, OPTIMIZE_I_S_TABLE}, {"TABLE_PRIVILEGES", table_privileges_fields_info, 0, fill_schema_table_privileges, 0, 0, -1, -1, 0, 0}, - {"TABLE_STATISTICS", table_stats_fields_info, reset_schema_table_stats, - fill_schema_table_stats, make_old_format, 0, -1, -1, 0, 0}, {"TRIGGERS", triggers_fields_info, 0, get_all_tables, make_old_format, get_schema_triggers_record, 5, 6, 0, OPEN_TRIGGER_ONLY|OPTIMIZE_I_S_TABLE}, {"USER_PRIVILEGES", user_privileges_fields_info, 0, fill_schema_user_privileges, 0, 0, -1, -1, 0, 0}, - {"USER_STATISTICS", user_stats_fields_info, reset_schema_user_stats, - fill_schema_user_stats, make_old_format, 0, -1, -1, 0, 0}, {"VIEWS", view_fields_info, 0, get_all_tables, 0, get_schema_views_record, 1, 2, 0, OPEN_VIEW_ONLY|OPTIMIZE_I_S_TABLE}, |