List:Commits« Previous MessageNext Message »
From:Marc Alff Date:August 2 2011 5:18pm
Subject:bzr push into mysql-trunk-wl5259 branch (marc.alff:3332 to 3333) WL#5259
View as plain text  
 3333 Marc Alff	2011-08-02
      WL#5259 PERFORMANCE SCHEMA HOST_CACHE
      
      Work in progress

    added:
      storage/perfschema/table_host_cache.cc
      storage/perfschema/table_host_cache.h
    modified:
      mysql-test/suite/perfschema/include/schema.inc
      mysql-test/suite/perfschema/include/start_server_common.inc
      mysql-test/suite/perfschema/r/information_schema.result
      mysql-test/suite/perfschema/r/pfs_upgrade.result
      mysql-test/suite/perfschema/r/schema.result
      mysql-test/suite/perfschema/r/start_server_innodb.result
      mysql-test/suite/perfschema/r/start_server_no_cond_class.result
      mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
      mysql-test/suite/perfschema/r/start_server_no_file_class.result
      mysql-test/suite/perfschema/r/start_server_no_file_inst.result
      mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
      mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
      mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
      mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
      mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
      mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
      mysql-test/suite/perfschema/r/start_server_no_stage_class.result
      mysql-test/suite/perfschema/r/start_server_no_stages_history.result
      mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
      mysql-test/suite/perfschema/r/start_server_no_statement_class.result
      mysql-test/suite/perfschema/r/start_server_no_statements_history.result
      mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
      mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
      mysql-test/suite/perfschema/r/start_server_no_table_inst.result
      mysql-test/suite/perfschema/r/start_server_no_thread_class.result
      mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
      mysql-test/suite/perfschema/r/start_server_nothing.result
      mysql-test/suite/perfschema/r/start_server_off.result
      mysql-test/suite/perfschema/r/start_server_on.result
      mysql-test/suite/perfschema/r/table_schema.result
      scripts/mysql_system_tables.sql
      sql/hash_filo.h
      sql/hostname.cc
      sql/hostname.h
      sql/mysqld.cc
      sql/mysqld.h
      sql/sql_acl.cc
      sql/sql_connect.cc
      sql/sys_vars.cc
      storage/perfschema/CMakeLists.txt
      storage/perfschema/pfs_engine_table.cc
 3332 Marc Alff	2011-08-02
      New branch for WL#5259

    modified:
      .bzr-mysql/default.conf
=== modified file 'mysql-test/suite/perfschema/include/schema.inc'
--- a/mysql-test/suite/perfschema/include/schema.inc	2011-06-30 15:50:45 +0000
+++ b/mysql-test/suite/perfschema/include/schema.inc	2011-08-02 17:17:18 +0000
@@ -43,6 +43,7 @@ show create table events_waits_summary_g
 show create table file_instances;
 show create table file_summary_by_event_name;
 show create table file_summary_by_instance;
+show create table host_cache;
 show create table mutex_instances;
 show create table objects_summary_global_by_type;
 show create table performance_timers;

=== modified file 'mysql-test/suite/perfschema/include/start_server_common.inc'
--- a/mysql-test/suite/perfschema/include/start_server_common.inc	2011-06-30 15:50:45 +0000
+++ b/mysql-test/suite/perfschema/include/start_server_common.inc	2011-08-02 17:17:18 +0000
@@ -47,6 +47,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/information_schema.result'
--- a/mysql-test/suite/perfschema/r/information_schema.result	2011-05-05 06:11:49 +0000
+++ b/mysql-test/suite/perfschema/r/information_schema.result	2011-08-02 17:17:18 +0000
@@ -22,6 +22,7 @@ performance_schema	events_waits_summary_
 performance_schema	file_instances	def
 performance_schema	file_summary_by_event_name	def
 performance_schema	file_summary_by_instance	def
+performance_schema	host_cache	def
 performance_schema	mutex_instances	def
 performance_schema	objects_summary_global_by_type	def
 performance_schema	performance_timers	def
@@ -59,6 +60,7 @@ events_waits_summary_global_by_event_nam
 file_instances	BASE TABLE	PERFORMANCE_SCHEMA
 file_summary_by_event_name	BASE TABLE	PERFORMANCE_SCHEMA
 file_summary_by_instance	BASE TABLE	PERFORMANCE_SCHEMA
+host_cache	BASE TABLE	PERFORMANCE_SCHEMA
 mutex_instances	BASE TABLE	PERFORMANCE_SCHEMA
 objects_summary_global_by_type	BASE TABLE	PERFORMANCE_SCHEMA
 performance_timers	BASE TABLE	PERFORMANCE_SCHEMA
@@ -96,6 +98,7 @@ events_waits_summary_global_by_event_nam
 file_instances	10	Dynamic
 file_summary_by_event_name	10	Dynamic
 file_summary_by_instance	10	Dynamic
+host_cache	10	Dynamic
 mutex_instances	10	Dynamic
 objects_summary_global_by_type	10	Dynamic
 performance_timers	10	Fixed
@@ -133,6 +136,7 @@ events_waits_summary_global_by_event_nam
 file_instances	1000	0
 file_summary_by_event_name	1000	0
 file_summary_by_instance	1000	0
+host_cache	1000	0
 mutex_instances	1000	0
 objects_summary_global_by_type	1000	0
 performance_timers	5	0
@@ -170,6 +174,7 @@ events_waits_summary_global_by_event_nam
 file_instances	0	0
 file_summary_by_event_name	0	0
 file_summary_by_instance	0	0
+host_cache	0	0
 mutex_instances	0	0
 objects_summary_global_by_type	0	0
 performance_timers	0	0
@@ -207,6 +212,7 @@ events_waits_summary_global_by_event_nam
 file_instances	0	0	NULL
 file_summary_by_event_name	0	0	NULL
 file_summary_by_instance	0	0	NULL
+host_cache	0	0	NULL
 mutex_instances	0	0	NULL
 objects_summary_global_by_type	0	0	NULL
 performance_timers	0	0	NULL
@@ -244,6 +250,7 @@ events_waits_summary_global_by_event_nam
 file_instances	NULL	NULL	NULL
 file_summary_by_event_name	NULL	NULL	NULL
 file_summary_by_instance	NULL	NULL	NULL
+host_cache	NULL	NULL	NULL
 mutex_instances	NULL	NULL	NULL
 objects_summary_global_by_type	NULL	NULL	NULL
 performance_timers	NULL	NULL	NULL
@@ -281,6 +288,7 @@ events_waits_summary_global_by_event_nam
 file_instances	utf8_general_ci	NULL
 file_summary_by_event_name	utf8_general_ci	NULL
 file_summary_by_instance	utf8_general_ci	NULL
+host_cache	utf8_general_ci	NULL
 mutex_instances	utf8_general_ci	NULL
 objects_summary_global_by_type	utf8_general_ci	NULL
 performance_timers	utf8_general_ci	NULL
@@ -318,6 +326,7 @@ events_waits_summary_global_by_event_nam
 file_instances	
 file_summary_by_event_name	
 file_summary_by_instance	
+host_cache	
 mutex_instances	
 objects_summary_global_by_type	
 performance_timers	

