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
97d2a923
Commit
97d2a923
authored
Dec 08, 2009
by
Konstantin Osipov
Browse files
Options
Browse Files
Download
Plain Diff
Merge with next-4284.
parents
463dcbb5
5ce2421b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
248 additions
and
1 deletion
+248
-1
mysql-test/r/innodb_mysql_lock.result
mysql-test/r/innodb_mysql_lock.result
+24
-0
mysql-test/r/lock.result
mysql-test/r/lock.result
+22
-0
mysql-test/suite/rpl/r/rpl_innodb.result
mysql-test/suite/rpl/r/rpl_innodb.result
+45
-0
mysql-test/suite/rpl/t/rpl_innodb.test
mysql-test/suite/rpl/t/rpl_innodb.test
+66
-1
mysql-test/t/innodb_mysql_lock-master.opt
mysql-test/t/innodb_mysql_lock-master.opt
+1
-0
mysql-test/t/innodb_mysql_lock.test
mysql-test/t/innodb_mysql_lock.test
+58
-0
mysql-test/t/lock.test
mysql-test/t/lock.test
+32
-0
No files found.
mysql-test/r/innodb_mysql_lock.result
0 → 100644
View file @
97d2a923
#
# Bug #22876 Four-way deadlock
#
DROP TABLE IF EXISTS t1;
# Connection 1
set @@autocommit=0;
CREATE TABLE t1(s1 INT UNIQUE) ENGINE=innodb;
INSERT INTO t1 VALUES (1);
# Connection 2
set @@autocommit=0;
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (1);
# Connection 3
set @@autocommit=0;
DROP TABLE t1;
# Connection 1
# Connection 1 is now holding the lock.
# Issuing insert from connection 1 while connection 2&3
# is waiting for the lock should give a deadlock error.
INSERT INTO t1 VALUES (2);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
# Cleanup
commit;
commit;
mysql-test/r/lock.result
View file @
97d2a923
...
...
@@ -319,5 +319,27 @@ alter table t1 add column j int;
unlock tables;
drop table t1;
#
# Bug#45066 FLUSH TABLES WITH READ LOCK deadlocks against
# LOCK TABLE
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT);
LOCK TABLE t1 READ;
FLUSH TABLES;
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
LOCK TABLE t1 WRITE;
FLUSH TABLES;
#
# If you allow the next combination, you reintroduce bug Bug#45066
#
LOCK TABLE t1 READ;
FLUSH TABLES WITH READ LOCK;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
LOCK TABLE t1 WRITE;
FLUSH TABLES WITH READ LOCK;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
UNLOCK TABLES;
DROP TABLE t1;
#
# End of 6.0 tests.
#
mysql-test/suite/rpl/r/rpl_innodb.result
View file @
97d2a923
...
...
@@ -82,3 +82,48 @@ FLUSH LOGS;
FLUSH LOGS;
DROP DATABASE mysqltest1;
End of 5.1 tests
#
# Bug#39675 rename tables on innodb tables with pending
#
transactions causes slave data issue.
#
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
CREATE TABLE t1 (
id INT PRIMARY KEY auto_increment,
b INT DEFAULT NULL
)
ENGINE=InnoDB;
CREATE TABLE t2 (
id INT PRIMARY KEY auto_increment,
b INT DEFAULT NULL
)
ENGINE=InnoDB;
INSERT INTO t1 (b) VALUES (1),(2),(3);
BEGIN;
INSERT INTO t1(b) VALUES (4);
-------- switch to master1 --------
RENAME TABLE t1 TO t3, t2 TO t1;;
-------- switch to master --------
COMMIT;
-------- switch to master1 --------
-------- switch to master --------
SELECT * FROM t1;
id b
SELECT * FROM t3;
id b
1 1
2 2
3 3
4 4
-------- switch to slave --------
SELECT * FROM t1;
id b
SELECT * FROM t3;
id b
1 1
2 2
3 3
4 4
-------- switch to master --------
DROP TABLE t1;
DROP TABLE t3;
End of 6.0 tests
mysql-test/suite/rpl/t/rpl_innodb.test
View file @
97d2a923
...
...
@@ -120,6 +120,71 @@ connection master;
FLUSH
LOGS
;
DROP
DATABASE
mysqltest1
;
--
source
include
/
master
-
slave
-
end
.
inc
--
echo
End
of
5.1
tests
--
echo
#
--
echo
# Bug#39675 rename tables on innodb tables with pending
--
echo
# transactions causes slave data issue.
--
echo
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
DROP
TABLE
IF
EXISTS
t2
;
DROP
TABLE
IF
EXISTS
t3
;
--
enable_warnings
CREATE
TABLE
t1
(
id
INT
PRIMARY
KEY
auto_increment
,
b
INT
DEFAULT
NULL
)
ENGINE
=
InnoDB
;
CREATE
TABLE
t2
(
id
INT
PRIMARY
KEY
auto_increment
,
b
INT
DEFAULT
NULL
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
(
b
)
VALUES
(
1
),(
2
),(
3
);
BEGIN
;
INSERT
INTO
t1
(
b
)
VALUES
(
4
);
--
echo
--------
switch
to
master1
--------
connection
master1
;
--
send
RENAME
TABLE
t1
TO
t3
,
t2
TO
t1
;
--
echo
--------
switch
to
master
--------
connection
master
;
# Need to wait until RENAME is received
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
1
FROM
information_schema
.
processlist
WHERE
info
=
"RENAME TABLE t1 TO t3, t2 TO t1"
and
state
=
"Waiting for table"
;
--
source
include
/
wait_condition
.
inc
COMMIT
;
--
echo
--------
switch
to
master1
--------
connection
master1
;
--
reap
--
echo
--------
switch
to
master
--------
connection
master
;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t3
;
sync_slave_with_master
;
--
echo
--------
switch
to
slave
--------
connection
slave
;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t3
;
--
echo
--------
switch
to
master
--------
connection
master
;
DROP
TABLE
t1
;
DROP
TABLE
t3
;
--
echo
End
of
6.0
tests
--
source
include
/
master
-
slave
-
end
.
inc
mysql-test/t/innodb_mysql_lock-master.opt
0 → 100644
View file @
97d2a923
--innodb_lock_wait_timeout=300
mysql-test/t/innodb_mysql_lock.test
0 → 100644
View file @
97d2a923
--
source
include
/
have_innodb
.
inc
--
echo
#
--
echo
# Bug #22876 Four-way deadlock
--
echo
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
connect
(
con1
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
connect
(
con3
,
localhost
,
root
,,);
--
echo
# Connection 1
connection
con1
;
set
@@
autocommit
=
0
;
CREATE
TABLE
t1
(
s1
INT
UNIQUE
)
ENGINE
=
innodb
;
INSERT
INTO
t1
VALUES
(
1
);
--
echo
# Connection 2
connection
con2
;
set
@@
autocommit
=
0
;
INSERT
INTO
t1
VALUES
(
2
);
--
send
INSERT
INTO
t1
VALUES
(
1
)
--
echo
# Connection 3
connection
con3
;
set
@@
autocommit
=
0
;
--
send
DROP
TABLE
t1
--
echo
# Connection 1
connection
con1
;
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
1
FROM
information_schema
.
processlist
WHERE
info
=
"INSERT INTO t1 VALUES (1)"
and
state
=
"update"
;
--
source
include
/
wait_condition
.
inc
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
1
FROM
information_schema
.
processlist
WHERE
info
=
"DROP TABLE t1"
and
state
=
"Waiting for table"
;
--
source
include
/
wait_condition
.
inc
--
echo
# Connection 1 is now holding the lock.
--
echo
# Issuing insert from connection 1 while connection 2&3
--
echo
# is waiting for the lock should give a deadlock error.
--
error
ER_LOCK_DEADLOCK
INSERT
INTO
t1
VALUES
(
2
);
--
echo
# Cleanup
connection
con2
;
--
reap
commit
;
connection
con1
;
commit
;
connection
con3
;
--
reap
connection
default
;
mysql-test/t/lock.test
View file @
97d2a923
...
...
@@ -385,6 +385,38 @@ alter table t1 add column j int;
unlock
tables
;
drop
table
t1
;
--
echo
#
--
echo
# Bug#45066 FLUSH TABLES WITH READ LOCK deadlocks against
--
echo
# LOCK TABLE
--
echo
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
CREATE
TABLE
t1
(
a
INT
);
LOCK
TABLE
t1
READ
;
--
error
ER_TABLE_NOT_LOCKED_FOR_WRITE
FLUSH
TABLES
;
LOCK
TABLE
t1
WRITE
;
FLUSH
TABLES
;
--
echo
#
--
echo
# If you allow the next combination, you reintroduce bug Bug#45066
--
echo
#
LOCK
TABLE
t1
READ
;
--
error
ER_LOCK_OR_ACTIVE_TRANSACTION
FLUSH
TABLES
WITH
READ
LOCK
;
LOCK
TABLE
t1
WRITE
;
--
error
ER_LOCK_OR_ACTIVE_TRANSACTION
FLUSH
TABLES
WITH
READ
LOCK
;
UNLOCK
TABLES
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# End of 6.0 tests.
--
echo
#
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