Bug #48113 Ndb : Insert hitting DD space exhaustion does not lock following tuple ops
Submitted: 16 Oct 2009 13:21 Modified: 20 Oct 2009 16:18
Reporter: Frazer Clement Email Updates:
Status: Closed Impact on me:
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:mysql-5.1-telco-6.2+ OS:Any
Assigned to: Frazer Clement CPU Architecture:Any

[16 Oct 2009 13:21] Frazer Clement
When TUP processes an inserting TUPKEYREQ, it creates the MM tuple, updates ACC to point to this tuple, then creates the DD part.

When the DD part insert fails due to disk space exhaustion, the MM tuple is marked as freed and TUPKEYREF is sent to LQH via the job buffer.  ACC continues to point to the freed MM tuple.

Subsequent LQHKEYREQ operations on the same PK (e.g. update in the same batch) fail to 'find' the inserted tuple in ACC as ACC uses TUP to get the PK and TUP reports a zero-length PK for the freed tuple.

Therefore subsequent LQHKEYREQ update operations get an immediate failure in ACCKEYREQ processing and start transaction abort based on this error code (e.g. 626) before LQH has received the queued LQHKEYREF from the first failing insert operation.

This manifests as tablespace exhaustion when inserting a Blob (which uses insert + update to the same PK in a batch) resulting in confusing 'row not found in table' errors rather than 'Out of extents' errors. 

How to repeat:
Run ndb_dd_alter with tablespace size set to 4M (and NdbApi blob bug#41764 fixed)

Alternatively see testcase in patch.

Suggested fix:
Either :
1) Do not update ACC with tuple local key until DD preallocation is known-successful
2) Reset ACC key value when DD preallocation fails
3) Handle freed TUP record in readPk() differently
[16 Oct 2009 13:26] Frazer Clement
Proposed patch + testcase for 6.2

Attachment: bug48113.patch (text/x-patch), 4.82 KiB.

[16 Oct 2009 15:39] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:


3019 Frazer Clement	2009-10-16
      Bug#48113 : Ndb : Insert hitting DD space exhaustion does not lock following tuple ops
[20 Oct 2009 16:18] Jon Stephens
Documented bugfix in the NDB-6.2.19 changelog as follows:

      Inserts of blob column values into a Disk Data table that exhausted the
      tablespace resulted in misleading error messages about rows not being
      found in the table rather than the expected Out of extents, tablespace
      full error.