List:Commits« Previous MessageNext Message »
From:Mauritz Sundell Date:January 30 2013 9:58am
Subject:bzr push into mysql-5.5-cluster-7.2 branch (mauritz.sundell:4158 to 4159)
View as plain text  
 4159 Mauritz Sundell	2013-01-30 [merge]
      merge 7.1 -> 7.2

    added:
      mysql-test/suite/ndb/include/ndb_check_unique_index.inc
      mysql-test/suite/ndb/t/ndb_add_partition.cnf
    modified:
      mysql-test/suite/ndb/r/ndb_add_partition.result
      mysql-test/suite/ndb/t/ndb_add_partition.test
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
 4158 Frazer Clement	2013-01-23 [merge]
      Merge 7.1->7.2

    modified:
      storage/ndb/include/kernel/signaldata/PackedSignal.hpp
      storage/ndb/src/common/debugger/signaldata/PackedSignal.cpp
      storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
      storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
=== added file 'mysql-test/suite/ndb/include/ndb_check_unique_index.inc'
--- a/mysql-test/suite/ndb/include/ndb_check_unique_index.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/include/ndb_check_unique_index.inc	2013-01-30 09:37:07 +0000
@@ -0,0 +1,47 @@
+#
+# ndb_check_unique_index.inc - check that all unique index use same fragment count as main table
+#
+# Usage:
+# let ndb_database= <table database>;
+# let ndb_table= <table name>;
+# --source suite/ndb/include/ndb_check_unique_index.inc
+#
+
+--perl
+use strict;
+
+my $db = $ENV{ndb_database} or die "Missing ndb_database in environment\n";
+my $tbl = $ENV{ndb_table} or die "Missing ndb_table in environment\n";
+my $cmd = "$ENV{NDB_DESC} -d$db $tbl";
+
+my $fragcnt;
+open MAIN, "$cmd|";
+print "Table: $db.$tbl\n";
+while (<MAIN>)
+{
+  if (/FragmentCount: (\S+).*/)
+  {
+    print;
+    $fragcnt = $1;
+  }
+  if (/([^(]+unique)\S+ - UniqueHashIndex.*/)
+  {
+    print;
+    my $index = $1;
+    open IDX, "$ENV{NDB_DESC} -d$db -t$tbl $index|"
+      or die "FAILED: $ENV{NDB_DESC} -d$db -t$tbl $index|";
+    while (<IDX>)
+    {
+      if (/FragmentCount: (\S+).*/)
+      {
+        print;
+      }
+    }
+    close IDX;
+  }
+}
+close MAIN;
+EOF
+
+let ndb_database=;
+let ndb_table=;

=== modified file 'mysql-test/suite/ndb/r/ndb_add_partition.result'
--- a/mysql-test/suite/ndb/r/ndb_add_partition.result	2012-03-21 15:42:47 +0000
+++ b/mysql-test/suite/ndb/r/ndb_add_partition.result	2013-01-30 09:37:07 +0000
@@ -37,6 +37,36 @@ c int unsigned not null,
 primary key(a,b),
 unique (b))
 ENGINE = NDB;
