Commit 3e260302 authored by unknown's avatar unknown

Merge perch.ndb.mysql.com:/home/jonas/src/merge-mysql-4.1-ndb-bj-to-mysql-4.1-ndb/mysql-4.1-ndb-bj

into  perch.ndb.mysql.com:/home/jonas/src/mysql-4.1-ndb

parents 973ec24e 42070e19
...@@ -28,6 +28,14 @@ ...@@ -28,6 +28,14 @@
class File_class class File_class
{ {
public: public:
/**
* Returns time for last contents modification of a file.
*
* @param aFileName a filename to check.
* @return the time for last contents modificaton of the file.
*/
static time_t mtime(const char* aFileName);
/** /**
* Returns true if the file exist. * Returns true if the file exist.
* *
......
...@@ -49,7 +49,7 @@ my_bool opt_core; ...@@ -49,7 +49,7 @@ my_bool opt_core;
{ "ndb-connectstring", OPT_NDB_CONNECTSTRING, \ { "ndb-connectstring", OPT_NDB_CONNECTSTRING, \
"Set connect string for connecting to ndb_mgmd. " \ "Set connect string for connecting to ndb_mgmd. " \
"Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". " \ "Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". " \
"Overides specifying entries in NDB_CONNECTSTRING and Ndb.cfg", \ "Overrides specifying entries in NDB_CONNECTSTRING and my.cnf", \
(gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, \ (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, \
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
{ "ndb-shm", OPT_NDB_SHM,\ { "ndb-shm", OPT_NDB_SHM,\
......
...@@ -147,6 +147,7 @@ FileLogHandler::createNewFile() ...@@ -147,6 +147,7 @@ FileLogHandler::createNewFile()
bool rc = true; bool rc = true;
int fileNo = 1; int fileNo = 1;
char newName[PATH_MAX]; char newName[PATH_MAX];
time_t newMtime, preMtime = 0;
do do
{ {
...@@ -159,7 +160,15 @@ FileLogHandler::createNewFile() ...@@ -159,7 +160,15 @@ FileLogHandler::createNewFile()
} }
BaseString::snprintf(newName, sizeof(newName), BaseString::snprintf(newName, sizeof(newName),
"%s.%d", m_pLogFile->getName(), fileNo++); "%s.%d", m_pLogFile->getName(), fileNo++);
newMtime = File_class::mtime(newName);
if (newMtime < preMtime)
{
break;
}
else
{
preMtime = newMtime;
}
} while (File_class::exists(newName)); } while (File_class::exists(newName));
m_pLogFile->close(); m_pLogFile->close();
......
...@@ -24,6 +24,18 @@ ...@@ -24,6 +24,18 @@
// //
// PUBLIC // PUBLIC
// //
time_t
File_class::mtime(const char* aFileName)
{
MY_STAT stmp;
time_t rc = 0;
if (my_stat(aFileName, &stmp, MYF(0)) != NULL) {
rc = stmp.st_mtime;
}
return rc;
}
bool bool
File_class::exists(const char* aFileName) File_class::exists(const char* aFileName)
......
This diff is collapsed.
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
verify delete verify delete
Arguments: Arguments:
-f Location of Ndb.cfg file, default Ndb.cfg -f Location of my.cnf file, default my.cnf
-t Number of threads to start, default 1 -t Number of threads to start, default 1
-o Number of operations per loop, default 500 -l Number of loops to run, default 1, 0=infinite -o Number of operations per loop, default 500 -l Number of loops to run, default 1, 0=infinite
-a Number of attributes, default 25 -a Number of attributes, default 25
...@@ -829,7 +829,7 @@ static int createTables(Ndb* pMyNdb) ...@@ -829,7 +829,7 @@ static int createTables(Ndb* pMyNdb)
static void printUsage() static void printUsage()
{ {
ndbout << "Usage of flexScan:" << endl; ndbout << "Usage of flexScan:" << endl;
ndbout << "-f <path> Location of Ndb.cfg file, default: Ndb.cfg" << endl; ndbout << "-f <path> Location of my.cnf file, default: my.cnf" << endl;
ndbout << "-t <int> Number of threads to start, default 1" << endl; ndbout << "-t <int> Number of threads to start, default 1" << endl;
ndbout << "-o <int> Number of operations per loop, default 500" << endl; ndbout << "-o <int> Number of operations per loop, default 500" << endl;
ndbout << "-l <int> Number of loops to run, default 1, 0=infinite" << endl; ndbout << "-l <int> Number of loops to run, default 1, 0=infinite" << endl;
......
...@@ -64,7 +64,7 @@ static struct my_option my_long_options[] = ...@@ -64,7 +64,7 @@ static struct my_option my_long_options[] =
{ "ndb-connectstring", 256, { "ndb-connectstring", 256,
"Set connect string for connecting to ndb_mgmd. " "Set connect string for connecting to ndb_mgmd. "
"Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". " "Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". "
"Overides specifying entries in NDB_CONNECTSTRING and Ndb.cfg", "Overrides specifying entries in NDB_CONNECTSTRING and my.cnf",
(gptr*) &g_connectstring, (gptr*) &g_connectstring, (gptr*) &g_connectstring, (gptr*) &g_connectstring,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "nodes", 256, "Print nodes", { "nodes", 256, "Print nodes",
......
...@@ -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