Bug #26242 UPDATE with subquery and triggers failing with cluster tables
Submitted: 9 Feb 2007 22:54 Modified: 10 Apr 2007 5:17
Reporter: Hartmut Holzgraefe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:5.0.30, 5.1bk OS:Linux (linux)
Assigned to: Martin Skold CPU Architecture:Any

[9 Feb 2007 22:54] Hartmut Holzgraefe
Description:
An UPDATE with subquery on a cluster table with an UPDATE trigger doesn't seem to work, MyISAM and InnoDB work fine with this though.

How to repeat:
see attached test case
[9 Feb 2007 23:02] Hartmut Holzgraefe
mysqltest test case

Attachment: bug26242.tgz (application/x-gtar, text), 1.19 KiB.

[14 Feb 2007 9:23] 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/19854

ChangeSet@1.2301, 2007-02-14 10:16:07+01:00, mskold@mysql.com +6 -0
  Bug #26242  UPDATE with subquery and triggers failing with cluster tables: inform handler with extra calls when batching of delete/update is possible
[14 Feb 2007 9:23] 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/19855

ChangeSet@1.2302, 2007-02-14 10:18:35+01:00, mskold@mysql.com +2 -0
  Bug #26242  UPDATE with subquery and triggers failing with cluster tables: added new test cases
[14 Feb 2007 12:27] Martin Skold
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/19862

ChangeSet@1.2432, 2007-02-14 13:17:12+01:00, mskold@linux.site +8 -0
  Merge mysql.com:/windows/Linux_space/MySQL/mysql-5.0
  into  mysql.com:/windows/Linux_space/MySQL/mysql-5.1
  MERGE: 1.1810.2399.19
[14 Feb 2007 13:36] 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/19867

ChangeSet@1.2433, 2007-02-14 14:21:44+01:00, mskold@mysql.com +2 -0
  Bug #26242  UPDATE with subquery and triggers failing with cluster tables: will_batch was not properly set
[27 Feb 2007 9:54] 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/20632

ChangeSet@1.2303, 2007-02-27 10:53:52+01:00, mskold@mysql.com +4 -0
  Bug #26242  UPDATE with subquery and triggers failing with cluster tables: removing HA_EXTRA_DELETE_CAN_BATCH and HA_EXTRA_UPDATE_CAN_BATCH, using HA_EXTRA_RESET instead
[27 Feb 2007 10:00] 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/20633

ChangeSet@1.2301, 2007-02-27 11:00:36+01:00, mskold@mysql.com +8 -0
  Bug #26242  UPDATE with subquery and triggers failing with cluster tables: Use HA_EXTRA_DELETE_CANNOT_BATCH and HA_EXTRA_UPDATE_CANNOT_BATCH to inform handler when batching of delete/update is not possible
[27 Feb 2007 10:01] Martin Skold
Last CS is the collapsed final one.
[27 Feb 2007 13:15] 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/20644

ChangeSet@1.2433, 2007-02-27 14:14:45+01:00, mskold@mysql.com +2 -0
  Bug #26242  UPDATE with subquery and triggers failing with cluster tables: Set will_batch to FALSE when batching is not possible
[14 Mar 2007 10:48] 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/21869

ChangeSet@1.2302, 2007-03-14 11:48:09+01:00, mskold@mysql.com +6 -0
  Bug #26242  UPDATE with subquery and triggers failing with cluster tables:
  Added checks if batching is possible for INSERT ON DUPLICATE UPDATE
  and REPLACE (doing DELETE). If not possible handler is inform by calls
  to extra() with HA_EXTRA_UPDATE_CANNOT_BATCH or HA_EXTRA_DELETE_CANNOT_BATCH
[14 Mar 2007 10:56] 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/21870

ChangeSet@1.2301, 2007-03-14 11:56:05+01:00, mskold@mysql.com +9 -0
  Bug #26242  UPDATE with subquery and triggers failing with cluster tables: Use HA_EXTRA_DELETE_CANNOT_BATCH and HA_EXTRA_UPDATE_CANNOT_BATCH to inform handler when batching of delete/update is not possible
[4 Apr 2007 10:50] 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/23771

ChangeSet@1.2301, 2007-04-04 12:50:39+02:00, mskold@mysql.com +11 -0
  Bug #26242  UPDATE with subquery and triggers failing with cluster tables
  
  In certain cases AFTER UPDATE/DELETE triggers on NDB tables that referenced
  subject table didn't see the results of operation which caused invocation
  of those triggers. In other words AFTER trigger invoked as result of update
  (or deletion) of particular row saw version of this row before update (or
  deletion).
  
  The problem occured because NDB handler in those cases postponed actual
  update/delete operations to be able to perform them later as one batch.
  
  This fix solves the problem by disabling this optimization for particular
  operation if subject table has AFTER trigger for this operation defined.
  To achieve this we introduce two new flags for handler::extra() method:
  HA_EXTRA_DELETE_CANNOT_BATCH and HA_EXTRA_UPDATE_CANNOT_BATCH.
  These are called if there exists AFTER DELETE/UPDATE triggers during a
  statement that potentially can generate calls to delete_row()/update_row().
  This includes multi_delete/multi_update statements as well as insert statements
  that do delete/update as part of an ON DUPLICATE statement.
[7 Apr 2007 7:00] Bugs System
Pushed into 5.0.40
[7 Apr 2007 7:01] Bugs System
Pushed into 5.1.18-beta
[10 Apr 2007 5:17] 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

Documented bugfix in 5.0.40 and 5.1.18 changelogs.