List:Commits« Previous MessageNext Message »
From:tim Date:March 21 2007 9:08pm
Subject:bk commit into 5.0 tree (tsmith:1.2416)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of tsmith. When tsmith 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@stripped, 2007-03-21 22:08:06+01:00, tsmith@stripped +4 -0
  5.0.36-sp backport: bug 26881
  BUG 26881 - Large MERGE tables report incorrect specification when no
              differences in tables
  Certain merge tables were wrongly reported as having incorrect definition:
  - Some fields that are 1 byte long (e.g. TINYINT, CHAR(1)), might
    be internally casted (in certain cases) to a different type on a
    storage engine layer. (affects 4.1 and up)

  myisam/mi_create.c@stripped, 2007-03-21 22:06:09+01:00, tsmith@stripped +5 -0
    5.0.36-sp backport: bug 26881

  mysql-test/r/merge.result@stripped, 2007-03-21 22:06:13+01:00, tsmith@stripped +13 -0
    5.0.36-sp backport: bug 26881

  mysql-test/t/merge.test@stripped, 2007-03-21 22:06:16+01:00, tsmith@stripped +17 -0
    5.0.36-sp backport: bug 26881

  sql/ha_myisam.cc@stripped, 2007-03-21 22:06:18+01:00, tsmith@stripped +36 -1
    5.0.36-sp backport: bug 26881

# 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:	tsmith
# Host:	quadxeon.mysql.com
# Root:	/benchmarks/ext3/TOSAVE/tsmith/bk/mysql-5.0.36-sp

--- 1.60/myisam/mi_create.c	2007-01-18 11:32:47 +01:00
+++ 1.61/myisam/mi_create.c	2007-03-21 22:06:09 +01:00
@@ -157,6 +157,11 @@
       rec--;
       if (rec->type == (int) FIELD_SKIP_ZERO && rec->length == 1)
       {
+        /*
+          NOTE1: here we change a field type FIELD_SKIP_ZERO ->
+          FIELD_NORMAL
+         */
+
 	rec->type=(int) FIELD_NORMAL;
 	packed--;
 	min_pack_length++;

--- 1.174/sql/ha_myisam.cc	2007-01-31 15:32:51 +01:00
+++ 1.175/sql/ha_myisam.cc	2007-03-21 22:06:18 +01:00
@@ -342,6 +342,12 @@
   RETURN VALUE
     0 - Equal definitions.
     1 - Different definitions.
+
+  TODO
+    - compare FULLTEXT keys;
+    - compare SPATIAL keys;
+    - compare FIELD_SKIP_ZERO which is converted to FIELD_NORMAL correctly
+      (should be corretly detected in table2myisam).
 */
 
 int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
@@ -367,6 +373,28 @@
   {
     HA_KEYSEG *t1_keysegs= t1_keyinfo[i].seg;
     HA_KEYSEG *t2_keysegs= t2_keyinfo[i].seg;
+    if (t1_keyinfo[i].flag & HA_FULLTEXT && t2_keyinfo[i].flag & HA_FULLTEXT)
+      continue;
+    else if (t1_keyinfo[i].flag & HA_FULLTEXT ||
+             t2_keyinfo[i].flag & HA_FULLTEXT)
+    {  
+       DBUG_PRINT("error", ("Key %d has different definition", i));
+       DBUG_PRINT("error", ("t1_fulltext= %d, t2_fulltext=%d",
+                            test(t1_keyinfo[i].flag & HA_FULLTEXT),
+                            test(t2_keyinfo[i].flag & HA_FULLTEXT)));
+       DBUG_RETURN(1);
+    }
+    if (t1_keyinfo[i].flag & HA_SPATIAL && t2_keyinfo[i].flag & HA_SPATIAL)
+      continue;
+    else if (t1_keyinfo[i].flag & HA_SPATIAL ||
+             t2_keyinfo[i].flag & HA_SPATIAL)
+    {  
+       DBUG_PRINT("error", ("Key %d has different definition", i));
+       DBUG_PRINT("error", ("t1_spatial= %d, t2_spatial=%d",
+                            test(t1_keyinfo[i].flag & HA_SPATIAL),
+                            test(t2_keyinfo[i].flag & HA_SPATIAL)));
+       DBUG_RETURN(1);
+    }
     if (t1_keyinfo[i].keysegs != t2_keyinfo[i].keysegs ||
         t1_keyinfo[i].key_alg != t2_keyinfo[i].key_alg)
     {
@@ -403,7 +431,14 @@
   {
     MI_COLUMNDEF *t1_rec= &t1_recinfo[i];
     MI_COLUMNDEF *t2_rec= &t2_recinfo[i];
-    if (t1_rec->type != t2_rec->type ||
+    /*
+      FIELD_SKIP_ZERO can be changed to FIELD_NORMAL in mi_create,
+      see NOTE1 in mi_create.c
+    */
+    if ((t1_rec->type != t2_rec->type &&
+         !(t1_rec->type == (int) FIELD_SKIP_ZERO &&
+           t1_rec->length == 1 &&
+           t2_rec->type == (int) FIELD_NORMAL)) ||
         t1_rec->length != t2_rec->length ||
         t1_rec->null_bit != t2_rec->null_bit)
     {

--- 1.56/mysql-test/r/merge.result	2007-01-31 14:09:57 +01:00
+++ 1.57/mysql-test/r/merge.result	2007-03-21 22:06:13 +01:00
@@ -803,6 +803,19 @@
 SELECT * FROM tm1;
 ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
 DROP TABLE t1, tm1;
+CREATE TABLE t1(c1 VARCHAR(1));
+CREATE TABLE m1 LIKE t1;
+ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
+SELECT * FROM m1;
+c1
+DROP TABLE t1, m1;
+CREATE TABLE t1(c1 VARCHAR(4), c2 TINYINT, c3 TINYINT, c4 TINYINT,
+c5 TINYINT, c6 TINYINT, c7 TINYINT, c8 TINYINT, c9 TINYINT);
+CREATE TABLE m1 LIKE t1;
+ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
+SELECT * FROM m1;
+c1	c2	c3	c4	c5	c6	c7	c8	c9
+DROP TABLE t1, m1;
 create table t1 (b bit(1));
 create table t2 (b bit(1));
 create table tm (b bit(1)) engine = merge union = (t1,t2);

--- 1.46/mysql-test/t/merge.test	2007-01-31 13:20:01 +01:00
+++ 1.47/mysql-test/t/merge.test	2007-03-21 22:06:16 +01:00
@@ -430,6 +430,23 @@
 SELECT * FROM tm1;
 DROP TABLE t1, tm1;
 
+
+# BUG#26881 - Large MERGE tables report incorrect specification when no
+#             differences in tables
+#
+CREATE TABLE t1(c1 VARCHAR(1));
+CREATE TABLE m1 LIKE t1;
+ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
+SELECT * FROM m1;
+DROP TABLE t1, m1;
+
+CREATE TABLE t1(c1 VARCHAR(4), c2 TINYINT, c3 TINYINT, c4 TINYINT,
+                c5 TINYINT, c6 TINYINT, c7 TINYINT, c8 TINYINT, c9 TINYINT);
+CREATE TABLE m1 LIKE t1;
+ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
+SELECT * FROM m1;
+DROP TABLE t1, m1;
+
 # End of 4.1 tests
 
 #
Thread
bk commit into 5.0 tree (tsmith:1.2416)tim21 Mar