Bug #30996 NDB commits too early when LOCK TABLE & SET AUTOCOMMIT=OFF are used together
Submitted: 13 Sep 2007 10:54 Modified: 5 Nov 2007 22:22
Reporter: Mikael Ronström Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:5.1.22 OS:Any
Assigned to: Mikael Ronström CPU Architecture:Any

[13 Sep 2007 10:54] Mikael Ronström
Description:
NDB handler uses a buggy behavior in the usage
of trans_register_ha and commit in handler interface.

When autocommit is on when lock table is called then
a transaction isn't started when insert is done.
Then switch to autocommit off (or start a transaction
The insert statement causes a trans_register_ha to
be called with only statement level registration.
Later commit is called to the NDB handler to indicate
end-of-statement this however isn't handled by the NDB
handler and so the transaction is committed too early.

How to repeat:
TEST CASE:
----------
set autocommit=1;
create table t1 (a int) engine=ndb;
lock table t1 write;
set autocommit=0;
insert into t1 values (0);
rollback;
select * from t1;
/* Record is still there */
unlock tables;
drop table t1;

Suggested fix:
Fix handler
[10 Oct 2007 10:10] Jon Stephens
Documented bugfix in mysql-5.1.22-ndb-6.2.7 changelog. Left status as PA.
[15 Oct 2007 17:59] Jon Stephens
Also documented in mysql-5.1.22-ndb-6.3.4 changelog; left status as PA.
[5 Nov 2007 13:56] Bugs System
Pushed into 5.1.23-rc
[5 Nov 2007 22:22] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Also documented in 5.1.23 changelog. Closed.