mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
BUG#4775 "Duplicate key requires rollback of transaction" - Improved error message telling that transaction is aborted
BUG#4312 "wrong behaviour on insert .. on duplicate key" functionality disabled mysql-test/r/ndb_insert.result: New tests for fduplicate inserts in combination with transaction New tests for INSERT IGNORE and REPLACE mysql-test/t/ndb_insert.test: New tests for fduplicate inserts in combination with transaction New tests for INSERT IGNORE and REPLACE ndb/src/ndbapi/NdbConnection.cpp: Return error 4350 "Transaction already aborted" if execute(Commit) is called when theCommitStatus==Aborted Add DBUG_PRINT's ndb/src/ndbapi/ndberror.c: Add new error message indicating that the transaction already has been aborted. sql/ha_ndbcluster.cc: Map all error code 0 to 1 in order to catch errors caused by NdbApi returning -1 without having set an error code. Use ndb object in THD in get_error_message BUG# 4312 Return HA_ERR_WRONG_COMMAND if extra(HA_EXTRA_IGNORE_DUP_KEY) is called Only use writeTuple if command is REPLACE sql/ha_ndbcluster.h: Added member variable to keep track of when HA_EXTRA_IGNORE_DUP_KEY is used, but NDB can't support it.
This commit is contained in:
@@ -420,12 +420,130 @@ INSERT INTO t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
|
||||
ERROR 23000: Duplicate entry '10' for key 1
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
begin;
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
|
||||
ERROR 23000: Duplicate entry '10' for key 1
|
||||
commit;
|
||||
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 1 1
|
||||
select * from t1 where pk1=10;
|
||||
pk1 b c
|
||||
10 10 10
|
||||
select count(*) from t1 where pk1 <= 10 order by pk1;
|
||||
count(*)
|
||||
11
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
begin;
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
|
||||
ERROR 23000: Duplicate entry '10' for key 1
|
||||
rollback;
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 1 1
|
||||
select * from t1 where pk1=10;
|
||||
pk1 b c
|
||||
10 10 10
|
||||
select count(*) from t1 where pk1 <= 10 order by pk1;
|
||||
count(*)
|
||||
11
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
begin;
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
|
||||
ERROR 23000: Duplicate entry '10' for key 1
|
||||
SELECT * FROM t1 WHERE pk1=10;
|
||||
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
|
||||
rollback;
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 1 1
|
||||
select * from t1 where pk1=10;
|
||||
pk1 b c
|
||||
10 10 10
|
||||
select count(*) from t1 where pk1 <= 10 order by pk1;
|
||||
count(*)
|
||||
11
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
begin;
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
|
||||
ERROR 23000: Duplicate entry '10' for key 1
|
||||
SELECT * FROM t1 WHERE pk1=10;
|
||||
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
|
||||
SELECT * FROM t1 WHERE pk1=10;
|
||||
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
|
||||
commit;
|
||||
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 1 1
|
||||
select * from t1 where pk1=10;
|
||||
pk1 b c
|
||||
10 10 10
|
||||
select count(*) from t1 where pk1 <= 10 order by pk1;
|
||||
count(*)
|
||||
11
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
begin;
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
|
||||
ERROR 23000: Duplicate entry '10' for key 1
|
||||
INSERT INTO t1 values (4000, 40, 44);
|
||||
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
|
||||
rollback;
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 1 1
|
||||
select * from t1 where pk1=10;
|
||||
pk1 b c
|
||||
10 10 10
|
||||
select count(*) from t1 where pk1 <= 10 order by pk1;
|
||||
count(*)
|
||||
11
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
insert into t1 select * from t1 where b < 10 order by pk1;
|
||||
ERROR 23000: Duplicate entry '9' for key 1
|
||||
begin;
|
||||
INSERT IGNORE INTO t1 VALUES(1,2,3);
|
||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||
commit;
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 1 1
|
||||
INSERT IGNORE INTO t1 VALUES(1,2,3);
|
||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 1 1
|
||||
REPLACE INTO t1 values(1, 2, 3);
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 2 3
|
||||
INSERT INTO t1 VALUES(1,1,1) ON DUPLICATE KEY UPDATE b=79;
|
||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 2 3
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user