Bug #44099 Scan can timeout incorrectly if low selectivity
Submitted: 5 Apr 2009 20:55 Modified: 15 Apr 2009 3:27
Reporter: Jonas Oreland Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:* OS:Any
Assigned to: Jonas Oreland
Triage: Needs Triage: D3 (Medium)

[5 Apr 2009 20:55] Jonas Oreland
Description:
1) deadlock detection is based solely on timeouts
2) if doing a scan, it will report to TC (to avoid timeout)
   on a regular basis, when it is not hanging on a lock
3) ACC-scan had a hard-coded value of checking this once every 100ms
   which mades scan timeout incorrectly if using
   TransactionDeadlockDetectionTimeout <= 100
4) TUP/TUX-scans did not have any such code, making them very easy to timeout.

---

Solution is to move this code from ACC into LQH (which handles ACC/TUP/TUX scans)
and remove the hard-coded value.

How to repeat:
create table with ~10M rows
run SQL-scan statement (with engine_condition_pushdown enabled) that
  will only return 1 (or very few rows)
set TransactionDeadlockDetectionTimeout to a low value.

Suggested fix:
see above
[5 Apr 2009 20:57] 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/71408

2899 Jonas Oreland	2009-04-05
      ndb - bug#44099 - move SCAN_HB handling to LQH, and check it once per row returned from ACC_SCAN
[5 Apr 2009 21:04] Bugs System
Pushed into 5.1.32-ndb-6.2.18 (revid:jonas@mysql.com-20090405205643-d7rplq1dym8gsoea) (version source revid:jonas@mysql.com-20090405205643-d7rplq1dym8gsoea) (merge vers: 5.1.32-ndb-6.2.18) (pib:6)
[5 Apr 2009 21:05] Bugs System
Pushed into 5.1.32-ndb-6.3.24 (revid:jonas@mysql.com-20090405210010-idfu6505qfrnngp3) (version source revid:jonas@mysql.com-20090405210010-idfu6505qfrnngp3) (merge vers: 5.1.32-ndb-6.3.24) (pib:6)
[5 Apr 2009 21:05] Bugs System
Pushed into 5.1.32-ndb-7.0.5 (revid:jonas@mysql.com-20090405210306-0285cjs2pn7wplo0) (version source revid:jonas@mysql.com-20090405210306-0285cjs2pn7wplo0) (merge vers: 5.1.32-ndb-7.0.5) (pib:6)
[15 Apr 2009 3:27] Jon Stephens
Documented bugfix in the NDB-6.2.18, 6.3.24, and 7.0.5 changelogs as follows:

        TransactionDeadlockDetectionTimeout values less than 100 were treated
        as 100. This could cause scans to time out unexpectedly.

Also noted behaviour (and change) as appropriate in 4.1/5.0/5.1 versions of configuration section of Cluster chapter in Manual.