Commit 4ed09d54 authored by Arun Kuruvila's avatar Arun Kuruvila

No commit message

No commit message
parent 447eaa5b
/* 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
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)
{
THD *thd= current_thd;
DBUG_ENTER("ha_federated::close");
free_result();
......@@ -1686,7 +1687,7 @@ int ha_federated::close(void)
FLUSH TABLES will quit the connection and if connection is broken,
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;
/* Disconnect from mysql */
......@@ -1700,9 +1701,16 @@ int ha_federated::close(void)
if the original query was not issued against the FEDERATED table.
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();
/*
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));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment