Bug #21667 NDB: Rollback of statement transactions failed
Submitted: 16 Aug 2006 0:42 Modified: 16 Aug 2006 2:23
Reporter: Marc ALFF Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S1 (Critical)
Version:5.0.25 OS:Linux (Gentoo Linux AMD64)
Assigned to: CPU Architecture:Any

[16 Aug 2006 0:42] Marc ALFF
Description:
The following script fails with the wrong error :

let $engine_type = ndbcluster;

set autocommit=1;

--disable_warnings
drop table if exists t1;
drop table if exists t2;
drop table if exists t3;
drop function if exists f2;
drop procedure if exists p1;
--enable_warnings

eval create table t1 (a int) engine = $engine_type;
eval create table t2 (a int unique) engine = $engine_type;
eval create table t3 (a int) engine = $engine_type;

insert into t1 (a) values (1), (2);
insert into t3 (a) values (1), (2);

delimiter //;

## Cause a failure every time
create function f2(x int) returns int
begin
  insert into t2 (a) values (x);
  insert into t2 (a) values (x);
  return x;
end//

delimiter ;//

set autocommit=0;

insert into t2 (a) values (1001);
--error ER_DUP_ENTRY
insert into t1 (a) values (f2(1));
select * from t2;
rollback;
select * from t2;
commit;

---------

The select after the failed insert statement causes :

mysqltest: At line 54: query 'select * from t2' failed: 1296: Got error 4350 'Transaction already aborted' from ndbcluster

The expected result is :
- a select that returns no rows, since a *statement* rollback should occur
on the insert
- a proper *transaction* rollback on the rollback statement.

Note that the same test with BDB or InnoDB works as expected.

How to repeat:
See above

Suggested fix:
N/A
[16 Aug 2006 2:23] Jonas Oreland
Hi,

NDB does not currently support rollback statement, but only rollback transaction.
I think this is listed under limitations...

/Jonas