From 4ed09d54f53771383b943ee6610dae5faa068cff Mon Sep 17 00:00:00 2001 From: Arun Kuruvila Date: Tue, 23 Feb 2016 12:10:41 +0530 Subject: --- storage/federated/ha_federated.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'storage') diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 8209b5a2fcf..b47c4565743 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -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 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)); } -- cgit v1.2.1