=== modified file 'mysql-test/suite/perfschema/r/pfs_upgrade.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade.result	2011-06-27 14:15:12 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade.result	2011-08-02 17:17:18 +0000
@@ -18,30 +18,31 @@ ERROR 1050 (42S01) at line 206: Table 'e
 ERROR 1050 (42S01) at line 215: Table 'file_instances' already exists
 ERROR 1050 (42S01) at line 226: Table 'file_summary_by_event_name' already exists
 ERROR 1050 (42S01) at line 238: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 247: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 261: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 271: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 281: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 290: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 298: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 307: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 318: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 326: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 371: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 415: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 494: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 514: Table 'threads' already exists
-ERROR 1050 (42S01) at line 529: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 544: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 559: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 572: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 584: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 627: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 670: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 713: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 745: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 776: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1196: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 253: Table 'host_cache' already exists
+ERROR 1050 (42S01) at line 262: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 276: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 286: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 296: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 305: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 313: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 322: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 333: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 341: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 386: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 430: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 509: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 529: Table 'threads' already exists
+ERROR 1050 (42S01) at line 544: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 559: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 574: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 587: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 599: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 642: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 685: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 728: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 760: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 791: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1644 (HY000) at line 1211: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 show tables like "user_table";
 Tables_in_performance_schema (user_table)
@@ -64,30 +65,31 @@ ERROR 1050 (42S01) at line 206: Table 'e
 ERROR 1050 (42S01) at line 215: Table 'file_instances' already exists
 ERROR 1050 (42S01) at line 226: Table 'file_summary_by_event_name' already exists
 ERROR 1050 (42S01) at line 238: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 247: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 261: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 271: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 281: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 290: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 298: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 307: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 318: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 326: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 371: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 415: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 494: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 514: Table 'threads' already exists
-ERROR 1050 (42S01) at line 529: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 544: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 559: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 572: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 584: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 627: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 670: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 713: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 745: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 776: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1196: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 253: Table 'host_cache' already exists
+ERROR 1050 (42S01) at line 262: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 276: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 286: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 296: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 305: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 313: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 322: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 333: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 341: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 386: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 430: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 509: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 529: Table 'threads' already exists
+ERROR 1050 (42S01) at line 544: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 559: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 574: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 587: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 599: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 642: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 685: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 728: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 760: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 791: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1644 (HY000) at line 1211: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 show tables like "user_view";
 Tables_in_performance_schema (user_view)
@@ -108,30 +110,31 @@ ERROR 1050 (42S01) at line 206: Table 'e
 ERROR 1050 (42S01) at line 215: Table 'file_instances' already exists
 ERROR 1050 (42S01) at line 226: Table 'file_summary_by_event_name' already exists
 ERROR 1050 (42S01) at line 238: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 247: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 261: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 271: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 281: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 290: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 298: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 307: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 318: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 326: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 371: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 415: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 494: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 514: Table 'threads' already exists
-ERROR 1050 (42S01) at line 529: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 544: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 559: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 572: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 584: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 627: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 670: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 713: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 745: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 776: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1196: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 253: Table 'host_cache' already exists
+ERROR 1050 (42S01) at line 262: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 276: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 286: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 296: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 305: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 313: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 322: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 333: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 341: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 386: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 430: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 509: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 529: Table 'threads' already exists
+ERROR 1050 (42S01) at line 544: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 559: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 574: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 587: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 599: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 642: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 685: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 728: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 760: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 791: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1644 (HY000) at line 1211: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.proc where db='performance_schema';
 name
@@ -152,30 +155,31 @@ ERROR 1050 (42S01) at line 206: Table 'e
 ERROR 1050 (42S01) at line 215: Table 'file_instances' already exists
 ERROR 1050 (42S01) at line 226: Table 'file_summary_by_event_name' already exists
 ERROR 1050 (42S01) at line 238: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 247: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 261: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 271: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 281: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 290: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 298: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 307: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 318: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 326: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 371: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 415: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 494: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 514: Table 'threads' already exists
-ERROR 1050 (42S01) at line 529: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 544: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 559: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 572: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 584: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 627: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 670: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 713: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 745: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 776: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1196: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 253: Table 'host_cache' already exists
+ERROR 1050 (42S01) at line 262: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 276: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 286: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 296: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 305: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 313: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 322: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 333: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 341: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 386: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 430: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 509: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 529: Table 'threads' already exists
+ERROR 1050 (42S01) at line 544: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 559: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 574: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 587: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 599: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 642: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 685: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 728: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 760: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 791: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1644 (HY000) at line 1211: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.proc where db='performance_schema';
 name
@@ -196,30 +200,31 @@ ERROR 1050 (42S01) at line 206: Table 'e
 ERROR 1050 (42S01) at line 215: Table 'file_instances' already exists
 ERROR 1050 (42S01) at line 226: Table 'file_summary_by_event_name' already exists
 ERROR 1050 (42S01) at line 238: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 247: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 261: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 271: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 281: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 290: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 298: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 307: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 318: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 326: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 371: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 415: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 494: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 514: Table 'threads' already exists
-ERROR 1050 (42S01) at line 529: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 544: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 559: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 572: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 584: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 627: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 670: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 713: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 745: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 776: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1196: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 253: Table 'host_cache' already exists
+ERROR 1050 (42S01) at line 262: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 276: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 286: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 296: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 305: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 313: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 322: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 333: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 341: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 386: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 430: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 509: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 529: Table 'threads' already exists
+ERROR 1050 (42S01) at line 544: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 559: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 574: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 587: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 599: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 642: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 685: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 728: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 760: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 791: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1644 (HY000) at line 1211: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.event where db='performance_schema';
 name

=== modified file 'mysql-test/suite/perfschema/r/schema.result'
--- a/mysql-test/suite/perfschema/r/schema.result	2011-06-27 14:15:12 +0000
+++ b/mysql-test/suite/perfschema/r/schema.result	2011-08-02 17:17:18 +0000
@@ -27,6 +27,7 @@ events_waits_summary_global_by_event_nam
 file_instances
 file_summary_by_event_name
 file_summary_by_instance
+host_cache
 mutex_instances
 objects_summary_global_by_type
 performance_timers
@@ -412,6 +413,19 @@ file_summary_by_instance	CREATE TABLE `f
   `SUM_NUMBER_OF_BYTES_READ` bigint(20) NOT NULL,
   `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) NOT NULL
 ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table host_cache;
