diff options
author | Timothy Smith <timothy.smith@sun.com> | 2008-12-14 12:15:12 -0700 |
---|---|---|
committer | Timothy Smith <timothy.smith@sun.com> | 2008-12-14 12:15:12 -0700 |
commit | 1945f661f7b4baf57bb7a95222f70a7d14544a5a (patch) | |
tree | 121881b67bf71bcdda5984186cc39abc59f4a239 /storage | |
parent | 25f3574a4f535a86a279b0eb368879e45607fbce (diff) | |
download | mariadb-git-1945f661f7b4baf57bb7a95222f70a7d14544a5a.tar.gz |
Complete applying InnoDB snapshot innodb-5.1-ss2479. Fixes
Bug #11894: innodb_file_per_table crashes w/ Windows .sym symbolic link hack
Detailed revision comments:
r2466 | calvin | 2008-05-20 01:37:14 +0300 (Tue, 20 May 2008) | 12 lines
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
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 23 | ||||
-rw-r--r-- | storage/innobase/os/os0file.c | 32 |
2 files changed, 49 insertions, 6 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index cd2b121cbf4..4b7c5b1246a 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4990,6 +4990,29 @@ ha_innobase::create( DBUG_ENTER("ha_innobase::create"); 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) { /* The limit probably should be REC_MAX_N_FIELDS - 3 = 1020, diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index 9adb9ddac50..8fd959512c1 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -1267,9 +1267,19 @@ try_again: if (file == INVALID_HANDLE_VALUE) { *success = FALSE; - retry = os_file_handle_error(name, - create_mode == OS_FILE_CREATE ? - "create" : "open"); + /* 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, + create_mode == OS_FILE_CREATE ? + "create" : "open"); + } + if (retry) { goto try_again; } @@ -1344,9 +1354,19 @@ try_again: if (file == -1) { *success = FALSE; - retry = os_file_handle_error(name, - create_mode == OS_FILE_CREATE ? - "create" : "open"); + /* 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, + create_mode == OS_FILE_CREATE ? + "create" : "open"); + } + if (retry) { goto try_again; } else { |