Bug #59404 More info from host cache
Submitted: 10 Jan 2011 21:34 Modified: 2 May 2011 8:02
Reporter: Daniël van Eeden Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Server: Information schema Severity:S4 (Feature request)
Version:5.5 OS:Any
Assigned to: CPU Architecture:Any
Triage: Needs Triage: D5 (Feature request)

[10 Jan 2011 21:34] Daniël van Eeden
The documentation suggests in http://dev.mysql.com/doc/refman/5.5/en/dns.html that the HOST_CACHE_SIZE can be changed from the default (128) but there is no method I know of to query the current size.

It's possible to do a FLUSH HOSTS, but it's not possible to view the contents of the hosts cache.

mysqladmin debug also doesn't show the host cache

It's not clear in the docs if the replication code also uses the host cache to find the master.

How to repeat:
Read docs, look at status variables.

Suggested fix:
* Add a Host_cache_size status variable
* Add info to the docs about if the replication slave uses host_cache to find the master
[11 Jan 2011 4:20] Valeriy Kravchuk
Thank you for the feature request.
[11 Jan 2011 13:10] Georgi Kodinov
Handled in WL#5259
[2 May 2011 3:32] Jeremy Cole
Everything old is new again: http://bugs.mysql.com/bug.php?id=22821
[2 May 2011 8:02] Valeriy Kravchuk
Yes, we can call this a duplicate of Bug #22821.
[20 Mar 2012 16:37] Paul Dubois
Noted in 5.6.5 changelog.

MySQL now provides improved access to the host cache, which contains
client host name and IP address information and is used to avoid DNS
lookups. These improvements have been implemented:

* A host_cache Performance Schema table exposes the contents of the
  host cache so that it can be examined using SELECT statements. The
  Performance Schema must be enabled or this table is empty.

  If you upgrade to this release of MySQL from an earlier version, you
  must run mysql_upgrade (and restart the server) to incorporate this
  change into the performance_schema database.

* The cache size is configurable using the host_cache_size system
  variable. Setting the size to 0 disables the host cache.This is
  similar to starting the server with --skip-host-cache, but
  host_cache_size is more flexible because it can also be used to
  resize, enable, or disable the host cache at runtime, not just at
  server startup. If you start the server with --skip-host-cache to
  disable the host cache, it cannot be re-enabled at runtime.

* There are Connection_errors_xxx status variables that provide
  information about the nature of connection errors and that can help
  diagnose connection problems.

Improved access to host cache contents makes it possible to answer
questions such as how many hosts are cached, or how close hosts are
to being blocked (by checking whether the
host_cache.SUM_CONNECT_ERRORS column is approaching the value of the
max_connect_errors system variable).