+CREATE TABLE t5 (a int unsigned not null,
+b int unsigned not null,
+c int unsigned null,
+primary key(a,b),
+unique (b),
+unique (c))
+ENGINE = NDB
+partition by key(a) partitions 3;
+Table: test.t1
+FragmentCount: 2
+b$unique(b) - UniqueHashIndex
+FragmentCount: 2
+Table: test.t2
+FragmentCount: 2
+b$unique(b) - UniqueHashIndex
+FragmentCount: 2
+Table: test.t3
+FragmentCount: 4
+b$unique(b) - UniqueHashIndex
+FragmentCount: 4
+Table: test.t4
+FragmentCount: 2
+b$unique(b) - UniqueHashIndex
+FragmentCount: 2
+Table: test.t5
+FragmentCount: 3
+b$unique(b) - UniqueHashIndex
+FragmentCount: 3
+c$unique(c) - UniqueHashIndex
+FragmentCount: 3
 INSERT INTO t1 VALUES
 (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
 (6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
@@ -61,6 +91,7 @@ INSERT INTO t1 VALUES
 insert into t2 select * from t1;
 insert into t3 select * from t1;
 insert into t4 select * from t1;
+insert into t5 (a,b,c) select a,b,if(a%2,b,NULL) as c from t1;
 select count(*) from t1;
 count(*)
 100
@@ -73,6 +104,9 @@ count(*)
 select count(*) from t4;
 count(*)
 100
+select count(*) from t5;
+count(*)
+100
 select * from t1 where a < 20;
 a	b	c
 1	1	1
@@ -264,6 +298,8 @@ Warning	1105	Cannot online REORGANIZE a
 Error	1235	This version of MySQL doesn't yet support 'alter online table t3 reorganize partition'
 alter online table t3 max_rows=50000000;
 alter online table t4 reorganize partition;
+alter online table t5 partition by key() partitions 6;
+ERROR 42000: This version of MySQL doesn't yet support 'alter online table t5 partition by key() partitions 6'
 Check partitions added, expect 0 in all cases
 partitions added to t1
 t1_added
@@ -489,6 +525,10 @@ a	b	c
 select * from t4 where b = 50;
 a	b	c
 50	50	50
+Table: test.t4
+FragmentCount: 2
+b$unique(b) - UniqueHashIndex
+FragmentCount: 2
 drop table t4;
 alter online table t1 add partition partitions 2;
 alter online table t2 add partition partitions 1;
@@ -643,7 +683,25 @@ a	b	c
 select * from t3 where b = 50;
 a	b	c
 50	50	50
-drop table t1,t2,t3;
+Table: test.t1
+FragmentCount: 5
+b$unique(b) - UniqueHashIndex
+FragmentCount: 2
+Table: test.t2
+FragmentCount: 7
+b$unique(b) - UniqueHashIndex
+FragmentCount: 2
+Table: test.t3
+FragmentCount: 8
+b$unique(b) - UniqueHashIndex
+FragmentCount: 4
+Table: test.t5
+FragmentCount: 3
+b$unique(b) - UniqueHashIndex
+FragmentCount: 3
+c$unique(c) - UniqueHashIndex
+FragmentCount: 3
+drop table t1,t2,t3,t5;
 alter tablespace ts1 drop datafile 'datafile.dat' engine = ndb;
 drop tablespace ts1 engine = ndb;
 drop logfile group lg1 engine = ndb;

=== added file 'mysql-test/suite/ndb/t/ndb_add_partition.cnf'
--- a/mysql-test/suite/ndb/t/ndb_add_partition.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/t/ndb_add_partition.cnf	2013-01-30 09:37:07 +0000
@@ -0,0 +1,9 @@
+!include suite/ndb/my.cnf
+
+[ENV]
+# Test will pass some table names that includes $ to command line interpreter.
+# $ is expanded in bourne shell, but not expanded in Windows command line.
+# The environment variable below makes sure that xxx$BLOB is passed as xxx$BLOB
+# in either case.
+unique=$unique
+BLOB=$BLOB

=== modified file 'mysql-test/suite/ndb/t/ndb_add_partition.test'
--- a/mysql-test/suite/ndb/t/ndb_add_partition.test	2012-11-27 12:53:59 +0000
+++ b/mysql-test/suite/ndb/t/ndb_add_partition.test	2013-01-30 09:56:42 +0000
@@ -48,6 +48,40 @@ CREATE TABLE t4 (a int unsigned not null
                  unique (b))
 ENGINE = NDB;
 
+CREATE TABLE t5 (a int unsigned not null,
+                 b int unsigned not null,
+                 c int unsigned null,
+                 primary key(a,b),
+                 unique (b),
+                 unique (c))
+ENGINE = NDB
+partition by key(a) partitions 3;
+
+# Fragment counts for unique index must be equal to main table
+# if main table is hashmap partitioned
+
+let ndb_database=test;
+let ndb_table=t1;
+--source suite/ndb/include/ndb_check_unique_index.inc
+
+let ndb_database=test;
+let ndb_table=t2;
+--source suite/ndb/include/ndb_check_unique_index.inc
+
+let ndb_database=test;
+let ndb_table=t3;
+--source suite/ndb/include/ndb_check_unique_index.inc
+
+let ndb_database=test;
+let ndb_table=t4;
+--source suite/ndb/include/ndb_check_unique_index.inc
+
+let ndb_database=test;
+let ndb_table=t5;
+--source suite/ndb/include/ndb_check_unique_index.inc
+
+#
+
 let $t1_part_count_start = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't1', Value, 1);
 
 let $t2_part_count_start = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't2', Value, 1);
