Commit 286c4998 authored by inaam's avatar inaam

branches/zip: Merge r2213:2236 from branches/5.1.

Forward port of r2236
Introduce retry/sleep logic as a workaround for a transient bug
where ::open fails for partitioned tables randomly if we are using
one file per table.  (Bug #33349)


Reviewed by: Heikki
parent d6a05779
...@@ -2389,6 +2389,8 @@ ha_innobase::open( ...@@ -2389,6 +2389,8 @@ 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;
DBUG_ENTER("ha_innobase::open"); DBUG_ENTER("ha_innobase::open");
...@@ -2422,11 +2424,29 @@ ha_innobase::open( ...@@ -2422,11 +2424,29 @@ ha_innobase::open(
DBUG_RETURN(1); DBUG_RETURN(1);
} }
/* We look for pattern #P# to see if the table is partitioned
MySQL table. The retry logic for partitioned tables is a
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. */
is_part = strstr(norm_name, "#P#");
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) {
++retries;
os_thread_sleep(100000);
goto retry;
}
if (is_part) {
sql_print_error("Failed to open table %s after "
"%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"
"the internal data dictionary of InnoDB " "the internal data dictionary of InnoDB "
"though the .frm file for the\n" "though the .frm file for the\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