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
1e68528f
Commit
1e68528f
authored
Apr 03, 2004
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge vvagin@bk-internal.mysql.com:/home/bk/mysql-4.1
into eagle.mysql.r18.ru:/home/vva/work/BUG_2385/mysql-4.1
parents
34f43916
64b93957
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
88 additions
and
12 deletions
+88
-12
mysql-test/include/have_debug.inc
mysql-test/include/have_debug.inc
+4
-0
mysql-test/r/have_debug.require
mysql-test/r/have_debug.require
+2
-0
mysql-test/t/synchronization-master.opt
mysql-test/t/synchronization-master.opt
+1
-0
mysql-test/t/synchronization.test
mysql-test/t/synchronization.test
+45
-0
sql/mysql_priv.h
sql/mysql_priv.h
+2
-0
sql/mysqld.cc
sql/mysqld.cc
+3
-1
sql/sql_table.cc
sql/sql_table.cc
+31
-11
No files found.
mysql-test/include/have_debug.inc
0 → 100644
View file @
1e68528f
--
require
r
/
have_debug
.
require
disable_query_log
;
select
instr
(
version
(),
convert
(
'debug'
using
utf8
))
!=
0
;
enable_query_log
;
mysql-test/r/have_debug.require
0 → 100644
View file @
1e68528f
instr(version(),convert('debug' using utf8))!=0;
1
\ No newline at end of file
mysql-test/t/synchronization-master.opt
0 → 100644
View file @
1e68528f
--exit-info=2048
\ No newline at end of file
mysql-test/t/synchronization.test
0 → 100644
View file @
1e68528f
--
source
include
/
have_crypt
.
inc
#
# Test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination table
#
connect
(
con_to_sleep
,
localhost
,
lock_controller
,,);
connect
(
con_to_harm_sleeper
,
localhost
,
root
,,);
# locking of source:
connection
con_to_sleep
;
CREATE
TABLE
t1
(
a
int
);
send
CREATE
TABLE
t2
LIKE
t1
;
connection
con_to_harm_sleeper
;
sleep
1
;
ALTER
TABLE
t1
add
key
(
a
);
connection
con_to_sleep
;
sleep
4
;
SHOW
CREATE
TABLE
t2
;
drop
table
t1
,
t2
;
# locking of destination:
connection
con_to_sleep
;
CREATE
TABLE
t1
(
a
int
);
send
CREATE
TABLE
t2
LIKE
t1
;
connection
con_to_harm_sleeper
;
sleep
1
;
CREATE
TABLE
t2
(
b
int
);
disable_query_log
;
select
"-----------"
as
"let's take a look at result of create .. like : "
;
enable_query_log
;
connection
con_to_sleep
;
sleep
1
;
--
error
1
reap
;
disable_query_log
;
select
""
as
"-----------"
;
enable_query_log
;
SHOW
CREATE
TABLE
t2
;
drop
table
t1
,
t2
;
\ No newline at end of file
sql/mysql_priv.h
View file @
1e68528f
...
...
@@ -171,6 +171,8 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#define TEST_CORE_ON_SIGNAL 256
/* Give core if signal */
#define TEST_NO_STACKTRACE 512
#define TEST_SIGINT 1024
/* Allow sigint on threads */
#define TEST_SYNCHRONIZATION 2048
/* get server to do sleep in some
places */
/* options for select set by the yacc parser (stored in lex->options) */
#define SELECT_DISTINCT (1L << 0)
...
...
sql/mysqld.cc
View file @
1e68528f
...
...
@@ -2108,8 +2108,10 @@ static int init_common_variables(const char *conf_file_name, int argc,
if
(
*
(
MYSQL_SERVER_SUFFIX
))
strxmov
(
strend
(
server_version
),
MYSQL_SERVER_SUFFIX
,
"-debug"
,
NullS
);
else
#endif
strmov
(
strend
(
server_version
),
"--debug"
);
#else
strmov
(
strend
(
server_version
),
MYSQL_SERVER_SUFFIX
);
#endif
load_defaults
(
conf_file_name
,
groups
,
&
argc
,
&
argv
);
defaults_argv
=
argv
;
...
...
sql/sql_table.cc
View file @
1e68528f
...
...
@@ -1902,7 +1902,8 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
char
*
table_name
=
table
->
real_name
;
char
*
src_db
=
thd
->
db
;
char
*
src_table
=
table_ident
->
table
.
str
;
int
err
;
int
err
,
res
=
-
1
;
TABLE_LIST
src_tables_list
;
DBUG_ENTER
(
"mysql_create_like_table"
);
/*
...
...
@@ -1916,6 +1917,13 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
my_error
(
ER_WRONG_TABLE_NAME
,
MYF
(
0
),
src_table
);
DBUG_RETURN
(
-
1
);
}
src_tables_list
.
db
=
table_ident
->
db
.
str
?
table_ident
->
db
.
str
:
thd
->
db
;
src_tables_list
.
real_name
=
table_ident
->
table
.
str
;
src_tables_list
.
next
=
0
;
if
(
lock_and_wait_for_table_name
(
thd
,
&
src_tables_list
))
goto
err
;
if
((
tmp_table
=
find_temporary_table
(
thd
,
src_db
,
src_table
)))
strxmov
(
src_path
,
(
*
tmp_table
)
->
path
,
reg_ext
,
NullS
);
...
...
@@ -1926,7 +1934,7 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
if
(
access
(
src_path
,
F_OK
))
{
my_error
(
ER_BAD_TABLE_ERROR
,
MYF
(
0
),
src_table
);
DBUG_RETURN
(
-
1
)
;
goto
err
;
}
}
...
...
@@ -1954,9 +1962,14 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
/*
Create a new table by copying from source table
*/
if
(
my_copy
(
src_path
,
dst_path
,
MYF
(
MY_WME
)))
DBUG_RETURN
(
-
1
);
*/
#ifndef DBUG_OFF
// The code stated below is for test synchronization.test Bug #2385
if
(
test_flags
&
TEST_SYNCHRONIZATION
)
sleep
(
3
);
#endif
if
(
my_copy
(
src_path
,
dst_path
,
MYF
(
MY_WME
|
MY_DONT_OVERWRITE_FILE
)))
goto
err
;
/*
As mysql_truncate don't work on a new table at this stage of
...
...
@@ -1972,14 +1985,14 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
{
(
void
)
rm_temporary_table
(
create_info
->
db_type
,
dst_path
);
/* purecov: inspected */
DBUG_RETURN
(
-
1
)
;
/* purecov: inspected */
goto
err
;
/* purecov: inspected */
}
}
else
if
(
err
)
{
(
void
)
quick_rm_table
(
create_info
->
db_type
,
db
,
table_name
);
/* purecov: inspected */
DBUG_RETURN
(
-
1
)
;
/* purecov: inspected */
goto
err
;
/* purecov: inspected */
}
// Must be written before unlock
...
...
@@ -1992,7 +2005,8 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
HA_LEX_CREATE_TMP_TABLE
));
mysql_bin_log
.
write
(
&
qinfo
);
}
DBUG_RETURN
(
0
);
res
=
0
;
goto
err
;
table_exists:
if
(
create_info
->
options
&
HA_LEX_CREATE_IF_NOT_EXISTS
)
...
...
@@ -2001,10 +2015,16 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
sprintf
(
warn_buff
,
ER
(
ER_TABLE_EXISTS_ERROR
),
table_name
);
push_warning
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_TABLE_EXISTS_ERROR
,
warn_buff
);
DBUG_RETURN
(
0
)
;
res
=
0
;
}
my_error
(
ER_TABLE_EXISTS_ERROR
,
MYF
(
0
),
table_name
);
DBUG_RETURN
(
-
1
);
else
my_error
(
ER_TABLE_EXISTS_ERROR
,
MYF
(
0
),
table_name
);
err:
pthread_mutex_lock
(
&
LOCK_open
);
unlock_table_name
(
thd
,
&
src_tables_list
);
pthread_mutex_unlock
(
&
LOCK_open
);
DBUG_RETURN
(
res
);
}
...
...
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