mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge neptunus.(none):/home/msvensson/mysql/mysql-4.1
into neptunus.(none):/home/msvensson/mysql/mysql-5.0 client/mysqltest.c: Auto merged mysql-test/r/func_gconcat.result: Auto merged mysql-test/r/mysqltest.result: Auto merged mysql-test/t/func_gconcat.test: Auto merged mysql-test/t/mysqltest.test: Auto merged ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp: Auto merged ndb/src/kernel/error/ErrorReporter.cpp: Auto merged ndb/src/kernel/main.cpp: Auto merged ndb/src/kernel/vm/Emulator.cpp: Auto merged ndb/src/kernel/vm/Emulator.hpp: Auto merged ndb/src/mgmsrv/ConfigInfo.cpp: Auto merged ndb/src/mgmsrv/MgmtSrvr.cpp: Auto merged ndb/src/mgmsrv/Services.cpp: Auto merged ndb/tools/ndb_config.cpp: Auto merged ndb/tools/restore/consumer_restore.cpp: Auto merged mysql-test/t/openssl_1.test: Manual merge ndb/include/util/ndb_opts.h: Manual merge ndb/tools/Makefile.am: Manual merge ndb/tools/restore/restore_main.cpp: Manual merge
This commit is contained in:
@ -558,3 +558,12 @@ DROP TABLE t1,t2;
|
||||
select * from (select group_concat('c') from DUAL) t;
|
||||
group_concat('c')
|
||||
NULL
|
||||
create table t1 ( a int not null default 0);
|
||||
select * from (select group_concat(a) from t1) t2;
|
||||
group_concat(a)
|
||||
NULL
|
||||
select group_concat('x') UNION ALL select 1;
|
||||
group_concat('x')
|
||||
NULL
|
||||
1
|
||||
drop table t1;
|
||||
|
@ -179,7 +179,6 @@ source database
|
||||
echo message echo message
|
||||
|
||||
mysqltest: At line 1: Empty variable
|
||||
mysqltest: At line 1: command "';' 2> /dev/null" failed
|
||||
mysqltest: At line 1: Missing argument in exec
|
||||
MySQL
|
||||
"MySQL"
|
||||
@ -301,7 +300,6 @@ mysqltest: At line 1: First argument to dec must be a variable (start with $)
|
||||
mysqltest: At line 1: End of line junk detected: "1000"
|
||||
mysqltest: At line 1: Missing arguments to system, nothing to do!
|
||||
mysqltest: At line 1: Missing arguments to system, nothing to do!
|
||||
mysqltest: At line 1: system command 'NonExistsinfComamdn 2> /dev/null' failed
|
||||
test
|
||||
test2
|
||||
test3
|
||||
|
@ -355,4 +355,12 @@ DROP TABLE t1,t2;
|
||||
#
|
||||
select * from (select group_concat('c') from DUAL) t;
|
||||
|
||||
#
|
||||
# Bug #12859 group_concat in subquery cause incorrect not null
|
||||
#
|
||||
create table t1 ( a int not null default 0);
|
||||
select * from (select group_concat(a) from t1) t2;
|
||||
select group_concat('x') UNION ALL select 1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -358,8 +358,11 @@ select 3 from t1 ;
|
||||
# Missing delimiter
|
||||
# The comment will be "sucked into" the sleep command since
|
||||
# delimiter is missing until after "show status"
|
||||
--system echo "sleep 4" > var/log/mysqltest.sql
|
||||
--system echo "# A comment" >> var/log/mysqltest.sql
|
||||
--system echo "show status;" >> var/log/mysqltest.sql
|
||||
--error 1
|
||||
--exec echo -e "sleep 4\n # A comment\nshow status;" | $MYSQL_TEST 2>&1
|
||||
--exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1
|
||||
|
||||
#
|
||||
# Extra delimiter
|
||||
@ -423,8 +426,9 @@ echo ;
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# Illegal use of exec
|
||||
--error 1
|
||||
--exec echo "--exec ';' 2> /dev/null" | $MYSQL_TEST 2>&1
|
||||
# Disabled, some shells prints the failed command regardless of pipes
|
||||
#--error 1
|
||||
#--exec echo "--exec ';' 2> /dev/null" | $MYSQL_TEST 2>&1
|
||||
|
||||
--error 1
|
||||
--exec echo "--exec " | $MYSQL_TEST 2>&1
|
||||
@ -671,8 +675,9 @@ system echo "hej" > /dev/null;
|
||||
--exec echo "system;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "system NonExistsinfComamdn 2> /dev/null;" | $MYSQL_TEST 2>&1
|
||||
# Disabled, some shells prints the failed command regardless of pipes
|
||||
#--error 1
|
||||
#--exec echo "system NonExistsinfComamdn 2> /dev/null;" | $MYSQL_TEST 2>&1
|
||||
|
||||
--disable_abort_on_error
|
||||
system NonExistsinfComamdn;
|
||||
@ -722,12 +727,21 @@ while ($i)
|
||||
--exec echo "end;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "{;" | $MYSQL_TEST 2>&1
|
||||
|
||||
--system echo "while (0)" > var/log/mysqltest.sql
|
||||
--system echo "echo hej;" >> var/log/mysqltest.sql
|
||||
--error 1
|
||||
--exec echo -e "while (0)\necho hej;" | $MYSQL_TEST 2>&1
|
||||
--exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1
|
||||
|
||||
--system echo "while (0)" > var/log/mysqltest.sql
|
||||
--system echo "{echo hej;" >> var/log/mysqltest.sql
|
||||
--error 1
|
||||
--exec echo -e "while (0)\n{echo hej;" | $MYSQL_TEST 2>&1
|
||||
--exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1
|
||||
|
||||
--system echo "while (0){" > var/log/mysqltest.sql
|
||||
--system echo "echo hej;" >> var/log/mysqltest.sql
|
||||
--error 1
|
||||
--exec echo -e "while (0){\n echo hej;" | $MYSQL_TEST 2>&1
|
||||
--exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test error messages returned from comments starting with a command
|
||||
|
@ -20,22 +20,22 @@ connect (con4,localhost,ssl_user4,,);
|
||||
|
||||
connection con1;
|
||||
select * from t1;
|
||||
--error 1142;
|
||||
--error 1142
|
||||
delete from t1;
|
||||
|
||||
connection con2;
|
||||
select * from t1;
|
||||
--error 1142;
|
||||
--error 1142
|
||||
delete from t1;
|
||||
|
||||
connection con3;
|
||||
select * from t1;
|
||||
--error 1142;
|
||||
--error 1142
|
||||
delete from t1;
|
||||
|
||||
connection con4;
|
||||
select * from t1;
|
||||
--error 1142;
|
||||
--error 1142
|
||||
delete from t1;
|
||||
|
||||
connection default;
|
||||
|
@ -30,6 +30,7 @@ my_bool opt_ndb_optimized_node_selection
|
||||
int opt_ndb_nodeid;
|
||||
bool opt_endinfo= 0;
|
||||
my_bool opt_ndb_shm;
|
||||
my_bool opt_core;
|
||||
const char *opt_ndb_connectstring= 0;
|
||||
const char *opt_connect_str= 0;
|
||||
const char *opt_ndb_mgmd= 0;
|
||||
@ -41,6 +42,11 @@ const char *opt_debug= 0;
|
||||
#endif
|
||||
|
||||
#define OPT_NDB_CONNECTSTRING 'c'
|
||||
#if defined VM_TRACE && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) )
|
||||
#define OPT_WANT_CORE_DEFAULT 1
|
||||
#else
|
||||
#define OPT_WANT_CORE_DEFAULT 0
|
||||
#endif
|
||||
|
||||
#define NDB_STD_OPTS_COMMON \
|
||||
{ "usage", '?', "Display this help and exit.", \
|
||||
@ -75,7 +81,10 @@ const char *opt_debug= 0;
|
||||
GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},\
|
||||
{ "connect-string", OPT_NDB_CONNECTSTRING, "same as --ndb-connectstring",\
|
||||
(gptr*) &opt_ndb_connectstring, (gptr*) &opt_ndb_connectstring, \
|
||||
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }
|
||||
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
|
||||
{ "core-file", OPT_WANT_CORE, "Write core on errors.",\
|
||||
(gptr*) &opt_core, (gptr*) &opt_core, 0,\
|
||||
GET_BOOL, NO_ARG, OPT_WANT_CORE_DEFAULT, 0, 0, 0, 0, 0}
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
#define NDB_STD_OPTS(prog_name) \
|
||||
@ -99,6 +108,7 @@ enum ndb_std_options {
|
||||
OPT_NDB_SHM= 256,
|
||||
OPT_NDB_SHM_SIGNUM,
|
||||
OPT_NDB_OPTIMIZED_NODE_SELECTION,
|
||||
OPT_WANT_CORE,
|
||||
OPT_NDB_MGMD,
|
||||
OPT_NDB_NODEID,
|
||||
NDB_STD_OPTIONS_LAST /* should always be last in this enum */
|
||||
|
@ -2489,6 +2489,14 @@ void Ndbcntr::Missra::sendNextSTTOR(Signal* signal){
|
||||
|
||||
const Uint32 start = currentBlockIndex;
|
||||
|
||||
if (currentStartPhase == ZSTART_PHASE_6)
|
||||
{
|
||||
// Ndbd has passed the critical startphases.
|
||||
// Change error handler from "startup" state
|
||||
// to normal state.
|
||||
ErrorReporter::setErrorHandlerShutdownType();
|
||||
}
|
||||
|
||||
for(; currentBlockIndex < ALL_BLOCKS_SZ; currentBlockIndex++){
|
||||
jam();
|
||||
if(ALL_BLOCKS[currentBlockIndex].NextSP == currentStartPhase){
|
||||
|
@ -152,6 +152,14 @@ ErrorReporter::formatMessage(ErrorCategory type,
|
||||
return;
|
||||
}
|
||||
|
||||
NdbShutdownType ErrorReporter::s_errorHandlerShutdownType = NST_ErrorHandler;
|
||||
|
||||
void
|
||||
ErrorReporter::setErrorHandlerShutdownType(NdbShutdownType nst)
|
||||
{
|
||||
s_errorHandlerShutdownType = nst;
|
||||
}
|
||||
|
||||
void
|
||||
ErrorReporter::handleAssert(const char* message, const char* file, int line)
|
||||
{
|
||||
@ -170,7 +178,7 @@ ErrorReporter::handleAssert(const char* message, const char* file, int line)
|
||||
WriteMessage(assert, ERR_ERROR_PRGERR, message, refMessage,
|
||||
theEmulatedJamIndex, theEmulatedJam);
|
||||
|
||||
NdbShutdown(NST_ErrorHandler);
|
||||
NdbShutdown(s_errorHandlerShutdownType);
|
||||
}
|
||||
|
||||
void
|
||||
@ -182,7 +190,7 @@ ErrorReporter::handleThreadAssert(const char* message,
|
||||
BaseString::snprintf(refMessage, 100, "file: %s lineNo: %d - %s",
|
||||
file, line, message);
|
||||
|
||||
NdbShutdown(NST_ErrorHandler);
|
||||
NdbShutdown(s_errorHandlerShutdownType);
|
||||
}//ErrorReporter::handleThreadAssert()
|
||||
|
||||
|
||||
@ -201,6 +209,8 @@ ErrorReporter::handleError(ErrorCategory type, int messageID,
|
||||
if(messageID == ERR_ERROR_INSERT){
|
||||
NdbShutdown(NST_ErrorInsert);
|
||||
} else {
|
||||
if (nst == NST_ErrorHandler)
|
||||
nst = s_errorHandlerShutdownType;
|
||||
NdbShutdown(nst);
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
class ErrorReporter
|
||||
{
|
||||
public:
|
||||
static void setErrorHandlerShutdownType(NdbShutdownType nst = NST_ErrorHandler);
|
||||
static void handleAssert(const char* message,
|
||||
const char* file,
|
||||
int line);
|
||||
@ -57,6 +58,7 @@ public:
|
||||
static const char* formatTimeStampString();
|
||||
|
||||
private:
|
||||
static enum NdbShutdownType s_errorHandlerShutdownType;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -48,8 +48,14 @@ extern NdbMutex * theShutdownMutex;
|
||||
|
||||
void catchsigs(bool ignore); // for process signal handling
|
||||
|
||||
#define MAX_FAILED_STARTUPS 3
|
||||
// Flag set by child through SIGUSR1 to signal a failed startup
|
||||
static bool failed_startup_flag = false;
|
||||
// Counter for consecutive failed startups
|
||||
static Uint32 failed_startups = 0;
|
||||
extern "C" void handler_shutdown(int signum); // for process signal handling
|
||||
extern "C" void handler_error(int signum); // for process signal handling
|
||||
extern "C" void handler_sigusr1(int signum); // child signalling failed restart
|
||||
|
||||
// Shows system information
|
||||
void systemInfo(const Configuration & conf,
|
||||
@ -95,6 +101,8 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
#ifndef NDB_WIN32
|
||||
signal(SIGUSR1, handler_sigusr1);
|
||||
|
||||
for(pid_t child = fork(); child != 0; child = fork()){
|
||||
/**
|
||||
* Parent
|
||||
@ -146,6 +154,20 @@ int main(int argc, char** argv)
|
||||
*/
|
||||
exit(0);
|
||||
}
|
||||
if (!failed_startup_flag)
|
||||
{
|
||||
// Reset the counter for consecutive failed startups
|
||||
failed_startups = 0;
|
||||
}
|
||||
else if (failed_startups >= MAX_FAILED_STARTUPS && !theConfig->stopOnError())
|
||||
{
|
||||
/**
|
||||
* Error shutdown && stopOnError()
|
||||
*/
|
||||
g_eventLogger.alert("Ndbd has failed %u consecutive startups. Not restarting", failed_startups);
|
||||
exit(0);
|
||||
}
|
||||
failed_startup_flag = false;
|
||||
g_eventLogger.info("Ndb has terminated (pid %d) restarting", child);
|
||||
theConfig->fetch_configuration();
|
||||
}
|
||||
@ -179,6 +201,9 @@ int main(int argc, char** argv)
|
||||
/**
|
||||
* Do startup
|
||||
*/
|
||||
|
||||
ErrorReporter::setErrorHandlerShutdownType(NST_ErrorHandlerStartup);
|
||||
|
||||
switch(globalData.theRestartFlag){
|
||||
case initial_state:
|
||||
globalEmulatorData.theThreadConfig->doStart(NodeState::SL_CMVMI);
|
||||
@ -375,3 +400,15 @@ handler_error(int signum){
|
||||
BaseString::snprintf(errorData, 40, "Signal %d received", signum);
|
||||
ERROR_SET_SIGNAL(fatal, 0, errorData, __FILE__);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
void
|
||||
handler_sigusr1(int signum)
|
||||
{
|
||||
if (!failed_startup_flag)
|
||||
{
|
||||
failed_startups++;
|
||||
failed_startup_flag = true;
|
||||
}
|
||||
g_eventLogger.info("Received signal %d. Ndbd failed startup (%u).", signum, failed_startups);
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ extern "C" {
|
||||
extern void (* ndb_new_handler)();
|
||||
}
|
||||
extern EventLogger g_eventLogger;
|
||||
extern my_bool opt_core;
|
||||
|
||||
/**
|
||||
* Declare the global variables
|
||||
@ -154,6 +155,9 @@ NdbShutdown(NdbShutdownType type,
|
||||
case NST_ErrorHandlerSignal:
|
||||
g_eventLogger.info("Error handler signal %s system", shutting);
|
||||
break;
|
||||
case NST_ErrorHandlerStartup:
|
||||
g_eventLogger.info("Error handler startup %s system", shutting);
|
||||
break;
|
||||
case NST_Restart:
|
||||
g_eventLogger.info("Restarting system");
|
||||
break;
|
||||
@ -165,23 +169,25 @@ NdbShutdown(NdbShutdownType type,
|
||||
}
|
||||
|
||||
const char * exitAbort = 0;
|
||||
#if defined VM_TRACE && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) )
|
||||
exitAbort = "aborting";
|
||||
#else
|
||||
exitAbort = "exiting";
|
||||
#endif
|
||||
if (opt_core)
|
||||
exitAbort = "aborting";
|
||||
else
|
||||
exitAbort = "exiting";
|
||||
|
||||
if(type == NST_Watchdog){
|
||||
/**
|
||||
* Very serious, don't attempt to free, just die!!
|
||||
*/
|
||||
g_eventLogger.info("Watchdog shutdown completed - %s", exitAbort);
|
||||
#if defined VM_TRACE && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) )
|
||||
signal(6, SIG_DFL);
|
||||
abort();
|
||||
#else
|
||||
exit(-1);
|
||||
#endif
|
||||
if (opt_core)
|
||||
{
|
||||
signal(6, SIG_DFL);
|
||||
abort();
|
||||
}
|
||||
else
|
||||
{
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NDB_WIN32
|
||||
@ -229,13 +235,19 @@ NdbShutdown(NdbShutdownType type,
|
||||
}
|
||||
|
||||
if(type != NST_Normal && type != NST_Restart){
|
||||
// Signal parent that error occured during startup
|
||||
if (type == NST_ErrorHandlerStartup)
|
||||
kill(getppid(), SIGUSR1);
|
||||
g_eventLogger.info("Error handler shutdown completed - %s", exitAbort);
|
||||
#if ( defined VM_TRACE || defined ERROR_INSERT ) && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) )
|
||||
signal(6, SIG_DFL);
|
||||
abort();
|
||||
#else
|
||||
exit(-1);
|
||||
#endif
|
||||
if (opt_core)
|
||||
{
|
||||
signal(6, SIG_DFL);
|
||||
abort();
|
||||
}
|
||||
else
|
||||
{
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,7 +83,8 @@ enum NdbShutdownType {
|
||||
NST_ErrorHandler,
|
||||
NST_ErrorHandlerSignal,
|
||||
NST_Restart,
|
||||
NST_ErrorInsert
|
||||
NST_ErrorInsert,
|
||||
NST_ErrorHandlerStartup
|
||||
};
|
||||
|
||||
enum NdbRestartType {
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <m_string.h>
|
||||
|
||||
extern my_bool opt_ndb_shm;
|
||||
extern my_bool opt_core;
|
||||
|
||||
#define MAX_LINE_LENGTH 255
|
||||
#define KEY_INTERNAL 0
|
||||
@ -2152,11 +2153,10 @@ static void require(bool v)
|
||||
{
|
||||
if(!v)
|
||||
{
|
||||
#ifndef DBUG_OFF
|
||||
abort();
|
||||
#else
|
||||
exit(-1);
|
||||
#endif
|
||||
if (opt_core)
|
||||
abort();
|
||||
else
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2226,7 +2226,7 @@ ConfigInfo::ConfigInfo()
|
||||
ndbout << "Error: Parameter " << param._fname
|
||||
<< " defined twice in section " << param._section
|
||||
<< "." << endl;
|
||||
exit(-1);
|
||||
require(false);
|
||||
}
|
||||
|
||||
// Add new pinfo to section
|
||||
@ -2276,7 +2276,7 @@ ConfigInfo::ConfigInfo()
|
||||
ndbout << "Check that each entry has a section failed." << endl;
|
||||
ndbout << "Parameter \"" << m_ParamInfo[i]._fname << endl;
|
||||
ndbout << "Edit file " << __FILE__ << "." << endl;
|
||||
exit(-1);
|
||||
require(false);
|
||||
}
|
||||
|
||||
if(m_ParamInfo[i]._type == ConfigInfo::CI_SECTION)
|
||||
@ -2289,7 +2289,7 @@ ConfigInfo::ConfigInfo()
|
||||
<< "\" does not exist in section \""
|
||||
<< m_ParamInfo[i]._section << "\"." << endl;
|
||||
ndbout << "Edit file " << __FILE__ << "." << endl;
|
||||
exit(-1);
|
||||
require(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,18 @@
|
||||
|
||||
extern int global_flag_send_heartbeat_now;
|
||||
extern int g_no_nodeid_checks;
|
||||
extern my_bool opt_core;
|
||||
|
||||
static void require(bool v)
|
||||
{
|
||||
if(!v)
|
||||
{
|
||||
if (opt_core)
|
||||
abort();
|
||||
else
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
void *
|
||||
MgmtSrvr::logLevelThread_C(void* m)
|
||||
@ -435,14 +447,14 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
|
||||
if (tmp_nodeid == 0)
|
||||
{
|
||||
ndbout_c(m_config_retriever->getErrorString());
|
||||
exit(-1);
|
||||
require(false);
|
||||
}
|
||||
// read config from other managent server
|
||||
_config= fetchConfig();
|
||||
if (_config == 0)
|
||||
{
|
||||
ndbout << m_config_retriever->getErrorString() << endl;
|
||||
exit(-1);
|
||||
require(false);
|
||||
}
|
||||
_ownNodeId= tmp_nodeid;
|
||||
}
|
||||
@ -453,7 +465,7 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
|
||||
_config= readConfig();
|
||||
if (_config == 0) {
|
||||
ndbout << "Unable to read config file" << endl;
|
||||
exit(-1);
|
||||
require(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -509,7 +521,7 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
|
||||
if ((m_node_id_mutex = NdbMutex_Create()) == 0)
|
||||
{
|
||||
ndbout << "mutex creation failed line = " << __LINE__ << endl;
|
||||
exit(-1);
|
||||
require(false);
|
||||
}
|
||||
|
||||
if (_ownNodeId == 0) // we did not get node id from other server
|
||||
@ -520,7 +532,7 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
|
||||
0, 0, error_string)){
|
||||
ndbout << "Unable to obtain requested nodeid: "
|
||||
<< error_string.c_str() << endl;
|
||||
exit(-1);
|
||||
require(false);
|
||||
}
|
||||
_ownNodeId = tmp;
|
||||
}
|
||||
@ -531,7 +543,7 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
|
||||
_ownNodeId))
|
||||
{
|
||||
ndbout << m_config_retriever->getErrorString() << endl;
|
||||
exit(-1);
|
||||
require(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2221,18 +2233,18 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
|
||||
iter(* _config->m_configValues, CFG_SECTION_NODE);
|
||||
for(iter.first(); iter.valid(); iter.next()) {
|
||||
unsigned tmp= 0;
|
||||
if(iter.get(CFG_NODE_ID, &tmp)) abort();
|
||||
if(iter.get(CFG_NODE_ID, &tmp)) require(false);
|
||||
if (*nodeId && *nodeId != tmp)
|
||||
continue;
|
||||
found_matching_id= true;
|
||||
if(iter.get(CFG_TYPE_OF_SECTION, &type_c)) abort();
|
||||
if(iter.get(CFG_TYPE_OF_SECTION, &type_c)) require(false);
|
||||
if(type_c != (unsigned)type)
|
||||
continue;
|
||||
found_matching_type= true;
|
||||
if (connected_nodes.get(tmp))
|
||||
continue;
|
||||
found_free_node= true;
|
||||
if(iter.get(CFG_NODE_HOST, &config_hostname)) abort();
|
||||
if(iter.get(CFG_NODE_HOST, &config_hostname)) require(false);
|
||||
if (config_hostname && config_hostname[0] == 0)
|
||||
config_hostname= 0;
|
||||
else if (client_addr) {
|
||||
@ -2581,7 +2593,7 @@ MgmtSrvr::backupCallback(BackupEvent & event)
|
||||
int
|
||||
MgmtSrvr::repCommand(Uint32* repReqId, Uint32 request, bool waitCompleted)
|
||||
{
|
||||
abort();
|
||||
require(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2745,7 +2757,7 @@ MgmtSrvr::setDbParameter(int node, int param, const char * value,
|
||||
ndbout_c("Updating node %d param: %d to %s", node, param, val_char);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
require(false);
|
||||
}
|
||||
assert(res);
|
||||
} while(node == 0 && iter.next() == 0);
|
||||
|
@ -362,8 +362,6 @@ MgmApiSession::getConfig_old(Parser_t::Context &ctx) {
|
||||
}
|
||||
#endif /* MGM_GET_CONFIG_BACKWARDS_COMPAT */
|
||||
|
||||
inline void require(bool b){ if(!b) abort(); }
|
||||
|
||||
void
|
||||
MgmApiSession::getConfig(Parser_t::Context &ctx,
|
||||
const class Properties &args) {
|
||||
|
@ -42,6 +42,7 @@ static const char * g_field_delimiter=",";
|
||||
static const char * g_row_delimiter=" ";
|
||||
|
||||
int g_print_full_config, opt_ndb_shm;
|
||||
my_bool opt_core;
|
||||
|
||||
typedef ndb_mgm_configuration_iterator Iter;
|
||||
|
||||
|
@ -14,9 +14,12 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#include <NDBT_ReturnCodes.h>
|
||||
#include "consumer_restore.hpp"
|
||||
#include <NdbSleep.h>
|
||||
|
||||
extern my_bool opt_core;
|
||||
|
||||
extern FilteredNdbOut err;
|
||||
extern FilteredNdbOut info;
|
||||
extern FilteredNdbOut debug;
|
||||
@ -472,7 +475,11 @@ bool BackupRestore::errorHandler(restore_callback_t *cb)
|
||||
void BackupRestore::exitHandler()
|
||||
{
|
||||
release();
|
||||
exit(-1);
|
||||
NDBT_ProgramExit(NDBT_FAILED);
|
||||
if (opt_core)
|
||||
abort();
|
||||
else
|
||||
exit(NDBT_FAILED);
|
||||
}
|
||||
|
||||
|
||||
@ -506,7 +513,7 @@ BackupRestore::logEntry(const LogEntry & tup)
|
||||
{
|
||||
// Deep shit, TODO: handle the error
|
||||
err << "Cannot start transaction" << endl;
|
||||
exit(-1);
|
||||
exitHandler();
|
||||
} // if
|
||||
|
||||
const NdbDictionary::Table * table = get_table(tup.m_table->m_dictTable);
|
||||
@ -514,7 +521,7 @@ BackupRestore::logEntry(const LogEntry & tup)
|
||||
if (op == NULL)
|
||||
{
|
||||
err << "Cannot get operation: " << trans->getNdbError() << endl;
|
||||
exit(-1);
|
||||
exitHandler();
|
||||
} // if
|
||||
|
||||
int check = 0;
|
||||
@ -532,13 +539,13 @@ BackupRestore::logEntry(const LogEntry & tup)
|
||||
default:
|
||||
err << "Log entry has wrong operation type."
|
||||
<< " Exiting...";
|
||||
exit(-1);
|
||||
exitHandler();
|
||||
}
|
||||
|
||||
if (check != 0)
|
||||
{
|
||||
err << "Error defining op: " << trans->getNdbError() << endl;
|
||||
exit(-1);
|
||||
exitHandler();
|
||||
} // if
|
||||
|
||||
Bitmask<4096> keys;
|
||||
@ -567,7 +574,7 @@ BackupRestore::logEntry(const LogEntry & tup)
|
||||
if (check != 0)
|
||||
{
|
||||
err << "Error defining op: " << trans->getNdbError() << endl;
|
||||
exit(-1);
|
||||
exitHandler();
|
||||
} // if
|
||||
}
|
||||
|
||||
@ -596,7 +603,7 @@ BackupRestore::logEntry(const LogEntry & tup)
|
||||
if (!ok)
|
||||
{
|
||||
err << "execute failed: " << errobj << endl;
|
||||
exit(-1);
|
||||
exitHandler();
|
||||
}
|
||||
}
|
||||
|
||||
@ -643,7 +650,7 @@ BackupRestore::tuple(const TupleS & tup)
|
||||
{
|
||||
// Deep shit, TODO: handle the error
|
||||
ndbout << "Cannot start transaction" << endl;
|
||||
exit(-1);
|
||||
exitHandler();
|
||||
} // if
|
||||
|
||||
const TableS * table = tup.getTable();
|
||||
@ -652,7 +659,7 @@ BackupRestore::tuple(const TupleS & tup)
|
||||
{
|
||||
ndbout << "Cannot get operation: ";
|
||||
ndbout << trans->getNdbError() << endl;
|
||||
exit(-1);
|
||||
exitHandler();
|
||||
} // if
|
||||
|
||||
// TODO: check return value and handle error
|
||||
@ -660,7 +667,7 @@ BackupRestore::tuple(const TupleS & tup)
|
||||
{
|
||||
ndbout << "writeTuple call failed: ";
|
||||
ndbout << trans->getNdbError() << endl;
|
||||
exit(-1);
|
||||
exitHandler();
|
||||
} // if
|
||||
|
||||
for (int i = 0; i < tup.getNoOfAttributes(); i++)
|
||||
@ -694,7 +701,7 @@ BackupRestore::tuple(const TupleS & tup)
|
||||
{
|
||||
ndbout << "execute failed: ";
|
||||
ndbout << trans->getNdbError() << endl;
|
||||
exit(-1);
|
||||
exitHandler();
|
||||
}
|
||||
m_ndb->closeTransaction(trans);
|
||||
if (ret == 0)
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <ndb_limits.h>
|
||||
#include <NdbTCP.h>
|
||||
#include <NdbOut.hpp>
|
||||
#include <NDBT_ReturnCodes.h>
|
||||
|
||||
#include "consumer_restore.hpp"
|
||||
#include "consumer_printer.hpp"
|
||||
@ -118,14 +119,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
if (ga_nodeId == 0)
|
||||
{
|
||||
printf("Error in --nodeid,-n setting, see --help\n");
|
||||
exit(1);
|
||||
exit(NDBT_ProgramExit(NDBT_WRONGARGS));
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
if (ga_backupId == 0)
|
||||
{
|
||||
printf("Error in --backupid,-b setting, see --help\n");
|
||||
exit(1);
|
||||
exit(NDBT_ProgramExit(NDBT_WRONGARGS));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -138,7 +139,7 @@ readArguments(int *pargc, char*** pargv)
|
||||
load_defaults("my",load_default_groups,pargc,pargv);
|
||||
if (handle_options(pargc, pargv, my_long_options, get_one_option))
|
||||
{
|
||||
exit(1);
|
||||
exit(NDBT_ProgramExit(NDBT_WRONGARGS));
|
||||
}
|
||||
|
||||
BackupPrinter* printer = new BackupPrinter();
|
||||
@ -228,6 +229,15 @@ free_data_callback()
|
||||
g_consumers[i]->tuple_free();
|
||||
}
|
||||
|
||||
static void exitHandler(int code)
|
||||
{
|
||||
NDBT_ProgramExit(code);
|
||||
if (opt_core)
|
||||
abort();
|
||||
else
|
||||
exit(code);
|
||||
}
|
||||
|
||||
const char * g_connect_string = 0;
|
||||
|
||||
int
|
||||
@ -237,7 +247,7 @@ main(int argc, char** argv)
|
||||
|
||||
if (!readArguments(&argc, &argv))
|
||||
{
|
||||
return -1;
|
||||
exitHandler(NDBT_FAILED);
|
||||
}
|
||||
|
||||
g_connect_string = opt_connect_str;
|
||||
@ -249,7 +259,7 @@ main(int argc, char** argv)
|
||||
if (!metaData.readHeader())
|
||||
{
|
||||
ndbout << "Failed to read " << metaData.getFilename() << endl << endl;
|
||||
return -1;
|
||||
exitHandler(NDBT_FAILED);
|
||||
}
|
||||
|
||||
const BackupFormat::FileHeader & tmp = metaData.getFileHeader();
|
||||
@ -267,20 +277,20 @@ main(int argc, char** argv)
|
||||
if (res == 0)
|
||||
{
|
||||
ndbout_c("Restore: Failed to load content");
|
||||
return -1;
|
||||
exitHandler(NDBT_FAILED);
|
||||
}
|
||||
|
||||
if (metaData.getNoOfTables() == 0)
|
||||
{
|
||||
ndbout_c("Restore: The backup contains no tables ");
|
||||
return -1;
|
||||
exitHandler(NDBT_FAILED);
|
||||
}
|
||||
|
||||
|
||||
if (!metaData.validateFooter())
|
||||
{
|
||||
ndbout_c("Restore: Failed to validate footer.");
|
||||
return -1;
|
||||
exitHandler(NDBT_FAILED);
|
||||
}
|
||||
|
||||
Uint32 i;
|
||||
@ -289,7 +299,7 @@ main(int argc, char** argv)
|
||||
if (!g_consumers[i]->init())
|
||||
{
|
||||
clearConsumers();
|
||||
return -11;
|
||||
exitHandler(NDBT_FAILED);
|
||||
}
|
||||
|
||||
}
|
||||
@ -304,7 +314,7 @@ main(int argc, char** argv)
|
||||
ndbout_c("Restore: Failed to restore table: %s. "
|
||||
"Exiting...",
|
||||
metaData[i]->getTableName());
|
||||
return -11;
|
||||
exitHandler(NDBT_FAILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -313,7 +323,7 @@ main(int argc, char** argv)
|
||||
if (!g_consumers[i]->endOfTables())
|
||||
{
|
||||
ndbout_c("Restore: Failed while closing tables");
|
||||
return -11;
|
||||
exitHandler(NDBT_FAILED);
|
||||
}
|
||||
|
||||
if (ga_restore || ga_print)
|
||||
@ -326,7 +336,7 @@ main(int argc, char** argv)
|
||||
if (!dataIter.readHeader())
|
||||
{
|
||||
ndbout << "Failed to read header of data file. Exiting..." ;
|
||||
return -11;
|
||||
exitHandler(NDBT_FAILED);
|
||||
}
|
||||
|
||||
|
||||
@ -344,12 +354,12 @@ main(int argc, char** argv)
|
||||
{
|
||||
ndbout_c("Restore: An error occured while restoring data. "
|
||||
"Exiting...");
|
||||
return -1;
|
||||
exitHandler(NDBT_FAILED);
|
||||
}
|
||||
if (!dataIter.validateFragmentFooter()) {
|
||||
ndbout_c("Restore: Error validating fragment footer. "
|
||||
"Exiting...");
|
||||
return -1;
|
||||
exitHandler(NDBT_FAILED);
|
||||
}
|
||||
} // while (dataIter.readFragmentHeader(res))
|
||||
|
||||
@ -357,7 +367,7 @@ main(int argc, char** argv)
|
||||
{
|
||||
err << "Restore: An error occured while restoring data. Exiting... "
|
||||
<< "res=" << res << endl;
|
||||
return -1;
|
||||
exitHandler(NDBT_FAILED);
|
||||
}
|
||||
|
||||
|
||||
@ -373,7 +383,7 @@ main(int argc, char** argv)
|
||||
if (!logIter.readHeader())
|
||||
{
|
||||
err << "Failed to read header of data file. Exiting..." << endl;
|
||||
return -1;
|
||||
exitHandler(NDBT_FAILED);
|
||||
}
|
||||
|
||||
const LogEntry * logEntry = 0;
|
||||
@ -387,7 +397,7 @@ main(int argc, char** argv)
|
||||
{
|
||||
err << "Restore: An restoring the data log. Exiting... res="
|
||||
<< res << endl;
|
||||
return -1;
|
||||
exitHandler(NDBT_FAILED);
|
||||
}
|
||||
logIter.validateFooter(); //not implemented
|
||||
for (i= 0; i < g_consumers.size(); i++)
|
||||
@ -406,14 +416,14 @@ main(int argc, char** argv)
|
||||
ndbout_c("Restore: Failed to finalize restore table: %s. "
|
||||
"Exiting...",
|
||||
metaData[i]->getTableName());
|
||||
return -11;
|
||||
exitHandler(NDBT_FAILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clearConsumers();
|
||||
return 0;
|
||||
return NDBT_ProgramExit(NDBT_OK);
|
||||
} // main
|
||||
|
||||
template class Vector<BackupConsumer*>;
|
||||
|
Reference in New Issue
Block a user