List:Commits« Previous MessageNext Message »
From:gluh Date:May 17 2006 11:48am
Subject:bk commit into 5.1 tree (gluh:1.2399) BUG#18730
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of gluh. When gluh 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.2399 06/05/17 16:48:34 gluh@stripped +3 -0
  Bug#18730 Partitions: NDB, crash on SELECT MIN(<unique column>)
   issue an error if table has no prmary key and
   has unique index and
   partition expression fileds are not a part of unique index

  sql/sql_partition.cc
    1.71 06/05/17 16:48:27 gluh@stripped +12 -4
    Bug#18730 Partitions: NDB, crash on SELECT MIN(<unique column>)
     issue an error if table has no prmary key and
     has unique index and
     partition expression fileds are not a part of unique index

  mysql-test/t/ndb_basic.test
    1.42 06/05/17 16:48:27 gluh@stripped +23 -0
    Bug#18730 Partitions: NDB, crash on SELECT MIN(<unique column>)
     test case

  mysql-test/r/ndb_basic.result
    1.41 06/05/17 16:48:27 gluh@stripped +16 -0
    Bug#18730 Partitions: NDB, crash on SELECT MIN(<unique column>)
     test case

# 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:	gluh
# Host:	eagle.intranet.mysql.r18.ru
# Root:	/home/gluh/MySQL/Bugs/5.1.18730

--- 1.40/mysql-test/r/ndb_basic.result	Thu May  4 08:28:20 2006
+++ 1.41/mysql-test/r/ndb_basic.result	Wed May 17 16:48:27 2006
@@ -755,3 +755,19 @@ f1	f2	f3
 111111	aaaaaa	1
 222222	bbbbbb	2
 drop table t1;
+CREATE TABLE t1 (f1 INTEGER, f2 INTEGER,
+UNIQUE INDEX(f1)) ENGINE=NDB
+PARTITION BY HASH(f2) PARTITIONS 2;
+ERROR HY000: A UNIQUE INDEX need to include all fields in the partition function
+CREATE TABLE t1 (f1 INTEGER, f2 INTEGER,
+primary key(f2), UNIQUE INDEX(f1)) ENGINE=NDB
+PARTITION BY HASH(f2) PARTITIONS 2;
+drop table t1;
+CREATE TABLE t1 (f1 INTEGER, f2 INTEGER,
+UNIQUE INDEX(f1)) ENGINE=NDB
+PARTITION BY KEY(f2) PARTITIONS 2;
+ERROR HY000: A UNIQUE INDEX need to include all fields in the partition function
+CREATE TABLE t1 (f1 INTEGER, f2 INTEGER,
+primary key(f2), UNIQUE INDEX(f1)) ENGINE=NDB
+PARTITION BY key(f2) PARTITIONS 2;
+drop table t1;

--- 1.41/mysql-test/t/ndb_basic.test	Thu May  4 08:28:20 2006
+++ 1.42/mysql-test/t/ndb_basic.test	Wed May 17 16:48:27 2006
@@ -714,3 +714,26 @@ select * from t1 order by f1;
 select * from t1 order by f2;
 select * from t1 order by f3;
 drop table t1;
+
+#
+# Bug#18730 Partitions: NDB, crash on SELECT MIN(<unique column>)
+#
+--error 1490
+CREATE TABLE t1 (f1 INTEGER, f2 INTEGER,
+UNIQUE INDEX(f1)) ENGINE=NDB
+PARTITION BY HASH(f2) PARTITIONS 2;
+
+CREATE TABLE t1 (f1 INTEGER, f2 INTEGER,
+primary key(f2), UNIQUE INDEX(f1)) ENGINE=NDB
+PARTITION BY HASH(f2) PARTITIONS 2;
+drop table t1;
+
+--error 1490
+CREATE TABLE t1 (f1 INTEGER, f2 INTEGER,
+UNIQUE INDEX(f1)) ENGINE=NDB
+PARTITION BY KEY(f2) PARTITIONS 2;
+
+CREATE TABLE t1 (f1 INTEGER, f2 INTEGER,
+primary key(f2), UNIQUE INDEX(f1)) ENGINE=NDB
+PARTITION BY key(f2) PARTITIONS 2;
+drop table t1;

--- 1.70/sql/sql_partition.cc	Sat May 13 00:42:22 2006
+++ 1.71/sql/sql_partition.cc	Wed May 17 16:48:27 2006
@@ -1470,10 +1470,18 @@ bool fix_partition_func(THD *thd, const 
     goto end;
   if (unlikely(check_primary_key(table)))
     goto end;
-  if (unlikely((!(table->s->db_type->partition_flags &&
-      (table->s->db_type->partition_flags() & HA_CAN_PARTITION_UNIQUE))) &&
-               check_unique_keys(table)))
-    goto end;
+
+  /*
+    if table has primary key which is ok for partitioning
+    then skip unique keys check
+  */
+ if (!(table->s->primary_key < MAX_KEY))
+  {
+    if (unlikely(part_info->full_part_field_array &&
+                 check_unique_keys(table)))
+      goto end;
+  }
+
   if (unlikely(set_up_partition_bitmap(thd, part_info)))
     goto end;
   check_range_capable_PF(table);
Thread
bk commit into 5.1 tree (gluh:1.2399) BUG#18730gluh17 May