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 @@
#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_STRING (getVersionString(NDB_VERSION, NDB_VERSION_STATUS))
#define NDB_VERSION_STRING_BUF_SZ 100
#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()
...
...
ndb/include/util/version.h
View file @
9be420ee
...
...
@@ -30,7 +30,8 @@ extern "C" {
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
();
Uint32
ndbGetOwnVersion
();
...
...
ndb/src/common/util/version.c
View file @
9be420ee
...
...
@@ -38,22 +38,24 @@ Uint32 makeVersion(Uint32 major, Uint32 minor, Uint32 build) {
}
const
char
*
getVersionString
(
Uint32
version
,
const
char
*
status
)
{
char
buff
[
100
];
char
ndb_version_string_buf
[
NDB_VERSION_STRING_BUF_SZ
];
const
char
*
getVersionString
(
Uint32
version
,
const
char
*
status
,
char
*
buf
,
unsigned
sz
)
{
if
(
status
&&
status
[
0
]
!=
0
)
basestring_snprintf
(
buf
f
,
sizeof
(
buff
)
,
basestring_snprintf
(
buf
,
sz
,
"Version %d.%d.%d (%s)"
,
getMajor
(
version
),
getMinor
(
version
),
getBuild
(
version
),
status
);
else
basestring_snprintf
(
buf
f
,
sizeof
(
buff
)
,
basestring_snprintf
(
buf
,
sz
,
"Version %d.%d.%d"
,
getMajor
(
version
),
getMinor
(
version
),
getBuild
(
version
));
return
strdup
(
buff
)
;
return
buf
;
}
typedef
enum
{
...
...
ndb/src/kernel/blocks/qmgr/Qmgr.hpp
View file @
9be420ee
...
...
@@ -257,8 +257,8 @@ private:
void
hbReceivedLab
(
Signal
*
signal
);
void
sendCmRegrefLab
(
Signal
*
signal
,
BlockReference
ref
,
CmRegRef
::
ErrorCode
);
void
systemErrorBecauseOtherNodeFailed
(
Signal
*
signal
,
NodeId
);
void
systemErrorLab
(
Signal
*
signal
,
void
systemErrorBecauseOtherNodeFailed
(
Signal
*
signal
,
Uint32
line
,
NodeId
);
void
systemErrorLab
(
Signal
*
signal
,
Uint32
line
,
const
char
*
message
=
NULL
);
void
prepFailReqLab
(
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)
void
Qmgr
::
execCM_NODEINFOREF
(
Signal
*
signal
)
{
jamEntry
();
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
return
;
}
//Qmgr::execCM_NODEINFOREF()
...
...
@@ -121,7 +121,7 @@ void Qmgr::execCONTINUEB(Signal* signal)
default:
jam
();
// ZCOULD_NOT_OCCUR_ERROR;
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
return
;
break
;
}
//switch
...
...
@@ -593,7 +593,7 @@ void Qmgr::execCM_REGCONF(Signal* signal)
jam
();
char
buf
[
128
];
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
;
}
...
...
@@ -688,7 +688,7 @@ void Qmgr::execCM_REGREF(Signal* signal)
switch
(
TrefuseReason
)
{
case
CmRegRef
:
:
ZINCOMPATIBLE_VERSION
:
jam
();
systemErrorLab
(
signal
,
"incompatible version, connection refused by running ndb node"
);
systemErrorLab
(
signal
,
__LINE__
,
"incompatible version, connection refused by running ndb node"
);
break
;
case
CmRegRef
:
:
ZBUSY
:
case
CmRegRef
:
:
ZBUSY_TO_PRES
:
...
...
@@ -1751,7 +1751,7 @@ void Qmgr::execAPI_FAILCONF(Signal* signal)
if
(
failedNodePtr
.
p
->
rcv
[
0
]
==
failedNodePtr
.
p
->
rcv
[
1
])
{
jam
();
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
}
else
{
jam
();
failedNodePtr
.
p
->
rcv
[
0
]
=
0
;
...
...
@@ -1763,7 +1763,7 @@ void Qmgr::execAPI_FAILCONF(Signal* signal)
ndbout
<<
"failedNodePtr.p->failState = "
<<
(
Uint32
)(
failedNodePtr
.
p
->
failState
)
<<
endl
;
#endif
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
}
//if
return
;
}
//Qmgr::execAPI_FAILCONF()
...
...
@@ -1780,7 +1780,7 @@ void Qmgr::execNDB_FAILCONF(Signal* signal)
failedNodePtr
.
p
->
failState
=
NORMAL
;
}
else
{
jam
();
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
}
//if
if
(
cpresident
==
getOwnNodeId
())
{
jam
();
...
...
@@ -1931,20 +1931,13 @@ void Qmgr::execAPI_REGREQ(Signal* signal)
#endif
bool
compatability_check
;
switch
(
getNodeInfo
(
apiNodePtr
.
i
).
getType
()){
NodeInfo
::
NodeType
type
=
getNodeInfo
(
apiNodePtr
.
i
).
getType
();
switch
(
type
){
case
NodeInfo
:
:
API
:
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
;
case
NodeInfo
:
:
MGM
:
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
;
case
NodeInfo
:
:
REP
:
// compatability_check = ndbCompatible_ndb_api(NDB_VERSION, version);
...
...
@@ -1953,13 +1946,19 @@ void Qmgr::execAPI_REGREQ(Signal* signal)
case
NodeInfo
:
:
INVALID
:
default:
sendApiRegRef
(
signal
,
ref
,
ApiRegRef
::
WrongType
);
infoEvent
(
"Invalid connection attempt with type %d"
,
getNodeInfo
(
apiNodePtr
.
i
).
getType
());
infoEvent
(
"Invalid connection attempt with type %d"
,
type
);
return
;
}
if
(
!
compatability_check
)
{
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
;
sendApiRegRef
(
signal
,
ref
,
ApiRegRef
::
UnsupportedVersion
);
return
;
...
...
@@ -2085,7 +2084,7 @@ void Qmgr::failReportLab(Signal* signal, Uint16 aFailedNode,
ptrCheckGuard
(
failedNodePtr
,
MAX_NODES
,
nodeRec
);
if
(
failedNodePtr
.
i
==
getOwnNodeId
())
{
jam
();
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
return
;
}
//if
...
...
@@ -2093,7 +2092,7 @@ void Qmgr::failReportLab(Signal* signal, Uint16 aFailedNode,
ptrCheckGuard
(
myNodePtr
,
MAX_NDB_NODES
,
nodeRec
);
if
(
myNodePtr
.
p
->
phase
!=
ZRUNNING
)
{
jam
();
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
return
;
}
//if
TnoFailedNodes
=
cnoFailedNodes
;
...
...
@@ -2172,7 +2171,7 @@ void Qmgr::execPREP_FAILREQ(Signal* signal)
ptrCheckGuard
(
myNodePtr
,
MAX_NDB_NODES
,
nodeRec
);
if
(
myNodePtr
.
p
->
phase
!=
ZRUNNING
)
{
jam
();
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
return
;
}
//if
...
...
@@ -2675,7 +2674,7 @@ void Qmgr::execREAD_NODESREQ(Signal* signal)
ReadNodesConf
::
SignalLength
,
JBB
);
}
//Qmgr::execREAD_NODESREQ()
void
Qmgr
::
systemErrorBecauseOtherNodeFailed
(
Signal
*
signal
,
void
Qmgr
::
systemErrorBecauseOtherNodeFailed
(
Signal
*
signal
,
Uint32
line
,
NodeId
failedNodeId
)
{
jam
();
...
...
@@ -2687,11 +2686,11 @@ void Qmgr::systemErrorBecauseOtherNodeFailed(Signal* signal,
"Node was shutdown during startup because node %d failed"
,
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
();
// Broadcast that this node is failing to other nodes
...
...
@@ -2699,7 +2698,7 @@ void Qmgr::systemErrorLab(Signal* signal, const char * message)
// If it's known why shutdown occured
// an error message has been passed to this function
progError
(
__LINE__
,
0
,
message
);
progError
(
line
,
0
,
message
);
return
;
}
//Qmgr::systemErrorLab()
...
...
@@ -2867,7 +2866,7 @@ Uint16 Qmgr::translateDynamicIdToNodeId(Signal* signal, UintR TdynamicId)
}
//for
if
(
TtdiNodeId
==
ZNIL
)
{
jam
();
systemErrorLab
(
signal
);
systemErrorLab
(
signal
,
__LINE__
);
}
//if
return
TtdiNodeId
;
}
//Qmgr::translateDynamicIdToNodeId()
...
...
ndb/tools/restore/restore_main.cpp
View file @
9be420ee
...
...
@@ -251,8 +251,9 @@ main(int argc, char** argv)
const
BackupFormat
::
FileHeader
&
tmp
=
metaData
.
getFileHeader
();
const
Uint32
version
=
tmp
.
NdbVersion
;
char
buf
[
NDB_VERSION_STRING_BUF_SZ
];
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).
...
...
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