Loading mysql-test/r/federated.result +35 −0 Original line number Diff line number Diff line Loading @@ -1843,6 +1843,41 @@ 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@127.0.0.1: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 create table federated.t1 (a int primary key, b varchar(64)) DEFAULT CHARSET=utf8; create table federated.t1 (a int primary key, b varchar(64)) Loading mysql-test/t/federated.test +40 −0 Original line number Diff line number Diff line Loading @@ -1575,6 +1575,46 @@ 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@127.0.0.1:$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; # # BUG#21019 Federated Engine does not support REPLACE/INSERT IGNORE/UPDATE IGNORE Loading sql/ha_federated.h +3 −1 Original line number Diff line number Diff line Loading @@ -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 " Loading Loading @@ -228,7 +229,8 @@ class ha_federated: public handler 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 Loading Loading
mysql-test/r/federated.result +35 −0 Original line number Diff line number Diff line Loading @@ -1843,6 +1843,41 @@ 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@127.0.0.1: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 create table federated.t1 (a int primary key, b varchar(64)) DEFAULT CHARSET=utf8; create table federated.t1 (a int primary key, b varchar(64)) Loading
mysql-test/t/federated.test +40 −0 Original line number Diff line number Diff line Loading @@ -1575,6 +1575,46 @@ 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@127.0.0.1:$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; # # BUG#21019 Federated Engine does not support REPLACE/INSERT IGNORE/UPDATE IGNORE Loading
sql/ha_federated.h +3 −1 Original line number Diff line number Diff line Loading @@ -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 " Loading Loading @@ -228,7 +229,8 @@ class ha_federated: public handler 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 Loading