Commit 1d628f12 authored by calvin's avatar calvin

branches/5.1:

Fix Bug#11894 innodb_file_per_table crashes w/ Windows .sym symbolic
link hack

The crash was due to un-handled error 3 (path not found). In the case
of file per table, change the call to os_file_handle_error_no_exit()
from os_file_handle_error(). Also, checks for full path pattern during
table create (Windows only), which is used in symbolic link and temp
table creation.

Approved by:	Heikki
parent bb959269
...@@ -4989,6 +4989,29 @@ ha_innobase::create( ...@@ -4989,6 +4989,29 @@ ha_innobase::create(
DBUG_ENTER("ha_innobase::create"); DBUG_ENTER("ha_innobase::create");
DBUG_ASSERT(thd != NULL); DBUG_ASSERT(thd != NULL);
DBUG_ASSERT(create_info != NULL);
#ifdef __WIN__
/* Names passed in from server are in two formats:
1. <database_name>/<table_name>: for normal table creation
2. full path: for temp table creation, or sym link
When srv_file_per_table is on, check for full path pattern, i.e.
X:\dir\..., X is a driver letter, or
\\dir1\dir2\..., UNC path
returns error if it is in full path format, but not creating a temp.
table. Currently InnoDB does not support symbolic link on Windows. */
if (srv_file_per_table
&& (!create_info->options & HA_LEX_CREATE_TMP_TABLE)) {
if ((name[1] == ':')
|| (name[0] == '\\' && name[1] == '\\')) {
sql_print_error("Cannot create table %s\n", name);
DBUG_RETURN(HA_ERR_GENERIC);
}
}
#endif
if (form->s->fields > 1000) { if (form->s->fields > 1000) {
/* The limit probably should be REC_MAX_N_FIELDS - 3 = 1020, /* The limit probably should be REC_MAX_N_FIELDS - 3 = 1020,
......
...@@ -1267,9 +1267,19 @@ try_again: ...@@ -1267,9 +1267,19 @@ try_again:
if (file == INVALID_HANDLE_VALUE) { if (file == INVALID_HANDLE_VALUE) {
*success = FALSE; *success = FALSE;
/* When srv_file_per_table is on, file creation failure may not
be critical to the whole instance. Do not crash the server in
case of unknown errors. */
if (srv_file_per_table) {
retry = os_file_handle_error_no_exit(name,
create_mode == OS_FILE_CREATE ?
"create" : "open");
} else {
retry = os_file_handle_error(name, retry = os_file_handle_error(name,
create_mode == OS_FILE_CREATE ? create_mode == OS_FILE_CREATE ?
"create" : "open"); "create" : "open");
}
if (retry) { if (retry) {
goto try_again; goto try_again;
} }
...@@ -1344,9 +1354,19 @@ try_again: ...@@ -1344,9 +1354,19 @@ try_again:
if (file == -1) { if (file == -1) {
*success = FALSE; *success = FALSE;
/* When srv_file_per_table is on, file creation failure may not
be critical to the whole instance. Do not crash the server in
case of unknown errors. */
if (srv_file_per_table) {
retry = os_file_handle_error_no_exit(name,
create_mode == OS_FILE_CREATE ?
"create" : "open");
} else {
retry = os_file_handle_error(name, retry = os_file_handle_error(name,
create_mode == OS_FILE_CREATE ? create_mode == OS_FILE_CREATE ?
"create" : "open"); "create" : "open");
}
if (retry) { if (retry) {
goto try_again; goto try_again;
} else { } else {
......
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