Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
eb94d025
Commit
eb94d025
authored
Sep 29, 2006
by
jonas@perch.ndb.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge perch.ndb.mysql.com:/home/jonas/src/tmp/mysql-4.1-ndb
into perch.ndb.mysql.com:/home/jonas/src/mysql-4.1-ndb-bj
parents
f819cac8
cb3b878a
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
250 additions
and
128 deletions
+250
-128
ndb/include/util/File.hpp
ndb/include/util/File.hpp
+8
-0
ndb/include/util/ndb_opts.h
ndb/include/util/ndb_opts.h
+1
-1
ndb/src/common/logger/FileLogHandler.cpp
ndb/src/common/logger/FileLogHandler.cpp
+10
-1
ndb/src/common/util/File.cpp
ndb/src/common/util/File.cpp
+12
-0
ndb/src/mgmclient/CommandInterpreter.cpp
ndb/src/mgmclient/CommandInterpreter.cpp
+195
-123
ndb/test/ndbapi/flexScan.cpp
ndb/test/ndbapi/flexScan.cpp
+2
-2
ndb/tools/ndb_config.cpp
ndb/tools/ndb_config.cpp
+1
-1
ndb/tools/restore/consumer.hpp
ndb/tools/restore/consumer.hpp
+1
-0
ndb/tools/restore/consumer_restore.cpp
ndb/tools/restore/consumer_restore.cpp
+6
-0
ndb/tools/restore/consumer_restore.hpp
ndb/tools/restore/consumer_restore.hpp
+3
-0
ndb/tools/restore/restore_main.cpp
ndb/tools/restore/restore_main.cpp
+11
-0
No files found.
ndb/include/util/File.hpp
View file @
eb94d025
...
@@ -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.
*
*
...
...
ndb/include/util/ndb_opts.h
View file @
eb94d025
...
@@ -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>]\". " \
"Over
ides specifying entries in NDB_CONNECTSTRING and Ndb.cfg
", \
"Over
rides 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,\
...
...
ndb/src/common/logger/FileLogHandler.cpp
View file @
eb94d025
...
@@ -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
();
...
...
ndb/src/common/util/File.cpp
View file @
eb94d025
...
@@ -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
)
...
...
ndb/src/mgmclient/CommandInterpreter.cpp
View file @
eb94d025
...
@@ -67,8 +67,9 @@ class CommandInterpreter {
...
@@ -67,8 +67,9 @@ class CommandInterpreter {
* command will be sent to all DB processes.
* command will be sent to all DB processes.
* @param allAfterFirstToken: What the client gave after the
* @param allAfterFirstToken: What the client gave after the
* first token on the command line
* first token on the command line
* @return: 0 if analyseAfterFirstToken succeeds, otherwise -1
*/
*/
void
analyseAfterFirstToken
(
int
processId
,
char
*
allAfterFirstTokenCstr
);
int
analyseAfterFirstToken
(
int
processId
,
char
*
allAfterFirstTokenCstr
);
/**
/**
* Parse the block specification part of the LOG* commands,
* Parse the block specification part of the LOG* commands,
...
@@ -93,38 +94,38 @@ class CommandInterpreter {
...
@@ -93,38 +94,38 @@ class CommandInterpreter {
* this case "22". Each function is responsible to check the parameters
* this case "22". Each function is responsible to check the parameters
* argument.
* argument.
*/
*/
void
executeHelp
(
char
*
parameters
);
int
executeHelp
(
char
*
parameters
);
void
executeShow
(
char
*
parameters
);
int
executeShow
(
char
*
parameters
);
void
executeConnect
(
char
*
parameters
);
int
executeConnect
(
char
*
parameters
);
void
executePurge
(
char
*
parameters
);
int
executePurge
(
char
*
parameters
);
int
executeShutdown
(
char
*
parameters
);
int
executeShutdown
(
char
*
parameters
);
void
executeRun
(
char
*
parameters
);
void
executeRun
(
char
*
parameters
);
void
executeInfo
(
char
*
parameters
);
void
executeInfo
(
char
*
parameters
);
void
executeClusterLog
(
char
*
parameters
);
void
executeClusterLog
(
char
*
parameters
);
public:
public:
void
executeStop
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeStop
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeEnterSingleUser
(
char
*
parameters
);
int
executeEnterSingleUser
(
char
*
parameters
);
void
executeExitSingleUser
(
char
*
parameters
);
int
executeExitSingleUser
(
char
*
parameters
);
void
executeStart
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeStart
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeRestart
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeRestart
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeLogLevel
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeLogLevel
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeError
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeError
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeLog
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeLog
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeLogIn
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeLogIn
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeLogOut
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeLogOut
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeLogOff
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeLogOff
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeTestOn
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeTestOn
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeTestOff
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeTestOff
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeSet
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeSet
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeGetStat
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeGetStat
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeStatus
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeStatus
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeEventReporting
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeEventReporting
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeDumpState
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeDumpState
(
int
processId
,
const
char
*
parameters
,
bool
all
);
int
executeStartBackup
(
char
*
parameters
);
int
executeStartBackup
(
char
*
parameters
);
void
executeAbortBackup
(
char
*
parameters
);
int
executeAbortBackup
(
char
*
parameters
);
void
executeRep
(
char
*
parameters
);
int
executeRep
(
char
*
parameters
);
void
executeCpc
(
char
*
parameters
);
void
executeCpc
(
char
*
parameters
);
...
@@ -136,7 +137,7 @@ class CommandInterpreter {
...
@@ -136,7 +137,7 @@ class CommandInterpreter {
* A execute function definition
* A execute function definition
*/
*/
public:
public:
typedef
void
(
CommandInterpreter
::*
ExecuteFunction
)(
int
processId
,
typedef
int
(
CommandInterpreter
::*
ExecuteFunction
)(
int
processId
,
const
char
*
param
,
const
char
*
param
,
bool
all
);
bool
all
);
...
@@ -148,7 +149,7 @@ class CommandInterpreter {
...
@@ -148,7 +149,7 @@ class CommandInterpreter {
/**
/**
*
*
*/
*/
void
executeForAll
(
const
char
*
cmd
,
int
executeForAll
(
const
char
*
cmd
,
ExecuteFunction
fun
,
ExecuteFunction
fun
,
const
char
*
param
);
const
char
*
param
);
...
@@ -606,6 +607,7 @@ CommandInterpreter::execute_impl(const char *_line)
...
@@ -606,6 +607,7 @@ CommandInterpreter::execute_impl(const char *_line)
char
*
line
;
char
*
line
;
if
(
_line
==
NULL
)
{
if
(
_line
==
NULL
)
{
m_error
=
-
1
;
DBUG_RETURN
(
false
);
DBUG_RETURN
(
false
);
}
}
line
=
my_strdup
(
_line
,
MYF
(
MY_WME
));
line
=
my_strdup
(
_line
,
MYF
(
MY_WME
));
...
@@ -636,16 +638,17 @@ CommandInterpreter::execute_impl(const char *_line)
...
@@ -636,16 +638,17 @@ CommandInterpreter::execute_impl(const char *_line)
if
(
strcasecmp
(
firstToken
,
"HELP"
)
==
0
||
if
(
strcasecmp
(
firstToken
,
"HELP"
)
==
0
||
strcasecmp
(
firstToken
,
"?"
)
==
0
)
{
strcasecmp
(
firstToken
,
"?"
)
==
0
)
{
executeHelp
(
allAfterFirstToken
);
m_error
=
executeHelp
(
allAfterFirstToken
);
DBUG_RETURN
(
true
);
DBUG_RETURN
(
true
);
}
}
else
if
(
strcasecmp
(
firstToken
,
"CONNECT"
)
==
0
)
{
else
if
(
strcasecmp
(
firstToken
,
"CONNECT"
)
==
0
)
{
executeConnect
(
allAfterFirstToken
);
m_error
=
executeConnect
(
allAfterFirstToken
);
DBUG_RETURN
(
true
);
DBUG_RETURN
(
true
);
}
}
else
if
(
strcasecmp
(
firstToken
,
"SLEEP"
)
==
0
)
{
else
if
(
strcasecmp
(
firstToken
,
"SLEEP"
)
==
0
)
{
if
(
allAfterFirstToken
)
if
(
allAfterFirstToken
)
sleep
(
atoi
(
allAfterFirstToken
));
if
(
sleep
(
atoi
(
allAfterFirstToken
))
!=
0
)
m_error
=
-
1
;
DBUG_RETURN
(
true
);
DBUG_RETURN
(
true
);
}
}
else
if
((
strcasecmp
(
firstToken
,
"QUIT"
)
==
0
||
else
if
((
strcasecmp
(
firstToken
,
"QUIT"
)
==
0
||
...
@@ -655,11 +658,13 @@ CommandInterpreter::execute_impl(const char *_line)
...
@@ -655,11 +658,13 @@ CommandInterpreter::execute_impl(const char *_line)
DBUG_RETURN
(
false
);
DBUG_RETURN
(
false
);
}
}
if
(
!
connect
())
if
(
!
connect
()){
m_error
=
-
1
;
DBUG_RETURN
(
true
);
DBUG_RETURN
(
true
);
}
if
(
strcasecmp
(
firstToken
,
"SHOW"
)
==
0
)
{
if
(
strcasecmp
(
firstToken
,
"SHOW"
)
==
0
)
{
executeShow
(
allAfterFirstToken
);
m_error
=
executeShow
(
allAfterFirstToken
);
DBUG_RETURN
(
true
);
DBUG_RETURN
(
true
);
}
}
else
if
(
strcasecmp
(
firstToken
,
"SHUTDOWN"
)
==
0
)
{
else
if
(
strcasecmp
(
firstToken
,
"SHUTDOWN"
)
==
0
)
{
...
@@ -679,17 +684,17 @@ CommandInterpreter::execute_impl(const char *_line)
...
@@ -679,17 +684,17 @@ CommandInterpreter::execute_impl(const char *_line)
else
if
(
strcasecmp
(
firstToken
,
"ABORT"
)
==
0
&&
else
if
(
strcasecmp
(
firstToken
,
"ABORT"
)
==
0
&&
allAfterFirstToken
!=
NULL
&&
allAfterFirstToken
!=
NULL
&&
strncasecmp
(
allAfterFirstToken
,
"BACKUP"
,
sizeof
(
"BACKUP"
)
-
1
)
==
0
){
strncasecmp
(
allAfterFirstToken
,
"BACKUP"
,
sizeof
(
"BACKUP"
)
-
1
)
==
0
){
executeAbortBackup
(
allAfterFirstToken
);
m_error
=
executeAbortBackup
(
allAfterFirstToken
);
DBUG_RETURN
(
true
);
DBUG_RETURN
(
true
);
}
}
else
if
(
strcasecmp
(
firstToken
,
"PURGE"
)
==
0
)
{
else
if
(
strcasecmp
(
firstToken
,
"PURGE"
)
==
0
)
{
executePurge
(
allAfterFirstToken
);
m_error
=
executePurge
(
allAfterFirstToken
);
DBUG_RETURN
(
true
);
DBUG_RETURN
(
true
);
}
}
#ifdef HAVE_GLOBAL_REPLICATION
#ifdef HAVE_GLOBAL_REPLICATION
else
if
(
strcasecmp
(
firstToken
,
"REPLICATION"
)
==
0
||
else
if
(
strcasecmp
(
firstToken
,
"REPLICATION"
)
==
0
||
strcasecmp
(
firstToken
,
"REP"
)
==
0
)
{
strcasecmp
(
firstToken
,
"REP"
)
==
0
)
{
executeRep
(
allAfterFirstToken
);
m_error
=
executeRep
(
allAfterFirstToken
);
DBUG_RETURN
(
true
);
DBUG_RETURN
(
true
);
}
}
#endif // HAVE_GLOBAL_REPLICATION
#endif // HAVE_GLOBAL_REPLICATION
...
@@ -697,18 +702,18 @@ CommandInterpreter::execute_impl(const char *_line)
...
@@ -697,18 +702,18 @@ CommandInterpreter::execute_impl(const char *_line)
allAfterFirstToken
!=
NULL
&&
allAfterFirstToken
!=
NULL
&&
strncasecmp
(
allAfterFirstToken
,
"SINGLE USER MODE "
,
strncasecmp
(
allAfterFirstToken
,
"SINGLE USER MODE "
,
sizeof
(
"SINGLE USER MODE"
)
-
1
)
==
0
){
sizeof
(
"SINGLE USER MODE"
)
-
1
)
==
0
){
executeEnterSingleUser
(
allAfterFirstToken
);
m_error
=
executeEnterSingleUser
(
allAfterFirstToken
);
DBUG_RETURN
(
true
);
DBUG_RETURN
(
true
);
}
}
else
if
(
strcasecmp
(
firstToken
,
"EXIT"
)
==
0
&&
else
if
(
strcasecmp
(
firstToken
,
"EXIT"
)
==
0
&&
allAfterFirstToken
!=
NULL
&&
allAfterFirstToken
!=
NULL
&&
strncasecmp
(
allAfterFirstToken
,
"SINGLE USER MODE "
,
strncasecmp
(
allAfterFirstToken
,
"SINGLE USER MODE "
,
sizeof
(
"SINGLE USER MODE"
)
-
1
)
==
0
){
sizeof
(
"SINGLE USER MODE"
)
-
1
)
==
0
){
executeExitSingleUser
(
allAfterFirstToken
);
m_error
=
executeExitSingleUser
(
allAfterFirstToken
);
DBUG_RETURN
(
true
);
DBUG_RETURN
(
true
);
}
}
else
if
(
strcasecmp
(
firstToken
,
"ALL"
)
==
0
)
{
else
if
(
strcasecmp
(
firstToken
,
"ALL"
)
==
0
)
{
analyseAfterFirstToken
(
-
1
,
allAfterFirstToken
);
m_error
=
analyseAfterFirstToken
(
-
1
,
allAfterFirstToken
);
}
else
{
}
else
{
/**
/**
* First token should be a digit, node ID
* First token should be a digit, node ID
...
@@ -717,15 +722,17 @@ CommandInterpreter::execute_impl(const char *_line)
...
@@ -717,15 +722,17 @@ CommandInterpreter::execute_impl(const char *_line)
if
(
!
convert
(
firstToken
,
nodeId
))
{
if
(
!
convert
(
firstToken
,
nodeId
))
{
invalid_command
(
_line
);
invalid_command
(
_line
);
m_error
=
-
1
;
DBUG_RETURN
(
true
);
DBUG_RETURN
(
true
);
}
}
if
(
nodeId
<=
0
)
{
if
(
nodeId
<=
0
)
{
ndbout
<<
"Invalid node ID: "
<<
firstToken
<<
"."
<<
endl
;
ndbout
<<
"Invalid node ID: "
<<
firstToken
<<
"."
<<
endl
;
m_error
=
-
1
;
DBUG_RETURN
(
true
);
DBUG_RETURN
(
true
);
}
}
analyseAfterFirstToken
(
nodeId
,
allAfterFirstToken
);
m_error
=
analyseAfterFirstToken
(
nodeId
,
allAfterFirstToken
);
}
}
DBUG_RETURN
(
true
);
DBUG_RETURN
(
true
);
...
@@ -759,14 +766,15 @@ static const CommandInterpreter::CommandFunctionPair commands[] = {
...
@@ -759,14 +766,15 @@ static const CommandInterpreter::CommandFunctionPair commands[] = {
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
void
int
CommandInterpreter
::
analyseAfterFirstToken
(
int
processId
,
CommandInterpreter
::
analyseAfterFirstToken
(
int
processId
,
char
*
allAfterFirstToken
)
{
char
*
allAfterFirstToken
)
{
int
retval
=
0
;
if
(
emptyString
(
allAfterFirstToken
))
{
if
(
emptyString
(
allAfterFirstToken
))
{
ndbout
<<
"Expected a command after "
ndbout
<<
"Expected a command after "
<<
((
processId
==
-
1
)
?
"ALL."
:
"node ID."
)
<<
endl
;
<<
((
processId
==
-
1
)
?
"ALL."
:
"node ID."
)
<<
endl
;
return
;
return
-
1
;
}
}
char
*
secondToken
=
strtok
(
allAfterFirstToken
,
" "
);
char
*
secondToken
=
strtok
(
allAfterFirstToken
,
" "
);
...
@@ -785,15 +793,16 @@ CommandInterpreter::analyseAfterFirstToken(int processId,
...
@@ -785,15 +793,16 @@ CommandInterpreter::analyseAfterFirstToken(int processId,
if
(
fun
==
0
){
if
(
fun
==
0
){
invalid_command
(
secondToken
);
invalid_command
(
secondToken
);
return
;
return
-
1
;
}
}
if
(
processId
==
-
1
){
if
(
processId
==
-
1
){
executeForAll
(
command
,
fun
,
allAfterSecondToken
);
retval
=
executeForAll
(
command
,
fun
,
allAfterSecondToken
);
}
else
{
}
else
{
(
this
->*
fun
)(
processId
,
allAfterSecondToken
,
false
);
retval
=
(
this
->*
fun
)(
processId
,
allAfterSecondToken
,
false
);
}
}
ndbout
<<
endl
;
ndbout
<<
endl
;
return
retval
;
}
}
/**
/**
...
@@ -834,18 +843,20 @@ get_next_nodeid(struct ndb_mgm_cluster_state *cl,
...
@@ -834,18 +843,20 @@ get_next_nodeid(struct ndb_mgm_cluster_state *cl,
return
0
;
return
0
;
}
}
void
int
CommandInterpreter
::
executeForAll
(
const
char
*
cmd
,
ExecuteFunction
fun
,
CommandInterpreter
::
executeForAll
(
const
char
*
cmd
,
ExecuteFunction
fun
,
const
char
*
allAfterSecondToken
)
const
char
*
allAfterSecondToken
)
{
{
int
nodeId
=
0
;
int
nodeId
=
0
;
int
retval
=
0
;
if
(
strcasecmp
(
cmd
,
"STOP"
)
==
0
)
{
if
(
strcasecmp
(
cmd
,
"STOP"
)
==
0
)
{
ndbout_c
(
"Executing STOP on all nodes."
);
ndbout_c
(
"Executing STOP on all nodes."
);
(
this
->*
fun
)(
nodeId
,
allAfterSecondToken
,
true
);
retval
=
(
this
->*
fun
)(
nodeId
,
allAfterSecondToken
,
true
);
}
else
if
(
strcasecmp
(
cmd
,
"RESTART"
)
==
0
)
{
}
else
if
(
strcasecmp
(
cmd
,
"RESTART"
)
==
0
)
{
ndbout_c
(
"Executing RESTART on all nodes."
);
ndbout_c
(
"Executing RESTART on all nodes."
);
ndbout_c
(
"Starting shutdown. This may take a while. Please wait..."
);
ndbout_c
(
"Starting shutdown. This may take a while. Please wait..."
);
(
this
->*
fun
)(
nodeId
,
allAfterSecondToken
,
true
);
retval
=
(
this
->*
fun
)(
nodeId
,
allAfterSecondToken
,
true
);
ndbout_c
(
"Trying to start all nodes of system."
);
ndbout_c
(
"Trying to start all nodes of system."
);
ndbout_c
(
"Use ALL STATUS to see the system start-up phases."
);
ndbout_c
(
"Use ALL STATUS to see the system start-up phases."
);
}
else
{
}
else
{
...
@@ -853,12 +864,13 @@ CommandInterpreter::executeForAll(const char * cmd, ExecuteFunction fun,
...
@@ -853,12 +864,13 @@ CommandInterpreter::executeForAll(const char * cmd, ExecuteFunction fun,
if
(
cl
==
0
){
if
(
cl
==
0
){
ndbout_c
(
"Unable get status from management server"
);
ndbout_c
(
"Unable get status from management server"
);
printError
();
printError
();
return
;
return
-
1
;
}
}
NdbAutoPtr
<
char
>
ap1
((
char
*
)
cl
);
NdbAutoPtr
<
char
>
ap1
((
char
*
)
cl
);
while
(
get_next_nodeid
(
cl
,
&
nodeId
,
NDB_MGM_NODE_TYPE_NDB
))
while
(
get_next_nodeid
(
cl
,
&
nodeId
,
NDB_MGM_NODE_TYPE_NDB
))
(
this
->*
fun
)(
nodeId
,
allAfterSecondToken
,
true
);
retval
=
(
this
->*
fun
)(
nodeId
,
allAfterSecondToken
,
true
);
}
}
return
retval
;
}
}
//*****************************************************************************
//*****************************************************************************
...
@@ -928,7 +940,7 @@ CommandInterpreter::parseBlockSpecification(const char* allAfterLog,
...
@@ -928,7 +940,7 @@ CommandInterpreter::parseBlockSpecification(const char* allAfterLog,
/*****************************************************************************
/*****************************************************************************
* HELP
* HELP
*****************************************************************************/
*****************************************************************************/
void
int
CommandInterpreter
::
executeHelp
(
char
*
parameters
)
CommandInterpreter
::
executeHelp
(
char
*
parameters
)
{
{
if
(
emptyString
(
parameters
))
{
if
(
emptyString
(
parameters
))
{
...
@@ -966,7 +978,9 @@ CommandInterpreter::executeHelp(char* parameters)
...
@@ -966,7 +978,9 @@ CommandInterpreter::executeHelp(char* parameters)
#endif
#endif
}
else
{
}
else
{
invalid_command
(
parameters
);
invalid_command
(
parameters
);
return
-
1
;
}
}
return
0
;
}
}
...
@@ -1110,7 +1124,7 @@ print_nodes(ndb_mgm_cluster_state *state, ndb_mgm_configuration_iterator *it,
...
@@ -1110,7 +1124,7 @@ print_nodes(ndb_mgm_cluster_state *state, ndb_mgm_configuration_iterator *it,
ndbout
<<
endl
;
ndbout
<<
endl
;
}
}
void
int
CommandInterpreter
::
executePurge
(
char
*
parameters
)
CommandInterpreter
::
executePurge
(
char
*
parameters
)
{
{
int
command_ok
=
0
;
int
command_ok
=
0
;
...
@@ -1129,7 +1143,7 @@ CommandInterpreter::executePurge(char* parameters)
...
@@ -1129,7 +1143,7 @@ CommandInterpreter::executePurge(char* parameters)
if
(
!
command_ok
)
{
if
(
!
command_ok
)
{
ndbout_c
(
"Unexpected command, expected: PURGE STALE SESSIONS"
);
ndbout_c
(
"Unexpected command, expected: PURGE STALE SESSIONS"
);
return
;
return
-
1
;
}
}
int
i
;
int
i
;
...
@@ -1137,7 +1151,7 @@ CommandInterpreter::executePurge(char* parameters)
...
@@ -1137,7 +1151,7 @@ CommandInterpreter::executePurge(char* parameters)
if
(
ndb_mgm_purge_stale_sessions
(
m_mgmsrv
,
&
str
))
{
if
(
ndb_mgm_purge_stale_sessions
(
m_mgmsrv
,
&
str
))
{
ndbout_c
(
"Command failed"
);
ndbout_c
(
"Command failed"
);
return
;
return
-
1
;
}
}
if
(
str
)
{
if
(
str
)
{
ndbout_c
(
"Purged sessions with node id's: %s"
,
str
);
ndbout_c
(
"Purged sessions with node id's: %s"
,
str
);
...
@@ -1147,9 +1161,10 @@ CommandInterpreter::executePurge(char* parameters)
...
@@ -1147,9 +1161,10 @@ CommandInterpreter::executePurge(char* parameters)
{
{
ndbout_c
(
"No sessions purged"
);
ndbout_c
(
"No sessions purged"
);
}
}
return
0
;
}
}
void
int
CommandInterpreter
::
executeShow
(
char
*
parameters
)
CommandInterpreter
::
executeShow
(
char
*
parameters
)
{
{
int
i
;
int
i
;
...
@@ -1158,7 +1173,7 @@ CommandInterpreter::executeShow(char* parameters)
...
@@ -1158,7 +1173,7 @@ CommandInterpreter::executeShow(char* parameters)
if
(
state
==
NULL
)
{
if
(
state
==
NULL
)
{
ndbout_c
(
"Could not get status"
);
ndbout_c
(
"Could not get status"
);
printError
();
printError
();
return
;
return
-
1
;
}
}
NdbAutoPtr
<
char
>
ap1
((
char
*
)
state
);
NdbAutoPtr
<
char
>
ap1
((
char
*
)
state
);
...
@@ -1166,7 +1181,7 @@ CommandInterpreter::executeShow(char* parameters)
...
@@ -1166,7 +1181,7 @@ CommandInterpreter::executeShow(char* parameters)
if
(
conf
==
0
){
if
(
conf
==
0
){
ndbout_c
(
"Could not get configuration"
);
ndbout_c
(
"Could not get configuration"
);
printError
();
printError
();
return
;
return
-
1
;
}
}
ndb_mgm_configuration_iterator
*
it
;
ndb_mgm_configuration_iterator
*
it
;
...
@@ -1174,7 +1189,7 @@ CommandInterpreter::executeShow(char* parameters)
...
@@ -1174,7 +1189,7 @@ CommandInterpreter::executeShow(char* parameters)
if
(
it
==
0
){
if
(
it
==
0
){
ndbout_c
(
"Unable to create config iterator"
);
ndbout_c
(
"Unable to create config iterator"
);
return
;
return
-
1
;
}
}
NdbAutoPtr
<
ndb_mgm_configuration_iterator
>
ptr
(
it
);
NdbAutoPtr
<
ndb_mgm_configuration_iterator
>
ptr
(
it
);
...
@@ -1208,7 +1223,7 @@ CommandInterpreter::executeShow(char* parameters)
...
@@ -1208,7 +1223,7 @@ CommandInterpreter::executeShow(char* parameters)
break
;
break
;
case
NDB_MGM_NODE_TYPE_UNKNOWN
:
case
NDB_MGM_NODE_TYPE_UNKNOWN
:
ndbout
<<
"Error: Unknown Node Type"
<<
endl
;
ndbout
<<
"Error: Unknown Node Type"
<<
endl
;
return
;
return
-
1
;
case
NDB_MGM_NODE_TYPE_REP
:
case
NDB_MGM_NODE_TYPE_REP
:
abort
();
abort
();
}
}
...
@@ -1220,7 +1235,7 @@ CommandInterpreter::executeShow(char* parameters)
...
@@ -1220,7 +1235,7 @@ CommandInterpreter::executeShow(char* parameters)
print_nodes
(
state
,
it
,
"ndb_mgmd"
,
mgm_nodes
,
NDB_MGM_NODE_TYPE_MGM
,
0
);
print_nodes
(
state
,
it
,
"ndb_mgmd"
,
mgm_nodes
,
NDB_MGM_NODE_TYPE_MGM
,
0
);
print_nodes
(
state
,
it
,
"mysqld"
,
api_nodes
,
NDB_MGM_NODE_TYPE_API
,
0
);
print_nodes
(
state
,
it
,
"mysqld"
,
api_nodes
,
NDB_MGM_NODE_TYPE_API
,
0
);
// ndbout << helpTextShow;
// ndbout << helpTextShow;
return
;
return
0
;
}
else
if
(
strcasecmp
(
parameters
,
"PROPERTIES"
)
==
0
||
}
else
if
(
strcasecmp
(
parameters
,
"PROPERTIES"
)
==
0
||
strcasecmp
(
parameters
,
"PROP"
)
==
0
)
{
strcasecmp
(
parameters
,
"PROP"
)
==
0
)
{
ndbout
<<
"SHOW PROPERTIES is not yet implemented."
<<
endl
;
ndbout
<<
"SHOW PROPERTIES is not yet implemented."
<<
endl
;
...
@@ -1237,22 +1252,28 @@ CommandInterpreter::executeShow(char* parameters)
...
@@ -1237,22 +1252,28 @@ CommandInterpreter::executeShow(char* parameters)
// << endl; /* XXX */
// << endl; /* XXX */
}
else
{
}
else
{
ndbout
<<
"Invalid argument."
<<
endl
;
ndbout
<<
"Invalid argument."
<<
endl
;
return
-
1
;
}
}
return
0
;
}
}
void
int
CommandInterpreter
::
executeConnect
(
char
*
parameters
)
CommandInterpreter
::
executeConnect
(
char
*
parameters
)
{
{
int
retval
;
disconnect
();
disconnect
();
if
(
!
emptyString
(
parameters
))
{
if
(
!
emptyString
(
parameters
))
{
if
(
ndb_mgm_set_connectstring
(
m_mgmsrv
,
if
(
retval
=
ndb_mgm_set_connectstring
(
m_mgmsrv
,
BaseString
(
parameters
).
trim
().
c_str
()))
BaseString
(
parameters
).
trim
().
c_str
()))
{
{
printError
();
printError
();
return
;
return
retval
;
}
}
}
}
connect
();
if
(
connect
()
==
false
){
return
-
1
;
}
return
0
;
}
}
//*****************************************************************************
//*****************************************************************************
...
@@ -1265,6 +1286,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
...
@@ -1265,6 +1286,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
if
(
emptyString
(
parameters
))
if
(
emptyString
(
parameters
))
{
{
ndbout
<<
"Missing argument."
<<
endl
;
ndbout
<<
"Missing argument."
<<
endl
;
m_error
=
-
1
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -1280,6 +1302,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
...
@@ -1280,6 +1302,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
if
(
enabled
==
NULL
)
{
if
(
enabled
==
NULL
)
{
ndbout
<<
"Couldn't get status"
<<
endl
;
ndbout
<<
"Couldn't get status"
<<
endl
;
printError
();
printError
();
m_error
=
-
1
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -1291,6 +1314,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
...
@@ -1291,6 +1314,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
if
(
enabled
[
0
]
==
0
)
if
(
enabled
[
0
]
==
0
)
{
{
ndbout
<<
"Cluster logging is disabled."
<<
endl
;
ndbout
<<
"Cluster logging is disabled."
<<
endl
;
m_error
=
0
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
#if 0
#if 0
...
@@ -1309,6 +1333,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
...
@@ -1309,6 +1333,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
ndbout
<<
BaseString
(
str
).
ndb_toupper
()
<<
" "
;
ndbout
<<
BaseString
(
str
).
ndb_toupper
()
<<
" "
;
}
}
ndbout
<<
endl
;
ndbout
<<
endl
;
m_error
=
0
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -1327,6 +1352,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
...
@@ -1327,6 +1352,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
enable
=
1
;
enable
=
1
;
}
else
{
}
else
{
ndbout
<<
"Invalid argument."
<<
endl
;
ndbout
<<
"Invalid argument."
<<
endl
;
m_error
=
-
1
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -1339,9 +1365,11 @@ CommandInterpreter::executeClusterLog(char* parameters)
...
@@ -1339,9 +1365,11 @@ CommandInterpreter::executeClusterLog(char* parameters)
{
{
ndbout
<<
"Couldn't set filter"
<<
endl
;
ndbout
<<
"Couldn't set filter"
<<
endl
;
printError
();
printError
();
m_error
=
-
1
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
ndbout
<<
"Cluster logging is "
<<
(
res_enable
?
"enabled."
:
"disabled"
)
<<
endl
;
ndbout
<<
"Cluster logging is "
<<
(
res_enable
?
"enabled."
:
"disabled"
)
<<
endl
;
m_error
=
0
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -1368,6 +1396,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
...
@@ -1368,6 +1396,7 @@ CommandInterpreter::executeClusterLog(char* parameters)
}
}
if
(
severity
==
NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL
)
{
if
(
severity
==
NDB_MGM_ILLEGAL_CLUSTERLOG_LEVEL
)
{
ndbout
<<
"Invalid severity level: "
<<
item
<<
endl
;
ndbout
<<
"Invalid severity level: "
<<
item
<<
endl
;
m_error
=
-
1
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -1376,23 +1405,26 @@ CommandInterpreter::executeClusterLog(char* parameters)
...
@@ -1376,23 +1405,26 @@ CommandInterpreter::executeClusterLog(char* parameters)
{
{
ndbout
<<
"Couldn't set filter"
<<
endl
;
ndbout
<<
"Couldn't set filter"
<<
endl
;
printError
();
printError
();
m_error
=
-
1
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
ndbout
<<
BaseString
(
item
).
ndb_toupper
().
c_str
()
<<
" "
<<
(
res_enable
?
"enabled"
:
"disabled"
)
<<
endl
;
ndbout
<<
BaseString
(
item
).
ndb_toupper
().
c_str
()
<<
" "
<<
(
res_enable
?
"enabled"
:
"disabled"
)
<<
endl
;
item
=
strtok_r
(
NULL
,
" "
,
&
tmpPtr
);
item
=
strtok_r
(
NULL
,
" "
,
&
tmpPtr
);
}
while
(
item
!=
NULL
);
}
while
(
item
!=
NULL
);
m_error
=
0
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
void
int
CommandInterpreter
::
executeStop
(
int
processId
,
const
char
*
,
bool
all
)
CommandInterpreter
::
executeStop
(
int
processId
,
const
char
*
,
bool
all
)
{
{
int
result
=
0
;
int
result
=
0
;
int
retval
=
0
;
if
(
all
)
{
if
(
all
)
{
result
=
ndb_mgm_stop
(
m_mgmsrv
,
0
,
0
);
result
=
ndb_mgm_stop
(
m_mgmsrv
,
0
,
0
);
}
else
{
}
else
{
...
@@ -1401,6 +1433,7 @@ CommandInterpreter::executeStop(int processId, const char *, bool all)
...
@@ -1401,6 +1433,7 @@ CommandInterpreter::executeStop(int processId, const char *, bool all)
if
(
result
<
0
)
{
if
(
result
<
0
)
{
ndbout
<<
"Shutdown failed."
<<
endl
;
ndbout
<<
"Shutdown failed."
<<
endl
;
printError
();
printError
();
retval
=
-
1
;
}
else
}
else
{
{
if
(
all
)
if
(
all
)
...
@@ -1408,9 +1441,10 @@ CommandInterpreter::executeStop(int processId, const char *, bool all)
...
@@ -1408,9 +1441,10 @@ CommandInterpreter::executeStop(int processId, const char *, bool all)
else
else
ndbout
<<
"Node "
<<
processId
<<
" has shutdown."
<<
endl
;
ndbout
<<
"Node "
<<
processId
<<
" has shutdown."
<<
endl
;
}
}
return
retval
;
}
}
void
int
CommandInterpreter
::
executeEnterSingleUser
(
char
*
parameters
)
CommandInterpreter
::
executeEnterSingleUser
(
char
*
parameters
)
{
{
strtok
(
parameters
,
" "
);
strtok
(
parameters
,
" "
);
...
@@ -1422,37 +1456,42 @@ CommandInterpreter::executeEnterSingleUser(char* parameters)
...
@@ -1422,37 +1456,42 @@ CommandInterpreter::executeEnterSingleUser(char* parameters)
if
(
id
==
0
||
sscanf
(
id
,
"%d"
,
&
nodeId
)
!=
1
){
if
(
id
==
0
||
sscanf
(
id
,
"%d"
,
&
nodeId
)
!=
1
){
ndbout_c
(
"Invalid arguments: expected <NodeId>"
);
ndbout_c
(
"Invalid arguments: expected <NodeId>"
);
ndbout_c
(
"Use SHOW to see what API nodes are configured"
);
ndbout_c
(
"Use SHOW to see what API nodes are configured"
);
return
;
return
-
1
;
}
}
int
result
=
ndb_mgm_enter_single_user
(
m_mgmsrv
,
nodeId
,
&
reply
);
int
result
=
ndb_mgm_enter_single_user
(
m_mgmsrv
,
nodeId
,
&
reply
);
if
(
result
!=
0
)
{
if
(
result
!=
0
)
{
ndbout_c
(
"Entering single user mode for node %d failed"
,
nodeId
);
ndbout_c
(
"Entering single user mode for node %d failed"
,
nodeId
);
printError
();
printError
();
return
-
1
;
}
else
{
}
else
{
ndbout_c
(
"Single user mode entered"
);
ndbout_c
(
"Single user mode entered"
);
ndbout_c
(
"Access is granted for API node %d only."
,
nodeId
);
ndbout_c
(
"Access is granted for API node %d only."
,
nodeId
);
}
}
return
0
;
}
}
void
int
CommandInterpreter
::
executeExitSingleUser
(
char
*
parameters
)
CommandInterpreter
::
executeExitSingleUser
(
char
*
parameters
)
{
{
int
result
=
ndb_mgm_exit_single_user
(
m_mgmsrv
,
0
);
int
result
=
ndb_mgm_exit_single_user
(
m_mgmsrv
,
0
);
if
(
result
!=
0
)
{
if
(
result
!=
0
)
{
ndbout_c
(
"Exiting single user mode failed."
);
ndbout_c
(
"Exiting single user mode failed."
);
printError
();
printError
();
return
-
1
;
}
else
{
}
else
{
ndbout_c
(
"Exiting single user mode in progress."
);
ndbout_c
(
"Exiting single user mode in progress."
);
ndbout_c
(
"Use ALL STATUS or SHOW to see when single user mode has been exited."
);
ndbout_c
(
"Use ALL STATUS or SHOW to see when single user mode has been exited."
);
return
0
;
}
}
}
}
void
int
CommandInterpreter
::
executeStart
(
int
processId
,
const
char
*
parameters
,
CommandInterpreter
::
executeStart
(
int
processId
,
const
char
*
parameters
,
bool
all
)
bool
all
)
{
{
int
result
;
int
result
;
int
retval
=
0
;
if
(
all
)
{
if
(
all
)
{
result
=
ndb_mgm_start
(
m_mgmsrv
,
0
,
0
);
result
=
ndb_mgm_start
(
m_mgmsrv
,
0
,
0
);
}
else
{
}
else
{
...
@@ -1462,6 +1501,7 @@ CommandInterpreter::executeStart(int processId, const char* parameters,
...
@@ -1462,6 +1501,7 @@ CommandInterpreter::executeStart(int processId, const char* parameters,
if
(
result
<=
0
)
{
if
(
result
<=
0
)
{
ndbout
<<
"Start failed."
<<
endl
;
ndbout
<<
"Start failed."
<<
endl
;
printError
();
printError
();
retval
=
-
1
;
}
else
}
else
{
{
if
(
all
)
if
(
all
)
...
@@ -1469,9 +1509,10 @@ CommandInterpreter::executeStart(int processId, const char* parameters,
...
@@ -1469,9 +1509,10 @@ CommandInterpreter::executeStart(int processId, const char* parameters,
else
else
ndbout_c
(
"Database node %d is being started."
,
processId
);
ndbout_c
(
"Database node %d is being started."
,
processId
);
}
}
return
retval
;
}
}
void
int
CommandInterpreter
::
executeRestart
(
int
processId
,
const
char
*
parameters
,
CommandInterpreter
::
executeRestart
(
int
processId
,
const
char
*
parameters
,
bool
all
)
bool
all
)
{
{
...
@@ -1479,6 +1520,7 @@ CommandInterpreter::executeRestart(int processId, const char* parameters,
...
@@ -1479,6 +1520,7 @@ CommandInterpreter::executeRestart(int processId, const char* parameters,
int
nostart
=
0
;
int
nostart
=
0
;
int
initialstart
=
0
;
int
initialstart
=
0
;
int
abort
=
0
;
int
abort
=
0
;
int
retval
=
0
;
if
(
parameters
!=
0
&&
strlen
(
parameters
)
!=
0
){
if
(
parameters
!=
0
&&
strlen
(
parameters
)
!=
0
){
char
*
tmpString
=
my_strdup
(
parameters
,
MYF
(
MY_WME
));
char
*
tmpString
=
my_strdup
(
parameters
,
MYF
(
MY_WME
));
...
@@ -1507,6 +1549,7 @@ CommandInterpreter::executeRestart(int processId, const char* parameters,
...
@@ -1507,6 +1549,7 @@ CommandInterpreter::executeRestart(int processId, const char* parameters,
if
(
result
<=
0
)
{
if
(
result
<=
0
)
{
ndbout
.
println
(
"Restart failed."
,
result
);
ndbout
.
println
(
"Restart failed."
,
result
);
printError
();
printError
();
retval
=
-
1
;
}
else
}
else
{
{
if
(
all
)
if
(
all
)
...
@@ -1514,15 +1557,16 @@ CommandInterpreter::executeRestart(int processId, const char* parameters,
...
@@ -1514,15 +1557,16 @@ CommandInterpreter::executeRestart(int processId, const char* parameters,
else
else
ndbout_c
(
"Node %d is being restarted."
,
processId
);
ndbout_c
(
"Node %d is being restarted."
,
processId
);
}
}
return
retval
;
}
}
void
int
CommandInterpreter
::
executeDumpState
(
int
processId
,
const
char
*
parameters
,
CommandInterpreter
::
executeDumpState
(
int
processId
,
const
char
*
parameters
,
bool
all
)
bool
all
)
{
{
if
(
emptyString
(
parameters
)){
if
(
emptyString
(
parameters
)){
ndbout
<<
"Expected argument"
<<
endl
;
ndbout
<<
"Expected argument"
<<
endl
;
return
;
return
-
1
;
}
}
Uint32
no
=
0
;
Uint32
no
=
0
;
...
@@ -1539,7 +1583,7 @@ CommandInterpreter::executeDumpState(int processId, const char* parameters,
...
@@ -1539,7 +1583,7 @@ CommandInterpreter::executeDumpState(int processId, const char* parameters,
ndbout
<<
"Illegal value in argument to signal."
<<
endl
ndbout
<<
"Illegal value in argument to signal."
<<
endl
<<
"(Value must be between 0 and 0xffffffff.)"
<<
"(Value must be between 0 and 0xffffffff.)"
<<
endl
;
<<
endl
;
return
;
return
-
1
;
}
}
no
++
;
no
++
;
item
=
strtok_r
(
NULL
,
" "
,
&
tmpPtr
);
item
=
strtok_r
(
NULL
,
" "
,
&
tmpPtr
);
...
@@ -1551,16 +1595,16 @@ CommandInterpreter::executeDumpState(int processId, const char* parameters,
...
@@ -1551,16 +1595,16 @@ CommandInterpreter::executeDumpState(int processId, const char* parameters,
}
}
struct
ndb_mgm_reply
reply
;
struct
ndb_mgm_reply
reply
;
ndb_mgm_dump_state
(
m_mgmsrv
,
processId
,
pars
,
no
,
&
reply
);
return
ndb_mgm_dump_state
(
m_mgmsrv
,
processId
,
pars
,
no
,
&
reply
);
}
}
void
int
CommandInterpreter
::
executeStatus
(
int
processId
,
CommandInterpreter
::
executeStatus
(
int
processId
,
const
char
*
parameters
,
bool
all
)
const
char
*
parameters
,
bool
all
)
{
{
if
(
!
emptyString
(
parameters
))
{
if
(
!
emptyString
(
parameters
))
{
ndbout_c
(
"No parameters expected to this command."
);
ndbout_c
(
"No parameters expected to this command."
);
return
;
return
-
1
;
}
}
ndb_mgm_node_status
status
;
ndb_mgm_node_status
status
;
...
@@ -1572,7 +1616,7 @@ CommandInterpreter::executeStatus(int processId,
...
@@ -1572,7 +1616,7 @@ CommandInterpreter::executeStatus(int processId,
if
(
cl
==
NULL
)
{
if
(
cl
==
NULL
)
{
ndbout_c
(
"Cannot get status of node %d."
,
processId
);
ndbout_c
(
"Cannot get status of node %d."
,
processId
);
printError
();
printError
();
return
;
return
-
1
;
}
}
NdbAutoPtr
<
char
>
ap1
((
char
*
)
cl
);
NdbAutoPtr
<
char
>
ap1
((
char
*
)
cl
);
...
@@ -1581,7 +1625,7 @@ CommandInterpreter::executeStatus(int processId,
...
@@ -1581,7 +1625,7 @@ CommandInterpreter::executeStatus(int processId,
i
++
;
i
++
;
if
(
cl
->
node_states
[
i
].
node_id
!=
processId
)
{
if
(
cl
->
node_states
[
i
].
node_id
!=
processId
)
{
ndbout
<<
processId
<<
": Node not found"
<<
endl
;
ndbout
<<
processId
<<
": Node not found"
<<
endl
;
return
;
return
-
1
;
}
}
status
=
cl
->
node_states
[
i
].
node_status
;
status
=
cl
->
node_states
[
i
].
node_status
;
startPhase
=
cl
->
node_states
[
i
].
start_phase
;
startPhase
=
cl
->
node_states
[
i
].
start_phase
;
...
@@ -1605,27 +1649,29 @@ CommandInterpreter::executeStatus(int processId,
...
@@ -1605,27 +1649,29 @@ CommandInterpreter::executeStatus(int processId,
getBuild
(
version
));
getBuild
(
version
));
else
else
ndbout
<<
endl
;
ndbout
<<
endl
;
return
0
;
}
}
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
void
int
CommandInterpreter
::
executeLogLevel
(
int
processId
,
const
char
*
parameters
,
CommandInterpreter
::
executeLogLevel
(
int
processId
,
const
char
*
parameters
,
bool
all
)
bool
all
)
{
{
(
void
)
all
;
(
void
)
all
;
if
(
emptyString
(
parameters
))
{
if
(
emptyString
(
parameters
))
{
ndbout
<<
"Expected argument"
<<
endl
;
ndbout
<<
"Expected argument"
<<
endl
;
return
;
return
-
1
;
}
}
BaseString
tmp
(
parameters
);
BaseString
tmp
(
parameters
);
Vector
<
BaseString
>
spec
;
Vector
<
BaseString
>
spec
;
tmp
.
split
(
spec
,
"="
);
tmp
.
split
(
spec
,
"="
);
if
(
spec
.
size
()
!=
2
){
if
(
spec
.
size
()
!=
2
){
ndbout
<<
"Invalid loglevel specification: "
<<
parameters
<<
endl
;
ndbout
<<
"Invalid loglevel specification: "
<<
parameters
<<
endl
;
return
;
return
-
1
;
}
}
spec
[
0
].
trim
().
ndb_toupper
();
spec
[
0
].
trim
().
ndb_toupper
();
...
@@ -1635,14 +1681,14 @@ CommandInterpreter::executeLogLevel(int processId, const char* parameters,
...
@@ -1635,14 +1681,14 @@ CommandInterpreter::executeLogLevel(int processId, const char* parameters,
if
(
category
<
NDB_MGM_MIN_EVENT_CATEGORY
||
if
(
category
<
NDB_MGM_MIN_EVENT_CATEGORY
||
category
>
NDB_MGM_MAX_EVENT_CATEGORY
){
category
>
NDB_MGM_MAX_EVENT_CATEGORY
){
ndbout
<<
"Unknown category:
\"
"
<<
spec
[
0
].
c_str
()
<<
"
\"
"
<<
endl
;
ndbout
<<
"Unknown category:
\"
"
<<
spec
[
0
].
c_str
()
<<
"
\"
"
<<
endl
;
return
;
return
-
1
;
}
}
}
}
int
level
=
atoi
(
spec
[
1
].
c_str
());
int
level
=
atoi
(
spec
[
1
].
c_str
());
if
(
level
<
0
||
level
>
15
){
if
(
level
<
0
||
level
>
15
){
ndbout
<<
"Invalid level: "
<<
spec
[
1
].
c_str
()
<<
endl
;
ndbout
<<
"Invalid level: "
<<
spec
[
1
].
c_str
()
<<
endl
;
return
;
return
-
1
;
}
}
ndbout
<<
"Executing LOGLEVEL on node "
<<
processId
<<
flush
;
ndbout
<<
"Executing LOGLEVEL on node "
<<
processId
<<
flush
;
...
@@ -1658,20 +1704,22 @@ CommandInterpreter::executeLogLevel(int processId, const char* parameters,
...
@@ -1658,20 +1704,22 @@ CommandInterpreter::executeLogLevel(int processId, const char* parameters,
if
(
result
<
0
)
{
if
(
result
<
0
)
{
ndbout_c
(
" failed."
);
ndbout_c
(
" failed."
);
printError
();
printError
();
return
-
1
;
}
else
{
}
else
{
ndbout_c
(
" OK!"
);
ndbout_c
(
" OK!"
);
}
}
return
0
;
}
}
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
void
CommandInterpreter
::
executeError
(
int
processId
,
int
CommandInterpreter
::
executeError
(
int
processId
,
const
char
*
parameters
,
bool
/* all */
)
const
char
*
parameters
,
bool
/* all */
)
{
{
int
retval
=
0
;
if
(
emptyString
(
parameters
))
{
if
(
emptyString
(
parameters
))
{
ndbout
<<
"Missing error number."
<<
endl
;
ndbout
<<
"Missing error number."
<<
endl
;
return
;
return
-
1
;
}
}
// Copy parameters since strtok will modify it
// Copy parameters since strtok will modify it
...
@@ -1682,29 +1730,30 @@ void CommandInterpreter::executeError(int processId,
...
@@ -1682,29 +1730,30 @@ void CommandInterpreter::executeError(int processId,
int
errorNo
;
int
errorNo
;
if
(
!
convert
(
firstParameter
,
errorNo
))
{
if
(
!
convert
(
firstParameter
,
errorNo
))
{
ndbout
<<
"Expected an integer."
<<
endl
;
ndbout
<<
"Expected an integer."
<<
endl
;
return
;
return
-
1
;
}
}
char
*
allAfterFirstParameter
=
strtok
(
NULL
,
"
\0
"
);
char
*
allAfterFirstParameter
=
strtok
(
NULL
,
"
\0
"
);
if
(
!
emptyString
(
allAfterFirstParameter
))
{
if
(
!
emptyString
(
allAfterFirstParameter
))
{
ndbout
<<
"Nothing expected after error number."
<<
endl
;
ndbout
<<
"Nothing expected after error number."
<<
endl
;
return
;
return
-
1
;
}
}
ndb_mgm_insert_error
(
m_mgmsrv
,
processId
,
errorNo
,
NULL
);
retval
=
ndb_mgm_insert_error
(
m_mgmsrv
,
processId
,
errorNo
,
NULL
);
return
retval
;
}
}
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
void
int
CommandInterpreter
::
executeLog
(
int
processId
,
CommandInterpreter
::
executeLog
(
int
processId
,
const
char
*
parameters
,
bool
all
)
const
char
*
parameters
,
bool
all
)
{
{
struct
ndb_mgm_reply
reply
;
struct
ndb_mgm_reply
reply
;
Vector
<
const
char
*>
blocks
;
Vector
<
const
char
*>
blocks
;
if
(
!
parseBlockSpecification
(
parameters
,
blocks
))
{
if
(
!
parseBlockSpecification
(
parameters
,
blocks
))
{
return
;
return
-
1
;
}
}
int
len
=
1
;
int
len
=
1
;
Uint32
i
;
Uint32
i
;
...
@@ -1728,82 +1777,91 @@ CommandInterpreter::executeLog(int processId,
...
@@ -1728,82 +1777,91 @@ CommandInterpreter::executeLog(int processId,
if
(
result
!=
0
)
{
if
(
result
!=
0
)
{
ndbout_c
(
"Execute LOG on node %d failed."
,
processId
);
ndbout_c
(
"Execute LOG on node %d failed."
,
processId
);
printError
();
printError
();
return
-
1
;
}
}
return
0
;
}
}
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
void
int
CommandInterpreter
::
executeLogIn
(
int
/* processId */
,
CommandInterpreter
::
executeLogIn
(
int
/* processId */
,
const
char
*
parameters
,
bool
/* all */
)
const
char
*
parameters
,
bool
/* all */
)
{
{
ndbout
<<
"Command LOGIN not implemented."
<<
endl
;
ndbout
<<
"Command LOGIN not implemented."
<<
endl
;
return
0
;
}
}
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
void
int
CommandInterpreter
::
executeLogOut
(
int
/*processId*/
,
CommandInterpreter
::
executeLogOut
(
int
/*processId*/
,
const
char
*
parameters
,
bool
/*all*/
)
const
char
*
parameters
,
bool
/*all*/
)
{
{
ndbout
<<
"Command LOGOUT not implemented."
<<
endl
;
ndbout
<<
"Command LOGOUT not implemented."
<<
endl
;
return
0
;
}
}
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
void
int
CommandInterpreter
::
executeLogOff
(
int
/*processId*/
,
CommandInterpreter
::
executeLogOff
(
int
/*processId*/
,
const
char
*
parameters
,
bool
/*all*/
)
const
char
*
parameters
,
bool
/*all*/
)
{
{
ndbout
<<
"Command LOGOFF not implemented."
<<
endl
;
ndbout
<<
"Command LOGOFF not implemented."
<<
endl
;
return
0
;
}
}
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
void
int
CommandInterpreter
::
executeTestOn
(
int
processId
,
CommandInterpreter
::
executeTestOn
(
int
processId
,
const
char
*
parameters
,
bool
/*all*/
)
const
char
*
parameters
,
bool
/*all*/
)
{
{
if
(
!
emptyString
(
parameters
))
{
if
(
!
emptyString
(
parameters
))
{
ndbout
<<
"No parameters expected to this command."
<<
endl
;
ndbout
<<
"No parameters expected to this command."
<<
endl
;
return
;
return
-
1
;
}
}
struct
ndb_mgm_reply
reply
;
struct
ndb_mgm_reply
reply
;
int
result
=
ndb_mgm_start_signallog
(
m_mgmsrv
,
processId
,
&
reply
);
int
result
=
ndb_mgm_start_signallog
(
m_mgmsrv
,
processId
,
&
reply
);
if
(
result
!=
0
)
{
if
(
result
!=
0
)
{
ndbout_c
(
"Execute TESTON failed."
);
ndbout_c
(
"Execute TESTON failed."
);
printError
();
printError
();
return
-
1
;
}
}
return
0
;
}
}
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
void
int
CommandInterpreter
::
executeTestOff
(
int
processId
,
CommandInterpreter
::
executeTestOff
(
int
processId
,
const
char
*
parameters
,
bool
/*all*/
)
const
char
*
parameters
,
bool
/*all*/
)
{
{
if
(
!
emptyString
(
parameters
))
{
if
(
!
emptyString
(
parameters
))
{
ndbout
<<
"No parameters expected to this command."
<<
endl
;
ndbout
<<
"No parameters expected to this command."
<<
endl
;
return
;
return
-
1
;
}
}
struct
ndb_mgm_reply
reply
;
struct
ndb_mgm_reply
reply
;
int
result
=
ndb_mgm_stop_signallog
(
m_mgmsrv
,
processId
,
&
reply
);
int
result
=
ndb_mgm_stop_signallog
(
m_mgmsrv
,
processId
,
&
reply
);
if
(
result
!=
0
)
{
if
(
result
!=
0
)
{
ndbout_c
(
"Execute TESTOFF failed."
);
ndbout_c
(
"Execute TESTOFF failed."
);
printError
();
printError
();
return
-
1
;
}
}
return
0
;
}
}
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
void
int
CommandInterpreter
::
executeSet
(
int
/*processId*/
,
CommandInterpreter
::
executeSet
(
int
/*processId*/
,
const
char
*
parameters
,
bool
/*all*/
)
const
char
*
parameters
,
bool
/*all*/
)
{
{
if
(
emptyString
(
parameters
))
{
if
(
emptyString
(
parameters
))
{
ndbout
<<
"Missing parameter name."
<<
endl
;
ndbout
<<
"Missing parameter name."
<<
endl
;
return
;
return
-
1
;
}
}
#if 0
#if 0
// Copy parameters since strtok will modify it
// Copy parameters since strtok will modify it
...
@@ -1867,17 +1925,18 @@ CommandInterpreter::executeSet(int /*processId*/,
...
@@ -1867,17 +1925,18 @@ CommandInterpreter::executeSet(int /*processId*/,
abort();
abort();
}
}
}
}
#endif
#endif
return
0
;
}
}
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
void
CommandInterpreter
::
executeGetStat
(
int
/*processId*/
,
int
CommandInterpreter
::
executeGetStat
(
int
/*processId*/
,
const
char
*
parameters
,
bool
/*all*/
)
const
char
*
parameters
,
bool
/*all*/
)
{
{
if
(
!
emptyString
(
parameters
))
{
if
(
!
emptyString
(
parameters
))
{
ndbout
<<
"No parameters expected to this command."
<<
endl
;
ndbout
<<
"No parameters expected to this command."
<<
endl
;
return
;
return
-
1
;
}
}
#if 0
#if 0
...
@@ -1893,19 +1952,21 @@ void CommandInterpreter::executeGetStat(int /*processId*/,
...
@@ -1893,19 +1952,21 @@ void CommandInterpreter::executeGetStat(int /*processId*/,
ndbout << "Number of GETSTAT commands: "
ndbout << "Number of GETSTAT commands: "
<< statistics._test1 << endl;
<< statistics._test1 << endl;
*/
*/
return
0
;
}
}
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
void
int
CommandInterpreter
::
executeEventReporting
(
int
processId
,
CommandInterpreter
::
executeEventReporting
(
int
processId
,
const
char
*
parameters
,
const
char
*
parameters
,
bool
all
)
bool
all
)
{
{
int
retval
=
0
;
if
(
emptyString
(
parameters
))
{
if
(
emptyString
(
parameters
))
{
ndbout
<<
"Expected argument"
<<
endl
;
ndbout
<<
"Expected argument"
<<
endl
;
return
;
return
-
1
;
}
}
BaseString
tmp
(
parameters
);
BaseString
tmp
(
parameters
);
Vector
<
BaseString
>
specs
;
Vector
<
BaseString
>
specs
;
...
@@ -1952,10 +2013,12 @@ CommandInterpreter::executeEventReporting(int processId,
...
@@ -1952,10 +2013,12 @@ CommandInterpreter::executeEventReporting(int processId,
if
(
result
!=
0
)
{
if
(
result
!=
0
)
{
ndbout_c
(
" failed."
);
ndbout_c
(
" failed."
);
printError
();
printError
();
retval
=
-
1
;
}
else
{
}
else
{
ndbout_c
(
" OK!"
);
ndbout_c
(
" OK!"
);
}
}
}
}
return
retval
;
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -2056,7 +2119,7 @@ CommandInterpreter::executeStartBackup(char* parameters)
...
@@ -2056,7 +2119,7 @@ CommandInterpreter::executeStartBackup(char* parameters)
return
0
;
return
0
;
}
}
void
int
CommandInterpreter
::
executeAbortBackup
(
char
*
parameters
)
CommandInterpreter
::
executeAbortBackup
(
char
*
parameters
)
{
{
int
bid
=
-
1
;
int
bid
=
-
1
;
...
@@ -2075,14 +2138,15 @@ CommandInterpreter::executeAbortBackup(char* parameters)
...
@@ -2075,14 +2138,15 @@ CommandInterpreter::executeAbortBackup(char* parameters)
if
(
result
!=
0
)
{
if
(
result
!=
0
)
{
ndbout
<<
"Abort of backup "
<<
bid
<<
" failed"
<<
endl
;
ndbout
<<
"Abort of backup "
<<
bid
<<
" failed"
<<
endl
;
printError
();
printError
();
return
-
1
;
}
else
{
}
else
{
ndbout
<<
"Abort of backup "
<<
bid
<<
" ordered"
<<
endl
;
ndbout
<<
"Abort of backup "
<<
bid
<<
" ordered"
<<
endl
;
}
}
}
}
return
;
return
0
;
executeAbortBackupError1:
executeAbortBackupError1:
ndbout
<<
"Invalid arguments: expected <BackupId>"
<<
endl
;
ndbout
<<
"Invalid arguments: expected <BackupId>"
<<
endl
;
return
;
return
-
1
;
}
}
#ifdef HAVE_GLOBAL_REPLICATION
#ifdef HAVE_GLOBAL_REPLICATION
...
@@ -2113,12 +2177,12 @@ CommandInterpreter::executeAbortBackup(char* parameters)
...
@@ -2113,12 +2177,12 @@ CommandInterpreter::executeAbortBackup(char* parameters)
*****************************************************************************/
*****************************************************************************/
void
int
CommandInterpreter
::
executeRep
(
char
*
parameters
)
CommandInterpreter
::
executeRep
(
char
*
parameters
)
{
{
if
(
emptyString
(
parameters
))
{
if
(
emptyString
(
parameters
))
{
ndbout
<<
helpTextRep
;
ndbout
<<
helpTextRep
;
return
;
return
0
;
}
}
char
*
line
=
my_strdup
(
parameters
,
MYF
(
MY_WME
));
char
*
line
=
my_strdup
(
parameters
,
MYF
(
MY_WME
));
...
@@ -2138,7 +2202,7 @@ CommandInterpreter::executeRep(char* parameters)
...
@@ -2138,7 +2202,7 @@ CommandInterpreter::executeRep(char* parameters)
if
(
host
==
NULL
)
if
(
host
==
NULL
)
{
{
ndbout_c
(
"host:port must be specified."
);
ndbout_c
(
"host:port must be specified."
);
return
;
return
-
1
;
}
}
if
(
rep_connected
)
{
if
(
rep_connected
)
{
...
@@ -2150,14 +2214,17 @@ CommandInterpreter::executeRep(char* parameters)
...
@@ -2150,14 +2214,17 @@ CommandInterpreter::executeRep(char* parameters)
if
(
m_repserver
==
NULL
)
if
(
m_repserver
==
NULL
)
m_repserver
=
ndb_rep_create_handle
();
m_repserver
=
ndb_rep_create_handle
();
if
(
ndb_rep_connect
(
m_repserver
,
host
)
<
0
)
if
(
ndb_rep_connect
(
m_repserver
,
host
)
<
0
){
ndbout_c
(
"Failed to connect to %s"
,
host
);
ndbout_c
(
"Failed to connect to %s"
,
host
);
return
-
1
;
}
else
else
rep_connected
=
true
;
rep_connected
=
true
;
return
;
return
0
;
if
(
!
rep_connected
)
{
if
(
!
rep_connected
)
{
ndbout_c
(
"Not connected to REP server"
);
ndbout_c
(
"Not connected to REP server"
);
return
-
1
;
}
}
}
}
...
@@ -2191,17 +2258,18 @@ CommandInterpreter::executeRep(char* parameters)
...
@@ -2191,17 +2258,18 @@ CommandInterpreter::executeRep(char* parameters)
req
=
GrepReq
::
START_DELETE
;
req
=
GrepReq
::
START_DELETE
;
}
else
{
}
else
{
ndbout_c
(
"Illegal argument to command 'REPLICATION START'"
);
ndbout_c
(
"Illegal argument to command 'REPLICATION START'"
);
return
;
return
-
1
;
}
}
int
result
=
ndb_rep_command
(
m_repserver
,
req
,
&
repId
,
&
reply
);
int
result
=
ndb_rep_command
(
m_repserver
,
req
,
&
repId
,
&
reply
);
if
(
result
!=
0
)
{
if
(
result
!=
0
)
{
ndbout
<<
"Start of Global Replication failed"
<<
endl
;
ndbout
<<
"Start of Global Replication failed"
<<
endl
;
return
-
1
;
}
else
{
}
else
{
ndbout
<<
"Start of Global Replication ordered"
<<
endl
;
ndbout
<<
"Start of Global Replication ordered"
<<
endl
;
}
}
return
;
return
0
;
}
}
/********
/********
...
@@ -2221,7 +2289,7 @@ CommandInterpreter::executeRep(char* parameters)
...
@@ -2221,7 +2289,7 @@ CommandInterpreter::executeRep(char* parameters)
char
*
strEpoch
=
strtok
(
NULL
,
"
\0
"
);
char
*
strEpoch
=
strtok
(
NULL
,
"
\0
"
);
if
(
strEpoch
==
NULL
)
{
if
(
strEpoch
==
NULL
)
{
ndbout_c
(
"Epoch expected!"
);
ndbout_c
(
"Epoch expected!"
);
return
;
return
-
1
;
}
}
req
=
GrepReq
::
STOP
;
req
=
GrepReq
::
STOP
;
epoch
=
atoi
(
strEpoch
);
epoch
=
atoi
(
strEpoch
);
...
@@ -2245,16 +2313,17 @@ CommandInterpreter::executeRep(char* parameters)
...
@@ -2245,16 +2313,17 @@ CommandInterpreter::executeRep(char* parameters)
req
=
GrepReq
::
STOP_DELETE
;
req
=
GrepReq
::
STOP_DELETE
;
}
else
{
}
else
{
ndbout_c
(
"Illegal argument to command 'REPLICATION STOP'"
);
ndbout_c
(
"Illegal argument to command 'REPLICATION STOP'"
);
return
;
return
-
1
;
}
}
int
result
=
ndb_rep_command
(
m_repserver
,
req
,
&
repId
,
&
reply
,
epoch
);
int
result
=
ndb_rep_command
(
m_repserver
,
req
,
&
repId
,
&
reply
,
epoch
);
if
(
result
!=
0
)
{
if
(
result
!=
0
)
{
ndbout
<<
"Stop command failed"
<<
endl
;
ndbout
<<
"Stop command failed"
<<
endl
;
return
-
1
;
}
else
{
}
else
{
ndbout
<<
"Stop ordered"
<<
endl
;
ndbout
<<
"Stop ordered"
<<
endl
;
}
}
return
;
return
0
;
}
}
/*********
/*********
...
@@ -2267,6 +2336,7 @@ CommandInterpreter::executeRep(char* parameters)
...
@@ -2267,6 +2336,7 @@ CommandInterpreter::executeRep(char* parameters)
if
(
result
!=
0
)
{
if
(
result
!=
0
)
{
ndbout
<<
"Status request of Global Replication failed"
<<
endl
;
ndbout
<<
"Status request of Global Replication failed"
<<
endl
;
return
-
1
;
}
else
{
}
else
{
ndbout
<<
"Status request of Global Replication ordered"
<<
endl
;
ndbout
<<
"Status request of Global Replication ordered"
<<
endl
;
ndbout
<<
"See printout at one of the DB nodes"
<<
endl
;
ndbout
<<
"See printout at one of the DB nodes"
<<
endl
;
...
@@ -2274,7 +2344,7 @@ CommandInterpreter::executeRep(char* parameters)
...
@@ -2274,7 +2344,7 @@ CommandInterpreter::executeRep(char* parameters)
ndbout
<<
" SubscriptionId "
<<
repstate
.
subid
ndbout
<<
" SubscriptionId "
<<
repstate
.
subid
<<
" SubscriptionKey "
<<
repstate
.
subkey
<<
endl
;
<<
" SubscriptionKey "
<<
repstate
.
subkey
<<
endl
;
}
}
return
;
return
0
;
}
}
/*********
/*********
...
@@ -2293,6 +2363,7 @@ CommandInterpreter::executeRep(char* parameters)
...
@@ -2293,6 +2363,7 @@ CommandInterpreter::executeRep(char* parameters)
if
(
result
!=
0
)
{
if
(
result
!=
0
)
{
ndbout
<<
"Query repserver failed"
<<
endl
;
ndbout
<<
"Query repserver failed"
<<
endl
;
return
-
1
;
}
else
{
}
else
{
ndbout
<<
"Query repserver sucessful"
<<
endl
;
ndbout
<<
"Query repserver sucessful"
<<
endl
;
ndbout_c
(
"repstate : QueryCounter %d, f=%d l=%d"
ndbout_c
(
"repstate : QueryCounter %d, f=%d l=%d"
...
@@ -2301,8 +2372,9 @@ CommandInterpreter::executeRep(char* parameters)
...
@@ -2301,8 +2372,9 @@ CommandInterpreter::executeRep(char* parameters)
repstate
.
first
[
0
],
repstate
.
last
[
0
],
repstate
.
first
[
0
],
repstate
.
last
[
0
],
repstate
.
no_of_nodegroups
);
repstate
.
no_of_nodegroups
);
}
}
return
;
return
0
;
}
}
return
0
;
}
}
#endif // HAVE_GLOBAL_REPLICATION
#endif // HAVE_GLOBAL_REPLICATION
...
...
ndb/test/ndbapi/flexScan.cpp
View file @
eb94d025
...
@@ -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
;
...
...
ndb/tools/ndb_config.cpp
View file @
eb94d025
...
@@ -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>]
\"
. "
"Over
ides specifying entries in NDB_CONNECTSTRING and Ndb.cfg
"
,
"Over
rides 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"
,
...
...
ndb/tools/restore/consumer.hpp
View file @
eb94d025
...
@@ -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
ndb/tools/restore/consumer_restore.cpp
View file @
eb94d025
...
@@ -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
...
...
ndb/tools/restore/consumer_restore.hpp
View file @
eb94d025
...
@@ -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;
...
...
ndb/tools/restore/restore_main.cpp
View file @
eb94d025
...
@@ -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
(
"
\n
Restore 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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment