summaryrefslogtreecommitdiff
path: root/storage/maria/ma_create.c
diff options
context:
space:
mode:
Diffstat (limited to 'storage/maria/ma_create.c')
-rw-r--r--storage/maria/ma_create.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c
index 25c44f7c90e..d64dc8308c5 100644
--- a/storage/maria/ma_create.c
+++ b/storage/maria/ma_create.c
@@ -319,7 +319,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
{
options|= HA_OPTION_TMP_TABLE;
tmp_table= TRUE;
- create_mode|= O_NOFOLLOW;
+ create_mode|= O_NOFOLLOW | (internal_table ? 0 : O_EXCL);
/* "CREATE TEMPORARY" tables are not crash-safe (dropped at restart) */
ci->transactional= FALSE;
flags&= ~HA_CREATE_PAGE_CHECKSUM;
@@ -894,9 +894,10 @@ int maria_create(const char *name, enum data_file_type datafile_type,
{
char *iext= strrchr(name, '.');
int have_iext= iext && !strcmp(iext, MARIA_NAME_IEXT);
- fn_format(kfilename, name, "", MARIA_NAME_IEXT,
- MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
+ fn_format(kfilename, name, "", MARIA_NAME_IEXT, MY_UNPACK_FILENAME |
+ (internal_table ? 0 : MY_RETURN_REAL_PATH) |
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
+ klinkname_ptr= NullS;
/*
Replace the current file.
Don't sync dir now if the data file has the same path.
@@ -1173,14 +1174,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
FALSE, TRUE))
goto err;
my_free(log_data);
-
- /*
- We don't need to sync directory as we can use the log to recreate
- the index and data files if needed.
- */
- sync_dir= 0;
}
- DBUG_ASSERT(!internal_table || sync_dir == 0);
if (!(flags & HA_DONT_TOUCH_DATA))
{
@@ -1218,7 +1212,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
if ((dfile=
mysql_file_create_with_symlink(key_file_dfile, dlinkname_ptr,
dfilename, 0, create_mode,
- MYF(MY_WME | create_flag))) < 0)
+ MYF(MY_WME | create_flag | sync_dir))) < 0)
goto err;
errpos=3;