Below is the list of changes that have just been committed into a local
5.1 repository of root. When root 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-01-05 16:55:34+08:00, gni@stripped +8 -0
BUG#24363 If the table schema has changed, the resoring will fail.
storage/ndb/include/ndbapi/NdbDictionary.hpp@stripped, 2007-01-05 16:55:31+08:00, gni@stripped +5 -0
add the new method to judge if the schema data of the tables doesn't change.
storage/ndb/src/ndbapi/NdbDictionary.cpp@stripped, 2007-01-05 16:55:31+08:00, gni@stripped +5 -0
add the new method to judge if the schema data of the tables doesn't change.
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp@stripped, 2007-01-05 16:55:31+08:00, gni@stripped +51 -0
implement the new method to judge if the schema data of the tables doesn't change.
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp@stripped, 2007-01-05 16:55:31+08:00, gni@stripped +1 -0
add the new method to judge if the schema data of the tables doesn't change.
storage/ndb/tools/restore/consumer.hpp@stripped, 2007-01-05 16:55:31+08:00, gni@stripped +1 -0
The method is used to judge whether the schema of the table has changed when restoring the data.
storage/ndb/tools/restore/consumer_restore.cpp@stripped, 2007-01-05 16:55:31+08:00, gni@stripped +41 -0
The method is used to judge whether the schema of the table has changed when restoring the data.
storage/ndb/tools/restore/consumer_restore.hpp@stripped, 2007-01-05 16:55:31+08:00, gni@stripped +1 -0
The method is used to judge whether the schema of the table has changed when restoring the data.
storage/ndb/tools/restore/restore_main.cpp@stripped, 2007-01-05 16:55:31+08:00, gni@stripped +12 -0
Before restoring the data, judge whether the schema of the table has changes. If the table schema has changed, restoring will fail.
# 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: gni
# Host: dev3-221.dev.cn.tlan
# Root: /home/ngb/mysql/mysql-5.1/mysql-5.1-bug24363
--- 1.85/storage/ndb/include/ndbapi/NdbDictionary.hpp 2007-01-05 16:55:41 +08:00
+++ 1.86/storage/ndb/include/ndbapi/NdbDictionary.hpp 2007-01-05 16:55:41 +08:00
@@ -693,6 +693,11 @@
bool equal(const Table&) const;
/**
+ * Check if schema data of a table is equal to some other table's
+ */
+ bool schemadata_equal(const Table&) const;
+
+ /**
* Get frm file stored with this table
*/
const void* getFrmData() const;
--- 1.50/storage/ndb/tools/restore/restore_main.cpp 2007-01-05 16:55:41 +08:00
+++ 1.51/storage/ndb/tools/restore/restore_main.cpp 2007-01-05 16:55:41 +08:00
@@ -590,6 +590,18 @@
{
if(_restore_data || _print_data)
{
+ for(i=0; i < metaData.getNoOfTables(); i++){
+ if (checkSysTable(metaData, i))
+ {
+ for(Uint32 j= 0; j < g_consumers.size(); j++)
+ if (!g_consumers[j]->equal(* metaData[i]))
+ {
+ err << "Restore: Failed to restore data, ";
+ err << metaData[i]->getTableName() << " schema doesn't match backup ... Exiting " << endl;
+ exitHandler(NDBT_FAILED);
+ }
+ }
+ }
RestoreDataIterator dataIter(metaData, &free_data_callback);
// Read data file header
--- 1.64/storage/ndb/src/ndbapi/NdbDictionary.cpp 2007-01-05 16:55:41 +08:00
+++ 1.65/storage/ndb/src/ndbapi/NdbDictionary.cpp 2007-01-05 16:55:41 +08:00
@@ -616,6 +616,11 @@
return m_impl.equal(col.m_impl);
}
+bool
+NdbDictionary::Table::schemadata_equal(const NdbDictionary::Table & col) const{
+ return m_impl.schemadata_equal(col.m_impl);
+}
+
int
NdbDictionary::Table::getRowSizeInBytes() const {
int sz = 0;
--- 1.154/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2007-01-05 16:55:41 +08:00
+++ 1.155/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2007-01-05 16:55:41 +08:00
@@ -473,6 +473,57 @@
m_tablespace_version = ~0;
}
+bool NdbTableImpl::schemadata_equal(const NdbTableImpl& obj)const
+{
+ DBUG_ENTER("NdbTableImpl::schemadata_equal");
+ if ((m_internalName.c_str() == NULL) ||
+ (strcmp(m_internalName.c_str(), "") == 0) ||
+ (obj.m_internalName.c_str() == NULL) ||
+ (strcmp(obj.m_internalName.c_str(), "") == 0))
+ {
+ // Shallow equal
+ if(strcmp(getName(), obj.getName()) != 0)
+ {
+ DBUG_PRINT("info",("name %s != %s",getName(),obj.getName()));
+ DBUG_RETURN(false);
+ }
+ }
+ else
+ {
+ // Deep equal
+ if(strcmp(m_internalName.c_str(), obj.m_internalName.c_str()) != 0)
+ {
+ DBUG_PRINT("info",("m_internalName %s != %s",
+ m_internalName.c_str(),obj.m_internalName.c_str()));
+ DBUG_RETURN(false);
+ }
+ }
+
+ if(m_columns.size() != obj.m_columns.size())
+ {
+ DBUG_PRINT("info",("m_columns.size %d != %d",m_columns.size(),
+ obj.m_columns.size()));
+ DBUG_RETURN(false);
+ }
+
+ for(unsigned i = 0; i<obj.m_columns.size(); i++)
+ {
+ if(!m_columns[i]->equal(* obj.m_columns[i]))
+ {
+ DBUG_PRINT("info",("m_columns [%d] != [%d]",i,i));
+ DBUG_RETURN(false);
+ }
+ }
+
+ if(m_type != obj.m_type)
+ {
+ DBUG_PRINT("info",("m_type %d != %d",m_type,obj.m_type));
+ DBUG_RETURN(false);
+ }
+
+ DBUG_RETURN(true);
+}
+
bool
NdbTableImpl::equal(const NdbTableImpl& obj) const
{
--- 1.69/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp 2007-01-05 16:55:41 +08:00
+++ 1.70/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp 2007-01-05 16:55:41 +08:00
@@ -231,6 +231,7 @@
/**
* Equality/assign
*/
+ bool schemadata_equal(const NdbTableImpl&) const;
bool equal(const NdbTableImpl&) const;
void assign(const NdbTableImpl&);
--- 1.12/storage/ndb/tools/restore/consumer.hpp 2007-01-05 16:55:41 +08:00
+++ 1.13/storage/ndb/tools/restore/consumer.hpp 2007-01-05 16:55:41 +08:00
@@ -41,6 +41,7 @@
NODE_GROUP_MAP *m_nodegroup_map;
uint m_nodegroup_map_len;
virtual bool has_temp_error() {return false;}
+ virtual bool equal(const TableS &) {return true;}
};
#endif
--- 1.38/storage/ndb/tools/restore/consumer_restore.cpp 2007-01-05 16:55:41 +08:00
+++ 1.39/storage/ndb/tools/restore/consumer_restore.cpp 2007-01-05 16:55:41 +08:00
@@ -667,6 +667,47 @@
}
bool
+BackupRestore::equal(const TableS &tableS){
+ const char *tablename = tableS.getTableName();
+
+ if(tableS.m_dictTable == NULL){
+ ndbout<<"Table %s has no m_dictTable " << tablename << endl;
+ return false;
+ }
+ /**
+ * Ignore blob tables
+ */
+ if(match_blob(tablename) >= 0)
+ return true;
+
+ const NdbTableImpl & tmptab = NdbTableImpl::getImpl(* tableS.m_dictTable);
+ if ((int) tmptab.m_indexType != (int) NdbDictionary::Index::Undefined){
+ return true;
+ }
+
+ BaseString tmp(tablename);
+ Vector<BaseString> split;
+ if(tmp.split(split, "/") != 3){
+ err << "Invalid table name format " << tablename << endl;
+ return false;
+ }
+
+ m_ndb->setDatabaseName(split[0].c_str());
+ m_ndb->setSchemaName(split[1].c_str());
+
+ NdbDictionary::Dictionary* dict = m_ndb->getDictionary();
+ const NdbDictionary::Table* tab = dict->getTable(split[2].c_str());
+ if(tab == 0){
+ err << "Unable to find table: " << split[2].c_str() << endl;
+ return false;
+ }
+ if(tab->schemadata_equal(*tableS.m_dictTable))
+ return true;
+
+ return false;
+}
+
+bool
BackupRestore::createSystable(const TableS & tables){
const char *tablename = tables.getTableName();
--- 1.15/storage/ndb/tools/restore/consumer_restore.hpp 2007-01-05 16:55:41 +08:00
+++ 1.16/storage/ndb/tools/restore/consumer_restore.hpp 2007-01-05 16:55:41 +08:00
@@ -74,6 +74,7 @@
virtual bool finalize_table(const TableS &);
virtual bool has_temp_error();
virtual bool createSystable(const TableS & table);
+ virtual bool equal(const TableS & table);
virtual bool update_apply_status(const RestoreMetaData &metaData);
void connectToMysql();
bool map_in_frm(char *new_data, const char *data,
| Thread |
|---|
| • bk commit into 5.1 tree (gni:1.2343) BUG#24363 | gni | 5 Jan |