@@ -81,10 +115,13 @@ INSERT INTO t1 VALUES
 insert into t2 select * from t1;
 insert into t3 select * from t1;
 insert into t4 select * from t1;
+insert into t5 (a,b,c) select a,b,if(a%2,b,NULL) as c from t1;
+
 select count(*) from t1;
 select count(*) from t2;
 select count(*) from t3;
 select count(*) from t4;
+select count(*) from t5;
 --sorted_result
 select * from t1 where a < 20;
 --sorted_result
@@ -154,6 +191,8 @@ show warnings;
 
 alter online table t3 max_rows=50000000;
 alter online table t4 reorganize partition;
+--error 1235
+alter online table t5 partition by key() partitions 6;
 
 let $t1_part_count_now = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't1', Value, 1);
 
@@ -275,6 +314,10 @@ select * from t4 where b = 30;
 select * from t4 where b = 40;
 select * from t4 where b = 50;
 
+let ndb_database=test;
+let ndb_table=t4;
+--source suite/ndb/include/ndb_check_unique_index.inc
+
 drop table t4;
 
 alter online table t1 add partition partitions 2;
@@ -343,7 +386,26 @@ select * from t3 where b = 30;
 select * from t3 where b = 40;
 select * from t3 where b = 50;
 
-drop table t1,t2,t3;
+# Fragment counts for unique index may now differ from main table
+# since unique index do not reorg
+
+let ndb_database=test;
+let ndb_table=t1;
+--source suite/ndb/include/ndb_check_unique_index.inc
+
+let ndb_database=test;
+let ndb_table=t2;
+--source suite/ndb/include/ndb_check_unique_index.inc
+
+let ndb_database=test;
+let ndb_table=t3;
+--source suite/ndb/include/ndb_check_unique_index.inc
+
+let ndb_database=test;
+let ndb_table=t5;
+--source suite/ndb/include/ndb_check_unique_index.inc
+
+drop table t1,t2,t3,t5;
 alter tablespace ts1 drop datafile 'datafile.dat' engine = ndb;
 drop tablespace ts1 engine = ndb;
 drop logfile group lg1 engine = ndb;

=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2012-11-21 00:30:55 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2013-01-30 09:56:42 +0000
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2003, 2010-2013, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -11256,6 +11256,14 @@ Dbdict::createIndex_toCreateTable(Signal
     w.add(DictTabInfo::TableTemporaryFlag, (Uint32)flag);
   }
   w.add(DictTabInfo::FragmentTypeVal, createIndexPtr.p->m_fragmentType);
+  // Inherit fragment count if main table is also hashmap partitioned.
+  // Otherwise better do use default.
+  if ((DictTabInfo::FragmentType)createIndexPtr.p->m_fragmentType == tablePtr.p->fragmentType &&
+      tablePtr.p->fragmentType == DictTabInfo::HashMapPartition)
+  {
+    w.add(DictTabInfo::FragmentCount, tablePtr.p->fragmentCount);
+  }
+
   w.add(DictTabInfo::TableTypeVal, createIndexPtr.p->m_request.indexType);
   { LocalRope name(c_rope_pool, tablePtr.p->tableName);
     char tableName[MAX_TAB_NAME_SIZE];

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster-7.2 branch (mauritz.sundell:4158 to 4159) Mauritz Sundell14 Mar