+Table	Create Table
+host_cache	CREATE TABLE `host_cache` (
+  `IP` varchar(64) NOT NULL,
+  `HOST` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+  `SUM_BLOCKING_ERRORS` bigint(20) NOT NULL,
+  `COUNT_NAMEINFO_ERRORS` bigint(20) NOT NULL,
+  `COUNT_FORMAT_ERRORS` bigint(20) NOT NULL,
+  `COUNT_ADDRINFO_ERRORS` bigint(20) NOT NULL,
+  `COUNT_FCRDNS_ERRORS` bigint(20) NOT NULL,
+  `COUNT_HOST_ACL_ERRORS` bigint(20) NOT NULL,
+  `COUNT_USER_ACL_ERRORS` bigint(20) NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
 show create table mutex_instances;
 Table	Create Table
 mutex_instances	CREATE TABLE `mutex_instances` (

=== modified file 'mysql-test/suite/perfschema/r/start_server_innodb.result'
--- a/mysql-test/suite/perfschema/r/start_server_innodb.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_innodb.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_cond_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_cond_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_file_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_file_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_mutex_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_setup_actors.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_setup_objects.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_stage_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result	2011-03-23 11:49:30 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_stages_history.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_statement_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_statement_class.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_statement_class.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_statements_history.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_table_hdl.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_table_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_thread_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_thread_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_nothing.result'
--- a/mysql-test/suite/perfschema/r/start_server_nothing.result	2011-04-28 22:01:07 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_nothing.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_off.result'
--- a/mysql-test/suite/perfschema/r/start_server_off.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_off.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/start_server_on.result'
--- a/mysql-test/suite/perfschema/r/start_server_on.result	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_on.result	2011-08-02 17:17:18 +0000
@@ -37,6 +37,7 @@ select * from performance_schema.events_
 select * from performance_schema.file_instances;
 select * from performance_schema.file_summary_by_event_name;
 select * from performance_schema.file_summary_by_instance;
+select * from performance_schema.host_cache;
 select * from performance_schema.mutex_instances;
 select * from performance_schema.objects_summary_global_by_type;
 select * from performance_schema.performance_timers;

=== modified file 'mysql-test/suite/perfschema/r/table_schema.result'
--- a/mysql-test/suite/perfschema/r/table_schema.result	2011-06-27 14:15:12 +0000
+++ b/mysql-test/suite/perfschema/r/table_schema.result	2011-08-02 17:17:18 +0000
@@ -293,6 +293,15 @@ def	performance_schema	file_summary_by_i
 def	performance_schema	file_summary_by_instance	COUNT_WRITE	4	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
 def	performance_schema	file_summary_by_instance	SUM_NUMBER_OF_BYTES_READ	5	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)			select,insert,update,references	
 def	performance_schema	file_summary_by_instance	SUM_NUMBER_OF_BYTES_WRITE	6	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)			select,insert,update,references	
+def	performance_schema	host_cache	IP	1	NULL	NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)			select,insert,update,references	
+def	performance_schema	host_cache	HOST	2	NULL	YES	varchar	255	765	NULL	NULL	utf8	utf8_bin	varchar(255)			select,insert,update,references	
+def	performance_schema	host_cache	SUM_BLOCKING_ERRORS	3	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)			select,insert,update,references	
+def	performance_schema	host_cache	COUNT_NAMEINFO_ERRORS	4	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)			select,insert,update,references	
+def	performance_schema	host_cache	COUNT_FORMAT_ERRORS	5	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)			select,insert,update,references	
+def	performance_schema	host_cache	COUNT_ADDRINFO_ERRORS	6	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)			select,insert,update,references	
+def	performance_schema	host_cache	COUNT_FCRDNS_ERRORS	7	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)			select,insert,update,references	
+def	performance_schema	host_cache	COUNT_HOST_ACL_ERRORS	8	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)			select,insert,update,references	
+def	performance_schema	host_cache	COUNT_USER_ACL_ERRORS	9	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)			select,insert,update,references	
 def	performance_schema	mutex_instances	NAME	1	NULL	NO	varchar	128	384	NULL	NULL	utf8	utf8_general_ci	varchar(128)			select,insert,update,references	
 def	performance_schema	mutex_instances	OBJECT_INSTANCE_BEGIN	2	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
 def	performance_schema	mutex_instances	LOCKED_BY_THREAD_ID	3	NULL	YES	int	NULL	NULL	10	0	NULL	NULL	int(11)			select,insert,update,references	

=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2011-07-05 16:45:26 +0000
+++ b/scripts/mysql_system_tables.sql	2011-08-02 17:17:18 +0000
@@ -408,6 +408,27 @@ EXECUTE stmt;
 DROP PREPARE stmt;
 
 --
+-- TABLE HOST_CACHE
+--
+
+SET @cmd="CREATE TABLE performance_schema.host_cache("
+  "IP VARCHAR(64) not null,"
+  "HOST VARCHAR(255) collate utf8_bin,"
+  "SUM_BLOCKING_ERRORS BIGINT not null,"
+  "COUNT_NAMEINFO_ERRORS BIGINT not null,"
+  "COUNT_FORMAT_ERRORS BIGINT not null,"
+  "COUNT_ADDRINFO_ERRORS BIGINT not null,"
+  "COUNT_FCRDNS_ERRORS BIGINT not null,"
+  "COUNT_HOST_ACL_ERRORS BIGINT not null,"
+  "COUNT_USER_ACL_ERRORS BIGINT not null"
+  ")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
 -- TABLE MUTEX_INSTANCES
 --
 

=== modified file 'sql/hash_filo.h'
--- a/sql/hash_filo.h	2011-06-30 15:50:45 +0000
+++ b/sql/hash_filo.h	2011-08-02 17:17:18 +0000
@@ -23,22 +23,30 @@
 #define  HASH_FILO_H
 
 #include "hash.h"        /* my_hash_get_key, my_hash_free_key, HASH */
-#include "m_string.h"
 #include "mysqld.h"      /* key_hash_filo_lock */
 
