Bug #24028 ndbapi delete on an unexisting PK value exhausts all memory on BLOB tables
Submitted: 6 Nov 2006 21:18 Modified: 13 Nov 2007 12:10
Reporter: Hartmut Holzgraefe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: NDB API Severity:S2 (Serious)
Version:5.1 OS:Linux (linux)
Assigned to: Pekka Nousiainen
Tags: BLOB, ndb api, ndb_restore, primary key, text

[6 Nov 2006 21:18] Hartmut Holzgraefe
Description:
when doing a deleteTuple() operation on a nonexisting primary key 
the execute should fail with a 626 "tuple did not exist" error code
(the fact that there is no symbolic constant like NDBAPI_ERR_NOT_FOUND
and that the magic number has to be used is a WTF by itself but not 
part of this bug report).

It fails as expected just fine on regular tables, returning error 
code 626 on NdbTransaction::execute()

But when the cluster table has some BLOB or TEXT field in it
the client enters a endless busy loop instead, leaking memory
very fast at the same time until finally the application is
terminated by either a user kill or by eventually running out
of allocatable memory 

How to repeat:
see the uploaded test project, run "./delete abc" once on

CREATE TABLE `session` (
  `id` char(32) NOT NULL,
  `usetime` timestamp,
  PRIMARY KEY  (`id`),
  KEY `usetime` (`usetime`)
) ENGINE=ndbcluster;

and see it fail just fine,
then do

ALTER TABLE session ADD COLUMN data TEXT;

and run "./delete abc" again

(i recommend that you set a rather low memory ulimit first)

Suggested fix:
make it fail with an error code as expected
[7 Nov 2006 9:22] Hartmut Holzgraefe
test project

Attachment: session_test-0.1.tar.bz2 (application/x-tar, text), 196.76 KiB.

[27 Dec 2006 21:04] 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/17421

ChangeSet@1.2563, 2006-12-27 22:04:09+01:00, pekka@clam.ndb.mysql.com +9 -0
  ndb - bug#24028 4.1
[31 Jan 2007 15:22] 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/19095

ChangeSet@1.2412, 2007-01-31 16:20:30+01:00, jonas@perch.ndb.mysql.com +1 -0
  ndb - bug#24028
    minimal fix
[20 Mar 2007 21:47] Tomas Ulin
5.1.16
[21 Mar 2007 8:13] 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/22441

ChangeSet@1.2489, 2007-03-21 09:13:05+01:00, pekka@clam.ndb.mysql.com +4 -0
  ndb - bug#24028 in 5.0
  proper fix exists only in version >= 5.1
[22 Mar 2007 4:54] Jon Stephens
Documented fix for 5.1.16.

Need version info for 4.1/5.0/telco fixes.
[22 Mar 2007 13:26] Tomas Ulin
this bug will not be fixed in 4.1
5.0 will have a different bug fix (opened separate bugreport 27308 for this)
in 5.1 it was fixed in 5.1.16
[23 Mar 2007 11:10] 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

Already documented for 5.1.16.
[30 Mar 2007 8:53] Bugs System
Pushed into 5.0.40
[13 Nov 2007 7:12] Stewart Smith
Jon, can you add to the docs that this can appear during ndb_restore (see BUG#30177) during restore of the log.
[13 Nov 2007 12:10] Jon Stephens
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.

Updated changelog entry; noted ndb_restore issue and that this bug had also been fixed in 5.0.40; also added cross-references to Bug #27308 and Bug #30177.