Bug #58017 st_table::prepare_for_position need HA_PRIMARY_KEY_REQUIRED_FOR_POSITION check
Submitted: 5 Nov 2010 14:46 Modified: 5 Feb 2013 10:32
Reporter: Magnus Blåudd Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Magnus Blåudd CPU Architecture:Any
Tags: SEAGULL

[5 Nov 2010 14:46] Magnus Blåudd
Description:
Apply fix for "Bug#40081 UPDATE....ORDER BY cannot find rows in cluster" to MySQL Server

How to repeat:
See testcase for bug#40081. Unfortunately it looks like the problem is only reproducable with newer versions of ha_ndbcluster that fully utilizes the read and write bitmasks.

Suggested fix:
5.5$ bzr diff
=== modified file 'sql/table.cc'
--- sql/table.cc	2010-09-06 17:29:02 +0000
+++ sql/table.cc	2010-11-05 14:32:39 +0000
@@ -4665,7 +4665,8 @@ void TABLE::prepare_for_position()
 {
   DBUG_ENTER("TABLE::prepare_for_position");
 
-  if ((file->ha_table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX) &&
+  if ((file->ha_table_flags() & (HA_PRIMARY_KEY_IN_READ_INDEX |
+                                 HA_PRIMARY_KEY_REQUIRED_FOR_POSITION)) &&
       s->primary_key < MAX_KEY)
   {
     mark_columns_used_by_index_no_reset(s->primary_key, read_set);
[5 Feb 2013 10:32] Erlend Dahl
Fixed in 2011 already.