Below is the list of changes that have just been committed into a local
4.1 repository of antony. When antony does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2501 06/06/14 20:01:37 acurtis@stripped +3 -0
Bug#8706
"temporary table with data directory option fails"
myisam should not use user-specified table name when creating
temporary tables and use generated connection specific real name.
Test included.
mysql-test/t/myisam.test
1.46 06/06/14 20:01:35 acurtis@stripped +31 -0
Bug#8706
Test for bug
mysql-test/r/myisam.result
1.60 06/06/14 20:01:35 acurtis@stripped +21 -0
Bug#8706
Test for bug
myisam/mi_create.c
1.48 06/06/14 20:01:35 acurtis@stripped +25 -7
Bug#8706
When creating a temporary table with directory override, ensure that
the real filename is using the hidden temporary name otherwise
multiple clients cannot have same named temporary tables without
conflict.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: acurtis
# Host: ltamd64.xiphis.org
# Root: /home/antony/work2/p2-bug8706.2
--- 1.47/myisam/mi_create.c 2005-07-23 08:03:31 -07:00
+++ 1.48/myisam/mi_create.c 2006-06-14 20:01:35 -07:00
@@ -519,9 +519,18 @@ int mi_create(const char *name,uint keys
if (ci->index_file_name)
{
- fn_format(filename, ci->index_file_name,"",MI_NAME_IEXT,4);
- fn_format(linkname,name, "",MI_NAME_IEXT,4);
- linkname_ptr=linkname;
+ if (options & HA_OPTION_TMP_TABLE)
+ {
+ char *path= strrchr(ci->index_file_name, FN_LIBCHAR);
+ if (path) *path= '\0';
+ fn_format(filename, name, ci->index_file_name, MI_NAME_IEXT,
+ MY_REPLACE_DIR | MY_UNPACK_FILENAME);
+ }
+ else
+ fn_format(filename, ci->index_file_name, "",
+ MI_NAME_IEXT, MY_UNPACK_FILENAME);
+ fn_format(linkname,name, "", MI_NAME_IEXT, MY_UNPACK_FILENAME);
+ linkname_ptr= linkname;
/*
Don't create the table if the link or file exists to ensure that one
doesn't accidently destroy another table.
@@ -575,10 +584,19 @@ int mi_create(const char *name,uint keys
{
if (ci->data_file_name)
{
- fn_format(filename, ci->data_file_name,"",MI_NAME_DEXT,4);
- fn_format(linkname, name, "",MI_NAME_DEXT,4);
- linkname_ptr=linkname;
- create_flag=0;
+ if (options & HA_OPTION_TMP_TABLE)
+ {
+ char *path= strrchr(ci->data_file_name, FN_LIBCHAR);
+ if (path) *path= '\0';
+ fn_format(filename, name, ci->data_file_name, MI_NAME_DEXT,
+ MY_REPLACE_DIR | MY_UNPACK_FILENAME);
+ }
+ else
+ fn_format(filename, ci->data_file_name, "",
+ MI_NAME_DEXT, MY_UNPACK_FILENAME);
+ fn_format(linkname, name, "", MI_NAME_DEXT, MY_UNPACK_FILENAME);
+ linkname_ptr= linkname;
+ create_flag= 0;
}
else
{
--- 1.59/mysql-test/r/myisam.result 2006-03-10 06:03:00 -08:00
+++ 1.60/mysql-test/r/myisam.result 2006-06-14 20:01:35 -07:00
@@ -748,3 +748,24 @@ select count(id1) from t1 where id2 = 10
count(id1)
5
drop table t1;
+show create table t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+show create table t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create table t1 (a int) engine=myisam select 42 a;
+select * from t1;
+a
+9
+select * from t1;
+a
+99
+select * from t1;
+a
+42
+drop table t1;
--- 1.45/mysql-test/t/myisam.test 2006-03-10 06:03:00 -08:00
+++ 1.46/mysql-test/t/myisam.test 2006-06-14 20:01:35 -07:00
@@ -705,4 +705,35 @@ select count(*) from t1 where id2 = 10
select count(id1) from t1 where id2 = 10;
drop table t1;
+#
+# Bug#8706 - temporary table with data directory option fails
+#
+connect (session1,localhost,root,,);
+connect (session2,localhost,root,,);
+
+connection session1;
+disable_query_log;
+eval create temporary table t1 (a int) engine=myisam data
directory="$MYSQL_TEST_DIR/var/tmp" select 9 a;
+enable_query_log;
+show create table t1;
+
+connection session2;
+disable_query_log;
+eval create temporary table t1 (a int) engine=myisam data
directory="$MYSQL_TEST_DIR/var/tmp" select 99 a;
+enable_query_log;
+show create table t1;
+
+connection default;
+create table t1 (a int) engine=myisam select 42 a;
+
+connection session1;
+select * from t1;
+disconnect session1;
+connection session2;
+select * from t1;
+disconnect session2;
+connection default;
+select * from t1;
+drop table t1;
+
# End of 4.1 tests
| Thread |
|---|
| • bk commit into 4.1 tree (acurtis:1.2501) BUG#8706 | antony | 15 Jun |