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
9be420ee
Commit
9be420ee
authored
Jul 14, 2005
by
tomas@poseidon.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stilled mem leak in usage on getVersionString
added __LINE__ so systemErrorLab for better error printout
parent
96a80fd2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
37 deletions
+48
-37
ndb/include/ndb_version.h.in
ndb/include/ndb_version.h.in
+10
-2
ndb/include/util/version.h
ndb/include/util/version.h
+2
-1
ndb/src/common/util/version.c
ndb/src/common/util/version.c
+7
-5
ndb/src/kernel/blocks/qmgr/Qmgr.hpp
ndb/src/kernel/blocks/qmgr/Qmgr.hpp
+2
-2
ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
+25
-26
ndb/tools/restore/restore_main.cpp
ndb/tools/restore/restore_main.cpp
+2
-1
No files found.
ndb/include/ndb_version.h.in
View file @
9be420ee
...
@@ -36,8 +36,16 @@
...
@@ -36,8 +36,16 @@
#define MAKE_VERSION(A,B,C) (((A) << 16) | ((B) << 8) | ((C) << 0))
#define MAKE_VERSION(A,B,C) (((A) << 16) | ((B) << 8) | ((C) << 0))
#define NDB_VERSION_D MAKE_VERSION(NDB_VERSION_MAJOR, NDB_VERSION_MINOR, NDB_VERSION_BUILD)
#define NDB_VERSION_D MAKE_VERSION(NDB_VERSION_MAJOR, NDB_VERSION_MINOR, NDB_VERSION_BUILD)
#define NDB_VERSION_STRING_BUF_SZ 100
#define NDB_VERSION_STRING (getVersionString(NDB_VERSION, NDB_VERSION_STATUS))
#ifdef __cplusplus
extern "C"
#else
extern
#endif
char ndb_version_string_buf[NDB_VERSION_STRING_BUF_SZ];
#define NDB_VERSION_STRING (getVersionString(NDB_VERSION, NDB_VERSION_STATUS, \
ndb_version_string_buf, \
sizeof(ndb_version_string_buf)))
#define NDB_VERSION ndbGetOwnVersion()
#define NDB_VERSION ndbGetOwnVersion()
...
...
ndb/include/util/version.h
View file @
9be420ee
...
@@ -30,7 +30,8 @@ extern "C" {
...
@@ -30,7 +30,8 @@ extern "C" {
Uint32
makeVersion
(
Uint32
major
,
Uint32
minor
,
Uint32
build
);
Uint32
makeVersion
(
Uint32
major
,
Uint32
minor
,
Uint32
build
);
const
char
*
getVersionString
(
Uint32
version
,
const
char
*
status
);
const
char
*
getVersionString
(
Uint32
version
,
const
char
*
status
,
char
*
buf
,
unsigned
sz
);
void
ndbPrintVersion
();
void
ndbPrintVersion
();
Uint32
ndbGetOwnVersion
();
Uint32
ndbGetOwnVersion
();
...
...
ndb/src/common/util/version.c
View file @
9be420ee
...
@@ -38,22 +38,24 @@ Uint32 makeVersion(Uint32 major, Uint32 minor, Uint32 build) {
...
@@ -38,22 +38,24 @@ Uint32 makeVersion(Uint32 major, Uint32 minor, Uint32 build) {
}
}
const
char
*
getVersionString
(
Uint32
version
,
const
char
*
status
)
{
char
ndb_version_string_buf
[
NDB_VERSION_STRING_BUF_SZ
];
char
buff
[
100
];
const
char
*
getVersionString
(
Uint32
version
,
const
char
*
status
,
char
*
buf
,
unsigned
sz
)
{
if
(
status
&&
status
[
0
]
!=
0
)
if
(
status
&&
status
[
0
]
!=
0
)
basestring_snprintf
(
buf
f
,
sizeof
(
buff
)
,
basestring_snprintf
(
buf
,
sz
,
"Version %d.%d.%d (%s)"
,
"Version %d.%d.%d (%s)"
,
getMajor
(
version
),
getMajor
(
version
),
getMinor
(
version
),
getMinor
(
version
),
getBuild
(
version
),
getBuild
(
version
),
status
);
status
);
else
else
basestring_snprintf
(
buf
f
,
sizeof
(
buff
)
,
basestring_snprintf
(
buf
,
sz
,
"Version %d.%d.%d"
,
"Version %d.%d.%d"
,
getMajor
(
version
),
getMajor
(
version
),
getMinor
(
version
),
getMinor
(
version
),
getBuild
(
version
));
getBuild
(
version
));
return
strdup
(
buff
)
;
return
buf
;
}
}
typedef
enum
{
typedef
enum
{
...
...
ndb/src/kernel/blocks/qmgr/Qmgr.hpp
View file @
9be420ee
...
@@ -257,8 +257,8 @@ private:
...
@@ -257,8 +257,8 @@ private:
void
hbReceivedLab
(
Signal
*
signal
);
void
hbReceivedLab
(
Signal
*
signal
);
void
sendCmRegrefLab
(
Signal
*
signal
,
BlockReference
ref
,
void
sendCmRegrefLab
(
Signal
*
signal
,
BlockReference
ref
,
CmRegRef
::
ErrorCode
);
CmRegRef
::
ErrorCode
);
void
systemErrorBecauseOtherNodeFailed
(
Signal
*
signal
,
NodeId
);
void
systemErrorBecauseOtherNodeFailed
(
Signal
*
signal
,
Uint32
line
,
NodeId
);
void
systemErrorLab
(
Signal
*
signal
,
void
systemErrorLab
(
Signal
*
signal
,
Uint32
line
,
const
char
*
message
=
NULL
);
const
char
*
message
=
NULL
);
void
prepFailReqLab
(
Signal
*
signal
);
void
prepFailReqLab
(
Signal
*
signal
);
void
prepFailConfLab
(
Signal
*
signal
);
void
prepFailConfLab
(
Signal
*
signal
);
...
...
ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
View file @
9be420ee
...
@@ -76,7 +76,7 @@ void Qmgr::execCM_HEARTBEAT(Signal* signal)
...
@@ -76,7 +76,7 @@ void Qmgr::execCM_HEARTBEAT(Signal* signal)
void
Qmgr
::
execCM_NODEINFOREF
(
Signal
*
signal
)
void
Qmgr
::
execCM_NODEINFOREF
(
Signal
*
signal
)
{
{
jamEntry
();
jamEntry
();
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
return
;
return
;
}
//Qmgr::execCM_NODEINFOREF()
}
//Qmgr::execCM_NODEINFOREF()
...
@@ -121,7 +121,7 @@ void Qmgr::execCONTINUEB(Signal* signal)
...
@@ -121,7 +121,7 @@ void Qmgr::execCONTINUEB(Signal* signal)
default:
default:
jam
();
jam
();
// ZCOULD_NOT_OCCUR_ERROR;
// ZCOULD_NOT_OCCUR_ERROR;
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
return
;
return
;
break
;
break
;
}
//switch
}
//switch
...
@@ -593,7 +593,7 @@ void Qmgr::execCM_REGCONF(Signal* signal)
...
@@ -593,7 +593,7 @@ void Qmgr::execCM_REGCONF(Signal* signal)
jam
();
jam
();
char
buf
[
128
];
char
buf
[
128
];
BaseString
::
snprintf
(
buf
,
sizeof
(
buf
),
"incompatible version own=0x%x other=0x%x, shutting down"
,
NDB_VERSION
,
cmRegConf
->
presidentVersion
);
BaseString
::
snprintf
(
buf
,
sizeof
(
buf
),
"incompatible version own=0x%x other=0x%x, shutting down"
,
NDB_VERSION
,
cmRegConf
->
presidentVersion
);
systemErrorLab
(
signal
,
buf
);
systemErrorLab
(
signal
,
__LINE__
,
buf
);
return
;
return
;
}
}
...
@@ -688,7 +688,7 @@ void Qmgr::execCM_REGREF(Signal* signal)
...
@@ -688,7 +688,7 @@ void Qmgr::execCM_REGREF(Signal* signal)
switch
(
TrefuseReason
)
{
switch
(
TrefuseReason
)
{
case
CmRegRef
:
:
ZINCOMPATIBLE_VERSION
:
case
CmRegRef
:
:
ZINCOMPATIBLE_VERSION
:
jam
();
jam
();
systemErrorLab
(
signal
,
"incompatible version, connection refused by running ndb node"
);
systemErrorLab
(
signal
,
__LINE__
,
"incompatible version, connection refused by running ndb node"
);
break
;
break
;
case
CmRegRef
:
:
ZBUSY
:
case
CmRegRef
:
:
ZBUSY
:
case
CmRegRef
:
:
ZBUSY_TO_PRES
:
case
CmRegRef
:
:
ZBUSY_TO_PRES
:
...
@@ -1751,7 +1751,7 @@ void Qmgr::execAPI_FAILCONF(Signal* signal)
...
@@ -1751,7 +1751,7 @@ void Qmgr::execAPI_FAILCONF(Signal* signal)
if
(
failedNodePtr
.
p
->
rcv
[
0
]
==
failedNodePtr
.
p
->
rcv
[
1
])
{
if
(
failedNodePtr
.
p
->
rcv
[
0
]
==
failedNodePtr
.
p
->
rcv
[
1
])
{
jam
();
jam
();
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
}
else
{
}
else
{
jam
();
jam
();
failedNodePtr
.
p
->
rcv
[
0
]
=
0
;
failedNodePtr
.
p
->
rcv
[
0
]
=
0
;
...
@@ -1763,7 +1763,7 @@ void Qmgr::execAPI_FAILCONF(Signal* signal)
...
@@ -1763,7 +1763,7 @@ void Qmgr::execAPI_FAILCONF(Signal* signal)
ndbout
<<
"failedNodePtr.p->failState = "
ndbout
<<
"failedNodePtr.p->failState = "
<<
(
Uint32
)(
failedNodePtr
.
p
->
failState
)
<<
endl
;
<<
(
Uint32
)(
failedNodePtr
.
p
->
failState
)
<<
endl
;
#endif
#endif
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
}
//if
}
//if
return
;
return
;
}
//Qmgr::execAPI_FAILCONF()
}
//Qmgr::execAPI_FAILCONF()
...
@@ -1780,7 +1780,7 @@ void Qmgr::execNDB_FAILCONF(Signal* signal)
...
@@ -1780,7 +1780,7 @@ void Qmgr::execNDB_FAILCONF(Signal* signal)
failedNodePtr
.
p
->
failState
=
NORMAL
;
failedNodePtr
.
p
->
failState
=
NORMAL
;
}
else
{
}
else
{
jam
();
jam
();
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
}
//if
}
//if
if
(
cpresident
==
getOwnNodeId
())
{
if
(
cpresident
==
getOwnNodeId
())
{
jam
();
jam
();
...
@@ -1931,20 +1931,13 @@ void Qmgr::execAPI_REGREQ(Signal* signal)
...
@@ -1931,20 +1931,13 @@ void Qmgr::execAPI_REGREQ(Signal* signal)
#endif
#endif
bool
compatability_check
;
bool
compatability_check
;
switch
(
getNodeInfo
(
apiNodePtr
.
i
).
getType
()){
NodeInfo
::
NodeType
type
=
getNodeInfo
(
apiNodePtr
.
i
).
getType
();
switch
(
type
){
case
NodeInfo
:
:
API
:
case
NodeInfo
:
:
API
:
compatability_check
=
ndbCompatible_ndb_api
(
NDB_VERSION
,
version
);
compatability_check
=
ndbCompatible_ndb_api
(
NDB_VERSION
,
version
);
if
(
!
compatability_check
)
infoEvent
(
"Connection attempt from api or mysqld id=%d with %s "
"incompatible with %s"
,
apiNodePtr
.
i
,
getVersionString
(
version
,
""
),
NDB_VERSION_STRING
);
break
;
break
;
case
NodeInfo
:
:
MGM
:
case
NodeInfo
:
:
MGM
:
compatability_check
=
ndbCompatible_ndb_mgmt
(
NDB_VERSION
,
version
);
compatability_check
=
ndbCompatible_ndb_mgmt
(
NDB_VERSION
,
version
);
if
(
!
compatability_check
)
infoEvent
(
"Connection attempt from management server id=%d with %s "
"incompatible with %s"
,
apiNodePtr
.
i
,
getVersionString
(
version
,
""
),
NDB_VERSION_STRING
);
break
;
break
;
case
NodeInfo
:
:
REP
:
case
NodeInfo
:
:
REP
:
// compatability_check = ndbCompatible_ndb_api(NDB_VERSION, version);
// compatability_check = ndbCompatible_ndb_api(NDB_VERSION, version);
...
@@ -1953,13 +1946,19 @@ void Qmgr::execAPI_REGREQ(Signal* signal)
...
@@ -1953,13 +1946,19 @@ void Qmgr::execAPI_REGREQ(Signal* signal)
case
NodeInfo
:
:
INVALID
:
case
NodeInfo
:
:
INVALID
:
default:
default:
sendApiRegRef
(
signal
,
ref
,
ApiRegRef
::
WrongType
);
sendApiRegRef
(
signal
,
ref
,
ApiRegRef
::
WrongType
);
infoEvent
(
"Invalid connection attempt with type %d"
,
infoEvent
(
"Invalid connection attempt with type %d"
,
type
);
getNodeInfo
(
apiNodePtr
.
i
).
getType
());
return
;
return
;
}
}
if
(
!
compatability_check
)
{
if
(
!
compatability_check
)
{
jam
();
jam
();
char
buf
[
NDB_VERSION_STRING_BUF_SZ
];
infoEvent
(
"Connection attempt from %s id=%d with %s "
"incompatible with %s"
,
type
==
NodeInfo
::
API
?
"api or mysqld"
:
"management server"
,
apiNodePtr
.
i
,
getVersionString
(
version
,
""
,
buf
,
sizeof
(
buf
)),
NDB_VERSION_STRING
);
apiNodePtr
.
p
->
phase
=
ZAPI_INACTIVE
;
apiNodePtr
.
p
->
phase
=
ZAPI_INACTIVE
;
sendApiRegRef
(
signal
,
ref
,
ApiRegRef
::
UnsupportedVersion
);
sendApiRegRef
(
signal
,
ref
,
ApiRegRef
::
UnsupportedVersion
);
return
;
return
;
...
@@ -2085,7 +2084,7 @@ void Qmgr::failReportLab(Signal* signal, Uint16 aFailedNode,
...
@@ -2085,7 +2084,7 @@ void Qmgr::failReportLab(Signal* signal, Uint16 aFailedNode,
ptrCheckGuard
(
failedNodePtr
,
MAX_NODES
,
nodeRec
);
ptrCheckGuard
(
failedNodePtr
,
MAX_NODES
,
nodeRec
);
if
(
failedNodePtr
.
i
==
getOwnNodeId
())
{
if
(
failedNodePtr
.
i
==
getOwnNodeId
())
{
jam
();
jam
();
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
return
;
return
;
}
//if
}
//if
...
@@ -2093,7 +2092,7 @@ void Qmgr::failReportLab(Signal* signal, Uint16 aFailedNode,
...
@@ -2093,7 +2092,7 @@ void Qmgr::failReportLab(Signal* signal, Uint16 aFailedNode,
ptrCheckGuard
(
myNodePtr
,
MAX_NDB_NODES
,
nodeRec
);
ptrCheckGuard
(
myNodePtr
,
MAX_NDB_NODES
,
nodeRec
);
if
(
myNodePtr
.
p
->
phase
!=
ZRUNNING
)
{
if
(
myNodePtr
.
p
->
phase
!=
ZRUNNING
)
{
jam
();
jam
();
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
return
;
return
;
}
//if
}
//if
TnoFailedNodes
=
cnoFailedNodes
;
TnoFailedNodes
=
cnoFailedNodes
;
...
@@ -2172,7 +2171,7 @@ void Qmgr::execPREP_FAILREQ(Signal* signal)
...
@@ -2172,7 +2171,7 @@ void Qmgr::execPREP_FAILREQ(Signal* signal)
ptrCheckGuard
(
myNodePtr
,
MAX_NDB_NODES
,
nodeRec
);
ptrCheckGuard
(
myNodePtr
,
MAX_NDB_NODES
,
nodeRec
);
if
(
myNodePtr
.
p
->
phase
!=
ZRUNNING
)
{
if
(
myNodePtr
.
p
->
phase
!=
ZRUNNING
)
{
jam
();
jam
();
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
return
;
return
;
}
//if
}
//if
...
@@ -2675,7 +2674,7 @@ void Qmgr::execREAD_NODESREQ(Signal* signal)
...
@@ -2675,7 +2674,7 @@ void Qmgr::execREAD_NODESREQ(Signal* signal)
ReadNodesConf
::
SignalLength
,
JBB
);
ReadNodesConf
::
SignalLength
,
JBB
);
}
//Qmgr::execREAD_NODESREQ()
}
//Qmgr::execREAD_NODESREQ()
void
Qmgr
::
systemErrorBecauseOtherNodeFailed
(
Signal
*
signal
,
void
Qmgr
::
systemErrorBecauseOtherNodeFailed
(
Signal
*
signal
,
Uint32
line
,
NodeId
failedNodeId
)
{
NodeId
failedNodeId
)
{
jam
();
jam
();
...
@@ -2687,11 +2686,11 @@ void Qmgr::systemErrorBecauseOtherNodeFailed(Signal* signal,
...
@@ -2687,11 +2686,11 @@ void Qmgr::systemErrorBecauseOtherNodeFailed(Signal* signal,
"Node was shutdown during startup because node %d failed"
,
"Node was shutdown during startup because node %d failed"
,
failedNodeId
);
failedNodeId
);
progError
(
__LINE__
,
ERR_SR_OTHERNODEFAILED
,
buf
);
progError
(
line
,
ERR_SR_OTHERNODEFAILED
,
buf
);
}
}
void
Qmgr
::
systemErrorLab
(
Signal
*
signal
,
const
char
*
message
)
void
Qmgr
::
systemErrorLab
(
Signal
*
signal
,
Uint32
line
,
const
char
*
message
)
{
{
jam
();
jam
();
// Broadcast that this node is failing to other nodes
// Broadcast that this node is failing to other nodes
...
@@ -2699,7 +2698,7 @@ void Qmgr::systemErrorLab(Signal* signal, const char * message)
...
@@ -2699,7 +2698,7 @@ void Qmgr::systemErrorLab(Signal* signal, const char * message)
// If it's known why shutdown occured
// If it's known why shutdown occured
// an error message has been passed to this function
// an error message has been passed to this function
progError
(
__LINE__
,
0
,
message
);
progError
(
line
,
0
,
message
);
return
;
return
;
}
//Qmgr::systemErrorLab()
}
//Qmgr::systemErrorLab()
...
@@ -2867,7 +2866,7 @@ Uint16 Qmgr::translateDynamicIdToNodeId(Signal* signal, UintR TdynamicId)
...
@@ -2867,7 +2866,7 @@ Uint16 Qmgr::translateDynamicIdToNodeId(Signal* signal, UintR TdynamicId)
}
//for
}
//for
if
(
TtdiNodeId
==
ZNIL
)
{
if
(
TtdiNodeId
==
ZNIL
)
{
jam
();
jam
();
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
}
//if
}
//if
return
TtdiNodeId
;
return
TtdiNodeId
;
}
//Qmgr::translateDynamicIdToNodeId()
}
//Qmgr::translateDynamicIdToNodeId()
...
...
ndb/tools/restore/restore_main.cpp
View file @
9be420ee
...
@@ -251,8 +251,9 @@ main(int argc, char** argv)
...
@@ -251,8 +251,9 @@ main(int argc, char** argv)
const
BackupFormat
::
FileHeader
&
tmp
=
metaData
.
getFileHeader
();
const
BackupFormat
::
FileHeader
&
tmp
=
metaData
.
getFileHeader
();
const
Uint32
version
=
tmp
.
NdbVersion
;
const
Uint32
version
=
tmp
.
NdbVersion
;
char
buf
[
NDB_VERSION_STRING_BUF_SZ
];
ndbout
<<
"Ndb version in backup files: "
ndbout
<<
"Ndb version in backup files: "
<<
getVersionString
(
version
,
0
)
<<
endl
;
<<
getVersionString
(
version
,
0
,
buf
,
sizeof
(
buf
)
)
<<
endl
;
/**
/**
* check wheater we can restore the backup (right version).
* check wheater we can restore the backup (right version).
...
...
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