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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
3209aa1e
Commit
3209aa1e
authored
May 15, 2007
by
dlenev@mockturtle.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into mockturtle.local:/home/dlenev/src/mysql-5.1-cts-3
parents
aff90798
d748e4de
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
4 deletions
+71
-4
mysql-test/include/mix1.inc
mysql-test/include/mix1.inc
+20
-0
mysql-test/r/innodb_mysql.result
mysql-test/r/innodb_mysql.result
+11
-0
sql/sql_table.cc
sql/sql_table.cc
+40
-4
No files found.
mysql-test/include/mix1.inc
View file @
3209aa1e
...
@@ -688,4 +688,24 @@ select * from t2;
...
@@ -688,4 +688,24 @@ select * from t2;
drop
table
t2
;
drop
table
t2
;
#
# Tests for bug #28415 "Some ALTER TABLE statements no longer work
# under LOCK TABLES" and some aspects of fast ALTER TABLE behaviour
# for transactional tables.
#
--
disable_warnings
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
create
table
t1
(
i
int
);
alter
table
t1
modify
i
int
default
1
;
alter
table
t1
modify
i
int
default
2
,
rename
t2
;
lock
table
t2
write
;
alter
table
t2
modify
i
int
default
3
;
unlock
tables
;
lock
table
t2
write
;
alter
table
t2
modify
i
int
default
4
,
rename
t1
;
unlock
tables
;
drop
table
t1
;
--
echo
End
of
5.1
tests
--
echo
End
of
5.1
tests
mysql-test/r/innodb_mysql.result
View file @
3209aa1e
...
@@ -733,4 +733,15 @@ k a c
...
@@ -733,4 +733,15 @@ k a c
11 15 1
11 15 1
12 20 1
12 20 1
drop table t2;
drop table t2;
drop table if exists t1, t2;
create table t1 (i int);
alter table t1 modify i int default 1;
alter table t1 modify i int default 2, rename t2;
lock table t2 write;
alter table t2 modify i int default 3;
unlock tables;
lock table t2 write;
alter table t2 modify i int default 4, rename t1;
unlock tables;
drop table t1;
End of 5.1 tests
End of 5.1 tests
sql/sql_table.cc
View file @
3209aa1e
...
@@ -6673,6 +6673,7 @@ view_err:
...
@@ -6673,6 +6673,7 @@ view_err:
}
}
if
(
!
need_copy_table
)
if
(
!
need_copy_table
)
{
{
bool
needs_unlink
=
FALSE
;
if
(
!
table
)
if
(
!
table
)
{
{
if
(
new_name
!=
table_name
||
new_db
!=
db
)
if
(
new_name
!=
table_name
||
new_db
!=
db
)
...
@@ -6683,11 +6684,41 @@ view_err:
...
@@ -6683,11 +6684,41 @@ view_err:
table_list
->
db
=
new_db
;
table_list
->
db
=
new_db
;
table_list
->
db_length
=
strlen
(
new_db
);
table_list
->
db_length
=
strlen
(
new_db
);
}
}
else
{
/*
TODO: Creation of name-lock placeholder here is a temporary
work-around. Long term we should change close_cached_table() call
which we invoke before table renaming operation in such way that
it will leave placeholders for table in table cache/THD::open_tables
list. By doing this we will be able easily reopen and relock these
tables later and therefore behave under LOCK TABLES in the same way
on all platforms.
*/
char
key
[
MAX_DBKEY_LENGTH
];
uint
key_length
;
key_length
=
create_table_def_key
(
thd
,
key
,
table_list
,
0
);
if
(
!
(
name_lock
=
table_cache_insert_placeholder
(
thd
,
key
,
key_length
)))
{
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
if
(
!
(
table
=
open_ltable
(
thd
,
table_list
,
TL_WRITE_ALLOW_READ
)))
goto
err
;
goto
err
;
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
}
name_lock
->
next
=
thd
->
open_tables
;
thd
->
open_tables
=
name_lock
;
}
table_list
->
table
=
name_lock
;
if
(
reopen_name_locked_table
(
thd
,
table_list
,
FALSE
))
{
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
goto
err
;
}
table
=
table_list
->
table
;
/*
We can't rely on later close_cached_table() calls to close
this instance of the table since it was not properly locked.
*/
needs_unlink
=
TRUE
;
}
}
/* Tell the handler that a new frm file is in place. */
/* Tell the handler that a new frm file is in place. */
if
(
table
->
file
->
create_handler_files
(
path
,
NULL
,
CHF_INDEX_FLAG
,
if
(
table
->
file
->
create_handler_files
(
path
,
NULL
,
CHF_INDEX_FLAG
,
...
@@ -6696,6 +6727,11 @@ view_err:
...
@@ -6696,6 +6727,11 @@ view_err:
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
goto
err
;
goto
err
;
}
}
if
(
needs_unlink
)
{
unlink_open_table
(
thd
,
table
,
FALSE
);
table
=
name_lock
=
0
;
}
}
}
if
(
thd
->
lock
||
new_name
!=
table_name
||
no_table_reopen
)
// True if WIN32
if
(
thd
->
lock
||
new_name
!=
table_name
||
no_table_reopen
)
// True if WIN32
...
...
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