Below is the list of changes that have just been committed into a local
5.1 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@stripped, 2007-04-30 12:12:07+02:00, tomas@stripped +5 -0
ndb_restore to set correct value force varpart
+ some tests
mysql-test/r/ndb_restore.result@stripped, 2007-04-30 12:12:04+02:00, tomas@stripped +5 -1
ndb_restore to set correct value force varpart
+ some tests
mysql-test/r/ndb_restore_compat.result@stripped, 2007-04-30 12:12:04+02:00, tomas@stripped +10 -0
ndb_restore to set correct value force varpart
+ some tests
mysql-test/t/ndb_restore.test@stripped, 2007-04-30 12:12:04+02:00, tomas@stripped +11 -1
ndb_restore to set correct value force varpart
+ some tests
mysql-test/t/ndb_restore_compat.test@stripped, 2007-04-30 12:12:04+02:00, tomas@stripped +19 -1
ndb_restore to set correct value force varpart
+ some tests
storage/ndb/tools/restore/consumer_restore.cpp@stripped, 2007-04-30 12:12:04+02:00, tomas@stripped +16 -0
ndb_restore to set correct value force varpart
+ some tests
# 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: whalegate.ndb.mysql.com
# Root: /home/tomas/mysql-5.1-telco-6.1
--- 1.41/storage/ndb/tools/restore/consumer_restore.cpp 2007-03-08 02:22:19 +01:00
+++ 1.42/storage/ndb/tools/restore/consumer_restore.cpp 2007-04-30 12:12:04 +02:00
@@ -807,6 +807,22 @@
copy.setFragmentData((const void *)ng_array, no_parts << 1);
}
+ /**
+ * Force of varpart was introduced in 5.1.18, telco 6.1.7 and 6.2.1
+ * Since default from mysqld is to add force of varpart (disable with
+ * ROW_FORMAT=FIXED) we force varpart onto tables when they are restored
+ * from backups taken with older versions. This will be wrong if
+ * ROW_FORMAT=FIXED was used on original table, however the likelyhood of
+ * this is low, since ROW_FORMAT= was a NOOP in older versions.
+ */
+
+ if (table.getBackupVersion() < MAKE_VERSION(5,1,18))
+ copy.setForceVarPart(true);
+ else if (getMajor(table.getBackupVersion()) == 6 &&
+ (table.getBackupVersion() < MAKE_VERSION(6,1,7) ||
+ table.getBackupVersion() == MAKE_VERSION(6,2,0)))
+ copy.setForceVarPart(true);
+
/*
update min and max rows to reflect the table, this to
ensure that memory is allocated properly in the ndb kernel
--- 1.19/mysql-test/r/ndb_restore.result 2006-07-07 00:17:51 +02:00
+++ 1.20/mysql-test/r/ndb_restore.result 2007-04-30 12:12:04 +02:00
@@ -23,7 +23,7 @@
`CapGoaledatta` smallint(5) unsigned NOT NULL default '0',
`capgotod` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`capgotod`,`CapGoaledatta`)
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED;
INSERT INTO `t3_c` VALUES (5,3),(2,4),(5,4),(1,3);
CREATE TABLE `t4_c` (
`capfa` bigint(20) unsigned NOT NULL auto_increment,
@@ -128,6 +128,8 @@
create table t8 engine=myisam as select * from t8_c;
create table t9 engine=myisam as select * from t9_c;
create table t10 engine=myisam as select * from t10_c;
+ForceVarPart: 0
+ForceVarPart: 1
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
@@ -136,6 +138,8 @@
<the_backup_id>
DROP TABLE test.backup_info;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
+ForceVarPart: 0
+ForceVarPart: 1
select count(*) from t1;
count(*)
5
--- 1.4/mysql-test/r/ndb_restore_compat.result 2007-03-08 02:22:18 +01:00
+++ 1.5/mysql-test/r/ndb_restore_compat.result 2007-04-30 12:12:04 +02:00
@@ -47,11 +47,21 @@
SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
server_id epoch log_name start_pos end_pos
0 151 0 0
+ForceVarPart: 1
+ForceVarPart: 1
+ForceVarPart: 1
+ForceVarPart: 1
+ForceVarPart: 1
TRUNCATE GL;
TRUNCATE ACCOUNT;
TRUNCATE TRANSACTION;
TRUNCATE SYSTEM_VALUES;
TRUNCATE ACCOUNT_TYPE;
+ForceVarPart: 1
+ForceVarPart: 1
+ForceVarPart: 1
+ForceVarPart: 1
+ForceVarPart: 1
SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE;
TIME ACCOUNT_TYPE BALANCE DEPOSIT_COUNT DEPOSIT_SUM WITHDRAWAL_COUNT WITHDRAWAL_SUM PURGED
0 0 10000000 0 0 0 0 1
--- 1.23/mysql-test/t/ndb_restore.test 2006-07-07 00:17:51 +02:00
+++ 1.24/mysql-test/t/ndb_restore.test 2007-04-30 12:12:04 +02:00
@@ -28,11 +28,13 @@
) 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');
+# Added ROW_FORMAT=FIXED to use below to see that setting is preserved
+# by restore
CREATE TABLE `t3_c` (
`CapGoaledatta` smallint(5) unsigned NOT NULL default '0',
`capgotod` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`capgotod`,`CapGoaledatta`)
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED;
INSERT INTO `t3_c` VALUES (5,3),(2,4),(5,4),(1,3);
CREATE TABLE `t4_c` (
@@ -150,11 +152,19 @@
create table t9 engine=myisam as select * from t9_c;
create table t10 engine=myisam as select * from t10_c;
+# check that force varpart is preserved by ndb_restore
+# t3_c has ROW_FORMAT=FIXED i.e. ForceVarPart=0
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t3_c | grep ForceVarPart
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t2_c | grep ForceVarPart
--source include/ndb_backup.inc
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 $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+# check that force varpart is preserved by ndb_restore
+# t3_c has ROW_FORMAT=FIXED i.e. ForceVarPart=0
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t3_c | grep ForceVarPart
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t2_c | grep ForceVarPart
# random output order??
#show tables;
--- 1.3/mysql-test/t/ndb_restore_compat.test 2006-12-01 15:48:24 +01:00
+++ 1.4/mysql-test/t/ndb_restore_compat.test 2007-04-30 12:12:04 +02:00
@@ -13,9 +13,9 @@
DROP DATABASE IF EXISTS BANK;
--enable_warnings
CREATE DATABASE BANK default charset=latin1 default collate=latin1_bin;
-USE BANK;
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -p 1 -m -r $MYSQL_TEST_DIR/std_data/ndb_backup51 >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -e -b 1 -n 2 -p 1 -r $MYSQL_TEST_DIR/std_data/ndb_backup51 >> $NDB_TOOLS_OUTPUT
+USE BANK;
SHOW TABLES;
SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE;
SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID;
@@ -23,6 +23,13 @@
SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID;
SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
+# Check that force varpart is set by ndb_restore
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d BANK GL | grep ForceVarPart
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d BANK ACCOUNT | grep ForceVarPart
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d BANK TRANSACTION | grep ForceVarPart
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d BANK SYSTEM_VALUES | grep ForceVarPart
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d BANK ACCOUNT_TYPE | grep ForceVarPart
+
#
# verify restore of 5.0 backup
# here we must use the already created tables as restoring the old
@@ -33,8 +40,19 @@
TRUNCATE TRANSACTION;
TRUNCATE SYSTEM_VALUES;
TRUNCATE ACCOUNT_TYPE;
+
+# Check that force varpart is not changed by truncate
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d BANK GL | grep ForceVarPart
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d BANK ACCOUNT | grep ForceVarPart
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d BANK TRANSACTION | grep ForceVarPart
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d BANK SYSTEM_VALUES | grep ForceVarPart
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d BANK ACCOUNT_TYPE | grep ForceVarPart
+
+# Restore data
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -p 1 -r $MYSQL_TEST_DIR/std_data/ndb_backup50 >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -e -b 1 -n 2 -p 1 -r $MYSQL_TEST_DIR/std_data/ndb_backup50 >> $NDB_TOOLS_OUTPUT
+
+# Check data
SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE;
SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID;
SELECT COUNT(*) FROM TRANSACTION;
| Thread |
|---|
| • bk commit into 5.1 tree (tomas:1.2515) | tomas | 30 Apr |