List:Commits« Previous MessageNext Message »
From:reggie Date:January 7 2006 12:52am
Subject:bk commit into 5.1 tree (reggie:1.2047) BUG#15968
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of reggie. When reggie 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.2047 06/01/06 18:52:49 reggie@stripped +3 -0
  Bug# 15968 - Partitions: crash when insert with f1 = -1 into partition by hash(f1)
  fixed

  sql/sql_partition.cc
    1.19 06/01/06 18:52:36 reggie@stripped +2 -1
    fields that generate a negative value would also generate a negative
    part_id which doesn't index into the m_file array to well.

  mysql-test/t/partition_hash.test
    1.2 06/01/06 18:52:35 reggie@stripped +9 -0
    test case for inserting a value into a hash that would generate a negative value

  mysql-test/r/partition_hash.result
    1.2 06/01/06 18:52:35 reggie@stripped +6 -0
    results for newly added test.

# 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:	reggie
# Host:	linux.site
# Root:	/home/reggie/work/mysql-5.1-bug15968

--- 1.1/mysql-test/r/partition_hash.result	2005-07-18 06:30:30 -05:00
+++ 1.2/mysql-test/r/partition_hash.result	2006-01-06 18:52:35 -06:00
@@ -64,3 +64,9 @@
 partition by key (a)
 (partition x1);
 drop table t1;
+CREATE TABLE t1 (f1 INTEGER, f2 char(20)) ENGINE = 'MYISAM' PARTITION BY HASH(f1) PARTITIONS 2;
+INSERT INTO t1 SET f1 = 0 - 1, f2 = '#######';
+select * from t1;
+f1	f2
+-1	#######
+drop table t1;

--- 1.1/mysql-test/t/partition_hash.test	2005-07-18 06:30:34 -05:00
+++ 1.2/mysql-test/t/partition_hash.test	2006-01-06 18:52:35 -06:00
@@ -75,3 +75,12 @@
 (partition x1);
 
 drop table t1;
+
+#
+# Bug# 15968 - crash when INSERT with f1 = -1 into partition by hash(f1)
+#
+CREATE TABLE t1 (f1 INTEGER, f2 char(20)) ENGINE = 'MYISAM' PARTITION BY HASH(f1) PARTITIONS 2;
+INSERT INTO t1 SET f1 = 0 - 1, f2 = '#######';
+select * from t1;
+drop table t1;
+

--- 1.18/sql/sql_partition.cc	2005-12-26 05:53:40 -06:00
+++ 1.19/sql/sql_partition.cc	2006-01-06 18:52:36 -06:00
@@ -2327,7 +2327,8 @@
                                Item *part_expr)
 {
   DBUG_ENTER("get_part_id_hash");
-  DBUG_RETURN((uint32)(part_expr->val_int() % no_parts));
+  longlong int_hash_id= part_expr->val_int() % no_parts;
+  DBUG_RETURN(int_hash_id < 0 ? -int_hash_id : int_hash_id);
 }
 
 
Thread
bk commit into 5.1 tree (reggie:1.2047) BUG#15968reggie7 Jan