List:Commits« Previous MessageNext Message »
From:tomas Date:December 20 2007 4:36pm
Subject:bk commit into 5.1 tree (tomas:1.2683) BUG#33406
View as plain text  
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-12-20 16:36:18+01:00, tomas@stripped +4 -0
  Bug #33406  	ndb_restore -e restores epoch with wrong (big) value from old backups

  mysql-test/suite/ndb/r/ndb_restore.result@stripped, 2007-12-20 16:36:15+01:00,
tomas@stripped +9 -0
    Bug #33406  	ndb_restore -e restores epoch with wrong (big) value from old backups

  mysql-test/suite/ndb/t/ndb_restore.test@stripped, 2007-12-20 16:36:15+01:00,
tomas@stripped +15 -0
    Bug #33406  	ndb_restore -e restores epoch with wrong (big) value from old backups

  storage/ndb/tools/restore/Restore.hpp@stripped, 2007-12-20 16:36:15+01:00,
tomas@stripped +1 -0
    Bug #33406  	ndb_restore -e restores epoch with wrong (big) value from old backups

  storage/ndb/tools/restore/consumer_restore.cpp@stripped, 2007-12-20 16:36:15+01:00,
tomas@stripped +8 -1
    Bug #33406  	ndb_restore -e restores epoch with wrong (big) value from old backups

diff -Nrup a/mysql-test/suite/ndb/r/ndb_restore.result
b/mysql-test/suite/ndb/r/ndb_restore.result
--- a/mysql-test/suite/ndb/r/ndb_restore.result	2007-08-28 20:29:53 +02:00
+++ b/mysql-test/suite/ndb/r/ndb_restore.result	2007-12-20 16:36:15 +01:00
@@ -488,3 +488,12 @@ DROP TABLE test.backup_info;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
 drop table if exists t2_c;
 520093696,<the_backup_id>
+select epoch from mysql.ndb_apply_status;
+epoch
+331
+select epoch from mysql.ndb_apply_status;
+epoch
+151
+select epoch > (1 << 32) from mysql.ndb_apply_status;
+epoch > (1 << 32)
+1
diff -Nrup a/mysql-test/suite/ndb/t/ndb_restore.test
b/mysql-test/suite/ndb/t/ndb_restore.test
--- a/mysql-test/suite/ndb/t/ndb_restore.test	2007-08-28 15:56:05 +02:00
+++ b/mysql-test/suite/ndb/t/ndb_restore.test	2007-12-20 16:36:15 +01:00
@@ -406,3 +406,18 @@ drop table if exists t2_c;
 --exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults -d sys -D , SYSTAB_0 | grep 520093696,
| sed "s/,$the_backup_id/,<the_backup_id>/"
 
 # End of 5.0 tests (4.1 test intermixed to save test time)
+
+#
+# Test restore of epoch number bug#
+#
+
+# ensure correct restore of epoch numbers in old versions
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --core=0 -e -b 1 -n 1
$MYSQL_TEST_DIR/std_data/ndb_backup50 >> $NDB_TOOLS_OUTPUT
+select epoch from mysql.ndb_apply_status;
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --core=0 -e -b 1 -n 1
$MYSQL_TEST_DIR/std_data/ndb_backup51 >> $NDB_TOOLS_OUTPUT
+select epoch from mysql.ndb_apply_status;
+# ensure correct restore of epoch numbers in current version
+# number hould be "big"
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --core=0 -e -b $the_backup_id -n 1
$NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+# should evaluate to true == 1
+select epoch > (1 << 32) from mysql.ndb_apply_status;
diff -Nrup a/storage/ndb/tools/restore/Restore.hpp b/storage/ndb/tools/restore/Restore.hpp
--- a/storage/ndb/tools/restore/Restore.hpp	2007-11-06 10:28:45 +01:00
+++ b/storage/ndb/tools/restore/Restore.hpp	2007-12-20 16:36:15 +01:00
@@ -344,6 +344,7 @@ public:
   void* getObjPtr(Uint32 i) const { return m_objects[i].m_objPtr; }
   
   Uint32 getStopGCP() const;
+  Uint32 getNdbVersion() const { return m_fileHeader.NdbVersion; };
 }; // RestoreMetaData
 
 
diff -Nrup a/storage/ndb/tools/restore/consumer_restore.cpp
b/storage/ndb/tools/restore/consumer_restore.cpp
--- a/storage/ndb/tools/restore/consumer_restore.cpp	2007-09-06 22:05:43 +02:00
+++ b/storage/ndb/tools/restore/consumer_restore.cpp	2007-12-20 16:36:15 +01:00
@@ -662,7 +662,14 @@ BackupRestore::update_apply_status(const
   }
 
   Uint32 server_id= 0;
-  Uint64 epoch= Uint64(metaData.getStopGCP()) << 32; // Only gci_hi is saved...
+  Uint64 epoch= Uint64(metaData.getStopGCP());
+  Uint32 version= metaData.getNdbVersion();
+  if (version >= NDBD_MICRO_GCP_63)
+    epoch<<= 32; // Only gci_hi is saved...
+  else if (version >= NDBD_MICRO_GCP_62 &&
+           getMinor(version) == 2)
+    epoch<<= 32; // Only gci_hi is saved...
+
   Uint64 zero= 0;
   char empty_string[1];
   empty_string[0]= 0;
Thread
bk commit into 5.1 tree (tomas:1.2683) BUG#33406tomas20 Dec