MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:Heikki Tuuri Date:March 23 2005 4:00pm
Subject:bk commit into 5.0 tree (heikki:1.1848) BUG#9314
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of heikki. When heikki does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1848 05/03/23 18:00:22 heikki@stripped +1 -0
  ha_innodb.cc:
    Fix bug #9314 in InnoDB true VARCHAR: InnoDB stored the 'position' of a row wrong in a column prefix primary key index; this could cause MySQL to complain 'ERROR 1032: Can't find record in ...' in an update of the primary key, and also some ORDER BY or DISTINCT queries

  sql/ha_innodb.cc
    1.181 05/03/23 17:59:04 heikki@stripped +18 -0
    Fix bug #9314 in InnoDB true VARCHAR: InnoDB stored the 'position' of a row wrong in a column prefix primary key index; this could cause MySQL to complain 'ERROR 1032: Can't find record in ...' in an update of the primary key, and also some ORDER BY or DISTINCT queries

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	heikki
# Host:	hundin.mysql.fi
# Root:	/home/heikki/mysql-5.0

--- 1.180/sql/ha_innodb.cc	Tue Mar 22 01:24:58 2005
+++ 1.181/sql/ha_innodb.cc	Wed Mar 23 17:59:04 2005
@@ -2439,7 +2439,14 @@
 				(byte*) (record
 				+ (ulint)get_field_offset(table, field)),
 				lenlen);
+
+			/* In a column prefix index, we may need to truncate
+			the stored value: */
 		
+			if (len > key_part->length) {
+			        len = key_part->length;
+			}
+
 			/* The length in a key value is always stored in 2
 			bytes */
 
@@ -2476,6 +2483,11 @@
 
 			ut_a(get_field_offset(table, field)
 						     == key_part->offset);
+
+			/* All indexes on BLOB and TEXT are column prefix
+			indexes, and we may need to truncate the data to be
+			stored in the kay value: */
+
 			if (blob_len > key_part->length) {
 			        blob_len = key_part->length;
 			}
@@ -2494,11 +2506,17 @@
 
 			buff += key_part->length;
 		} else {
+			/* Here we handle all other data types except the
+			true VARCHAR, BLOB and TEXT. Note that the column
+			value we store may be also in a column prefix
+			index. */
+
 		        if (is_null) {
 				 buff += key_part->length;
 				 
 				 continue;
 			}
+
 			memcpy(buff, record + key_part->offset,
 							key_part->length);
 			buff += key_part->length;
Thread
bk commit into 5.0 tree (heikki:1.1848) BUG#9314Heikki Tuuri23 Mar