mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
cleanup: remove dead code
This commit is contained in:
@ -3125,100 +3125,6 @@ end:
|
||||
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
|
||||
|
||||
|
Reference in New Issue
Block a user