Commit 0c2f1e3a authored by unknown's avatar unknown

Bug#27775 mediumint auto_increment with ndb_restore

- autoincrement column of size medium int not handled in ndb_restore
- added testcase also for other types, tiny, small... etc
parent 270b5b4a
...@@ -2,12 +2,12 @@ use test; ...@@ -2,12 +2,12 @@ use test;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c; drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
CREATE TABLE `t1_c` ( CREATE TABLE `t1_c` (
`capgoaledatta` smallint(5) unsigned NOT NULL auto_increment, `capgoaledatta` mediumint(5) unsigned NOT NULL auto_increment,
`goaledatta` char(2) NOT NULL default '', `goaledatta` char(2) NOT NULL default '',
`maturegarbagefa` varchar(32) NOT NULL default '', `maturegarbagefa` varchar(32) NOT NULL default '',
PRIMARY KEY (`capgoaledatta`,`goaledatta`,`maturegarbagefa`) PRIMARY KEY (`capgoaledatta`,`goaledatta`,`maturegarbagefa`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1; ) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(4,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3,'20','threetrees.qt'); INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(400,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3000,'20','threetrees.qt');
CREATE TABLE `t2_c` ( CREATE TABLE `t2_c` (
`capgotod` smallint(5) unsigned NOT NULL auto_increment, `capgotod` smallint(5) unsigned NOT NULL auto_increment,
`gotod` smallint(5) unsigned NOT NULL default '0', `gotod` smallint(5) unsigned NOT NULL default '0',
...@@ -18,7 +18,7 @@ CREATE TABLE `t2_c` ( ...@@ -18,7 +18,7 @@ CREATE TABLE `t2_c` (
PRIMARY KEY (`capgotod`), PRIMARY KEY (`capgotod`),
KEY `i quadaddsvr` (`gotod`) KEY `i quadaddsvr` (`gotod`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1; ) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t2_c` VALUES (5,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST'); INSERT INTO `t2_c` VALUES (500,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
CREATE TABLE `t3_c` ( CREATE TABLE `t3_c` (
`CapGoaledatta` smallint(5) unsigned NOT NULL default '0', `CapGoaledatta` smallint(5) unsigned NOT NULL default '0',
`capgotod` smallint(5) unsigned NOT NULL default '0', `capgotod` smallint(5) unsigned NOT NULL default '0',
...@@ -36,7 +36,7 @@ PRIMARY KEY (`fa`,`realm`), ...@@ -36,7 +36,7 @@ PRIMARY KEY (`fa`,`realm`),
KEY `capfa` (`capfa`), KEY `capfa` (`capfa`),
KEY `i_quadentity` (`fa`,`realm`) KEY `i_quadentity` (`fa`,`realm`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1; ) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t4_c` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(22,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(29,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL); INSERT INTO `t4_c` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(2200,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32000,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(290000000,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL);
CREATE TABLE `t5_c` ( CREATE TABLE `t5_c` (
`capfa` bigint(20) unsigned NOT NULL default '0', `capfa` bigint(20) unsigned NOT NULL default '0',
`gotod` smallint(5) unsigned NOT NULL default '0', `gotod` smallint(5) unsigned NOT NULL default '0',
...@@ -53,7 +53,7 @@ PRIMARY KEY (`capfa_child`,`capfa_parent`,`relatta`) ...@@ -53,7 +53,7 @@ PRIMARY KEY (`capfa_child`,`capfa_parent`,`relatta`)
INSERT INTO `t6_c` VALUES (15,16,0),(19,20,0),(18326932092909551615,30,0),(26,29,0),(18326932092909551615,29,0),(19,18,0),(26,28,0),(12,14,0); INSERT INTO `t6_c` VALUES (15,16,0),(19,20,0),(18326932092909551615,30,0),(26,29,0),(18326932092909551615,29,0),(19,18,0),(26,28,0),(12,14,0);
CREATE TABLE `t7_c` ( CREATE TABLE `t7_c` (
`dardpo` char(15) NOT NULL default '', `dardpo` char(15) NOT NULL default '',
`dardtestard` tinyint(3) unsigned NOT NULL default '0', `dardtestard` tinyint(3) unsigned NOT NULL auto_increment,
`FastFA` char(5) NOT NULL default '', `FastFA` char(5) NOT NULL default '',
`FastCode` char(6) NOT NULL default '', `FastCode` char(6) NOT NULL default '',
`Fastca` char(1) NOT NULL default '', `Fastca` char(1) NOT NULL default '',
...@@ -118,6 +118,7 @@ PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`) ...@@ -118,6 +118,7 @@ PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`)
INSERT INTO `t9_c` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net','436643316120','436643316939','91341234568968','695595699','1.1.1.1','2.2.6.2','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',3123123,9569,6565,1),('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643316120','436643316939','8956234534568968','5254595969','1.1.1.1','8.6.2.2','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565,2),('4545435545','john','q3.net','q3.net','acne.li','436643316120','436643316939','45345234568968','995696699','1.1.1.1','2.9.9.2','2','86998','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8823123,169,3565,3); INSERT INTO `t9_c` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net','436643316120','436643316939','91341234568968','695595699','1.1.1.1','2.2.6.2','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',3123123,9569,6565,1),('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643316120','436643316939','8956234534568968','5254595969','1.1.1.1','8.6.2.2','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565,2),('4545435545','john','q3.net','q3.net','acne.li','436643316120','436643316939','45345234568968','995696699','1.1.1.1','2.9.9.2','2','86998','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8823123,169,3565,3);
create table t10_c (a int auto_increment key) ENGINE=ndbcluster; create table t10_c (a int auto_increment key) ENGINE=ndbcluster;
insert into t10_c values (1),(2),(3); insert into t10_c values (1),(2),(3);
insert into t10_c values (10000),(2000),(3000);
create table t1 engine=myisam as select * from t1_c; create table t1 engine=myisam as select * from t1_c;
create table t2 engine=myisam as select * from t2_c; create table t2 engine=myisam as select * from t2_c;
create table t3 engine=myisam as select * from t3_c; create table t3 engine=myisam as select * from t3_c;
...@@ -255,6 +256,24 @@ a ...@@ -255,6 +256,24 @@ a
1 1
2 2
3 3
2000
3000
10000
show table status like 't1_c';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
X X X X X X X X X X 3001 X X X X X X X
show table status like 't2_c';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
X X X X X X X X X X 501 X X X X X X X
show table status like 't4_c';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
X X X X X X X X X X 290000001 X X X X X X X
show table status like 't7_c';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
X X X X X X X X X X 29 X X X X X X X
show table status like 't10_c';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
X X X X X X X X X X 10001 X X X X X X X
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9, t10; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9, t10;
drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c, t10_c; drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c, t10_c;
520093696,1 520093696,1
...@@ -8,17 +8,21 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; ...@@ -8,17 +8,21 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c; drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
--enable_warnings --enable_warnings
# Bug #27775 - mediumint auto inc not restored correctly
# - check mediumint
CREATE TABLE `t1_c` ( CREATE TABLE `t1_c` (
`capgoaledatta` smallint(5) unsigned NOT NULL auto_increment, `capgoaledatta` mediumint(5) unsigned NOT NULL auto_increment,
`goaledatta` char(2) NOT NULL default '', `goaledatta` char(2) NOT NULL default '',
`maturegarbagefa` varchar(32) NOT NULL default '', `maturegarbagefa` varchar(32) NOT NULL default '',
PRIMARY KEY (`capgoaledatta`,`goaledatta`,`maturegarbagefa`) PRIMARY KEY (`capgoaledatta`,`goaledatta`,`maturegarbagefa`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1; ) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(4,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3,'20','threetrees.qt'); INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(400,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3000,'20','threetrees.qt');
# #
# Bug #27758 Restoring NDB backups makes table usable in SQL nodes # Bug #27758 Restoring NDB backups makes table usable in SQL nodes
# - space in key made table unusable after restore # - space in key made table unusable after restore
# #
# Bug #27775 - mediumint auto inc not restored correctly
# - check smallint
CREATE TABLE `t2_c` ( CREATE TABLE `t2_c` (
`capgotod` smallint(5) unsigned NOT NULL auto_increment, `capgotod` smallint(5) unsigned NOT NULL auto_increment,
`gotod` smallint(5) unsigned NOT NULL default '0', `gotod` smallint(5) unsigned NOT NULL default '0',
...@@ -29,7 +33,7 @@ CREATE TABLE `t2_c` ( ...@@ -29,7 +33,7 @@ CREATE TABLE `t2_c` (
PRIMARY KEY (`capgotod`), PRIMARY KEY (`capgotod`),
KEY `i quadaddsvr` (`gotod`) KEY `i quadaddsvr` (`gotod`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1; ) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t2_c` VALUES (5,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST'); INSERT INTO `t2_c` VALUES (500,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
CREATE TABLE `t3_c` ( CREATE TABLE `t3_c` (
`CapGoaledatta` smallint(5) unsigned NOT NULL default '0', `CapGoaledatta` smallint(5) unsigned NOT NULL default '0',
...@@ -38,6 +42,8 @@ CREATE TABLE `t3_c` ( ...@@ -38,6 +42,8 @@ CREATE TABLE `t3_c` (
) ENGINE=ndbcluster DEFAULT CHARSET=latin1; ) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t3_c` VALUES (5,3),(2,4),(5,4),(1,3); INSERT INTO `t3_c` VALUES (5,3),(2,4),(5,4),(1,3);
# Bug #27775 - mediumint auto inc not restored correctly
# - check bigint
CREATE TABLE `t4_c` ( CREATE TABLE `t4_c` (
`capfa` bigint(20) unsigned NOT NULL auto_increment, `capfa` bigint(20) unsigned NOT NULL auto_increment,
`realm` varchar(32) NOT NULL default '', `realm` varchar(32) NOT NULL default '',
...@@ -49,7 +55,7 @@ CREATE TABLE `t4_c` ( ...@@ -49,7 +55,7 @@ CREATE TABLE `t4_c` (
KEY `capfa` (`capfa`), KEY `capfa` (`capfa`),
KEY `i_quadentity` (`fa`,`realm`) KEY `i_quadentity` (`fa`,`realm`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1; ) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t4_c` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(22,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(29,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL); INSERT INTO `t4_c` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(2200,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32000,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(290000000,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL);
CREATE TABLE `t5_c` ( CREATE TABLE `t5_c` (
`capfa` bigint(20) unsigned NOT NULL default '0', `capfa` bigint(20) unsigned NOT NULL default '0',
...@@ -67,9 +73,11 @@ CREATE TABLE `t6_c` ( ...@@ -67,9 +73,11 @@ CREATE TABLE `t6_c` (
) ENGINE=ndbcluster DEFAULT CHARSET=latin1; ) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t6_c` VALUES (15,16,0),(19,20,0),(18326932092909551615,30,0),(26,29,0),(18326932092909551615,29,0),(19,18,0),(26,28,0),(12,14,0); INSERT INTO `t6_c` VALUES (15,16,0),(19,20,0),(18326932092909551615,30,0),(26,29,0),(18326932092909551615,29,0),(19,18,0),(26,28,0),(12,14,0);
# Bug #27775 - mediumint auto inc not restored correctly
# - check tinyint
CREATE TABLE `t7_c` ( CREATE TABLE `t7_c` (
`dardpo` char(15) NOT NULL default '', `dardpo` char(15) NOT NULL default '',
`dardtestard` tinyint(3) unsigned NOT NULL default '0', `dardtestard` tinyint(3) unsigned NOT NULL auto_increment,
`FastFA` char(5) NOT NULL default '', `FastFA` char(5) NOT NULL default '',
`FastCode` char(6) NOT NULL default '', `FastCode` char(6) NOT NULL default '',
`Fastca` char(1) NOT NULL default '', `Fastca` char(1) NOT NULL default '',
...@@ -141,6 +149,9 @@ INSERT INTO `t9_c` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net',' ...@@ -141,6 +149,9 @@ INSERT INTO `t9_c` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net','
# seen by select below # seen by select below
create table t10_c (a int auto_increment key) ENGINE=ndbcluster; create table t10_c (a int auto_increment key) ENGINE=ndbcluster;
insert into t10_c values (1),(2),(3); insert into t10_c values (1),(2),(3);
# Bug #27775 - mediumint auto inc not restored correctly
# - check int
insert into t10_c values (10000),(2000),(3000);
create table t1 engine=myisam as select * from t1_c; create table t1 engine=myisam as select * from t1_c;
create table t2 engine=myisam as select * from t2_c; create table t2 engine=myisam as select * from t2_c;
...@@ -218,6 +229,18 @@ select count(*) ...@@ -218,6 +229,18 @@ select count(*)
# Bug #20820 cont'd # Bug #20820 cont'd
select * from t10_c order by a; select * from t10_c order by a;
# Bug #27775 cont'd
# - auto inc info should be correct
--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X
show table status like 't1_c';
--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X
show table status like 't2_c';
--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X
show table status like 't4_c';
--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X
show table status like 't7_c';
--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X
show table status like 't10_c';
--disable_warnings --disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9, t10; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9, t10;
......
...@@ -219,6 +219,9 @@ public: ...@@ -219,6 +219,9 @@ public:
memcpy(&val.u32,data,4); memcpy(&val.u32,data,4);
v= val.u32; v= val.u32;
break; break;
case 24:
v= uint3korr((unsigned char*)data);
break;
case 16: case 16:
memcpy(&val.u16,data,2); memcpy(&val.u16,data,2);
v= val.u16; v= val.u16;
......
...@@ -388,7 +388,7 @@ void BackupRestore::tuple_a(restore_callback_t *cb) ...@@ -388,7 +388,7 @@ void BackupRestore::tuple_a(restore_callback_t *cb)
Uint32 length = (size * arraySize) / 8; Uint32 length = (size * arraySize) / 8;
if (j == 0 && tup.getTable()->have_auto_inc(i)) if (j == 0 && tup.getTable()->have_auto_inc(i))
tup.getTable()->update_max_auto_val(dataPtr,size); tup.getTable()->update_max_auto_val(dataPtr,size*arraySize);
if (attr_desc->m_column->getPrimaryKey()) if (attr_desc->m_column->getPrimaryKey())
{ {
...@@ -602,7 +602,7 @@ BackupRestore::logEntry(const LogEntry & tup) ...@@ -602,7 +602,7 @@ BackupRestore::logEntry(const LogEntry & tup)
const char * dataPtr = attr->Data.string_value; const char * dataPtr = attr->Data.string_value;
if (tup.m_table->have_auto_inc(attr->Desc->attrId)) if (tup.m_table->have_auto_inc(attr->Desc->attrId))
tup.m_table->update_max_auto_val(dataPtr,size); tup.m_table->update_max_auto_val(dataPtr,size*arraySize);
const Uint32 length = (size / 8) * arraySize; const Uint32 length = (size / 8) * arraySize;
if (attr->Desc->m_column->getPrimaryKey()) if (attr->Desc->m_column->getPrimaryKey())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment