Commit 38e97dae authored by Annamalai Gurusami's avatar Annamalai Gurusami

Bug #16244691 SERVER GONE AWAY ERROR OCCURS DEPENDING ON THE NUMBER OF

TABLE/KEY RELATIONS

Problem:

When there are many tables, linked together through the foreign key
constraints, then loading one table will recursively open other tables.  This
can sometimes lead to thread stack overflow.  In such situations the server
will exit.

I see the stack overflow problem when the thread_stack is 196608 (the default
value for 32-bit systems).  I don't see the problem when the thread_stack is
set to 262144 (the default value for 64-bit systems).

Solution:

Currently, in InnoDB, there is a macro DICT_FK_MAX_RECURSIVE_LOAD which defines
the maximum number of tables that will be loaded recursively because of foreign
key relations.  This is currently set to 250.  We can reduce this number to 33
(anything more than 33 does not solve the problem for the default value).  We
can keep it small enough so that thread stack overflow does not happen for the
default values.  Reducing the DICT_FK_MAX_RECURSIVE_LOAD will not affect the
functionality of InnoDB.  The tables will eventually be loaded. 

rb#2058 approved by Marko

parent 1ea6eb14
/****************************************************** /*****************************************************************************
Data dictionary memory object creation
Copyright (c) 1996, 2013, 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 the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
(c) 1996 Innobase Oy You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
/**************************************************//**
@file include/dict0mem.h
Data dictionary memory object creation
Created 1/8/1996 Heikki Tuuri Created 1/8/1996 Heikki Tuuri
*******************************************************/ *******************************************************/
...@@ -300,7 +317,7 @@ This could result in rescursive calls and out of stack error eventually. ...@@ -300,7 +317,7 @@ This could result in rescursive calls and out of stack error eventually.
DICT_FK_MAX_RECURSIVE_LOAD defines the maximum number of recursive loads, DICT_FK_MAX_RECURSIVE_LOAD defines the maximum number of recursive loads,
when exceeded, the child table will not be loaded. It will be loaded when when exceeded, the child table will not be loaded. It will be loaded when
the foreign constraint check needs to be run. */ the foreign constraint check needs to be run. */
#define DICT_FK_MAX_RECURSIVE_LOAD 250 #define DICT_FK_MAX_RECURSIVE_LOAD 33
/** Similarly, when tables are chained together with foreign key constraints /** Similarly, when tables are chained together with foreign key constraints
with on cascading delete/update clause, delete from parent table could with on cascading delete/update clause, delete from parent table could
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -118,7 +118,7 @@ This could result in rescursive calls and out of stack error eventually. ...@@ -118,7 +118,7 @@ This could result in rescursive calls and out of stack error eventually.
DICT_FK_MAX_RECURSIVE_LOAD defines the maximum number of recursive loads, DICT_FK_MAX_RECURSIVE_LOAD defines the maximum number of recursive loads,
when exceeded, the child table will not be loaded. It will be loaded when when exceeded, the child table will not be loaded. It will be loaded when
the foreign constraint check needs to be run. */ the foreign constraint check needs to be run. */
#define DICT_FK_MAX_RECURSIVE_LOAD 250 #define DICT_FK_MAX_RECURSIVE_LOAD 33
/** Similarly, when tables are chained together with foreign key constraints /** Similarly, when tables are chained together with foreign key constraints
with on cascading delete/update clause, delete from parent table could with on cascading delete/update clause, delete from parent table could
......
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