Eine aufbereitete Darstellung der Quelle

 
     
 
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung


Quelle  trx_deadlock.result   Sprache: Lisp

 

#
# MDEV-36959 Deadlock does not rollback transaction fully
#
CREATE TABLE t1(col1 INT PRIMARY KEY, col2 INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 1), (2, 2);
SELECT * FROM t1;
col1 col2
1 1
2 2
connect  con1,localhost,root,,;
START TRANSACTION;
# Trx-1: Lock 1st record
UPDATE t1 SET col2=10 where col1=1;
connection default;
START TRANSACTION;
# Trx-2: Lock 2nd record
UPDATE t1 SET col2=100 where col1=2;
connection con1;
# Trx-1: Try locking 1st record : Wait
UPDATE t1 SET col2=10 where col1=2;
connection default;
# Wait for Trx-1 to get into lock wait stage
# Trx-2: Try locking 2nd record : Deadlock
UPDATE t1 SET col2=100 where col1=1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection con1;
ROLLBACK;
connection default;
SELECT @@in_transaction;
@@in_transaction
0
UPDATE t1 SET col2=10 where col1=1;
UPDATE t1 SET col2=100 where col1=2;
SELECT @@in_transaction;
@@in_transaction
0
ROLLBACK;
SELECT * FROM t1;
col1 col2
1 10
2 100
DROP TABLE t1;
#
# MDEV-37141 DML committed within XA transaction block after deadlock error and implicit rollback
#
CREATE TABLE t1(col1 INT PRIMARY KEY, col2 INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 1), (2, 2);
SELECT * FROM t1;
col1 col2
1 1
2 2
# Wait for information schema cache for locks to get cleared
connection con1;
XA BEGIN 'x1';
# XA Trx-1: Lock 1st record
UPDATE t1 SET col2=10 where col1=1;
connection default;
XA BEGIN 'x2';
# XA Trx-2: Lock 2nd record
UPDATE t1 SET col2=100 where col1=2;
connection con1;
# XA Trx-1: Try locking 1st record : Wait
UPDATE t1 SET col2=10 where col1=2;
connection default;
# Wait for XA Trx-1 to get into lock wait stage
# XA Trx-2: Try locking 2nd record : Deadlock
UPDATE t1 SET col2=100 where col1=1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
INSERT INTO t1 VALUES (3, 3), (4, 4);
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the  ROLLBACK ONLY state
XA END 'x2';
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the  ROLLBACK ONLY state
XA ROLLBACK 'x2';
connection con1;
XA END 'x1';
XA ROLLBACK 'x1';
connection default;
SELECT * FROM t1;
col1 col2
1 1
2 2
DROP TABLE t1;
disconnect con1;

Messung
CHZG
100100100100

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet am  2026-11-24) ¤

*© Formatika GbR, Deutschland







                                                                                                                                                                                                                                                                                                                                                                                                     

 

Neuigkeiten

Aktuelles
Motto des Tages

Open Source Software


Gedichte
Musik
Bilder

Jenseits des Üblichen

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1,188,255
#Domains=933,830