From 08526dfb0109a5809101ec7818a9514b2f5ea606 Mon Sep 17 00:00:00 2001 From: Arun Kuruvila Date: Wed, 28 Jan 2015 09:43:34 +0530 Subject: Bug #12671631 CREATE TABLE .. LIKE .. FEDERATED TABLE CRASHES WITH AUTO_INCREMENT COLUMN Description:- Creating a federated table with AUTO_INCREMENT column using LIKE clause results in a server crash. Analysis:- Creating a federated table with AUTO_INCREMENT column using LIKE clause results in a federated server crash due to the uninitialized connection structure(mysql). Also due to unassigned connection string for the remote server, at the time of preparation of "create_info" structure, the creation of any federated table using LIKE clause fails with an error, "ERROR 1 (HY000): server name: '' doesn't exist!". This bug is not only with AUTO_INCREMENT but in all creations of federated tables with LIKE clause. Fix :- In ha_federated::info(), "mysql->insert_id" assigned to "stats.auto_increment_value" only when there is an active connection. This fixes the crash issue. For creating the federated table with LIKE clause, connection string is assigned at the time of preparation of "create_info" structure. --- storage/federated/ha_federated.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'storage') diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 541b3327ad4..8209b5a2fcf 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2004, 2015, 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 @@ -2944,7 +2944,7 @@ int ha_federated::info(uint flag) } - if (flag & HA_STATUS_AUTO) + if ((flag & HA_STATUS_AUTO) && mysql) stats.auto_increment_value= mysql->insert_id; mysql_free_result(result); -- cgit v1.2.1