Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
49285e96
Commit
49285e96
authored
Jul 11, 2007
by
gkodinov/kgeorge@magare.gmz
Browse files
Options
Browse Files
Download
Plain Diff
Merge magare.gmz:/home/kgeorge/mysql/work/B29325-5.0-opt
into magare.gmz:/home/kgeorge/mysql/work/B29325-5.1-opt
parents
c5025571
015e1290
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
63 additions
and
2 deletions
+63
-2
include/my_base.h
include/my_base.h
+1
-0
mysql-test/r/create.result
mysql-test/r/create.result
+17
-0
mysql-test/t/create.test
mysql-test/t/create.test
+31
-0
sql/set_var.cc
sql/set_var.cc
+2
-0
sql/sql_class.h
sql/sql_class.h
+1
-0
sql/sql_table.cc
sql/sql_table.cc
+3
-0
sql/unireg.cc
sql/unireg.cc
+2
-0
storage/myisam/ha_myisam.cc
storage/myisam/ha_myisam.cc
+2
-0
storage/myisam/mi_create.c
storage/myisam/mi_create.c
+4
-2
No files found.
include/my_base.h
View file @
49285e96
...
...
@@ -299,6 +299,7 @@ enum ha_base_keytype {
#define HA_PACK_RECORD 2
/* Request packed record format */
#define HA_CREATE_TMP_TABLE 4
#define HA_CREATE_CHECKSUM 8
#define HA_CREATE_KEEP_FILES 16
/* don't overwrite .MYD and MYI */
#define HA_CREATE_DELAY_KEY_WRITE 64
#define HA_CREATE_RELIES_ON_SQL_LAYER 128
...
...
mysql-test/r/create.result
View file @
49285e96
...
...
@@ -1516,6 +1516,23 @@ t1 CREATE TABLE `t1` (
`c17` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE DATABASE db1;
CREATE DATABASE db2;
USE db2;
INSERT INTO db2.t1 VALUES (1);
SELECT * FROM db2.t1;
b
1
RESET QUERY CACHE;
USE db1;
SET SESSION keep_files_on_create = TRUE;
CREATE TABLE t1 (a INT) ENGINE MYISAM;
ERROR HY000: Can't create/write to file './db1/t1.MYD' (Errcode: 17)
SET SESSION keep_files_on_create = DEFAULT;
DROP TABLE db2.t1;
DROP DATABASE db1;
DROP DATABASE db2;
USE test;
End of 5.0 tests
CREATE TABLE t1 (a int, b int);
insert into t1 values (1,1),(1,2);
...
...
mysql-test/t/create.test
View file @
49285e96
...
...
@@ -1122,6 +1122,37 @@ show create table t1;
drop
table
t1
;
#
# Bug #29325: create table overwrites .MYD file of other table (datadir)
#
CREATE
DATABASE
db1
;
CREATE
DATABASE
db2
;
USE
db2
;
--
disable_query_log
eval
CREATE
TABLE
t1
(
b
INT
)
ENGINE
MYISAM
DATA
DIRECTORY
=
'$MYSQLTEST_VARDIR/master-data/db1/'
;
--
enable_query_log
INSERT
INTO
db2
.
t1
VALUES
(
1
);
SELECT
*
FROM
db2
.
t1
;
RESET
QUERY
CACHE
;
USE
db1
;
#no warning from create table
SET
SESSION
keep_files_on_create
=
TRUE
;
--
disable_abort_on_error
CREATE
TABLE
t1
(
a
INT
)
ENGINE
MYISAM
;
--
enable_abort_on_error
SET
SESSION
keep_files_on_create
=
DEFAULT
;
DROP
TABLE
db2
.
t1
;
DROP
DATABASE
db1
;
DROP
DATABASE
db2
;
USE
test
;
--
echo
End
of
5.0
tests
...
...
sql/set_var.cc
View file @
49285e96
...
...
@@ -616,6 +616,8 @@ sys_var_thd_time_zone sys_time_zone(&vars, "time_zone");
/* Global read-only variable containing hostname */
static
sys_var_const_str
sys_hostname
(
&
vars
,
"hostname"
,
glob_hostname
);
sys_var_thd_bool
sys_keep_files_on_create
(
&
vars
,
"keep_files_on_create"
,
&
SV
::
keep_files_on_create
);
/* Read only variables */
static
sys_var_have_variable
sys_have_compress
(
&
vars
,
"have_compress"
,
&
have_compress
);
...
...
sql/sql_class.h
View file @
49285e96
...
...
@@ -305,6 +305,7 @@ struct system_variables
my_bool
old_mode
;
my_bool
query_cache_wlock_invalidate
;
my_bool
engine_condition_pushdown
;
my_bool
keep_files_on_create
;
my_bool
ndb_force_send
;
my_bool
ndb_use_copying_alter_table
;
my_bool
ndb_use_exact_count
;
...
...
sql/sql_table.cc
View file @
49285e96
...
...
@@ -4697,8 +4697,11 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
DBUG_EXECUTE_IF
(
"sleep_create_like_before_ha_create"
,
my_sleep
(
6000000
););
dst_path
[
dst_path_length
-
reg_ext_length
]
=
'\0'
;
// Remove .frm
if
(
thd
->
variables
.
keep_files_on_create
)
create_info
->
options
|=
HA_CREATE_KEEP_FILES
;
err
=
ha_create_table
(
thd
,
dst_path
,
db
,
table_name
,
create_info
,
1
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
if
(
create_info
->
options
&
HA_LEX_CREATE_TMP_TABLE
)
{
if
(
err
||
!
open_temporary_table
(
thd
,
dst_path
,
db
,
table_name
,
1
))
...
...
sql/unireg.cc
View file @
49285e96
...
...
@@ -355,6 +355,8 @@ int rea_create_table(THD *thd, const char *path,
// Make sure mysql_create_frm din't remove extension
DBUG_ASSERT
(
*
fn_rext
(
frm_name
));
if
(
thd
->
variables
.
keep_files_on_create
)
create_info
->
options
|=
HA_CREATE_KEEP_FILES
;
if
(
file
->
create_handler_files
(
path
,
NULL
,
CHF_CREATE_FLAG
,
create_info
))
goto
err_handler
;
if
(
!
create_info
->
frm_only
&&
ha_create_table
(
thd
,
path
,
db
,
table_name
,
...
...
storage/myisam/ha_myisam.cc
View file @
49285e96
...
...
@@ -1889,6 +1889,8 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
if
(
ha_create_info
->
options
&
HA_LEX_CREATE_TMP_TABLE
)
create_flags
|=
HA_CREATE_TMP_TABLE
;
if
(
ha_create_info
->
options
&
HA_CREATE_KEEP_FILES
)
create_flags
|=
HA_CREATE_KEEP_FILES
;
if
(
options
&
HA_OPTION_PACK_RECORD
)
create_flags
|=
HA_PACK_RECORD
;
if
(
options
&
HA_OPTION_CHECKSUM
)
...
...
storage/myisam/mi_create.c
View file @
49285e96
...
...
@@ -615,7 +615,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
(
have_iext
?
MY_REPLACE_EXT
:
MY_APPEND_EXT
));
linkname_ptr
=
0
;
/* Replace the current file */
create_flag
=
MY_DELETE_OLD
;
if
(
!
(
flags
&
HA_CREATE_KEEP_FILES
))
create_flag
=
MY_DELETE_OLD
;
}
/*
...
...
@@ -689,7 +690,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
fn_format
(
filename
,
name
,
""
,
MI_NAME_DEXT
,
MY_UNPACK_FILENAME
|
MY_APPEND_EXT
);
linkname_ptr
=
0
;
create_flag
=
MY_DELETE_OLD
;
if
(
!
(
flags
&
HA_CREATE_KEEP_FILES
))
create_flag
=
MY_DELETE_OLD
;
}
if
((
dfile
=
my_create_with_symlink
(
linkname_ptr
,
filename
,
0
,
create_mode
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment