Bug #45687 Deleting rows during a SELECT can cause error
Submitted: 23 Jun 2009 17:03 Modified: 26 Feb 2010 14:05
Reporter: Andrew Hutchings Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:mysql-5.1-telco-6.3 OS:Any
Assigned to: Jonas Oreland CPU Architecture:Any
Tags: 6.3.24

[23 Jun 2009 17:03] Andrew Hutchings
Description:
If a thread is running a select query that requires a sort it is possible that a delete in another thread can cause the following error with the select query:

ERROR 1032 (HY000) at line 65: Can't find record in 'Alert'

How to repeat:
Using files to be attached:

1. Setup a cluster, 2 data nodes, 1 mysqld node with ndb-cluster-connection-pool=2
2. Create the table in table.sql
3. Do the following to generate data:
shell> php test.php > test.sql
4. Insert this data
5. Run the following in 2 shells simultaneously:
shell1> mysql > /dev/null < queries1.txt
shell2> mysql < queries2.txt

Within a few seconds you should hit the error.
[22 Sep 2009 5:51] Jonas Oreland
aha, it is solvable:
https://intranet.mysql.com/secure/mailarchive/mail.php?folder=4&mail=30894
[22 Sep 2009 6:09] Andrew Hutchings
This is by design for READ-COMMITTED.  I had forgotten that I had left this open.

Closing as not a bug.
[6 Dec 2009 15:18] Andrew Hutchings
Re-opening after cluster@ discussion with Jonas.
[28 Dec 2009 16:32] theblue Sage
Any news on this bug? my session table is gettig huge and I cant delete from it fast enough ...
[22 Feb 2010 10:39] Jonas Oreland
proposed patch

Attachment: bug45687.patch (application/octet-stream, text), 569 bytes.

[22 Feb 2010 10:40] Jonas Oreland
Hi Andrew (or some other listener),

If you could test my patch and post results, that would be great!

/Jonas
[23 Feb 2010 16:56] Andrew Hutchings
I cannot reproduce the problem using the patch.  Looks good to me :)
[25 Feb 2010 15:55] 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/101474

3103 Jonas Oreland	2010-02-25
      ndb - bug#45687
        handle position/rnd_pos with records deleted inbetween
[25 Feb 2010 16:03] Jonas Oreland
pushed to 6.3.32, 7.0.13 and 7.1.2
[26 Feb 2010 14:05] Jon Stephens
Documented bugfix in the NDB-6.3.32, 7.0.13, and 7.1.2 changelogs, as follows:

      A SELECT requiring a sort could fail with the error -Can't find 
      record in '[table]'- when run concurrently with a DELETE from the 
      same table.

Closed