Commit 30049697 authored by Annamalai Gurusami's avatar Annamalai Gurusami

Bug #15973904 INNODB PARTITION CODE HOLDS LOCK_OPEN AND SLEEPS WHILE

OPENING MISSING PARTITION

In the ha_innobase::open() call, for normal tables, there is no retry logic.
But for partitioned tables, there is a retry logic introduced as fix for:

http://bugs.mysql.com/bug.php?id=33349  
https://support.mysql.com/view.php?id=21080

The Bug#33349, does not provide sufficient information to analyze the original
problem.  The original problem reported by bug#33349 is also minor (just an
annoyance and no loss of functionality).  Most importantly, the retry logic
has been introduced without any associated test case.

So we are removing the retry logic for partitioned tables.  When the original
problem occurs, a different solution will be explored.
parent 93f380c5
...@@ -2977,7 +2977,6 @@ ha_innobase::open( ...@@ -2977,7 +2977,6 @@ ha_innobase::open(
dict_table_t* ib_table; dict_table_t* ib_table;
char norm_name[1000]; char norm_name[1000];
THD* thd; THD* thd;
ulint retries = 0;
char* is_part = NULL; char* is_part = NULL;
ibool par_case_name_set = FALSE; ibool par_case_name_set = FALSE;
char par_case_name[MAX_FULL_NAME_LEN + 1]; char par_case_name[MAX_FULL_NAME_LEN + 1];
...@@ -3023,22 +3022,18 @@ ha_innobase::open( ...@@ -3023,22 +3022,18 @@ ha_innobase::open(
} }
/* We look for pattern #P# to see if the table is partitioned /* We look for pattern #P# to see if the table is partitioned
MySQL table. The retry logic for partitioned tables is a MySQL table. */
workaround for http://bugs.mysql.com/bug.php?id=33349. Look
at support issue https://support.mysql.com/view.php?id=21080
for more details. */
#ifdef __WIN__ #ifdef __WIN__
is_part = strstr(norm_name, "#p#"); is_part = strstr(norm_name, "#p#");
#else #else
is_part = strstr(norm_name, "#P#"); is_part = strstr(norm_name, "#P#");
#endif /* __WIN__ */ #endif /* __WIN__ */
retry:
/* Get pointer to a table object in InnoDB dictionary cache */ /* Get pointer to a table object in InnoDB dictionary cache */
ib_table = dict_table_get(norm_name, TRUE); ib_table = dict_table_get(norm_name, TRUE);
if (NULL == ib_table) { if (NULL == ib_table) {
if (is_part && retries < 10) { if (is_part) {
/* MySQL partition engine hard codes the file name /* MySQL partition engine hard codes the file name
separator as "#P#". The text case is fixed even if separator as "#P#". The text case is fixed even if
lower_case_table_names is set to 1 or 2. This is true lower_case_table_names is set to 1 or 2. This is true
...@@ -3081,11 +3076,7 @@ retry: ...@@ -3081,11 +3076,7 @@ retry:
ib_table = dict_table_get( ib_table = dict_table_get(
par_case_name, FALSE); par_case_name, FALSE);
} }
if (!ib_table) { if (ib_table) {
++retries;
os_thread_sleep(100000);
goto retry;
} else {
#ifndef __WIN__ #ifndef __WIN__
sql_print_warning("Partition table %s opened " sql_print_warning("Partition table %s opened "
"after converting to lower " "after converting to lower "
...@@ -3108,12 +3099,9 @@ retry: ...@@ -3108,12 +3099,9 @@ retry:
#endif #endif
goto table_opened; goto table_opened;
} }
}
if (is_part) { sql_print_error("Failed to open table %s.\n",
sql_print_error("Failed to open table %s after " norm_name);
"%lu attemtps.\n", norm_name,
retries);
} }
sql_print_error("Cannot find or open table %s from\n" sql_print_error("Cannot find or open table %s from\n"
......
...@@ -3615,7 +3615,6 @@ ha_innobase::open( ...@@ -3615,7 +3615,6 @@ ha_innobase::open(
dict_table_t* ib_table; dict_table_t* ib_table;
char norm_name[1000]; char norm_name[1000];
THD* thd; THD* thd;
ulint retries = 0;
char* is_part = NULL; char* is_part = NULL;
ibool par_case_name_set = FALSE; ibool par_case_name_set = FALSE;
char par_case_name[MAX_FULL_NAME_LEN + 1]; char par_case_name[MAX_FULL_NAME_LEN + 1];
...@@ -3661,22 +3660,18 @@ ha_innobase::open( ...@@ -3661,22 +3660,18 @@ ha_innobase::open(
} }
/* We look for pattern #P# to see if the table is partitioned /* We look for pattern #P# to see if the table is partitioned
MySQL table. The retry logic for partitioned tables is a MySQL table. */
workaround for http://bugs.mysql.com/bug.php?id=33349. Look
at support issue https://support.mysql.com/view.php?id=21080
for more details. */
#ifdef __WIN__ #ifdef __WIN__
is_part = strstr(norm_name, "#p#"); is_part = strstr(norm_name, "#p#");
#else #else
is_part = strstr(norm_name, "#P#"); is_part = strstr(norm_name, "#P#");
#endif /* __WIN__ */ #endif /* __WIN__ */
retry:
/* Get pointer to a table object in InnoDB dictionary cache */ /* Get pointer to a table object in InnoDB dictionary cache */
ib_table = dict_table_get(norm_name, TRUE); ib_table = dict_table_get(norm_name, TRUE);
if (NULL == ib_table) { if (NULL == ib_table) {
if (is_part && retries < 10) { if (is_part) {
/* MySQL partition engine hard codes the file name /* MySQL partition engine hard codes the file name
separator as "#P#". The text case is fixed even if separator as "#P#". The text case is fixed even if
lower_case_table_names is set to 1 or 2. This is true lower_case_table_names is set to 1 or 2. This is true
...@@ -3719,11 +3714,7 @@ retry: ...@@ -3719,11 +3714,7 @@ retry:
ib_table = dict_table_get( ib_table = dict_table_get(
par_case_name, FALSE); par_case_name, FALSE);
} }
if (!ib_table) { if (ib_table) {
++retries;
os_thread_sleep(100000);
goto retry;
} else {
#ifndef __WIN__ #ifndef __WIN__
sql_print_warning("Partition table %s opened " sql_print_warning("Partition table %s opened "
"after converting to lower " "after converting to lower "
...@@ -3749,9 +3740,8 @@ retry: ...@@ -3749,9 +3740,8 @@ retry:
} }
if (is_part) { if (is_part) {
sql_print_error("Failed to open table %s after " sql_print_error("Failed to open table %s.\n",
"%lu attempts.\n", norm_name, norm_name);
retries);
} }
sql_print_error("Cannot find or open table %s from\n" sql_print_error("Cannot find or open table %s from\n"
......
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