Bug #51034 NdbApi : Read of blob data with lockmode LM_SimpleRead does not upgrade
Submitted: 9 Feb 2010 17:07 Modified: 3 Mar 2010 5:51
Reporter: Frazer Clement Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: NDB API Severity:S3 (Non-critical)
Version:mysql-5.1-telco-6.2+ OS:Any
Assigned to: Frazer Clement CPU Architecture:Any

[9 Feb 2010 17:07] Frazer Clement
Description:
Due to multi-row nature of the Blob implementation, an LM_Read lock must be taken on the Blob head row and held until after read operations on the Blob part table rows have completed.  If this is not the case then reads of Blob parts can return an inconsistent set of snapshots of Blob parts and / or result in transaction rollback.

Bug#19285 implements an automatic lock-upgrade from LM_CommittedRead to LM_Read.

However, there is currently no automatic upgrade from LM_SimpleRead to LM_Read.

This means that a Blob access using LM_SimpleRead may return part data from different concurrently committing update transactions.  If the Blob is shortened by a concurrent transaction then the Blob read may result in transaction abort. 

Note that MySQLD does not currently use LM_SimpleRead lockmode, so this bug only affects NdbApi programs.

How to repeat:
- Modify testBlobs to also test LM_SimpleRead lock upgrade.

Suggested fix:
Modify Blobs code to perform automatic lock upgrade for LM_SimpleRead as well as LM_CommittedRead.
[10 Feb 2010 8:17] Frazer Clement
Proposed patch and testcase improvements

Attachment: blob-simpleread-fix.patch (text/x-patch), 9.81 KiB.

[25 Feb 2010 13:17] 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:

  http://lists.mysql.com/commits/101449

3082 Frazer Clement	2010-02-25
      Bug#51034 NdbApi : Read of blob data with lockmode LM_SimpleRead does not upgrade
      
      Modify NdbApi to upgrade SimpleRead when reading Blob(s)
[26 Feb 2010 12:11] 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:

  http://lists.mysql.com/commits/101605

3083 Frazer Clement	2010-02-26
      Bug#51034 NdbApi : Read of blob data with lockmode LM_SimpleRead does not upgrade
      
      Modify NdbApi to upgrade SimpleRead when reading Blob(s)
[1 Mar 2010 13:34] Frazer Clement
Pushed to : 
  6.2.19
  6.3.32
  7.0.13
  7.1.2
[3 Mar 2010 5:51] Jon Stephens
Documented as follows in the NDB-6.2.19, 6.3.32, 7.0.13, and 7.1.2 changelogs:

      When reading blob data with lock mode LM_SimpleRead, the lock was not
      upgraded as expected.

Closed.
[3 Mar 2010 5:59] Jon Stephens
NB: Fix went into 6.3.33/7.0.14, and not 6.3.32/7.0.13.

Changelog entry tagged with correct versions.