Commit 3f7cc414 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: remove dead code

parent 534cbc1f
......@@ -474,60 +474,6 @@ void init_user_stats(USER_STATS *user_stats,
}
#ifdef COMPLETE_PATCH_NOT_ADDED_YET
void add_user_stats(USER_STATS *user_stats,
uint total_connections,
uint concurrent_connections,
time_t connected_time,
double busy_time,
double cpu_time,
ulonglong bytes_received,
ulonglong bytes_sent,
ulonglong binlog_bytes_written,
ha_rows rows_sent,
ha_rows rows_read,
ha_rows rows_inserted,
ha_rows rows_deleted,
ha_rows rows_updated,
ulonglong select_commands,
ulonglong update_commands,
ulonglong other_commands,
ulonglong commit_trans,
ulonglong rollback_trans,
ulonglong denied_connections,
ulonglong lost_connections,
ulonglong max_statement_time_exceeded,
ulonglong access_denied_errors,
ulonglong empty_queries)
{
user_stats->total_connections+= total_connections;
user_stats->concurrent_connections+= concurrent_connections;
user_stats->connected_time+= connected_time;
user_stats->busy_time+= busy_time;
user_stats->cpu_time+= cpu_time;
user_stats->bytes_received+= bytes_received;
user_stats->bytes_sent+= bytes_sent;
user_stats->binlog_bytes_written+= binlog_bytes_written;
user_stats->rows_sent+= rows_sent;
user_stats->rows_inserted+= rows_inserted;
user_stats->rows_deleted+= rows_deleted;
user_stats->rows_updated+= rows_updated;
user_stats->rows_read+= rows_read;
user_stats->select_commands+= select_commands;
user_stats->update_commands+= update_commands;
user_stats->other_commands+= other_commands;
user_stats->commit_trans+= commit_trans;
user_stats->rollback_trans+= rollback_trans;
user_stats->denied_connections+= denied_connections;
user_stats->lost_connections+= lost_connections;
user_stats->max_statement_time_exceeded+= max_statement_time_exceeded;
user_stats->access_denied_errors+= access_denied_errors;
user_stats->empty_queries+= empty_queries;
}
#endif
void init_global_user_stats(void)
{
if (my_hash_init(&global_user_stats, system_charset_info, max_connections,
......
......@@ -3125,100 +3125,6 @@ static bool show_status_array(THD *thd, const char *wild,
DBUG_RETURN(res);
}
#ifdef COMPLETE_PATCH_NOT_ADDED_YET
/*
Aggregate values for mapped_user entries by their role.
SYNOPSIS
aggregate_user_stats
all_user_stats - input to aggregate
agg_user_stats - returns aggregated values
RETURN
0 - OK
1 - error
*/
static int aggregate_user_stats(HASH *all_user_stats, HASH *agg_user_stats)
{
DBUG_ENTER("aggregate_user_stats");
if (my_hash_init(agg_user_stats, system_charset_info,
MY_MAX(all_user_stats->records, 1),
0, 0, (my_hash_get_key)get_key_user_stats,
(my_hash_free_key)free_user_stats, 0))
{
sql_print_error("Malloc in aggregate_user_stats failed");
DBUG_RETURN(1);
}
for (uint i= 0; i < all_user_stats->records; i++)
{
USER_STATS *user= (USER_STATS*)my_hash_element(all_user_stats, i);
USER_STATS *agg_user;
uint name_length= strlen(user->priv_user);
if (!(agg_user= (USER_STATS*) my_hash_search(agg_user_stats,
(uchar*)user->priv_user,
name_length)))
{
// First entry for this role.
if (!(agg_user= (USER_STATS*) my_malloc(sizeof(USER_STATS),
MYF(MY_WME | MY_ZEROFILL|
MY_THREAD_SPECIFIC))))
{
sql_print_error("Malloc in aggregate_user_stats failed");
DBUG_RETURN(1);
}
init_user_stats(agg_user, user->priv_user, name_length,
user->priv_user,
user->total_connections, user->concurrent_connections,
user->connected_time, user->busy_time, user->cpu_time,
user->bytes_received, user->bytes_sent,
user->binlog_bytes_written,
user->rows_sent, user->rows_read,
user->rows_inserted, user->rows_deleted,
user->rows_updated,
user->select_commands, user->update_commands,
user->other_commands,
user->commit_trans, user->rollback_trans,
user->denied_connections, user->lost_connections,
user->max_statement_time_exceeded,
user->access_denied_errors, user->empty_queries);
if (my_hash_insert(agg_user_stats, (uchar*) agg_user))
{
/* Out of memory */
my_free(agg_user, 0);
sql_print_error("Malloc in aggregate_user_stats failed");
DBUG_RETURN(1);
}
}
else
{
/* Aggregate with existing values for this role. */
add_user_stats(agg_user,
user->total_connections, user->concurrent_connections,
user->connected_time, user->busy_time, user->cpu_time,
user->bytes_received, user->bytes_sent,
user->binlog_bytes_written,
user->rows_sent, user->rows_read,
user->rows_inserted, user->rows_deleted,
user->rows_updated,
user->select_commands, user->update_commands,
user->other_commands,
user->commit_trans, user->rollback_trans,
user->denied_connections, user->lost_connections,
user->max_statement_time_exceeded,
user->access_denied_errors, user->empty_queries);
}
}
DBUG_PRINT("exit", ("aggregated %lu input into %lu output entries",
all_user_stats->records, agg_user_stats->records));
DBUG_RETURN(0);
}
#endif
/*
Write result to network for SHOW USER_STATISTICS
......
......@@ -338,33 +338,6 @@ init_user_stats(USER_STATS *user_stats,
ulonglong access_denied_errors,
ulonglong empty_queries);
/* Increment values of an instance of USER_STATS */
extern void
add_user_stats(USER_STATS *user_stats,
uint total_connections,
uint concurrent_connections,
time_t connected_time,
double busy_time,
double cpu_time,
ulonglong bytes_received,
ulonglong bytes_sent,
ulonglong binlog_bytes_written,
ha_rows rows_sent,
ha_rows rows_read,
ha_rows rows_inserted,
ha_rows rows_deleted,
ha_rows rows_updated,
ulonglong select_commands,
ulonglong update_commands,
ulonglong other_commands,
ulonglong commit_trans,
ulonglong rollback_trans,
ulonglong denied_connections,
ulonglong lost_connections,
ulonglong max_statement_time_exceeded,
ulonglong access_denied_errors,
ulonglong empty_queries);
typedef struct st_table_stats
{
char table[NAME_LEN * 2 + 2]; // [db] + '\0' + [table] + '\0'
......
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