Below is the list of changes that have just been committed into a local
5.0 repository of tomas. When tomas 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
1.2210 06/07/06 18:50:44 tomas@stripped +5 -0
Bug #20820 auto inc table not handled correctly when restored from cluster backup
ndb/tools/restore/consumer_restore.cpp
1.25 06/07/06 18:50:32 tomas@stripped +29 -11
Bug #20820 auto inc table not handled correctly when restored from cluster backup
mysql-test/t/ndb_restore.test
1.10 06/07/06 18:50:32 tomas@stripped +17 -6
Bug #20820 auto inc table not handled correctly when restored from cluster backup
mysql-test/r/ndb_restore.result
1.5 06/07/06 18:50:32 tomas@stripped +17 -7
Bug #20820 auto inc table not handled correctly when restored from cluster backup
mysql-test/r/ndb_default_cluster.require
1.2 06/07/06 18:50:32 tomas@stripped +1 -1
Bug #20820 auto inc table not handled correctly when restored from cluster backup
mysql-test/include/ndb_default_cluster.inc
1.2 06/07/06 18:50:32 tomas@stripped +1 -1
Bug #20820 auto inc table not handled correctly when restored from cluster backup
# 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: tomas
# Host: poseidon.ndb.mysql.com
# Root: /home/tomas/mysql-5.0
--- 1.24/ndb/tools/restore/consumer_restore.cpp 2006-06-27 10:02:32 +02:00
+++ 1.25/ndb/tools/restore/consumer_restore.cpp 2006-07-06 18:50:32 +02:00
@@ -145,17 +145,38 @@
bool ret= true;
if (!m_restore && !m_restore_meta)
return ret;
- if (table.have_auto_inc())
+ if (!table.have_auto_inc())
+ return ret;
+
+ Uint64 max_val= table.get_max_auto_val();
+ do
{
- Uint64 max_val= table.get_max_auto_val();
- Uint64 auto_val;
+ Uint64 auto_val = ~(Uint64)0;
int r= m_ndb->readAutoIncrementValue(get_table(table.m_dictTable), auto_val);
- if (r == -1 && m_ndb->getNdbError().code != 626)
+ if (r == -1 && m_ndb->getNdbError().status == NdbError::TemporaryError)
+ {
+ NdbSleep_MilliSleep(50);
+ continue; // retry
+ }
+ else if (r == -1 && m_ndb->getNdbError().code != 626)
+ {
ret= false;
- else if (r == -1 || max_val+1 > auto_val)
- ret= m_ndb->setAutoIncrementValue(get_table(table.m_dictTable), max_val+1, false) != -1;
- }
- return ret;
+ }
+ else if ((r == -1 && m_ndb->getNdbError().code == 626) ||
+ max_val+1 > auto_val || auto_val == ~(Uint64)0)
+ {
+ r= m_ndb->setAutoIncrementValue(get_table(table.m_dictTable),
+ max_val+1, false);
+ if (r == -1 &&
+ m_ndb->getNdbError().status == NdbError::TemporaryError)
+ {
+ NdbSleep_MilliSleep(50);
+ continue; // retry
+ }
+ ret = (r == 0);
+ }
+ return (ret);
+ } while (1);
}
bool
@@ -216,9 +237,6 @@
if(tab == 0){
err << "Unable to find table: " << split[2].c_str() << endl;
return false;
- }
- if(m_restore_meta){
- m_ndb->setAutoIncrementValue(tab, ~(Uint64)0, false);
}
const NdbDictionary::Table* null = 0;
m_new_tables.fill(table.m_dictTable->getTableId(), null);
--- 1.1/mysql-test/include/ndb_default_cluster.inc 2005-01-26 14:38:03 +01:00
+++ 1.2/mysql-test/include/ndb_default_cluster.inc 2006-07-06 18:50:32 +02:00
@@ -1,4 +1,4 @@
-- require r/ndb_default_cluster.require
disable_query_log;
-show status like "Ndb_connected_host";
+show status like "Ndb_config_from_host";
enable_query_log;
--- 1.1/mysql-test/r/ndb_default_cluster.require 2005-01-26 14:38:05 +01:00
+++ 1.2/mysql-test/r/ndb_default_cluster.require 2006-07-06 18:50:32 +02:00
@@ -1,2 +1,2 @@
Variable_name Value
-Ndb_connected_host localhost
+Ndb_config_from_host localhost
--- 1.4/mysql-test/r/ndb_restore.result 2005-05-04 10:13:26 +02:00
+++ 1.5/mysql-test/r/ndb_restore.result 2006-07-06 18:50:32 +02:00
@@ -1,6 +1,6 @@
use test;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+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;
CREATE TABLE `t1` (
`capgoaledatta` smallint(5) unsigned NOT NULL auto_increment,
`goaledatta` char(2) NOT NULL default '',
@@ -116,6 +116,8 @@
PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`)
) ENGINE=myisam DEFAULT CHARSET=latin1;
INSERT INTO `t9` 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 (a int auto_increment key);
+insert into t10 values (1),(2),(3);
create table t1_c engine=ndbcluster as select * from t1;
create table t2_c engine=ndbcluster as select * from t2;
create table t3_c engine=ndbcluster as select * from t3;
@@ -125,10 +127,12 @@
create table t7_c engine=ndbcluster as select * from t7;
create table t8_c engine=ndbcluster as select * from t8;
create table t9_c engine=ndbcluster as select * from t9;
-drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+create table t10_c engine=ndbcluster as select * from t10;
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c, t10_c;
show tables;
Tables_in_test
t1
+t10
t2
t3
t4
@@ -137,14 +141,15 @@
t7
t8
t9
-t8_c
+t3_c
t9_c
t1_c
+t8_c
t7_c
t6_c
t5_c
t4_c
-t3_c
+t10_c
t2_c
select count(*) from t1;
count(*)
@@ -245,6 +250,11 @@
select * from t9_c) a;
count(*)
3
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+select * from t10_c order by a;
+a
+1
+2
+3
+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;
520093696,1
--- 1.9/mysql-test/t/ndb_restore.test 2005-07-28 15:12:35 +02:00
+++ 1.10/mysql-test/t/ndb_restore.test 2006-07-06 18:50:32 +02:00
@@ -4,8 +4,8 @@
--disable_warnings
use test;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+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;
--enable_warnings
CREATE TABLE `t1` (
@@ -132,6 +132,13 @@
) ENGINE=myisam DEFAULT CHARSET=latin1;
INSERT INTO `t9` 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);
+# Bug #20820
+# auto inc table not handled correctly when restored from cluster backup
+# - before fix ndb_restore would not set auto inc value correct,
+# seen by select below
+create table t10 (a int auto_increment key);
+insert into t10 values (1),(2),(3);
+
create table t1_c engine=ndbcluster as select * from t1;
create table t2_c engine=ndbcluster as select * from t2;
create table t3_c engine=ndbcluster as select * from t3;
@@ -141,10 +148,11 @@
create table t7_c engine=ndbcluster as select * from t7;
create table t8_c engine=ndbcluster as select * from t8;
create table t9_c engine=ndbcluster as select * from t9;
+create table t10_c engine=ndbcluster as select * from t10;
--exec $NDB_MGM --no-defaults -e "start backup" >> $NDB_TOOLS_OUTPUT
-drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c, t10_c;
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-1 >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-1 >> $NDB_TOOLS_OUTPUT
@@ -205,9 +213,12 @@
from (select * from t9 union
select * from t9_c) a;
+# Bug #20820 cont'd
+select * from t10_c order by a;
+
--disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+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;
--enable_warnings
#
@@ -216,4 +227,4 @@
--exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults -d sys -D , SYSTAB_0 | grep 520093696
-# End of 4.1 tests
+# End of 5.0 tests (4.1 test intermixed to save test time)
| Thread |
|---|
| • bk commit into 5.0 tree (tomas:1.2210) BUG#20820 | tomas | 6 Jul |