This commit is contained in:
Arun Kuruvila 2016-02-23 12:10:41 +05:30
parent 447eaa5bc0
commit 4ed09d54f5

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -1675,6 +1675,7 @@ int ha_federated::open(const char *name, int mode, uint test_if_locked)
int ha_federated::close(void) int ha_federated::close(void)
{ {
THD *thd= current_thd;
DBUG_ENTER("ha_federated::close"); DBUG_ENTER("ha_federated::close");
free_result(); free_result();
@ -1686,7 +1687,7 @@ int ha_federated::close(void)
FLUSH TABLES will quit the connection and if connection is broken, FLUSH TABLES will quit the connection and if connection is broken,
it will reconnect again and quit silently. it will reconnect again and quit silently.
*/ */
if (mysql && !vio_is_connected(mysql->net.vio)) if (mysql && (!mysql->net.vio || !vio_is_connected(mysql->net.vio)))
mysql->net.error= 2; mysql->net.error= 2;
/* Disconnect from mysql */ /* Disconnect from mysql */
@ -1700,9 +1701,16 @@ int ha_federated::close(void)
if the original query was not issued against the FEDERATED table. if the original query was not issued against the FEDERATED table.
So, don't propagate errors from mysql_close(). So, don't propagate errors from mysql_close().
*/ */
if (table->in_use) if (table->in_use && thd != table->in_use)
table->in_use->clear_error(); table->in_use->clear_error();
/*
Errors from mysql_close() are silently ignored for flush tables.
Close the connection silently.
*/
if (thd && thd->lex->sql_command == SQLCOM_FLUSH)
thd->clear_error();
DBUG_RETURN(free_share(share)); DBUG_RETURN(free_share(share));
} }