-class hash_filo_element
+struct hash_filo_element
 {
+private:
   hash_filo_element *next_used,*prev_used;
- public:
+public:
   hash_filo_element() {}
+  hash_filo_element *next()
+  { return next_used; }
+  hash_filo_element *prev()
+  { return prev_used; }
+  
   friend class hash_filo;
 };
 
 
 class hash_filo
 {
-  const uint size, key_offset, key_length;
+private:
+  const uint key_offset, key_length;
   const my_hash_get_key get_key;
+  /** Size of this hash table. */
+  uint m_size;
   my_hash_free_key free_element;
   bool init;
   CHARSET_INFO *hash_charset;
@@ -48,11 +56,12 @@ public:
   mysql_mutex_t lock;
   HASH cache;
 
-  hash_filo(uint size_arg, uint key_offset_arg , uint key_length_arg,
+  hash_filo(uint size, uint key_offset_arg , uint key_length_arg,
 	    my_hash_get_key get_key_arg, my_hash_free_key free_element_arg,
 	    CHARSET_INFO *hash_charset_arg)
-    :size(size_arg), key_offset(key_offset_arg), key_length(key_length_arg),
-    get_key(get_key_arg), free_element(free_element_arg),init(0),
+    : key_offset(key_offset_arg), key_length(key_length_arg),
+    get_key(get_key_arg), m_size(size),
+    free_element(free_element_arg),init(0),
     hash_charset(hash_charset_arg)
   {
     memset(&cache, 0, sizeof(cache));
@@ -77,13 +86,19 @@ public:
     if (!locked)
       mysql_mutex_lock(&lock);
     (void) my_hash_free(&cache);
-    (void) my_hash_init(&cache,hash_charset,size,key_offset, 
-    		     key_length, get_key, free_element,0);
+    (void) my_hash_init(&cache, hash_charset, m_size, key_offset, 
+                        key_length, get_key, free_element,0);
     if (!locked)
       mysql_mutex_unlock(&lock);
     first_link=last_link=0;
   }
 
+  hash_filo_element *first()
+  { return first_link; }
+
+  hash_filo_element *last()
+  { return last_link; }
+
   hash_filo_element *search(uchar* key, size_t length)
   {
     hash_filo_element *entry=(hash_filo_element*)
@@ -109,7 +124,7 @@ public:
 
   my_bool add(hash_filo_element *entry)
   {
-    if (cache.records == size)
+    if (cache.records == m_size)
     {
       hash_filo_element *tmp=last_link;
       last_link=last_link->prev_used;
@@ -128,6 +143,17 @@ public:
     first_link=entry;
     return 0;
   }
+
+  uint size()
+  { return m_size; }
+
+  void resize(uint new_size)
+  {
+    mysql_mutex_lock(&lock);
+    m_size= new_size;
+    clear(true);
+    mysql_mutex_unlock(&lock);
+  }
 };
 
 #endif

=== modified file 'sql/hostname.cc'
--- a/sql/hostname.cc	2011-04-20 10:40:22 +0000
+++ b/sql/hostname.cc	2011-08-02 17:17:18 +0000
@@ -26,6 +26,10 @@
 
 #include "sql_priv.h"
 #include "hostname.h"
+#include "my_global.h"
+#ifndef __WIN__
+#include <netdb.h>        // getservbyname, servent
+#endif
 #include "hash_filo.h"
 #include <m_ctype.h>
 #include "log.h"                                // sql_print_warning,
@@ -45,54 +49,54 @@ extern "C" {					// Because of SCO 3.2V4
 }
 #endif
 
-/*
-  HOST_ENTRY_KEY_SIZE -- size of IP address string in the hash cache.
-*/
-
-#define HOST_ENTRY_KEY_SIZE INET6_ADDRSTRLEN
-
-/**
-  An entry in the hostname hash table cache.
+Host_errors::Host_errors()
+: m_nameinfo_errors(0), m_format_errors(0),
+  m_addrinfo_errors(0), m_FCrDNS_errors(0)
+{}
+    
+Host_errors::~Host_errors()
+{}
 
-  Host name cache does two things:
-    - caches host names to save DNS look ups;
-    - counts connect errors from IP.
-
-  Host name can be NULL (that means DNS look up failed), but connect errors
-  still are counted.
-*/
-
-class Host_entry :public hash_filo_element
+void Host_errors::reset()
 {
-public:
-  /**
-    Client IP address. This is the key used with the hash table.
-
-    The client IP address is always expressed in IPv6, even when the
-    network IPv6 stack is not present.
-
-    This IP address is never used to connect to a socket.
-  */
-  char ip_key[HOST_ENTRY_KEY_SIZE];
+  m_nameinfo_errors= 0;
+  m_format_errors= 0;
+  m_addrinfo_errors= 0;
+  m_FCrDNS_errors= 0;
+}
 
-  /**
-    Number of errors during handshake phase from the IP address.
-  */
-  uint connect_errors;
+uint Host_errors::get_blocking_errors()
+{
+  // FIXME
+  return m_nameinfo_errors;
+}
 
-  /**
-    One of the host names for the IP address. May be NULL.
-  */
-  const char *hostname;
-};
+void Host_errors::aggregate(const Host_errors *errors)
+{
+  m_nameinfo_errors+= errors->m_nameinfo_errors;
+  m_format_errors+= errors->m_format_errors;
+  m_addrinfo_errors+= errors->m_addrinfo_errors;
+  m_FCrDNS_errors+= errors->m_FCrDNS_errors;
+}
 
 static hash_filo *hostname_cache;
+ulong host_cache_size;
 
 void hostname_cache_refresh()
 {
   hostname_cache->clear();
 }
 
+uint hostname_cache_size()
+{
+  return hostname_cache->size();
+}
+
+void hostname_cache_resize(uint size)
+{
+  hostname_cache->resize(size);
+}
+
 bool hostname_cache_init()
 {
   Host_entry tmp;
@@ -115,6 +119,16 @@ void hostname_cache_free()
   hostname_cache= NULL;
 }
 
+void hostname_cache_lock()
+{
+  mysql_mutex_lock(&hostname_cache->lock);
+}
+
+void hostname_cache_unlock()
+{
+  mysql_mutex_unlock(&hostname_cache->lock);
+}
+
 static void prepare_hostname_cache_key(const char *ip_string,
                                        char *ip_key)
 {
@@ -125,65 +139,83 @@ static void prepare_hostname_cache_key(c
   memcpy(ip_key, ip_string, ip_string_length);
 }
 
+Host_entry *hostname_cache_first()
+{ return (Host_entry *) hostname_cache->first(); }
+
 static inline Host_entry *hostname_cache_search(const char *ip_key)
 {
   return (Host_entry *) hostname_cache->search((uchar *) ip_key, 0);
 }
 
-static bool add_hostname_impl(const char *ip_key, const char *hostname)
+static bool add_hostname_impl(const char *ip_key, const char *hostname,
+                              bool validated, Host_errors *errors)
 {
-  if (hostname_cache_search(ip_key))
-    return FALSE;
-
-  size_t hostname_size= hostname ? strlen(hostname) + 1 : 0;
+  Host_entry *entry;
+  bool duplicate;
 
-  Host_entry *entry= (Host_entry *) malloc(sizeof (Host_entry) + hostname_size);
+  entry= hostname_cache_search(ip_key);
 
-  if (!entry)
-    return TRUE;
-
-  char *hostname_copy;
+  if (likely(entry == NULL))
+  {
+    entry= (Host_entry *) malloc(sizeof (Host_entry));
+    if (entry == NULL)
+      return TRUE;
 
-  memcpy(&entry->ip_key, ip_key, HOST_ENTRY_KEY_SIZE);
+    duplicate= false;
+    memcpy(&entry->ip_key, ip_key, HOST_ENTRY_KEY_SIZE);
+    entry->m_errors.reset();
+  }
+  else
+  {
+    duplicate= true;
+  }
 
-  if (hostname_size)
+  if (hostname != NULL)
   {
-    hostname_copy= (char *) (entry + 1);
-    memcpy(hostname_copy, hostname, hostname_size);
+    uint len= strlen(hostname);
+    if (len > sizeof(entry->m_hostname) - 1)
+      len= sizeof(entry->m_hostname) - 1;
+    memcpy(entry->m_hostname, hostname, len);
+    entry->m_hostname[len]= '\0';
+    entry->m_hostname_length= len;
 
-    DBUG_PRINT("info", ("Adding '%s' -> '%s' to the hostname cache...'",
+    DBUG_PRINT("info", ("Adding/Updating '%s' -> '%s' to the hostname cache...'",
                         (const char *) ip_key,
-                        (const char *) hostname_copy));
+                        (const char *) entry->m_hostname));
   }
   else
   {
-    hostname_copy= NULL;
+    entry->m_hostname_length= 0;
 
-    DBUG_PRINT("info", ("Adding '%s' -> NULL to the hostname cache...'",
+    DBUG_PRINT("info", ("Adding '%s' -> empty to the hostname cache...'",
                         (const char *) ip_key));
   }
 
-  entry->hostname= hostname_copy;
-  entry->connect_errors= 0;
+  entry->m_host_validated= validated;
+  entry->m_errors.aggregate(errors);
 
-  return hostname_cache->add(entry);
+  if (! duplicate)
+    hostname_cache->add(entry);
+
+  return FALSE;
 }
 
-static bool add_hostname(const char *ip_key, const char *hostname)
+static bool add_hostname(const char *ip_key, const char *hostname,
+                         bool validated, Host_errors *errors)
 {
   if (specialflag & SPECIAL_NO_HOST_CACHE)
     return FALSE;
 
   mysql_mutex_lock(&hostname_cache->lock);
 
-  bool err_status= add_hostname_impl(ip_key, hostname);
+  bool err_status= add_hostname_impl(ip_key, hostname, validated, errors);
 
   mysql_mutex_unlock(&hostname_cache->lock);
 
   return err_status;
 }
 
-void inc_host_errors(const char *ip_string)
+void inc_host_errors(const char *ip_string, const Host_errors *errors)
 {
   if (!ip_string)
     return;
@@ -196,7 +228,7 @@ void inc_host_errors(const char *ip_stri
   Host_entry *entry= hostname_cache_search(ip_key);
 
   if (entry)
-    entry->connect_errors++;
+    entry->m_errors.aggregate(errors);
 
   mysql_mutex_unlock(&hostname_cache->lock);
 }
@@ -215,7 +247,7 @@ void reset_host_errors(const char *ip_st
   Host_entry *entry= hostname_cache_search(ip_key);
 
   if (entry)
-    entry->connect_errors= 0;
+    entry->m_errors.reset();
 
   mysql_mutex_unlock(&hostname_cache->lock);
 }
@@ -297,6 +329,7 @@ bool ip_to_hostname(struct sockaddr_stor
   const struct sockaddr *ip= (const sockaddr *) ip_storage;
   int err_code;
   bool err_status;
+  Host_errors errors;
 
   DBUG_ENTER("ip_to_hostname");
   DBUG_PRINT("info", ("IP address: '%s'; family: %d.",
@@ -330,21 +363,24 @@ bool ip_to_hostname(struct sockaddr_stor
 
     if (entry)
     {
-      *connect_errors= entry->connect_errors;
+      *connect_errors= entry->m_errors.get_blocking_errors();
       *hostname= NULL;
 
-      if (entry->hostname)
-        *hostname= my_strdup(entry->hostname, MYF(0));
+      if (entry->m_host_validated)
+      {
+        if (entry->m_hostname_length)
+          *hostname= my_strdup(entry->m_hostname, MYF(0));
 
-      DBUG_PRINT("info",("IP (%s) has been found in the cache. "
-                         "Hostname: '%s'; connect_errors: %d",
-                         (const char *) ip_key,
-                         (const char *) (*hostname? *hostname : "null"),
-                         (int) *connect_errors));
+        DBUG_PRINT("info",("IP (%s) has been found in the cache. "
+                           "Hostname: '%s'; connect_errors: %d",
+                           (const char *) ip_key,
+                           (const char *) (*hostname? *hostname : "null"),
+                           (int) *connect_errors));
 
-      mysql_mutex_unlock(&hostname_cache->lock);
+        mysql_mutex_unlock(&hostname_cache->lock);
 
-      DBUG_RETURN(FALSE);
+        DBUG_RETURN(FALSE);
+      }
     }
 
     mysql_mutex_unlock(&hostname_cache->lock);
@@ -362,35 +398,47 @@ bool ip_to_hostname(struct sockaddr_stor
   err_code= vio_getnameinfo(ip, hostname_buffer, NI_MAXHOST, NULL, 0,
                             NI_NAMEREQD);
 
-  if (err_code)
+  if (err_code == EAI_NONAME)
   {
-    // NOTE: gai_strerror() returns a string ending by a dot.
+    /*
+      There is no reverse address mapping for the IP address. A host name
+      can not be resolved.
+    */
 
-    DBUG_PRINT("error", ("IP address '%s' could not be resolved: %s",
-                         (const char *) ip_key,
-                         (const char *) gai_strerror(err_code)));
+    DBUG_PRINT("error", ("IP address '%s' could not be resolved: "
+                         "no reverse address mapping.",
+                         (const char *) ip_key));
+
+    sql_print_warning("IP address '%s' could not be resolved: "
+                      "no reverse address mapping.",
+                      (const char *) ip_key);
 
-    sql_print_warning("IP address '%s' could not be resolved: %s",
-                      (const char *) ip_key,
-                      (const char *) gai_strerror(err_code));
+    (void) add_hostname(ip_key, NULL, true, &errors);
 
-    if (vio_is_no_name_error(err_code))
-    {
-      /*
-        The no-name error means that there is no reverse address mapping
-        for the IP address. A host name can not be resolved.
-
-        If it is not the no-name error, we should not cache the hostname
-        (or rather its absence), because the failure might be transient.
-      */
+    *hostname= NULL;
+    *connect_errors= 0; /* New IP added to the cache. */
 
-      add_hostname(ip_key, NULL);
+    /* This is a success, regardless of whether a record was added or not in the cache. */
+    DBUG_RETURN(FALSE);
+  }
 
-      *hostname= NULL;
-      *connect_errors= 0; /* New IP added to the cache. */
-    }
+  if (err_code)
+  {
+    DBUG_PRINT("error", ("IP address '%s' could not be resolved: "
+                         "getnameinfo() returned %d.",
+                         (const char *) ip_key,
+                         (int) err_code));
 
-    DBUG_RETURN(FALSE);
+    sql_print_warning("IP address '%s' could not be resolved: "
+                      "getnameinfo() returned error (code: %d).",
+                      (const char *) ip_key,
+                      (int) err_code);
+
+    /* Count nameinfo errors for this IP */
+    errors.m_nameinfo_errors= 1;
+    (void) add_hostname(ip_key, NULL, false, &errors);
+
+    DBUG_RETURN(TRUE);
   }
 
   DBUG_PRINT("info", ("IP '%s' resolved to '%s'.",
@@ -426,7 +474,8 @@ bool ip_to_hostname(struct sockaddr_stor
                       (const char *) ip_key,
                       (const char *) hostname_buffer);
 
-    err_status= add_hostname(ip_key, NULL);
+    errors.m_format_errors= 1;
+    err_status= add_hostname(ip_key, NULL, false, &errors);
 
     *hostname= NULL;
     *connect_errors= 0; /* New IP added to the cache. */
@@ -458,7 +507,8 @@ bool ip_to_hostname(struct sockaddr_stor
       indefinitely.
     */
 
-    err_status= add_hostname(ip_key, NULL);
+    errors.m_addrinfo_errors= 1;
+    err_status= add_hostname(ip_key, NULL, false, &errors);
 
     *hostname= NULL;
     *connect_errors= 0; /* New IP added to the cache. */
@@ -540,14 +590,15 @@ bool ip_to_hostname(struct sockaddr_stor
 
   if (*hostname)
   {
-    err_status= add_hostname(ip_key, *hostname);
+    err_status= add_hostname(ip_key, *hostname, true, &errors);
     *connect_errors= 0;
   }
   else
   {
     DBUG_PRINT("error",("Couldn't verify hostname with getaddrinfo()."));
 
-    err_status= add_hostname(ip_key, NULL);
+    errors.m_FCrDNS_errors= 1;
+    err_status= add_hostname(ip_key, NULL, false, &errors);
     *hostname= NULL;
     *connect_errors= 0;
   }

=== modified file 'sql/hostname.h'
--- a/sql/hostname.h	2011-06-30 15:50:45 +0000
+++ b/sql/hostname.h	2011-08-02 17:17:18 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -17,14 +17,92 @@
 #define HOSTNAME_INCLUDED
 
 #include "my_global.h"                          /* uint */
+#include "hash_filo.h"
+
+#include <netdb.h> /* INET6_ADDRSTRLEN */
+
+struct Host_errors
+{
+public:
+  Host_errors();
+  ~Host_errors();
+
+  void reset();
+  void aggregate(const Host_errors *errors);
+
+  /** Number of blocking errors. */
+  uint get_blocking_errors();
+
+  /** Number of errors from getnameinfo(). */
+  uint m_nameinfo_errors;
+  /** Number of errors from is_hostname_valid(). */
+  uint m_format_errors;
+  /** Number of errors from getaddrinfo(). */
+  uint m_addrinfo_errors;
+  /** Number of errors from Forward-confirmed reverse DNS checks. */
+  uint m_FCrDNS_errors;
+  /** Number of errors from authentication. */
+  uint m_handshake_errors;
+  /** Number of errors from host grants. */
+  uint m_host_acl_errors;
+};
+
+/** Size of IP address string in the hash cache. */
+#define HOST_ENTRY_KEY_SIZE INET6_ADDRSTRLEN
+
+/**
+  An entry in the hostname hash table cache.
+
+  Host name cache does two things:
+    - caches host names to save DNS look ups;
+    - counts errors from IP.
+
+  Host name can be empty (that means DNS look up failed),
+  but errors still are counted.
+*/
+class Host_entry : public hash_filo_element
+{
+public:
+  Host_entry *next()
+  { return (Host_entry*) hash_filo_element::next(); }
+
+  /**
+    Client IP address. This is the key used with the hash table.
+
+    The client IP address is always expressed in IPv6, even when the
+    network IPv6 stack is not present.
+
+    This IP address is never used to connect to a socket.
+  */
+  char ip_key[HOST_ENTRY_KEY_SIZE];
+
+  /**
+    One of the host names for the IP address. May be a zero length string.
+  */
+  char m_hostname[HOSTNAME_LENGTH + 1];
+  /** Length in bytes of @c m_hostname. */
+  uint m_hostname_length;
+  /* Flag that indicate if the hostname was validated. */
+  bool m_host_validated;
+  /** Error statistics. */
+  Host_errors m_errors;
+};
+
+/** The size of the host_cache. */
+extern ulong host_cache_size;
 
 bool ip_to_hostname(struct sockaddr_storage *ip_storage,
                     const char *ip_string,
                     char **hostname, uint *connect_errors);
-void inc_host_errors(const char *ip_string);
+void inc_host_errors(const char *ip_string, const Host_errors *errors);
 void reset_host_errors(const char *ip_string);
 bool hostname_cache_init();
 void hostname_cache_free();
 void hostname_cache_refresh(void);
+uint hostname_cache_size();
+void hostname_cache_resize(uint size);
+void hostname_cache_lock();
+void hostname_cache_unlock();
+Host_entry *hostname_cache_first();
 
 #endif /* HOSTNAME_INCLUDED */

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-07-28 10:54:44 +0000
+++ b/sql/mysqld.cc	2011-08-02 17:17:18 +0000
@@ -573,6 +573,9 @@ const char *in_additional_cond= "<IN CON
 const char *in_having_cond= "<IN HAVING>";
 
 my_decimal decimal_zero;
+/** Number of errors when reading the peer address. */
+ulong peer_addr_errors= 0;
+
 /* classes for comparation parsing/processing */
 Eq_creator eq_creator;
 Ne_creator ne_creator;
@@ -3249,6 +3252,7 @@ int init_common_variables()
 {
   char buff[FN_REFLEN];
   umask(((~my_umask) & 0666));
+  peer_addr_errors= 0;
   my_decimal_set_zero(&decimal_zero); // set decimal_zero constant;
   tzset();			// Set tzname
 
@@ -7010,6 +7014,7 @@ SHOW_VAR status_vars[]= {
   {"Opened_files",             (char*) &my_file_total_opened, SHOW_LONG_NOFLUSH},
   {"Opened_tables",            (char*) offsetof(STATUS_VAR, opened_tables), SHOW_LONG_STATUS},
   {"Opened_table_definitions", (char*) offsetof(STATUS_VAR, opened_shares), SHOW_LONG_STATUS},
+  {"Peer_address_errors",      (char*) &peer_addr_errors, SHOW_LONG_STATUS},
   {"Prepared_stmt_count",      (char*) &show_prepared_stmt_count, SHOW_FUNC},
 #ifdef HAVE_QUERY_CACHE
   {"Qcache_free_blocks",       (char*) &query_cache.free_memory_blocks, SHOW_LONG_NOFLUSH},

=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h	2011-07-25 15:13:06 +0000
+++ b/sql/mysqld.h	2011-08-02 17:17:18 +0000
@@ -231,6 +231,7 @@ extern I_List<THD> threads;
 extern char err_shared_dir[];
 extern TYPELIB thread_handling_typelib;
 extern my_decimal decimal_zero;
+extern ulong peer_addr_errors;
 
 /*
   THR_MALLOC is a key which will be used to set/get MEM_ROOT** for a thread,

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	2011-07-28 10:54:44 +0000
+++ b/sql/sql_acl.cc	2011-08-02 17:17:18 +0000
@@ -1753,6 +1753,13 @@ bool acl_check_host(const char *host, co
     }
   }
   mysql_mutex_unlock(&acl_cache->lock);
+  if (ip != NULL)
+  {
+    /* Increment HOST_CACHE.COUNT_HOST_ACL_ERRORS. */
+    Host_errors errors;
+    errors.m_host_acl_errors= 1;
+    inc_host_errors(ip, &errors);
+  }
   return 1;					// Host is not allowed
 }
 
@@ -9060,7 +9067,9 @@ static int server_mpvio_read_packet(MYSQ
 err:
   if (mpvio->status == MPVIO_EXT::FAILURE)
   {
-    inc_host_errors(mpvio->ip);
+    Host_errors errors;
+    errors.m_handshake_errors= 1;
+    inc_host_errors(mpvio->ip, &errors);
     my_error(ER_HANDSHAKE_ERROR, MYF(0));
   }
   DBUG_RETURN(-1);
@@ -9643,7 +9652,9 @@ static int native_password_authenticate(
                 CR_ERROR : CR_OK);
   }
 
-  inc_host_errors(mpvio->ip);
+  Host_errors errors;
+  errors.m_handshake_errors= 1;
+  inc_host_errors(mpvio->ip, &errors);
   my_error(ER_HANDSHAKE_ERROR, MYF(0));
   DBUG_RETURN(CR_ERROR);
 }
@@ -9697,7 +9708,9 @@ static int old_password_authenticate(MYS
                              CR_ERROR : CR_OK;
   }
 
-  inc_host_errors(mpvio->ip);
+  Host_errors errors;
+  errors.m_handshake_errors= 1;
+  inc_host_errors(mpvio->ip, &errors);
   my_error(ER_HANDSHAKE_ERROR, MYF(0));
   return CR_ERROR;
 }

=== modified file 'sql/sql_connect.cc'
--- a/sql/sql_connect.cc	2011-07-07 09:45:10 +0000
+++ b/sql/sql_connect.cc	2011-08-02 17:17:18 +0000
@@ -464,11 +464,20 @@ static int check_connection(THD *thd)
 
     if (vio_peer_addr(net->vio, ip, &thd->peer_port, NI_MAXHOST))
     {
+      /*
+        Since we can not even get the peer IP address,
+        there is nothing to show in the host_cache,
+        so increment the global status variable "peer_address_errors".
+      */
+      peer_addr_errors++;
       my_error(ER_BAD_HOST_ERROR, MYF(0));
       return 1;
     }
     if (!(thd->main_security_ctx.ip= my_strdup(ip,MYF(MY_WME))))
+    {
+      /* FIXME: no error accounting in host_cache. */
       return 1; /* The error is set by my_strdup(). */
+    }
     thd->main_security_ctx.host_or_ip= thd->main_security_ctx.ip;
     if (!(specialflag & SPECIAL_NO_RESOLVE))
     {
@@ -516,7 +525,10 @@ static int check_connection(THD *thd)
   vio_keepalive(net->vio, TRUE);
   
   if (thd->packet.alloc(thd->variables.net_buffer_length))
+  {
+    /* FIXME: no error accounting in host_cache. */
     return 1; /* The error is set by alloc(). */
+  }
 
   return acl_authenticate(thd, connect_errors, 0);
 }

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2011-07-28 10:54:44 +0000
+++ b/sql/sys_vars.cc	2011-08-02 17:17:18 +0000
@@ -51,6 +51,7 @@
                      // mysql_user_table_is_in_short_password_format
 #include "derror.h"  // read_texts
 #include "sql_base.h"                           // close_cached_tables
+#include "hostname.h"                           // host_cache_size
 
 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
 #include "../storage/perfschema/pfs_server.h"
@@ -3462,3 +3463,19 @@ static Sys_var_tz Sys_time_zone(
        SESSION_VAR(time_zone), NO_CMD_LINE,
        DEFAULT(&default_tz), NO_MUTEX_GUARD, IN_BINLOG);
 
+static bool fix_host_cache_size(sys_var *, THD *, enum_var_type)
+{
+  hostname_cache_resize((uint) host_cache_size);
+  return false;
+}
+
+static Sys_var_ulong Sys_host_cache_size(
+       "host_cache_size",
+       "How many host names should be cached to avoid resolving.",
+       GLOBAL_VAR(host_cache_size),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 2048),
+       DEFAULT(HOST_CACHE_SIZE),
+       BLOCK_SIZE(1),
+       NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
+       ON_UPDATE(fix_host_cache_size));
+

=== modified file 'storage/perfschema/CMakeLists.txt'
--- a/storage/perfschema/CMakeLists.txt	2011-02-14 14:23:55 +0000
+++ b/storage/perfschema/CMakeLists.txt	2011-08-02 17:17:18 +0000
@@ -61,6 +61,7 @@ table_ews_global_by_event_name.h
 table_file_instances.h
 table_file_summary.h
 table_helper.h
+table_host_cache.h
 table_os_global_by_type.h
 table_performance_timers.h
 table_setup_actors.h
@@ -106,6 +107,7 @@ table_ews_global_by_event_name.cc
 table_file_instances.cc
 table_file_summary.cc
 table_helper.cc
+table_host_cache.cc
 table_os_global_by_type.cc
 table_performance_timers.cc
 table_setup_actors.cc

=== modified file 'storage/perfschema/pfs_engine_table.cc'
--- a/storage/perfschema/pfs_engine_table.cc	2011-06-30 15:50:45 +0000
+++ b/storage/perfschema/pfs_engine_table.cc	2011-08-02 17:17:18 +0000
@@ -30,6 +30,7 @@
 #include "table_events_waits_summary.h"
 #include "table_ews_by_thread_by_event_name.h"
 #include "table_ews_global_by_event_name.h"
+#include "table_host_cache.h"
 #include "table_os_global_by_type.h"
 #include "table_sync_instances.h"
 #include "table_file_instances.h"
@@ -74,6 +75,7 @@ static PFS_engine_table_share *all_share
   &table_file_instances::m_share,
   &table_file_summary_by_event_name::m_share,
   &table_file_summary_by_instance::m_share,
+  &table_host_cache::m_share,
   &table_mutex_instances::m_share,
   &table_os_global_by_type::m_share,
   &table_performance_timers::m_share,
@@ -114,7 +116,7 @@ void PFS_engine_table_share::check_all_t
   DBUG_EXECUTE_IF("tampered_perfschema_table1",
                   {
                     /* Hack SETUP_INSTRUMENT, incompatible change. */
-                    all_shares[16]->m_field_def->count++;
+                    all_shares[17]->m_field_def->count++;
                   });
 
   for (current= &all_shares[0]; (*current) != NULL; current++)

=== added file 'storage/perfschema/table_host_cache.cc'
--- a/storage/perfschema/table_host_cache.cc	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_host_cache.cc	2011-08-02 17:17:18 +0000
@@ -0,0 +1,266 @@
+/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; version 2 of the License.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software Foundation,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+/**
+  @file storage/perfschema/table_host_cache.cc
+  Table HOST_CACHE (implementation).
+*/
+
+#include "my_global.h"
+#include "my_pthread.h"
+#include "table_host_cache.h"
+#include "hostname.h"
+
+THR_LOCK table_host_cache::m_table_lock;
+
+static const TABLE_FIELD_TYPE field_types[]=
+{
+  {
+    { C_STRING_WITH_LEN("IP") },
+    { C_STRING_WITH_LEN("varchar(64)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("HOST") },
+    { C_STRING_WITH_LEN("varchar(255)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_BLOCKING_ERRORS") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("COUNT_NAMEINFO_ERRORS") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("COUNT_FORMAT_ERRORS") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("COUNT_ADDRINFO_ERRORS") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("COUNT_FCRDNS_ERRORS") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("COUNT_HOST_ACL_ERRORS") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("COUNT_USER_ACL_ERRORS") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  }
+};
+
+TABLE_FIELD_DEF
+table_host_cache::m_field_def=
+{ 9, field_types };
+
+PFS_engine_table_share
+table_host_cache::m_share=
+{
+  { C_STRING_WITH_LEN("host_cache") },
+  &pfs_readonly_acl,
+  &table_host_cache::create,
+  NULL, /* write_row */
+  NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
+  1000, /* records */
+  sizeof(PFS_simple_index), /* ref length */
+  &m_table_lock,
+  &m_field_def,
+  false /* checked */
+};
+
+PFS_engine_table* table_host_cache::create(void)
+{
+  table_host_cache *t= new table_host_cache();
+  if (t != NULL)
+  {
+    THD *thd= current_thd;
+    DBUG_ASSERT(thd != NULL);
+    t->materialize(thd);
+  }
+  return t;
+}
+
+table_host_cache::table_host_cache()
+  : PFS_engine_table(&m_share, &m_pos),
+    m_all_rows(NULL), m_row_count(0),
+    m_row(NULL), m_pos(0), m_next_pos(0)
+{}
+
+void table_host_cache::materialize(THD *thd)
+{
+  Host_entry *current;
+  uint size;
+  uint index;
+  row_host_cache *rows;
+  row_host_cache *row;
+
+  DBUG_ASSERT(m_all_rows == NULL);
+  DBUG_ASSERT(m_row_count == 0);
+
+  hostname_cache_lock();
+
+  size= hostname_cache_size();
+  if (size == 0)
+  {
+    /* Normal case, the cache is empty. */
+    goto end;
+  }
+
+  rows= (row_host_cache*) thd->alloc(size * sizeof(row_host_cache));
+  if (rows == NULL)
+  {
+    /* Out of memory, this thread will error out. */
+    goto end;
+  }
+
+  index= 0;
+  row= rows;
+  current= hostname_cache_first();
+
+  while ((current != NULL) && (index < size))
+  {
+    make_row(current, row);
+    index++;
+    row++;
+    current= current->next();
+  }
+
+  m_all_rows= rows;
+  m_row_count= index;
+  
+end:
+  hostname_cache_unlock();
+}
+
+void table_host_cache::make_row(Host_entry *entry, row_host_cache *row)
+{
+  row->m_ip_length= strlen(entry->ip_key);
+  strcpy(row->m_ip, entry->ip_key);
+  row->m_hostname_length= entry->m_hostname_length;
+  strcpy(row->m_hostname, entry->m_hostname);
+  row->m_hostname_length= 11;
+  row->m_sum_blocking_errors= entry->m_errors.get_blocking_errors();
+  row->m_count_nameinfo_errors= entry->m_errors.m_nameinfo_errors;
+  row->m_count_format_errors= entry->m_errors.m_format_errors;
+  row->m_count_addrinfo_errors= entry->m_errors.m_addrinfo_errors;
+  row->m_count_fcrdns_errors= entry->m_errors.m_FCrDNS_errors;
+  row->m_count_host_acl_errors= 12; // FIXME
+  row->m_count_user_acl_errors= 12; // FIXME
+}
+
+void table_host_cache::reset_position(void)
+{
+  m_pos.m_index= 0;
+  m_next_pos.m_index= 0;
+}
+
+int table_host_cache::rnd_next(void)
+{
+  int result;
+
+  m_pos.set_at(&m_next_pos);
+
+  if (m_pos.m_index < m_row_count)
+  {
+    m_row= &m_all_rows[m_pos.m_index];
+    m_next_pos.set_after(&m_pos);
+    result= 0;
+  }
+  else
+  {
+    m_row= NULL;
+    result= HA_ERR_END_OF_FILE;
+  }
+
+  return result;
+}
+
+int table_host_cache::rnd_pos(const void *pos)
+{
+  set_position(pos);
+  DBUG_ASSERT(m_pos.m_index < m_row_count);
+  m_row= &m_all_rows[m_pos.m_index];
+  return 0;
+}
+
+int table_host_cache::read_row_values(TABLE *table,
+                                      unsigned char *buf,
+                                      Field **fields,
+                                      bool read_all)
+{
+  Field *f;
+
+  DBUG_ASSERT(m_row);
+
+  /* Set the null bits */
+  DBUG_ASSERT(table->s->null_bytes == 1);
+  buf[0]= 0;
+
+  for (; (f= *fields) ; fields++)
+  {
+    if (read_all || bitmap_is_set(table->read_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case 0: /* IP */
+        set_field_varchar_utf8(f, m_row->m_ip, m_row->m_ip_length);
+        break;
+      case 1: /* HOST */
+        set_field_varchar_utf8(f, m_row->m_hostname, m_row->m_hostname_length);
+        break;
+      case 2: /* SUM_BLOCKING_ERRORS */
+        set_field_ulonglong(f, m_row->m_sum_blocking_errors);
+        break;
+      case 3: /* COUNT_NAMEINFO_ERRORS */
+        set_field_ulonglong(f, m_row->m_count_nameinfo_errors);
+        break;
+      case 4: /* COUNT_FORMAT_ERRORS */
+        set_field_ulonglong(f, m_row->m_count_format_errors);
+        break;
+      case 5: /* COUNT_ADDRINFO_ERRORS */
+        set_field_ulonglong(f, m_row->m_count_addrinfo_errors);
+        break;
+      case 6: /* COUNT_FCRDNS_ERRORS */
+        set_field_ulonglong(f, m_row->m_count_fcrdns_errors);
+        break;
+      case 7: /* COUNT_HOST_ACL_ERRORS */
+        set_field_ulonglong(f, m_row->m_count_host_acl_errors);
+        break;
+      case 8: /* COUNT_USER_ACL_ERRORS */
+        set_field_ulonglong(f, m_row->m_count_user_acl_errors);
+        break;
+      default:
+        DBUG_ASSERT(false);
+      }
+    }
+  }
+
+  return 0;
+}
+

=== added file 'storage/perfschema/table_host_cache.h'
--- a/storage/perfschema/table_host_cache.h	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_host_cache.h	2011-08-02 17:17:18 +0000
@@ -0,0 +1,95 @@
+/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; version 2 of the License.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software Foundation,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#ifndef TABLE_HOST_CACHE_H
+#define TABLE_HOST_CACHE_H
+
+/**
+  @file storage/perfschema/table_host_cache.h
+  Table HOST_CACHE (declarations).
+*/
+
+#include "pfs_column_types.h"
+#include "pfs_engine_table.h"
+
+class Host_entry;
+
+/**
+  @addtogroup Performance_schema_tables
+  @{
+*/
+
+/** A row of PERFORMANCE_SCHEMA.HOST_CACHE. */
+struct row_host_cache
+{
+  char m_ip[64];
+  uint m_ip_length;
+  /** Column HOST. */
+  char m_hostname[255];
+  uint m_hostname_length;
+  ulonglong m_sum_blocking_errors;
+  ulonglong m_count_nameinfo_errors;
+  ulonglong m_count_format_errors;
+  ulonglong m_count_addrinfo_errors;
+  ulonglong m_count_fcrdns_errors;
+  ulonglong m_count_host_acl_errors;
+  ulonglong m_count_user_acl_errors;
+};
+
+/** Table PERFORMANCE_SCHEMA.HOST_CACHE. */
+class table_host_cache : public PFS_engine_table
+{
+public:
+  /** Table share. */
+  static PFS_engine_table_share m_share;
+  static PFS_engine_table* create();
+
+  virtual int rnd_next();
+  virtual int rnd_pos(const void *pos);
+  virtual void reset_position(void);
+
+protected:
+  virtual int read_row_values(TABLE *table,
+                              unsigned char *buf,
+                              Field **fields,
+                              bool read_all);
+
+  table_host_cache();
+
+public:
+  ~table_host_cache()
+  {}
+
+private:
+  void materialize(THD *thd);
+  static void make_row(Host_entry *entry, row_host_cache *row);
+
+  /** Table share lock. */
+  static THR_LOCK m_table_lock;
+  /** Fields definition. */
+  static TABLE_FIELD_DEF m_field_def;
+
+  row_host_cache *m_all_rows;
+  uint m_row_count;
+  /** Current row. */
+  row_host_cache *m_row;
+  /** Current position. */
+  PFS_simple_index m_pos;
+  /** Next position. */
+  PFS_simple_index m_next_pos;
+};
+
+/** @} */
+#endif

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-wl5259 branch (marc.alff:3332 to 3333) WL#5259Marc Alff3 Aug