2010-11-03 17:07:08 +01:00
|
|
|
DROP TABLE IF EXISTS t1;
|
|
|
|
CREATE TABLE t1 (k INT NOT NULL, a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, PRIMARY KEY(k)) ENGINE=InnoDB;
|
|
|
|
INSERT INTO t1 (k, a, b, c) VALUES (1, 0, 0, 0);
|
|
|
|
INSERT INTO t1 (k, a, b, c) VALUES (2, 0, 0, 0);
|
|
|
|
INSERT INTO t1 (k, a, b, c) VALUES (3, 0, 0, 0);
|
|
|
|
INSERT INTO t1 (k, a, b, c) VALUES (4, 0, 0, 0);
|
|
|
|
RESET MASTER;
|
|
|
|
SET DEBUG_SYNC= 'RESET';
|
|
|
|
# Connection c1
|
2011-01-27 15:56:44 +01:00
|
|
|
SET binlog_format= mixed;
|
2010-11-03 17:07:08 +01:00
|
|
|
BEGIN;
|
|
|
|
UPDATE t1 SET a=10 WHERE k=1;
|
|
|
|
SET DEBUG_SYNC="commit_after_release_LOCK_prepare_ordered SIGNAL c1_prepared WAIT_FOR c2_committing";
|
|
|
|
COMMIT;
|
|
|
|
# Connection c2
|
2011-01-27 15:56:44 +01:00
|
|
|
SET binlog_format= mixed;
|
2010-11-03 17:07:08 +01:00
|
|
|
SET DEBUG_SYNC="now WAIT_FOR c1_prepared";
|
|
|
|
BEGIN;
|
|
|
|
SELECT * FROM t1 WHERE k=1 FOR UPDATE;
|
|
|
|
k a b c
|
|
|
|
1 10 0 0
|
|
|
|
UPDATE t1 SET a=20 WHERE k=1;
|
|
|
|
SET DEBUG_SYNC="now SIGNAL c2_committing";
|
|
|
|
COMMIT;
|
|
|
|
# Connection c1
|
|
|
|
BEGIN;
|
|
|
|
UPDATE t1 SET a=10 WHERE k=2;
|
|
|
|
SET DEBUG_SYNC="commit_after_release_LOCK_prepare_ordered SIGNAL c1_prepared WAIT_FOR c2_committed TIMEOUT 2";
|
|
|
|
COMMIT;
|
|
|
|
# Connection c2
|
|
|
|
SET DEBUG_SYNC="now WAIT_FOR c1_prepared";
|
|
|
|
BEGIN;
|
|
|
|
SELECT * FROM t1 WHERE k=2 FOR UPDATE;
|
|
|
|
k a b c
|
|
|
|
2 10 0 0
|
|
|
|
UPDATE t1 SET a=20 WHERE k=2;
|
|
|
|
SET DEBUG_SYNC="binlog_after_log_and_order SIGNAL c2_committed";
|
|
|
|
COMMIT;
|
|
|
|
# Connection c1
|
|
|
|
# This should warn about DEBUG_SYNC timeout
|
|
|
|
Warnings:
|
|
|
|
Warning 1639 debug sync point wait timed out
|
|
|
|
# Connection c2
|
|
|
|
SHOW BINLOG EVENTS LIMIT 2,12;
|
|
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
2011-01-27 15:56:44 +01:00
|
|
|
master-bin.000001 # Query 1 # use `test`; UPDATE t1 SET a=10 WHERE k=1
|
|
|
|
master-bin.000001 # Xid 1 # COMMIT /* xid=XX */
|
|
|
|
master-bin.000001 # Query 1 # BEGIN
|
|
|
|
master-bin.000001 # Query 1 # use `test`; UPDATE t1 SET a=20 WHERE k=1
|
|
|
|
master-bin.000001 # Xid 1 # COMMIT /* xid=XX */
|
|
|
|
master-bin.000001 # Query 1 # BEGIN
|
|
|
|
master-bin.000001 # Query 1 # use `test`; UPDATE t1 SET a=10 WHERE k=2
|
|
|
|
master-bin.000001 # Xid 1 # COMMIT /* xid=XX */
|
|
|
|
master-bin.000001 # Query 1 # BEGIN
|
|
|
|
master-bin.000001 # Query 1 # use `test`; UPDATE t1 SET a=20 WHERE k=2
|
|
|
|
master-bin.000001 # Xid 1 # COMMIT /* xid=XX */
|
2010-11-03 17:07:08 +01:00
|
|
|
# Connection c1
|
|
|
|
RESET MASTER;
|
|
|
|
SET DEBUG_SYNC="commit_after_release_LOCK_prepare_ordered SIGNAL c1_prepared WAIT_FOR c2_committing";
|
|
|
|
UPDATE t1 SET a=10 WHERE k=3;
|
|
|
|
# Connection c2
|
|
|
|
SET DEBUG_SYNC="now WAIT_FOR c1_prepared";
|
|
|
|
SELECT * FROM t1 WHERE k=3 FOR UPDATE;
|
|
|
|
k a b c
|
|
|
|
3 10 0 0
|
|
|
|
SET DEBUG_SYNC="commit_after_release_LOCK_prepare_ordered SIGNAL c2_committing";
|
|
|
|
UPDATE t1 SET a=20 WHERE k=3;
|
|
|
|
# Connection c1
|
|
|
|
SET DEBUG_SYNC="commit_after_release_LOCK_prepare_ordered SIGNAL c1_prepared WAIT_FOR c2_committed TIMEOUT 2";
|
|
|
|
UPDATE t1 SET a=10 WHERE k=4;
|
|
|
|
# Connection c2
|
|
|
|
SET DEBUG_SYNC="now WAIT_FOR c1_prepared";
|
|
|
|
SELECT * FROM t1 WHERE k=4 FOR UPDATE;
|
|
|
|
k a b c
|
|
|
|
4 10 0 0
|
|
|
|
SET DEBUG_SYNC="binlog_after_log_and_order SIGNAL c2_committed";
|
|
|
|
UPDATE t1 SET a=20 WHERE k=4;
|
|
|
|
# Connection c1
|
|
|
|
# This should warn about DEBUG_SYNC timeout
|
2010-12-25 18:28:24 +01:00
|
|
|
Warnings:
|
2010-11-03 17:07:08 +01:00
|
|
|
Warning 1639 debug sync point wait timed out
|
|
|
|
# Connection c2
|
|
|
|
SHOW BINLOG EVENTS LIMIT 1,12;
|
|
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
2011-01-27 15:56:44 +01:00
|
|
|
master-bin.000001 # Query 1 # BEGIN
|
|
|
|
master-bin.000001 # Query 1 # use `test`; UPDATE t1 SET a=10 WHERE k=3
|
|
|
|
master-bin.000001 # Xid 1 # COMMIT /* xid=XX */
|
|
|
|
master-bin.000001 # Query 1 # BEGIN
|
|
|
|
master-bin.000001 # Query 1 # use `test`; UPDATE t1 SET a=20 WHERE k=3
|
|
|
|
master-bin.000001 # Xid 1 # COMMIT /* xid=XX */
|
|
|
|
master-bin.000001 # Query 1 # BEGIN
|
|
|
|
master-bin.000001 # Query 1 # use `test`; UPDATE t1 SET a=10 WHERE k=4
|
|
|
|
master-bin.000001 # Xid 1 # COMMIT /* xid=XX */
|
|
|
|
master-bin.000001 # Query 1 # BEGIN
|
|
|
|
master-bin.000001 # Query 1 # use `test`; UPDATE t1 SET a=20 WHERE k=4
|
|
|
|
master-bin.000001 # Xid 1 # COMMIT /* xid=XX */
|
2010-11-03 17:07:08 +01:00
|
|
|
SELECT * FROM t1 ORDER BY k;
|
|
|
|
k a b c
|
|
|
|
1 20 0 0
|
|
|
|
2 20 0 0
|
|
|
|
3 20 0 0
|
|
|
|
4 20 0 0
|
|
|
|
DROP TABLE t1;
|
|
|
|
SET DEBUG_SYNC= 'RESET';
|