Commit 999b0303 authored by unknown's avatar unknown

fix for bug#19651, if temporary error occured while retoring, report it in the restore result.


ndb/tools/restore/consumer.hpp:
  added a function to judge whether there is temporary error.
ndb/tools/restore/consumer_restore.cpp:
  record when temporary error occured in restore.
ndb/tools/restore/consumer_restore.hpp:
  added a member to record temporary error in restore.
ndb/tools/restore/restore_main.cpp:
  report temporary error in restore.
parent 2504e093
...@@ -31,6 +31,7 @@ public: ...@@ -31,6 +31,7 @@ public:
virtual void logEntry(const LogEntry &){} virtual void logEntry(const LogEntry &){}
virtual void endOfLogEntrys(){} virtual void endOfLogEntrys(){}
virtual bool finalize_table(const TableS &){return true;} virtual bool finalize_table(const TableS &){return true;}
virtual bool has_temp_error() {return false;}
}; };
#endif #endif
...@@ -139,6 +139,11 @@ BackupRestore::finalize_table(const TableS & table){ ...@@ -139,6 +139,11 @@ BackupRestore::finalize_table(const TableS & table){
return ret; return ret;
} }
bool
BackupRestore::has_temp_error(){
return m_temp_error;
}
bool bool
BackupRestore::table(const TableS & table){ BackupRestore::table(const TableS & table){
if (!m_restore && !m_restore_meta) if (!m_restore && !m_restore_meta)
...@@ -437,6 +442,7 @@ bool BackupRestore::errorHandler(restore_callback_t *cb) ...@@ -437,6 +442,7 @@ bool BackupRestore::errorHandler(restore_callback_t *cb)
case NdbError::TemporaryError: case NdbError::TemporaryError:
err << "Temporary error: " << error << endl; err << "Temporary error: " << error << endl;
m_temp_error = true;
NdbSleep_MilliSleep(sleepTime); NdbSleep_MilliSleep(sleepTime);
return true; return true;
// RETRY // RETRY
......
...@@ -41,6 +41,7 @@ public: ...@@ -41,6 +41,7 @@ public:
m_parallelism = parallelism; m_parallelism = parallelism;
m_callback = 0; m_callback = 0;
m_free_callback = 0; m_free_callback = 0;
m_temp_error = false;
m_transactions = 0; m_transactions = 0;
m_cache.m_old_table = 0; m_cache.m_old_table = 0;
} }
...@@ -60,6 +61,7 @@ public: ...@@ -60,6 +61,7 @@ public:
virtual void logEntry(const LogEntry &); virtual void logEntry(const LogEntry &);
virtual void endOfLogEntrys(); virtual void endOfLogEntrys();
virtual bool finalize_table(const TableS &); virtual bool finalize_table(const TableS &);
virtual bool has_temp_error();
void connectToMysql(); void connectToMysql();
Ndb * m_ndb; Ndb * m_ndb;
bool m_restore; bool m_restore;
...@@ -72,6 +74,7 @@ public: ...@@ -72,6 +74,7 @@ public:
restore_callback_t *m_callback; restore_callback_t *m_callback;
restore_callback_t *m_free_callback; restore_callback_t *m_free_callback;
bool m_temp_error;
/** /**
* m_new_table_ids[X] = Y; * m_new_table_ids[X] = Y;
......
...@@ -411,6 +411,17 @@ main(int argc, char** argv) ...@@ -411,6 +411,17 @@ main(int argc, char** argv)
} }
} }
} }
for(Uint32 i= 0; i < g_consumers.size(); i++)
{
if (g_consumers[i]->has_temp_error())
{
clearConsumers();
ndbout_c("\nRestore successful, but encountered temporary error, "
"please look at configuration.");
return NDBT_ProgramExit(NDBT_TEMPORARY);
}
}
clearConsumers(); clearConsumers();
return NDBT_ProgramExit(NDBT_OK); return NDBT_ProgramExit(NDBT_OK);
} // main } // main
......
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