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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
5712bc55
Commit
5712bc55
authored
Dec 17, 2004
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
cfa20fba
e69cc6b2
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
101 additions
and
665 deletions
+101
-665
ndb/include/ndbapi/Ndb.hpp
ndb/include/ndbapi/Ndb.hpp
+1
-10
ndb/src/common/util/version.c
ndb/src/common/util/version.c
+24
-18
ndb/src/mgmsrv/CommandInterpreter.cpp
ndb/src/mgmsrv/CommandInterpreter.cpp
+1
-536
ndb/src/mgmsrv/CommandInterpreter.hpp
ndb/src/mgmsrv/CommandInterpreter.hpp
+0
-8
ndb/src/ndbapi/Ndb.cpp
ndb/src/ndbapi/Ndb.cpp
+13
-24
ndb/src/ndbapi/NdbConnection.cpp
ndb/src/ndbapi/NdbConnection.cpp
+2
-2
ndb/src/ndbapi/NdbImpl.hpp
ndb/src/ndbapi/NdbImpl.hpp
+21
-12
ndb/src/ndbapi/NdbReceiver.cpp
ndb/src/ndbapi/NdbReceiver.cpp
+2
-2
ndb/src/ndbapi/Ndbif.cpp
ndb/src/ndbapi/Ndbif.cpp
+12
-9
ndb/src/ndbapi/Ndbinit.cpp
ndb/src/ndbapi/Ndbinit.cpp
+14
-16
ndb/src/ndbapi/Ndblist.cpp
ndb/src/ndbapi/Ndblist.cpp
+11
-28
No files found.
ndb/include/ndbapi/Ndb.hpp
View file @
5712bc55
...
@@ -1586,7 +1586,6 @@ private:
...
@@ -1586,7 +1586,6 @@ private:
/******************************************************************************
/******************************************************************************
* These are the private variables in this class.
* These are the private variables in this class.
*****************************************************************************/
*****************************************************************************/
NdbObjectIdMap
*
theNdbObjectIdMap
;
Ndb_cluster_connection
*
m_ndb_cluster_connection
;
Ndb_cluster_connection
*
m_ndb_cluster_connection
;
NdbConnection
**
thePreparedTransactionsArray
;
NdbConnection
**
thePreparedTransactionsArray
;
...
@@ -1637,10 +1636,6 @@ private:
...
@@ -1637,10 +1636,6 @@ private:
Uint32
theMyRef
;
// My block reference
Uint32
theMyRef
;
// My block reference
Uint32
theNode
;
// The node number of our node
Uint32
theNode
;
// The node number of our node
Uint32
theNoOfDBnodes
;
// The number of DB nodes
Uint32
*
theDBnodes
;
// The node number of the DB nodes
Uint8
*
the_release_ind
;
// 1 indicates to release all connections to node
Uint64
the_last_check_time
;
Uint64
the_last_check_time
;
Uint64
theFirstTransId
;
Uint64
theFirstTransId
;
...
@@ -1663,10 +1658,6 @@ private:
...
@@ -1663,10 +1658,6 @@ private:
InitConfigError
InitConfigError
}
theInitState
;
}
theInitState
;
// Ensure good distribution of connects
Uint32
theCurrentConnectIndex
;
Uint32
theCurrentConnectCounter
;
/**
/**
* Computes fragement id for primary key
* Computes fragement id for primary key
*
*
...
@@ -1692,7 +1683,7 @@ private:
...
@@ -1692,7 +1683,7 @@ private:
Uint32
noOfFragments
;
Uint32
noOfFragments
;
Uint32
*
fragment2PrimaryNodeMap
;
Uint32
*
fragment2PrimaryNodeMap
;
void
init
(
Uint32
noOfNodes
,
Uint
32
nodeIds
[]);
void
init
(
Uint32
noOfNodes
,
Uint
8
nodeIds
[]);
void
release
();
void
release
();
}
startTransactionNodeSelectionData
;
}
startTransactionNodeSelectionData
;
...
...
ndb/src/common/util/version.c
View file @
5712bc55
...
@@ -18,6 +18,8 @@
...
@@ -18,6 +18,8 @@
#include <ndb_version.h>
#include <ndb_version.h>
#include <version.h>
#include <version.h>
#include <basestring_vsnprintf.h>
#include <basestring_vsnprintf.h>
#include <NdbEnv.h>
#include <NdbOut.hpp>
Uint32
getMajor
(
Uint32
version
)
{
Uint32
getMajor
(
Uint32
version
)
{
return
(
version
>>
16
)
&
0xFF
;
return
(
version
>>
16
)
&
0xFF
;
...
@@ -68,8 +70,27 @@ struct NdbUpGradeCompatible {
...
@@ -68,8 +70,27 @@ struct NdbUpGradeCompatible {
/*#define TEST_VERSION*/
/*#define TEST_VERSION*/
#define HAVE_NDB_SETVERSION
#ifdef HAVE_NDB_SETVERSION
Uint32
ndbOwnVersionTesting
=
0
;
void
ndbSetOwnVersion
()
{
char
buf
[
256
];
if
(
NdbEnv_GetEnv
(
"NDB_SETVERSION"
,
buf
,
sizeof
(
buf
)))
{
Uint32
_v1
,
_v2
,
_v3
;
if
(
sscanf
(
buf
,
"%u.%u.%u"
,
&
_v1
,
&
_v2
,
&
_v3
)
==
3
)
{
ndbOwnVersionTesting
=
MAKE_VERSION
(
_v1
,
_v2
,
_v3
);
ndbout_c
(
"Testing: Version set to 0x%x"
,
ndbOwnVersionTesting
);
}
}
}
#else
void
ndbSetOwnVersion
()
{}
#endif
#ifndef TEST_VERSION
#ifndef TEST_VERSION
struct
NdbUpGradeCompatible
ndbCompatibleTable_full
[]
=
{
struct
NdbUpGradeCompatible
ndbCompatibleTable_full
[]
=
{
{
MAKE_VERSION
(
4
,
1
,
9
),
MAKE_VERSION
(
4
,
1
,
8
),
UG_Exact
},
{
MAKE_VERSION
(
3
,
5
,
2
),
MAKE_VERSION
(
3
,
5
,
1
),
UG_Exact
},
{
MAKE_VERSION
(
3
,
5
,
2
),
MAKE_VERSION
(
3
,
5
,
1
),
UG_Exact
},
{
0
,
0
,
UG_Null
}
{
0
,
0
,
UG_Null
}
};
};
...
@@ -79,8 +100,6 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = {
...
@@ -79,8 +100,6 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = {
{
0
,
0
,
UG_Null
}
{
0
,
0
,
UG_Null
}
};
};
void
ndbSetOwnVersion
()
{}
#else
/* testing purposes */
#else
/* testing purposes */
struct
NdbUpGradeCompatible
ndbCompatibleTable_full
[]
=
{
struct
NdbUpGradeCompatible
ndbCompatibleTable_full
[]
=
{
...
@@ -101,19 +120,6 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = {
...
@@ -101,19 +120,6 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = {
};
};
Uint32
ndbOwnVersionTesting
=
0
;
void
ndbSetOwnVersion
()
{
char
buf
[
256
];
if
(
NdbEnv_GetEnv
(
"NDB_SETVERSION"
,
buf
,
sizeof
(
buf
)))
{
Uint32
_v1
,
_v2
,
_v3
;
if
(
sscanf
(
buf
,
"%u.%u.%u"
,
&
_v1
,
&
_v2
,
&
_v3
)
==
3
)
{
ndbOwnVersionTesting
=
MAKE_VERSION
(
_v1
,
_v2
,
_v3
);
ndbout_c
(
"Testing: Version set to 0x%x"
,
ndbOwnVersionTesting
);
}
}
}
#endif
#endif
void
ndbPrintVersion
()
void
ndbPrintVersion
()
...
@@ -127,13 +133,13 @@ void ndbPrintVersion()
...
@@ -127,13 +133,13 @@ void ndbPrintVersion()
Uint32
Uint32
ndbGetOwnVersion
()
ndbGetOwnVersion
()
{
{
#ifndef TEST_VERSION
#ifdef HAVE_NDB_SETVERSION
return
NDB_VERSION_D
;
#else
/* testing purposes */
if
(
ndbOwnVersionTesting
==
0
)
if
(
ndbOwnVersionTesting
==
0
)
return
NDB_VERSION_D
;
return
NDB_VERSION_D
;
else
else
return
ndbOwnVersionTesting
;
return
ndbOwnVersionTesting
;
#else
return
NDB_VERSION_D
;
#endif
#endif
}
}
...
...
ndb/src/mgmsrv/CommandInterpreter.cpp
View file @
5712bc55
...
@@ -30,64 +30,10 @@
...
@@ -30,64 +30,10 @@
#include <version.h>
#include <version.h>
#include <m_string.h>
#include <m_string.h>
static
const
char
*
helpTexts
[]
=
{
"HELP Print help text"
,
"HELP SHOW Help for the SHOW command"
,
#ifdef VM_TRACE // DEBUG ONLY
"HELP DEBUG Help for debug compiled version"
,
#endif
"SHOW Print information about cluster"
,
"SHOW CONFIG Print configuration"
,
"SHOW PARAMETERS Print configuration parameters"
,
"START BACKUP Start backup
\n
"
"ABORT BACKUP <backup id> Aborts backup
\n
"
"CLUSTERLOG ON Enable Cluster logging"
,
"CLUSTERLOG OFF Disable Cluster logging"
,
"CLUSTERLOG FILTER <severity> Toggle severity filter on/off"
,
"CLUSTERLOG INFO Print cluster log information"
,
"{<id>|ALL} START Start DB node (started with -n)"
,
"{<id>|ALL} RESTART [-n] [-i] Restart DB node"
,
"{<id>|ALL} STOP Stop DB node"
,
"{<id>|ALL} STATUS Print status"
,
"{<id>|ALL} CLUSTERLOG {<category>=<level>}+ Set log level for cluster log"
,
"QUIT Quit management server"
,
};
static
const
unsigned
noOfHelpTexts
=
sizeof
(
helpTexts
)
/
sizeof
(
const
char
*
);
static
const
char
*
helpTextShow
=
"SHOW prints NDB Cluster information
\n\n
"
"SHOW Print information about cluster
\n
"
"SHOW CONFIG Print configuration (in initial config file format)
\n
"
"SHOW PARAMETERS Print information about configuration parameters
\n\n
"
;
#ifdef VM_TRACE // DEBUG ONLY
static
const
char
*
helpTextDebug
=
"SHOW PROPERTIES Print config properties object
\n
"
"{<id>|ALL} LOGLEVEL {<category>=<level>}+ Set log level
\n
"
"{<id>|ALL} ERROR <errorNo> Inject error into NDB node
\n
"
"{<id>|ALL} TRACE <traceNo> Set trace number
\n
"
"{<id>|ALL} LOG [BLOCK = {ALL|<block>+}] Set logging on in & out signals
\n
"
"{<id>|ALL} LOGIN [BLOCK = {ALL|<block>+}] Set logging on in signals
\n
"
"{<id>|ALL} LOGOUT [BLOCK = {ALL|<block>+}] Set logging on out signals
\n
"
"{<id>|ALL} LOGOFF [BLOCK = {ALL|<block>+}] Unset signal logging
\n
"
"{<id>|ALL} TESTON Start signal logging
\n
"
"{<id>|ALL} TESTOFF Stop signal logging
\n
"
"{<id>|ALL} SET <configParamName> <value> Update configuration variable
\n
"
"{<id>|ALL} DUMP <arg> Dump system state to cluster.log
\n
"
"{<id>|ALL} GETSTAT Print statistics
\n
"
"
\n
"
;
#endif
//******************************************************************************
//******************************************************************************
//******************************************************************************
//******************************************************************************
CommandInterpreter
::
CommandInterpreter
(
MgmtSrvr
&
mgmtSrvr
)
:
CommandInterpreter
::
CommandInterpreter
(
MgmtSrvr
&
mgmtSrvr
)
:
_mgmtSrvr
(
mgmtSrvr
)
{
_mgmtSrvr
(
mgmtSrvr
)
{
// _mgmtSrvr.setCallback(CmdBackupCallback);
}
}
...
@@ -145,48 +91,7 @@ int CommandInterpreter::readAndExecute() {
...
@@ -145,48 +91,7 @@ int CommandInterpreter::readAndExecute() {
char
*
firstToken
=
strtok
(
line
,
" "
);
char
*
firstToken
=
strtok
(
line
,
" "
);
char
*
allAfterFirstToken
=
strtok
(
NULL
,
"
\0
"
);
char
*
allAfterFirstToken
=
strtok
(
NULL
,
"
\0
"
);
if
(
strcmp
(
firstToken
,
"HELP"
)
==
0
)
{
if
(
strcmp
(
firstToken
,
"ALL"
)
==
0
)
{
executeHelp
(
allAfterFirstToken
);
return
true
;
}
else
if
(
strcmp
(
firstToken
,
"?"
)
==
0
)
{
executeHelp
(
allAfterFirstToken
);
return
true
;
}
else
if
(
strcmp
(
firstToken
,
"SHOW"
)
==
0
)
{
executeShow
(
allAfterFirstToken
);
return
true
;
}
else
if
(
strcmp
(
firstToken
,
"START"
)
==
0
&&
allAfterFirstToken
!=
0
&&
strncmp
(
allAfterFirstToken
,
"BACKUP"
,
sizeof
(
"BACKUP"
)
-
1
)
==
0
){
executeStartBackup
(
allAfterFirstToken
);
return
true
;
}
else
if
(
strcmp
(
firstToken
,
"ABORT"
)
==
0
&&
allAfterFirstToken
!=
0
&&
strncmp
(
allAfterFirstToken
,
"BACKUP"
,
sizeof
(
"BACKUP"
)
-
1
)
==
0
){
executeAbortBackup
(
allAfterFirstToken
);
return
true
;
}
else
if
(
strcmp
(
firstToken
,
"ENTER"
)
==
0
&&
allAfterFirstToken
!=
0
&&
strncmp
(
allAfterFirstToken
,
"SINGLE USER MODE "
,
sizeof
(
"SINGLE USER MODE"
)
-
1
)
==
0
){
executeEnterSingleUser
(
allAfterFirstToken
);
return
true
;
}
else
if
(
strcmp
(
firstToken
,
"EXIT"
)
==
0
&&
allAfterFirstToken
!=
0
&&
strncmp
(
allAfterFirstToken
,
"SINGLE USER MODE "
,
sizeof
(
"SINGLE USER MODE"
)
-
1
)
==
0
){
executeExitSingleUser
(
allAfterFirstToken
);
return
true
;
}
else
if
(
strcmp
(
firstToken
,
"ALL"
)
==
0
)
{
analyseAfterFirstToken
(
-
1
,
allAfterFirstToken
);
analyseAfterFirstToken
(
-
1
,
allAfterFirstToken
);
}
}
else
if
(
strcmp
(
firstToken
,
"QUIT"
)
==
0
||
else
if
(
strcmp
(
firstToken
,
"QUIT"
)
==
0
||
...
@@ -218,8 +123,6 @@ static const CommandInterpreter::CommandFunctionPair commands[] = {
...
@@ -218,8 +123,6 @@ static const CommandInterpreter::CommandFunctionPair commands[] = {
{
"START"
,
&
CommandInterpreter
::
executeStart
}
{
"START"
,
&
CommandInterpreter
::
executeStart
}
,{
"RESTART"
,
&
CommandInterpreter
::
executeRestart
}
,{
"RESTART"
,
&
CommandInterpreter
::
executeRestart
}
,{
"STOP"
,
&
CommandInterpreter
::
executeStop
}
,{
"STOP"
,
&
CommandInterpreter
::
executeStop
}
,{
"STATUS"
,
&
CommandInterpreter
::
executeStatus
}
,{
"LOGLEVEL"
,
&
CommandInterpreter
::
executeLogLevel
}
#ifdef ERROR_INSERT
#ifdef ERROR_INSERT
,{
"ERROR"
,
&
CommandInterpreter
::
executeError
}
,{
"ERROR"
,
&
CommandInterpreter
::
executeError
}
#endif
#endif
...
@@ -230,9 +133,7 @@ static const CommandInterpreter::CommandFunctionPair commands[] = {
...
@@ -230,9 +133,7 @@ static const CommandInterpreter::CommandFunctionPair commands[] = {
,{
"LOGOFF"
,
&
CommandInterpreter
::
executeLogOff
}
,{
"LOGOFF"
,
&
CommandInterpreter
::
executeLogOff
}
,{
"TESTON"
,
&
CommandInterpreter
::
executeTestOn
}
,{
"TESTON"
,
&
CommandInterpreter
::
executeTestOn
}
,{
"TESTOFF"
,
&
CommandInterpreter
::
executeTestOff
}
,{
"TESTOFF"
,
&
CommandInterpreter
::
executeTestOff
}
,{
"CLUSTERLOG"
,
&
CommandInterpreter
::
executeEventReporting
}
,{
"DUMP"
,
&
CommandInterpreter
::
executeDumpState
}
,{
"DUMP"
,
&
CommandInterpreter
::
executeDumpState
}
,{
"JONAS"
,
&
CommandInterpreter
::
jonas
}
};
};
...
@@ -370,104 +271,9 @@ bool CommandInterpreter::parseBlockSpecification(const char* allAfterLog,
...
@@ -370,104 +271,9 @@ bool CommandInterpreter::parseBlockSpecification(const char* allAfterLog,
return
true
;
return
true
;
}
}
//******************************************************************************
//******************************************************************************
void
CommandInterpreter
::
executeHelp
(
char
*
parameters
)
{
(
void
)
parameters
;
// Don't want compiler warning
if
(
emptyString
(
parameters
))
{
unsigned
i
;
for
(
i
=
0
;
i
<
noOfHelpTexts
;
i
++
)
{
ndbout
<<
helpTexts
[
i
]
<<
endl
;
}
ndbout
<<
endl
<<
"<severity> = "
<<
"ALERT | CRITICAL | ERROR | WARNING | INFO | DEBUG"
<<
endl
;
ndbout
<<
"<category> = "
;
for
(
i
=
0
;
i
<
CFG_MIN_LOGLEVEL
;
i
++
){
ndbout
<<
ndb_mgm_get_event_category_string
((
ndb_mgm_event_category
)
i
);
if
(
i
<
CFG_MIN_LOGLEVEL
-
1
)
{
ndbout
<<
" | "
;
}
}
ndbout
<<
endl
;
ndbout
<<
"<level> = "
<<
"0 - 15"
<<
endl
;
ndbout
<<
endl
;
}
else
if
(
strcmp
(
parameters
,
"SHOW"
)
==
0
)
{
ndbout
<<
helpTextShow
;
#ifdef VM_TRACE // DEBUG ONLY
}
else
if
(
strcmp
(
parameters
,
"DEBUG"
)
==
0
)
{
ndbout
<<
helpTextDebug
;
#endif
}
else
{
ndbout
<<
"Invalid argument."
<<
endl
;
}
}
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
void
CommandInterpreter
::
executeShow
(
char
*
parameters
)
{
if
(
emptyString
(
parameters
))
{
ndbout
<<
"Cluster Configuration"
<<
endl
<<
"---------------------"
<<
endl
;
NodeId
nodeId
=
0
;
ndbout
<<
_mgmtSrvr
.
getNodeCount
(
NDB_MGM_NODE_TYPE_NDB
)
<<
" NDB Node(s) with"
<<
endl
;
while
(
_mgmtSrvr
.
getNextNodeId
(
&
nodeId
,
NDB_MGM_NODE_TYPE_NDB
)){
ndbout
<<
" Node Id = "
<<
nodeId
<<
endl
;
}
ndbout
<<
endl
;
nodeId
=
0
;
ndbout
<<
_mgmtSrvr
.
getNodeCount
(
NDB_MGM_NODE_TYPE_API
)
<<
" API Node(s) with"
<<
endl
;
while
(
_mgmtSrvr
.
getNextNodeId
(
&
nodeId
,
NDB_MGM_NODE_TYPE_API
)){
ndbout
<<
" Node Id = "
<<
nodeId
<<
endl
;
}
ndbout
<<
endl
;
nodeId
=
0
;
ndbout
<<
_mgmtSrvr
.
getNodeCount
(
NDB_MGM_NODE_TYPE_MGM
)
<<
" MGM Node(s) with"
<<
endl
;
while
(
_mgmtSrvr
.
getNextNodeId
(
&
nodeId
,
NDB_MGM_NODE_TYPE_MGM
)){
ndbout
<<
" Node Id = "
<<
nodeId
<<
endl
;
}
ndbout
<<
endl
;
ndbout
<<
helpTextShow
;
return
;
}
else
if
(
strcmp
(
parameters
,
"PROPERTIES"
)
==
0
||
strcmp
(
parameters
,
"PROP"
)
==
0
)
{
ndbout
<<
"_mgmtSrvr.getConfig()->print();"
<<
endl
;
/* XXX */
}
else
if
(
strcmp
(
parameters
,
"CONFIGURATION"
)
==
0
||
strcmp
(
parameters
,
"CONFIG"
)
==
0
){
ndbout
<<
"_mgmtSrvr.getConfigFile()->print();"
<<
endl
;
/* XXX */
_mgmtSrvr
.
getConfig
()
->
printConfigFile
();
}
else
if
(
strcmp
(
parameters
,
"PARAMETERS"
)
==
0
||
strcmp
(
parameters
,
"PARAMS"
)
==
0
||
strcmp
(
parameters
,
"PARAM"
)
==
0
)
{
ndbout
<<
"_mgmtSrvr.getConfigInfo()->print();"
<<
endl
;
/* XXX */
}
else
{
ndbout
<<
"Invalid argument."
<<
endl
;
}
}
void
void
stopCallback
(
int
nodeId
,
void
*
anyData
,
int
errCode
){
stopCallback
(
int
nodeId
,
void
*
anyData
,
int
errCode
){
if
(
errCode
==
0
){
if
(
errCode
==
0
){
...
@@ -483,59 +289,6 @@ stopCallback(int nodeId, void * anyData, int errCode){
...
@@ -483,59 +289,6 @@ stopCallback(int nodeId, void * anyData, int errCode){
}
}
}
}
void
versionCallback
(
int
nodeId
,
int
version
,
void
*
anyData
,
int
errCode
){
if
(
errCode
==
0
){
MgmtSrvr
*
mgm
=
(
MgmtSrvr
*
)
anyData
;
switch
(
mgm
->
getNodeType
(
nodeId
)){
case
NDB_MGM_NODE_TYPE_MGM
:
{
ndbout
<<
"MGMT node:
\t
"
<<
nodeId
<<
" "
;
ndbout_c
(
" (Version %d.%d.%d)"
,
getMajor
(
version
)
,
getMinor
(
version
),
getBuild
(
version
));
}
break
;
case
NDB_MGM_NODE_TYPE_NDB
:
{
ndbout
<<
"DB node:
\t
"
<<
nodeId
<<
" "
;
if
(
version
==
0
)
ndbout
<<
"(no version information available)"
<<
endl
;
else
{
ndbout_c
(
" (Version %d.%d.%d)"
,
getMajor
(
version
)
,
getMinor
(
version
),
getBuild
(
version
));
}
}
break
;
case
NDB_MGM_NODE_TYPE_API
:
{
ndbout
<<
"API node:
\t
"
<<
nodeId
<<
" "
;
if
(
version
==
0
)
ndbout
<<
"(no version information available)"
<<
endl
;
else
{
ndbout_c
(
" (Version %d.%d.%d)"
,
getMajor
(
version
)
,
getMinor
(
version
),
getBuild
(
version
));
}
}
break
;
case
NDB_MGM_NODE_TYPE_UNKNOWN
:
case
NDB_MGM_NODE_TYPE_REP
:
abort
();
};
}
else
{
MgmtSrvr
*
mgm
=
(
MgmtSrvr
*
)
anyData
;
char
err_str
[
1024
];
ndbout
<<
mgm
->
getErrorText
(
errCode
,
err_str
,
sizeof
(
err_str
))
<<
endl
;
}
}
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
void
CommandInterpreter
::
executeStop
(
int
processId
,
void
CommandInterpreter
::
executeStop
(
int
processId
,
...
@@ -644,124 +397,6 @@ CommandInterpreter::executeDumpState(int processId, const char* parameters,
...
@@ -644,124 +397,6 @@ CommandInterpreter::executeDumpState(int processId, const char* parameters,
}
}
}
}
void
CommandInterpreter
::
executeStatus
(
int
processId
,
const
char
*
parameters
,
bool
all
)
{
(
void
)
all
;
// Don't want compiler warning
if
(
!
emptyString
(
parameters
))
{
ndbout
<<
"No parameters expected to this command."
<<
endl
;
return
;
}
ndb_mgm_node_status
status
;
Uint32
startPhase
,
version
,
dynamicId
,
nodeGroup
,
connectCount
;
bool
system
;
int
result
=
_mgmtSrvr
.
status
(
processId
,
&
status
,
&
version
,
&
startPhase
,
&
system
,
&
dynamicId
,
&
nodeGroup
,
&
connectCount
);
if
(
result
!=
0
){
ndbout
<<
get_error_text
(
result
)
<<
endl
;
return
;
}
ndbout
<<
"Node "
<<
processId
<<
": "
;
switch
(
status
){
case
NDB_MGM_NODE_STATUS_NO_CONTACT
:
ndbout
<<
"No contact"
<<
endl
;
break
;
case
NDB_MGM_NODE_STATUS_NOT_STARTED
:
ndbout
<<
"Not started"
;
break
;
case
NDB_MGM_NODE_STATUS_STARTING
:
ndbout
<<
"Starting (Start phase "
<<
startPhase
<<
")"
;
break
;
case
NDB_MGM_NODE_STATUS_STARTED
:
ndbout
<<
"Started"
;
break
;
case
NDB_MGM_NODE_STATUS_SHUTTING_DOWN
:
ndbout
<<
"Shutting down "
<<
(
system
==
false
?
"node"
:
"system"
)
<<
" (Phase "
<<
startPhase
<<
")"
;
break
;
case
NDB_MGM_NODE_STATUS_RESTARTING
:
ndbout
<<
"Restarting"
;
break
;
case
NDB_MGM_NODE_STATUS_SINGLEUSER
:
ndbout
<<
"Single user mode"
;
break
;
default:
ndbout
<<
"Unknown state"
;
break
;
}
if
(
status
!=
NDB_MGM_NODE_STATUS_NO_CONTACT
){
ndbout_c
(
" (Version %d.%d.%d)"
,
getMajor
(
version
)
,
getMinor
(
version
),
getBuild
(
version
));
// NOTE It's possible to print dynamicId and nodeGroup here ...
// ndbout << ", " <<dynamicId<<", "<<nodeGroup<<endl;
}
}
//*****************************************************************************
//*****************************************************************************
void
CommandInterpreter
::
executeLogLevel
(
int
processId
,
const
char
*
parameters
,
bool
all
)
{
#if 0
(void)all; // Don't want compiler warning
SetLogLevelOrd logLevel; logLevel.clear();
if (emptyString(parameters) || (strcmp(parameters, "ALL") == 0)) {
for(Uint32 i = 0; i<EventLoggerBase::noOfEventCategoryNames; i++)
logLevel.setLogLevel(EventLoggerBase::eventCategoryNames[i].category, 7);
} else {
char * tmpString = strdup(parameters);
char * tmpPtr = 0;
char * item = strtok_r(tmpString, ", ", &tmpPtr);
while(item != NULL){
char categoryTxt[255];
int level;
const int m = sscanf(item, "%[^=]=%d", categoryTxt, &level);
if(m != 2){
free(tmpString);
ndbout << "Invalid loglevel specification category=level" << endl;
return;
}
LogLevel::EventCategory cat;
if(!EventLoggerBase::matchEventCategory(categoryTxt,
&cat)){
ndbout << "Invalid loglevel specification, unknown category: "
<< categoryTxt << endl;
free(tmpString);
return ;
}
if(level < 0 || level > 15){
ndbout << "Invalid loglevel specification row, level 0-15" << endl;
free(tmpString);
return ;
}
logLevel.setLogLevel(cat, level);
item = strtok_r(NULL, ", ", &tmpPtr);
}
free(tmpString);
}
int result = _mgmtSrvr.setNodeLogLevel(processId, logLevel);
if (result != 0) {
ndbout << get_error_text(result) << endl;
}
#endif
}
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
void
CommandInterpreter
::
executeError
(
int
processId
,
void
CommandInterpreter
::
executeError
(
int
processId
,
...
@@ -957,173 +592,3 @@ void CommandInterpreter::executeTestOff(int processId,
...
@@ -957,173 +592,3 @@ void CommandInterpreter::executeTestOff(int processId,
}
}
}
}
//*****************************************************************************
//*****************************************************************************
void
CommandInterpreter
::
executeEventReporting
(
int
processId
,
const
char
*
parameters
,
bool
all
)
{
#if 0
(void)all; // Don't want compiler warning
SetLogLevelOrd logLevel; logLevel.clear();
if (emptyString(parameters) || (strcmp(parameters, "ALL") == 0)) {
for(Uint32 i = 0; i<EventLoggerBase::noOfEventCategoryNames; i++)
logLevel.setLogLevel(EventLoggerBase::eventCategoryNames[i].category, 7);
} else {
char * tmpString = strdup(parameters);
char * tmpPtr = 0;
char * item = strtok_r(tmpString, ", ", &tmpPtr);
while(item != NULL){
char categoryTxt[255];
int level;
const int m = sscanf(item, "%[^=]=%d", categoryTxt, &level);
if(m != 2){
free(tmpString);
ndbout << "Invalid loglevel specification category=level" << endl;
return;
}
LogLevel::EventCategory cat;
if(!EventLoggerBase::matchEventCategory(categoryTxt,
&cat)){
ndbout << "Invalid loglevel specification, unknown category: "
<< categoryTxt << endl;
free(tmpString);
return ;
}
if(level < 0 || level > 15){
ndbout << "Invalid loglevel specification row, level 0-15" << endl;
free(tmpString);
return ;
}
logLevel.setLogLevel(cat, level);
item = strtok_r(NULL, ", ", &tmpPtr);
}
free(tmpString);
}
ndbout_c("processId %d", processId);
int result = _mgmtSrvr.setEventReportingLevel(processId, logLevel);
if (result != 0) {
ndbout << get_error_text(result) << endl;
}
#endif
}
void
CommandInterpreter
::
executeStartBackup
(
char
*
parameters
)
{
Uint32
backupId
;
int
result
=
_mgmtSrvr
.
startBackup
(
backupId
);
if
(
result
!=
0
)
{
ndbout
<<
get_error_text
(
result
)
<<
endl
;
}
else
{
// ndbout << "Start of backup ordered" << endl;
}
}
void
CommandInterpreter
::
executeAbortBackup
(
char
*
parameters
)
{
strtok
(
parameters
,
" "
);
char
*
id
=
strtok
(
NULL
,
"
\0
"
);
int
bid
=
-
1
;
if
(
id
==
0
||
sscanf
(
id
,
"%d"
,
&
bid
)
!=
1
){
ndbout
<<
"Invalid arguments: expected <BackupId>"
<<
endl
;
return
;
}
int
result
=
_mgmtSrvr
.
abortBackup
(
bid
);
if
(
result
!=
0
)
{
ndbout
<<
get_error_text
(
result
)
<<
endl
;
}
else
{
ndbout
<<
"Abort of backup "
<<
bid
<<
" ordered"
<<
endl
;
}
}
void
CommandInterpreter
::
executeEnterSingleUser
(
char
*
parameters
)
{
strtok
(
parameters
,
" "
);
char
*
id
=
strtok
(
NULL
,
" "
);
id
=
strtok
(
NULL
,
" "
);
id
=
strtok
(
NULL
,
"
\0
"
);
int
nodeId
=
-
1
;
if
(
id
==
0
||
sscanf
(
id
,
"%d"
,
&
nodeId
)
!=
1
){
ndbout
<<
"Invalid arguments: expected <NodeId>"
<<
endl
;
return
;
}
int
result
=
_mgmtSrvr
.
enterSingleUser
(
0
,
nodeId
,
0
,
0
);
if
(
result
!=
0
)
{
ndbout
<<
get_error_text
(
result
)
<<
endl
;
}
else
{
ndbout
<<
"Entering single user mode, granting access for node "
<<
nodeId
<<
" OK."
<<
endl
;
}
}
void
CommandInterpreter
::
executeExitSingleUser
(
char
*
parameters
)
{
_mgmtSrvr
.
exitSingleUser
(
0
,
0
,
0
,
0
);
}
#include <NdbApiSignal.hpp>
void
CommandInterpreter
::
jonas
(
int
processId
,
const
char
*
parameters
,
bool
all
)
{
MgmtSrvr
::
Area51
tmp
=
_mgmtSrvr
.
getStuff
();
NdbApiSignal
signal
(
0
);
Uint32
*
theData
=
signal
.
getDataPtrSend
();
Uint32
data
[
25
];
Uint32
sec0
[
70
];
Uint32
sec1
[
123
];
data
[
0
]
=
12
;
data
[
1
]
=
13
;
unsigned
i
;
for
(
i
=
0
;
i
<
70
;
i
++
)
sec0
[
i
]
=
i
;
for
(
i
=
0
;
i
<
123
;
i
++
)
sec1
[
i
]
=
70
+
i
;
signal
.
set
(
0
,
CMVMI
,
GSN_TESTSIG
,
3
);
signal
.
m_noOfSections
=
2
;
signal
.
m_fragmentInfo
=
1
;
LinearSectionPtr
ptr
[
3
];
theData
[
0
]
=
3
;
theData
[
1
]
=
0
;
theData
[
2
]
=
7
;
// FragmentId
ptr
[
0
].
sz
=
2
;
ptr
[
0
].
p
=
&
data
[
0
];
ptr
[
1
].
sz
=
60
;
ptr
[
1
].
p
=
&
sec0
[
0
];
tmp
.
theFacade
->
lock_mutex
();
tmp
.
theRegistry
->
prepareSend
(
&
signal
,
1
,
theData
,
processId
,
ptr
);
tmp
.
theFacade
->
unlock_mutex
();
signal
.
set
(
0
,
CMVMI
,
GSN_TESTSIG
,
3
);
signal
.
m_noOfSections
=
2
;
signal
.
m_fragmentInfo
=
3
;
theData
[
0
]
=
0
;
theData
[
1
]
=
1
;
theData
[
2
]
=
7
;
// FragmentId
ptr
[
0
].
sz
=
10
;
ptr
[
0
].
p
=
&
sec0
[
60
];
ptr
[
1
].
sz
=
123
;
ptr
[
1
].
p
=
&
sec1
[
0
];
tmp
.
theFacade
->
lock_mutex
();
tmp
.
theRegistry
->
prepareSend
(
&
signal
,
1
,
theData
,
processId
,
ptr
);
tmp
.
theFacade
->
unlock_mutex
();
}
ndb/src/mgmsrv/CommandInterpreter.hpp
View file @
5712bc55
...
@@ -130,7 +130,6 @@ public:
...
@@ -130,7 +130,6 @@ public:
void
executeStop
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeStop
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeStart
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeStart
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeRestart
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeRestart
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeLogLevel
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeError
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeError
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeTrace
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeTrace
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeLog
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeLog
(
int
processId
,
const
char
*
parameters
,
bool
all
);
...
@@ -140,14 +139,7 @@ public:
...
@@ -140,14 +139,7 @@ public:
void
executeTestOn
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeTestOn
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeTestOff
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeTestOff
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeStatus
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeStatus
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeEnterSingleUser
(
char
*
parameters
);
void
executeExitSingleUser
(
char
*
parameters
);
void
executeEventReporting
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeDumpState
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeDumpState
(
int
processId
,
const
char
*
parameters
,
bool
all
);
void
executeStartBackup
(
char
*
pars
);
void
executeAbortBackup
(
char
*
pars
);
void
jonas
(
int
processId
,
const
char
*
parameters
,
bool
all
);
/**
/**
* A execute function definition
* A execute function definition
...
...
ndb/src/ndbapi/Ndb.cpp
View file @
5712bc55
...
@@ -65,37 +65,25 @@ NdbConnection* Ndb::doConnect(Uint32 tConNode)
...
@@ -65,37 +65,25 @@ NdbConnection* Ndb::doConnect(Uint32 tConNode)
// We will connect to any node. Make sure that we have connections to all
// We will connect to any node. Make sure that we have connections to all
// nodes.
// nodes.
//****************************************************************************
//****************************************************************************
Uint32
tNoOfDbNodes
=
theNoOfDBnodes
;
Uint32
tNoOfDbNodes
=
theImpl
->
theNoOfDBnodes
;
i
=
theCurrentConnectIndex
;
Uint32
&
theCurrentConnectIndex
=
theImpl
->
theCurrentConnectIndex
;
UintR
Tcount
=
0
;
UintR
Tcount
=
0
;
do
{
do
{
if
(
i
>=
tNoOfDbNodes
)
{
theCurrentConnectIndex
++
;
i
=
0
;
if
(
theCurrentConnectIndex
>=
tNoOfDbNodes
)
{
theCurrentConnectIndex
=
0
;
}
//if
}
//if
Tcount
++
;
Tcount
++
;
tNode
=
the
DBnodes
[
i
];
tNode
=
the
Impl
->
theDBnodes
[
theCurrentConnectIndex
];
TretCode
=
NDB_connect
(
tNode
);
TretCode
=
NDB_connect
(
tNode
);
if
((
TretCode
==
1
)
||
(
TretCode
==
2
))
{
if
((
TretCode
==
1
)
||
(
TretCode
==
2
))
{
//****************************************************************************
//****************************************************************************
// We have connections now to the desired node. Return
// We have connections now to the desired node. Return
//****************************************************************************
//****************************************************************************
if
(
theCurrentConnectIndex
==
i
)
{
theCurrentConnectCounter
++
;
if
(
theCurrentConnectCounter
==
8
)
{
theCurrentConnectCounter
=
1
;
theCurrentConnectIndex
++
;
}
//if
}
else
{
// Set to 2 because we have already connected to a node
// when we get here.
theCurrentConnectCounter
=
2
;
theCurrentConnectIndex
=
i
;
}
//if
return
getConnectedNdbConnection
(
tNode
);
return
getConnectedNdbConnection
(
tNode
);
}
else
if
(
TretCode
!=
0
)
{
}
else
if
(
TretCode
!=
0
)
{
tAnyAlive
=
1
;
tAnyAlive
=
1
;
}
//if
}
//if
i
++
;
}
while
(
Tcount
<
tNoOfDbNodes
);
}
while
(
Tcount
<
tNoOfDbNodes
);
//****************************************************************************
//****************************************************************************
// We were unable to find a free connection. If no node alive we will report
// We were unable to find a free connection. If no node alive we will report
...
@@ -211,8 +199,9 @@ Ndb::doDisconnect()
...
@@ -211,8 +199,9 @@ Ndb::doDisconnect()
NdbConnection
*
tNdbCon
;
NdbConnection
*
tNdbCon
;
CHECK_STATUS_MACRO_VOID
;
CHECK_STATUS_MACRO_VOID
;
DBUG_PRINT
(
"info"
,
(
"theNoOfDBnodes=%d"
,
theNoOfDBnodes
));
Uint32
tNoOfDbNodes
=
theImpl
->
theNoOfDBnodes
;
Uint32
tNoOfDbNodes
=
theNoOfDBnodes
;
Uint8
*
theDBnodes
=
theImpl
->
theDBnodes
;
DBUG_PRINT
(
"info"
,
(
"theNoOfDBnodes=%d"
,
tNoOfDbNodes
));
UintR
i
;
UintR
i
;
for
(
i
=
0
;
i
<
tNoOfDbNodes
;
i
++
)
{
for
(
i
=
0
;
i
<
tNoOfDbNodes
;
i
++
)
{
Uint32
tNode
=
theDBnodes
[
i
];
Uint32
tNode
=
theDBnodes
[
i
];
...
@@ -259,8 +248,8 @@ Ndb::waitUntilReady(int timeout)
...
@@ -259,8 +248,8 @@ Ndb::waitUntilReady(int timeout)
unsigned
int
foundAliveNode
=
0
;
unsigned
int
foundAliveNode
=
0
;
TransporterFacade
*
tp
=
TransporterFacade
::
instance
();
TransporterFacade
*
tp
=
TransporterFacade
::
instance
();
tp
->
lock_mutex
();
tp
->
lock_mutex
();
for
(
unsigned
int
i
=
0
;
i
<
theNoOfDBnodes
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
the
Impl
->
the
NoOfDBnodes
;
i
++
)
{
const
NodeId
nodeId
=
theDBnodes
[
i
];
const
NodeId
nodeId
=
the
Impl
->
the
DBnodes
[
i
];
//************************************************
//************************************************
// If any node is answering, ndb is answering
// If any node is answering, ndb is answering
//************************************************
//************************************************
...
@@ -270,7 +259,7 @@ Ndb::waitUntilReady(int timeout)
...
@@ -270,7 +259,7 @@ Ndb::waitUntilReady(int timeout)
}
//for
}
//for
tp
->
unlock_mutex
();
tp
->
unlock_mutex
();
if
(
foundAliveNode
==
theNoOfDBnodes
)
{
if
(
foundAliveNode
==
the
Impl
->
the
NoOfDBnodes
)
{
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
//if
}
//if
if
(
foundAliveNode
>
0
)
{
if
(
foundAliveNode
>
0
)
{
...
@@ -1077,7 +1066,7 @@ Ndb::guessPrimaryNode(Uint32 fragmentId){
...
@@ -1077,7 +1066,7 @@ Ndb::guessPrimaryNode(Uint32 fragmentId){
void
void
Ndb
::
StartTransactionNodeSelectionData
::
init
(
Uint32
noOfNodes
,
Ndb
::
StartTransactionNodeSelectionData
::
init
(
Uint32
noOfNodes
,
Uint
32
nodeIds
[])
{
Uint
8
nodeIds
[])
{
kValue
=
6
;
kValue
=
6
;
noOfFragments
=
2
*
noOfNodes
;
noOfFragments
=
2
*
noOfNodes
;
...
...
ndb/src/ndbapi/NdbConnection.cpp
View file @
5712bc55
...
@@ -83,7 +83,7 @@ NdbConnection::NdbConnection( Ndb* aNdb ) :
...
@@ -83,7 +83,7 @@ NdbConnection::NdbConnection( Ndb* aNdb ) :
{
{
theListState
=
NotInList
;
theListState
=
NotInList
;
theError
.
code
=
0
;
theError
.
code
=
0
;
theId
=
theNdb
->
the
NdbObjectIdMap
->
map
(
this
);
theId
=
theNdb
->
the
Impl
->
theNdbObjectIdMap
.
map
(
this
);
#define CHECK_SZ(mask, sz) assert((sizeof(mask)/sizeof(mask[0])) == sz)
#define CHECK_SZ(mask, sz) assert((sizeof(mask)/sizeof(mask[0])) == sz)
...
@@ -99,7 +99,7 @@ Remark: Deletes the connection object.
...
@@ -99,7 +99,7 @@ Remark: Deletes the connection object.
NdbConnection
::~
NdbConnection
()
NdbConnection
::~
NdbConnection
()
{
{
DBUG_ENTER
(
"NdbConnection::~NdbConnection"
);
DBUG_ENTER
(
"NdbConnection::~NdbConnection"
);
theNdb
->
the
NdbObjectIdMap
->
unmap
(
theId
,
this
);
theNdb
->
the
Impl
->
theNdbObjectIdMap
.
unmap
(
theId
,
this
);
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
//NdbConnection::~NdbConnection()
}
//NdbConnection::~NdbConnection()
...
...
ndb/src/ndbapi/NdbImpl.hpp
View file @
5712bc55
...
@@ -17,7 +17,15 @@
...
@@ -17,7 +17,15 @@
#ifndef NDB_IMPL_HPP
#ifndef NDB_IMPL_HPP
#define NDB_IMPL_HPP
#define NDB_IMPL_HPP
#include <Vector.hpp>
#include <Ndb.hpp>
#include <NdbError.hpp>
#include <NdbCondition.h>
#include <NdbReceiver.hpp>
#include <NdbOperation.hpp>
#include <kernel/ndb_limits.h>
#include <NdbTick.h>
#include "ObjectMap.hpp"
#include "ObjectMap.hpp"
/**
/**
...
@@ -25,19 +33,20 @@
...
@@ -25,19 +33,20 @@
*/
*/
class
NdbImpl
{
class
NdbImpl
{
public:
public:
Vector
<
class
NdbTableImpl
*>
m_invalidTables
;
NdbImpl
();
~
NdbImpl
();
void
checkErrorCode
(
Uint32
i
);
// Ensure good distribution of connects
void
checkInvalidTable
(
class
NdbDictionaryImpl
*
dict
);
Uint32
theCurrentConnectIndex
;
};
#include <Ndb.hpp>
NdbObjectIdMap
theNdbObjectIdMap
;
#include <NdbError.hpp>
#include <NdbCondition.h>
#include <NdbReceiver.hpp>
#include <NdbOperation.hpp>
#include <NdbTick.h>
Uint32
theNoOfDBnodes
;
// The number of DB nodes
Uint8
theDBnodes
[
MAX_NDB_NODES
];
// The node number of the DB nodes
// 1 indicates to release all connections to node
Uint32
the_release_ind
[
MAX_NDB_NODES
];
};
#ifdef VM_TRACE
#ifdef VM_TRACE
#define TRACE_DEBUG(x) ndbout << x << endl;
#define TRACE_DEBUG(x) ndbout << x << endl;
...
@@ -57,7 +66,7 @@ public:
...
@@ -57,7 +66,7 @@ public:
inline
inline
void
*
void
*
Ndb
::
int2void
(
Uint32
val
){
Ndb
::
int2void
(
Uint32
val
){
return
the
NdbObjectIdMap
->
getObject
(
val
);
return
the
Impl
->
theNdbObjectIdMap
.
getObject
(
val
);
}
}
inline
inline
...
...
ndb/src/ndbapi/NdbReceiver.cpp
View file @
5712bc55
...
@@ -40,7 +40,7 @@ NdbReceiver::~NdbReceiver()
...
@@ -40,7 +40,7 @@ NdbReceiver::~NdbReceiver()
{
{
DBUG_ENTER
(
"NdbReceiver::~NdbReceiver"
);
DBUG_ENTER
(
"NdbReceiver::~NdbReceiver"
);
if
(
m_id
!=
NdbObjectIdMap
::
InvalidId
)
{
if
(
m_id
!=
NdbObjectIdMap
::
InvalidId
)
{
m_ndb
->
the
NdbObjectIdMap
->
unmap
(
m_id
,
this
);
m_ndb
->
the
Impl
->
theNdbObjectIdMap
.
unmap
(
m_id
,
this
);
}
}
delete
[]
m_rows
;
delete
[]
m_rows
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
...
@@ -54,7 +54,7 @@ NdbReceiver::init(ReceiverType type, void* owner)
...
@@ -54,7 +54,7 @@ NdbReceiver::init(ReceiverType type, void* owner)
m_owner
=
owner
;
m_owner
=
owner
;
if
(
m_id
==
NdbObjectIdMap
::
InvalidId
)
{
if
(
m_id
==
NdbObjectIdMap
::
InvalidId
)
{
if
(
m_ndb
)
if
(
m_ndb
)
m_id
=
m_ndb
->
the
NdbObjectIdMap
->
map
(
this
);
m_id
=
m_ndb
->
the
Impl
->
theNdbObjectIdMap
.
map
(
this
);
}
}
theFirstRecAttr
=
NULL
;
theFirstRecAttr
=
NULL
;
...
...
ndb/src/ndbapi/Ndbif.cpp
View file @
5712bc55
...
@@ -92,8 +92,8 @@ Ndb::init(int aMaxNoOfTransactions)
...
@@ -92,8 +92,8 @@ Ndb::init(int aMaxNoOfTransactions)
theDictionary
->
setTransporter
(
this
,
theFacade
);
theDictionary
->
setTransporter
(
this
,
theFacade
);
aNrOfCon
=
theNoOfDBnodes
;
aNrOfCon
=
the
Impl
->
the
NoOfDBnodes
;
aNrOfOp
=
2
*
theNoOfDBnodes
;
aNrOfOp
=
2
*
the
Impl
->
the
NoOfDBnodes
;
// Create connection object in a linked list
// Create connection object in a linked list
if
((
createConIdleList
(
aNrOfCon
))
==
-
1
){
if
((
createConIdleList
(
aNrOfCon
))
==
-
1
){
...
@@ -192,14 +192,14 @@ void Ndb::connected(Uint32 ref)
...
@@ -192,14 +192,14 @@ void Ndb::connected(Uint32 ref)
}
}
TransporterFacade
*
theFacade
=
TransporterFacade
::
instance
();
TransporterFacade
*
theFacade
=
TransporterFacade
::
instance
();
int
i
;
int
i
,
n
=
0
;
theNoOfDBnodes
=
0
;
for
(
i
=
1
;
i
<
MAX_NDB_NODES
;
i
++
){
for
(
i
=
1
;
i
<
MAX_NDB_NODES
;
i
++
){
if
(
theFacade
->
getIsDbNode
(
i
)){
if
(
theFacade
->
getIsDbNode
(
i
)){
the
DBnodes
[
theNoOfDBnodes
]
=
i
;
the
Impl
->
theDBnodes
[
n
]
=
i
;
theNoOfDBnodes
++
;
n
++
;
}
}
}
}
theImpl
->
theNoOfDBnodes
=
n
;
theFirstTransId
=
((
Uint64
)
tBlockNo
<<
52
)
+
theFirstTransId
=
((
Uint64
)
tBlockNo
<<
52
)
+
((
Uint64
)
tmpTheNode
<<
40
);
((
Uint64
)
tmpTheNode
<<
40
);
theFirstTransId
+=
theFacade
->
m_max_trans_id
;
theFirstTransId
+=
theFacade
->
m_max_trans_id
;
...
@@ -207,9 +207,10 @@ void Ndb::connected(Uint32 ref)
...
@@ -207,9 +207,10 @@ void Ndb::connected(Uint32 ref)
DBUG_PRINT
(
"info"
,(
"connected with ref=%x, id=%d, no_db_nodes=%d, first_trans_id=%lx"
,
DBUG_PRINT
(
"info"
,(
"connected with ref=%x, id=%d, no_db_nodes=%d, first_trans_id=%lx"
,
theMyRef
,
theMyRef
,
tmpTheNode
,
tmpTheNode
,
theNoOfDBnodes
,
the
Impl
->
the
NoOfDBnodes
,
theFirstTransId
));
theFirstTransId
));
startTransactionNodeSelectionData
.
init
(
theNoOfDBnodes
,
theDBnodes
);
startTransactionNodeSelectionData
.
init
(
theImpl
->
theNoOfDBnodes
,
theImpl
->
theDBnodes
);
theCommitAckSignal
=
new
NdbApiSignal
(
theMyRef
);
theCommitAckSignal
=
new
NdbApiSignal
(
theMyRef
);
theDictionary
->
m_receiver
.
m_reference
=
theMyRef
;
theDictionary
->
m_receiver
.
m_reference
=
theMyRef
;
...
@@ -247,7 +248,9 @@ Ndb::report_node_failure(Uint32 node_id)
...
@@ -247,7 +248,9 @@ Ndb::report_node_failure(Uint32 node_id)
*
*
* This method is only called by ClusterMgr (via lots of methods)
* This method is only called by ClusterMgr (via lots of methods)
*/
*/
the_release_ind
[
node_id
]
=
1
;
theImpl
->
the_release_ind
[
node_id
]
=
1
;
// must come after
theImpl
->
the_release_ind
[
0
]
=
1
;
theWaiter
.
nodeFail
(
node_id
);
theWaiter
.
nodeFail
(
node_id
);
return
;
return
;
}
//Ndb::report_node_failure()
}
//Ndb::report_node_failure()
...
...
ndb/src/ndbapi/Ndbinit.cpp
View file @
5712bc55
...
@@ -82,7 +82,6 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
...
@@ -82,7 +82,6 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
{
{
DBUG_ENTER
(
"Ndb::setup"
);
DBUG_ENTER
(
"Ndb::setup"
);
theNdbObjectIdMap
=
0
;
m_ndb_cluster_connection
=
ndb_cluster_connection
;
m_ndb_cluster_connection
=
ndb_cluster_connection
;
thePreparedTransactionsArray
=
NULL
;
thePreparedTransactionsArray
=
NULL
;
theSentTransactionsArray
=
NULL
;
theSentTransactionsArray
=
NULL
;
...
@@ -110,9 +109,6 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
...
@@ -110,9 +109,6 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
theCallList
=
NULL
;
theCallList
=
NULL
;
theScanList
=
NULL
;
theScanList
=
NULL
;
theNdbBlobIdleList
=
NULL
;
theNdbBlobIdleList
=
NULL
;
theNoOfDBnodes
=
0
;
theDBnodes
=
NULL
;
the_release_ind
=
NULL
;
the_last_check_time
=
0
;
the_last_check_time
=
0
;
theFirstTransId
=
0
;
theFirstTransId
=
0
;
theRestartGCI
=
0
;
theRestartGCI
=
0
;
...
@@ -134,19 +130,12 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
...
@@ -134,19 +130,12 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
theError
.
code
=
0
;
theError
.
code
=
0
;
theNdbObjectIdMap
=
new
NdbObjectIdMap
(
1024
,
1024
);
theConnectionArray
=
new
NdbConnection
*
[
MAX_NDB_NODES
];
theConnectionArray
=
new
NdbConnection
*
[
MAX_NDB_NODES
];
theDBnodes
=
new
Uint32
[
MAX_NDB_NODES
];
the_release_ind
=
new
Uint8
[
MAX_NDB_NODES
];
theCommitAckSignal
=
NULL
;
theCommitAckSignal
=
NULL
;
theCurrentConnectCounter
=
1
;
theCurrentConnectIndex
=
0
;
int
i
;
int
i
;
for
(
i
=
0
;
i
<
MAX_NDB_NODES
;
i
++
)
{
for
(
i
=
0
;
i
<
MAX_NDB_NODES
;
i
++
)
{
theConnectionArray
[
i
]
=
NULL
;
theConnectionArray
[
i
]
=
NULL
;
the_release_ind
[
i
]
=
0
;
theDBnodes
[
i
]
=
0
;
}
//forg
}
//forg
for
(
i
=
0
;
i
<
2048
;
i
++
)
{
for
(
i
=
0
;
i
<
2048
;
i
++
)
{
theFirstTupleId
[
i
]
=
0
;
theFirstTupleId
[
i
]
=
0
;
...
@@ -213,7 +202,6 @@ Ndb::~Ndb()
...
@@ -213,7 +202,6 @@ Ndb::~Ndb()
doDisconnect
();
doDisconnect
();
delete
theDictionary
;
delete
theDictionary
;
delete
theImpl
;
NdbGlobalEventBuffer_drop
(
theGlobalEventBufferHandle
);
NdbGlobalEventBuffer_drop
(
theGlobalEventBufferHandle
);
...
@@ -260,15 +248,12 @@ Ndb::~Ndb()
...
@@ -260,15 +248,12 @@ Ndb::~Ndb()
startTransactionNodeSelectionData
.
release
();
startTransactionNodeSelectionData
.
release
();
delete
[]
theConnectionArray
;
delete
[]
theConnectionArray
;
delete
[]
theDBnodes
;
delete
[]
the_release_ind
;
if
(
theCommitAckSignal
!=
NULL
){
if
(
theCommitAckSignal
!=
NULL
){
delete
theCommitAckSignal
;
delete
theCommitAckSignal
;
theCommitAckSignal
=
NULL
;
theCommitAckSignal
=
NULL
;
}
}
if
(
theNdbObjectIdMap
!=
0
)
delete
theImpl
;
delete
theNdbObjectIdMap
;
/**
/**
* This sleep is to make sure that the transporter
* This sleep is to make sure that the transporter
...
@@ -307,4 +292,17 @@ NdbWaiter::~NdbWaiter(){
...
@@ -307,4 +292,17 @@ NdbWaiter::~NdbWaiter(){
NdbCondition_Destroy
(
m_condition
);
NdbCondition_Destroy
(
m_condition
);
}
}
NdbImpl
::
NdbImpl
()
:
theNdbObjectIdMap
(
1024
,
1024
),
theCurrentConnectIndex
(
0
),
theNoOfDBnodes
(
0
)
{
int
i
;
for
(
i
=
0
;
i
<
MAX_NDB_NODES
;
i
++
)
{
the_release_ind
[
i
]
=
0
;
}
}
NdbImpl
::~
NdbImpl
()
{
}
ndb/src/ndbapi/Ndblist.cpp
View file @
5712bc55
...
@@ -30,10 +30,18 @@ void
...
@@ -30,10 +30,18 @@ void
Ndb
::
checkFailedNode
()
Ndb
::
checkFailedNode
()
{
{
DBUG_ENTER
(
"Ndb::checkFailedNode"
);
DBUG_ENTER
(
"Ndb::checkFailedNode"
);
DBUG_PRINT
(
"enter"
,
(
"theNoOfDBnodes: %d"
,
theNoOfDBnodes
));
Uint32
*
the_release_ind
=
theImpl
->
the_release_ind
;
if
(
the_release_ind
[
0
]
==
0
)
{
DBUG_VOID_RETURN
;
}
Uint32
tNoOfDbNodes
=
theImpl
->
theNoOfDBnodes
;
Uint8
*
theDBnodes
=
theImpl
->
theDBnodes
;
DBUG_PRINT
(
"enter"
,
(
"theNoOfDBnodes: %d"
,
tNoOfDbNodes
));
DBUG_ASSERT
(
t
heNoOfDBn
odes
<
MAX_NDB_NODES
);
DBUG_ASSERT
(
t
NoOfDbN
odes
<
MAX_NDB_NODES
);
for
(
Uint32
i
=
0
;
i
<
t
heNoOfDBn
odes
;
i
++
){
for
(
Uint32
i
=
0
;
i
<
t
NoOfDbN
odes
;
i
++
){
const
NodeId
node_id
=
theDBnodes
[
i
];
const
NodeId
node_id
=
theDBnodes
[
i
];
DBUG_PRINT
(
"info"
,
(
"i: %d, node_id: %d"
,
i
,
node_id
));
DBUG_PRINT
(
"info"
,
(
"i: %d, node_id: %d"
,
i
,
node_id
));
...
@@ -56,31 +64,6 @@ Ndb::checkFailedNode()
...
@@ -56,31 +64,6 @@ Ndb::checkFailedNode()
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
#if 0
void
NdbImpl::checkInvalidTable(NdbDictionaryImpl * dict){
Uint32 sz = m_invalidTables.size();
for(Int32 i = sz - 1; i >= 0; i--){
NdbTableImpl * tab = m_invalidTables[i];
m_invalidTables.erase(i);
dict->tableDropped(* tab);
}
}
void
NdbImpl::checkErrorCode(Uint32 i, NdbTableImpl * tab){
switch(i){
case 241:
case 283:
case 284:
case 285:
case 1225:
case 1226:
}
}
#endif
/***************************************************************************
/***************************************************************************
* int createConIdleList(int aNrOfCon);
* int createConIdleList(int aNrOfCon);
*
*
...
...
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