MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:July 18 2007 6:04pm
Subject:bk commit into 5.0 tree (cmiller:1.2503) BUG#26909
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of cmiller. When cmiller 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-07-18 14:03:58-04:00, cmiller@stripped +3 -0
  Bug#26909: Specified key was too long; max key length is 255 bytes \
  	when creating table
  
  Federated tables had an artificially low maximum of key length, 
  because the handler failed to implement a method to return it and 
  the default value is taked from the prototype handler.
  
  Now, implement that method and return the maximum possible key
  length, which is that of InnoDB.

  mysql-test/r/federated.result@stripped, 2007-07-18 14:03:56-04:00, cmiller@stripped +37 -0
    Verify that unique keys may be longer than 255 characters.

  mysql-test/t/federated.test@stripped, 2007-07-18 14:03:56-04:00, cmiller@stripped +40 -0
    Verify that unique keys may be longer than 255 characters.

  sql/ha_federated.h@stripped, 2007-07-18 14:03:56-04:00, cmiller@stripped +3 -1
    Implement the virtual method that tells the max size of parts to 
    make a key.
    
    Backport the length defined in 5.1.

# 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:	cmiller
# Host:	zippy.cornsilk.net
# Root:	/home/cmiller/work/mysql/bug26909/my50-bug26909

--- 1.40/mysql-test/r/federated.result	2006-11-29 13:56:41 -05:00
+++ 1.41/mysql-test/r/federated.result	2007-07-18 14:03:56 -04:00
@@ -1843,6 +1843,43 @@ C3A4C3B6C3BCC39F
 D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E
 drop table federated.t1;
 drop table federated.t1;
+CREATE TABLE federated.t1 (
+categoryId int(11) NOT NULL AUTO_INCREMENT,
+domainId varchar(745) NOT NULL DEFAULT '',
+categoryName varchar(255) NOT NULL DEFAULT '',
+PRIMARY KEY (categoryId),
+UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName),
+KEY idx_category_domainId (domainId)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+CREATE TABLE federated.t1 (
+categoryId int(11) NOT NULL AUTO_INCREMENT,
+domainId varchar(745) NOT NULL DEFAULT '',
+categoryName varchar(255) NOT NULL DEFAULT '',
+PRIMARY KEY (categoryId),
+UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName),
+KEY idx_category_domainId (domainId)
+) ENGINE=FEDERATED DEFAULT CHARSET=latin1
+CONNECTION='mysql://root@stripped:SLAVE_PORT/federated/t1';
+insert into federated.t1 (domainId, categoryName) values ( '1231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231  300', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345  250');
+insert into federated.t1 (domainId, categoryName) values ( '12312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312  301', '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456  250');
+insert into federated.t1 (domainId, categoryName) values ('a', 'b');
+select categoryId from federated.t1 order by domainId, categoryName;
+categoryId
+1
+2
+3
+select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId;
+categoryId
+3
+select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId;
+categoryId
+3
+select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' order by categoryId;
+categoryId
+1
+2
+drop table federated.t1;
+drop table federated.t1;
 DROP TABLE IF EXISTS federated.t1;
 DROP DATABASE IF EXISTS federated;
 DROP TABLE IF EXISTS federated.t1;

--- 1.35/mysql-test/t/federated.test	2006-11-29 13:56:18 -05:00
+++ 1.36/mysql-test/t/federated.test	2007-07-18 14:03:56 -04:00
@@ -1575,5 +1575,45 @@ drop table federated.t1;
 connection slave;
 drop table federated.t1;
 
+#
+# Bug#26909: Specified key was too long; max key length is 255 bytes 
+#       when creating a table
+#
+connection slave;
+CREATE TABLE federated.t1 (
+    categoryId int(11) NOT NULL AUTO_INCREMENT,
+    domainId varchar(745) NOT NULL DEFAULT '',
+    categoryName varchar(255) NOT NULL DEFAULT '',
+    PRIMARY KEY (categoryId),
+    UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName),
+    KEY idx_category_domainId (domainId)
+  ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+connection master;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE federated.t1 (
+    categoryId int(11) NOT NULL AUTO_INCREMENT,
+    domainId varchar(745) NOT NULL DEFAULT '',
+    categoryName varchar(255) NOT NULL DEFAULT '',
+    PRIMARY KEY (categoryId),
+    UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName),
+    KEY idx_category_domainId (domainId)
+  ) ENGINE=FEDERATED DEFAULT CHARSET=latin1
+  CONNECTION='mysql://root@stripped:$SLAVE_MYPORT/federated/t1';
+
+
+insert into federated.t1 (domainId, categoryName) values ( '1231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231  300', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345  250');
+insert into federated.t1 (domainId, categoryName) values ( '12312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312  301', '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456  250');
+insert into federated.t1 (domainId, categoryName) values ('a', 'b');
+
+select categoryId from federated.t1 order by domainId, categoryName;
+select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId;
+select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId;
+select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' order by categoryId;
+
+drop table federated.t1;
+
+connection slave;
+drop table federated.t1;
 
 source include/federated_cleanup.inc;

--- 1.30/sql/ha_federated.h	2006-12-23 14:04:24 -05:00
+++ 1.31/sql/ha_federated.h	2007-07-18 14:03:56 -04:00
@@ -37,6 +37,7 @@
 #define FEDERATED_QUERY_BUFFER_SIZE STRING_BUFFER_USUAL_SIZE * 5
 #define FEDERATED_RECORDS_IN_RANGE 2
 
+#define FEDERATED_MAX_KEY_LENGTH 3500 // Same as innodb
 #define FEDERATED_INFO " SHOW TABLE STATUS LIKE "
 #define FEDERATED_INFO_LEN sizeof(FEDERATED_INFO)
 #define FEDERATED_SELECT "SELECT "
@@ -217,7 +218,8 @@ public:
   uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; }
   uint max_supported_keys()          const { return MAX_KEY; }
   uint max_supported_key_parts()     const { return MAX_REF_PARTS; }
-  uint max_supported_key_length()    const { return MAX_KEY_LENGTH; }
+  uint max_supported_key_length()    const { return FEDERATED_MAX_KEY_LENGTH; }
+  uint max_supported_key_part_length() const { return FEDERATED_MAX_KEY_LENGTH; }
   /*
     Called in test_quick_select to determine if indexes should be used.
     Normally, we need to know number of blocks . For federated we need to
Thread
bk commit into 5.0 tree (cmiller:1.2503) BUG#26909Chad MILLER18 Jul