diff options
author | Monty <monty@mariadb.org> | 2016-01-03 13:20:07 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2016-01-03 13:20:07 +0200 |
commit | 661a6d89065390ca1e9b4be05219b75f850ed290 (patch) | |
tree | 5e58bf86d9880d4cfc23eb71e074135b9e3ed45a /sql/net_serv.cc | |
parent | 4b4777ab63522b2bdd1f98ad03558a5b1da53dc0 (diff) | |
download | mariadb-git-661a6d89065390ca1e9b4be05219b75f850ed290.tar.gz |
Cleanup of slave code:
- Added testing if connection is killed to shortcut reading of connection data
This will allow us later in 10.2 to do a cleaner shutdown of slaves (less errors in the log)
- Add new status variables: Slaves_connected, Slaves_running and Slave_connections.
- Use MYSQL_SLAVE_NOT_RUN instead of 0 with slave_running.
- Don't print obvious extra warnings to the error log when slave is shut down normally.
Diffstat (limited to 'sql/net_serv.cc')
-rw-r--r-- | sql/net_serv.cc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 0ce0fa93f99..91a17606d68 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -34,6 +34,7 @@ HFTODO this must be hidden if we don't want client capabilities in embedded library */ + #include <my_global.h> #include <mysql.h> #include <mysql_com.h> @@ -107,13 +108,12 @@ extern void query_cache_insert(const char *packet, ulong length, unsigned pkt_nr); #endif // HAVE_QUERY_CACHE #define update_statistics(A) A -#else -#define update_statistics(A) -#endif - -#ifdef MYSQL_SERVER +extern my_bool thd_net_is_killed(); /* Additional instrumentation hooks for the server */ #include "mysql_com_server.h" +#else +#define update_statistics(A) +#define thd_net_is_killed() 0 #endif #define TEST_BLOCKING 8 @@ -875,6 +875,16 @@ my_real_read(NET *net, size_t *complen, DBUG_PRINT("info",("vio_read returned %ld errno: %d", (long) length, vio_errno(net->vio))); + + if (i== 0 && thd_net_is_killed()) + { + len= packet_error; + net->error= 0; + net->last_errno= ER_CONNECTION_KILLED; + MYSQL_SERVER_my_error(net->last_errno, MYF(0)); + goto end; + } + #if !defined(__WIN__) && defined(MYSQL_SERVER) /* We got an error that there was no data on the socket. We now set up |