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
2119a88a
Commit
2119a88a
authored
Sep 20, 2005
by
jonas@perch.ndb.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge perch.ndb.mysql.com:/home/jonas/src/mysql-4.1
into perch.ndb.mysql.com:/home/jonas/src/mysql-5.0
parents
e813de68
668a192c
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
409 additions
and
480 deletions
+409
-480
ndb/include/ndbapi/Ndb.hpp
ndb/include/ndbapi/Ndb.hpp
+13
-15
ndb/include/ndbapi/NdbBlob.hpp
ndb/include/ndbapi/NdbBlob.hpp
+5
-1
ndb/include/ndbapi/NdbIndexOperation.hpp
ndb/include/ndbapi/NdbIndexOperation.hpp
+1
-0
ndb/include/ndbapi/NdbIndexScanOperation.hpp
ndb/include/ndbapi/NdbIndexScanOperation.hpp
+2
-1
ndb/include/ndbapi/NdbOperation.hpp
ndb/include/ndbapi/NdbOperation.hpp
+5
-2
ndb/include/ndbapi/NdbRecAttr.hpp
ndb/include/ndbapi/NdbRecAttr.hpp
+5
-2
ndb/include/ndbapi/NdbTransaction.hpp
ndb/include/ndbapi/NdbTransaction.hpp
+4
-4
ndb/src/ndbapi/NdbApiSignal.cpp
ndb/src/ndbapi/NdbApiSignal.cpp
+19
-0
ndb/src/ndbapi/NdbApiSignal.hpp
ndb/src/ndbapi/NdbApiSignal.hpp
+2
-1
ndb/src/ndbapi/NdbBlob.cpp
ndb/src/ndbapi/NdbBlob.cpp
+1
-1
ndb/src/ndbapi/NdbImpl.hpp
ndb/src/ndbapi/NdbImpl.hpp
+118
-1
ndb/src/ndbapi/NdbRecAttr.cpp
ndb/src/ndbapi/NdbRecAttr.cpp
+2
-2
ndb/src/ndbapi/NdbUtil.cpp
ndb/src/ndbapi/NdbUtil.cpp
+6
-10
ndb/src/ndbapi/NdbUtil.hpp
ndb/src/ndbapi/NdbUtil.hpp
+23
-17
ndb/src/ndbapi/Ndbif.cpp
ndb/src/ndbapi/Ndbif.cpp
+0
-9
ndb/src/ndbapi/Ndbinit.cpp
ndb/src/ndbapi/Ndbinit.cpp
+0
-39
ndb/src/ndbapi/Ndblist.cpp
ndb/src/ndbapi/Ndblist.cpp
+138
-373
ndb/tools/restore/Restore.cpp
ndb/tools/restore/Restore.cpp
+1
-1
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+46
-0
sql/ha_ndbcluster.h
sql/ha_ndbcluster.h
+2
-0
sql/mysqld.cc
sql/mysqld.cc
+1
-0
sql/sql_lex.h
sql/sql_lex.h
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+11
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+3
-0
No files found.
ndb/include/ndbapi/Ndb.hpp
View file @
2119a88a
...
...
@@ -984,10 +984,10 @@ class BaseString;
class
NdbEventOperation
;
class
NdbBlob
;
class
NdbReceiver
;
template
<
class
T
>
struct
Ndb_free_list_t
;
typedef
void
(
*
NdbEventCallback
)(
NdbEventOperation
*
,
Ndb
*
,
void
*
);
#if defined NDB_OSE
/**
* Default time to wait for response after request has been sent to
...
...
@@ -1457,8 +1457,20 @@ public:
*/
NdbTransaction
*
hupp
(
NdbTransaction
*
);
Uint32
getReference
()
const
{
return
theMyRef
;}
struct
Free_list_usage
{
const
char
*
m_name
;
Uint32
m_created
;
Uint32
m_free
;
Uint32
m_sizeof
;
};
Free_list_usage
*
get_free_list_usage
(
Free_list_usage
*
);
#endif
/*****************************************************************************
* These are service routines used by the other classes in the NDBAPI.
****************************************************************************/
...
...
@@ -1630,22 +1642,8 @@ private:
class
NdbDictionaryImpl
*
theDictionary
;
class
NdbGlobalEventBufferHandle
*
theGlobalEventBufferHandle
;
NdbTransaction
*
theConIdleList
;
// First connection in idle list.
NdbOperation
*
theOpIdleList
;
// First operation in the idle list.
NdbIndexScanOperation
*
theScanOpIdleList
;
// First scan operation in the idle list.
NdbIndexOperation
*
theIndexOpIdleList
;
// First index operation in the idle list.
NdbTransaction
*
theTransactionList
;
NdbTransaction
**
theConnectionArray
;
NdbRecAttr
*
theRecAttrIdleList
;
NdbApiSignal
*
theSignalIdleList
;
// First signal in idlelist.
NdbLabel
*
theLabelList
;
// First label descriptor in list
NdbBranch
*
theBranchList
;
// First branch descriptor in list
NdbSubroutine
*
theSubroutineList
;
// First subroutine descriptor in
NdbCall
*
theCallList
;
// First call descriptor in list
NdbReceiver
*
theScanList
;
NdbBlob
*
theNdbBlobIdleList
;
Uint32
theMyRef
;
// My block reference
Uint32
theNode
;
// The node number of our node
...
...
ndb/include/ndbapi/NdbBlob.hpp
View file @
2119a88a
...
...
@@ -277,7 +277,7 @@ private:
// for keeping in lists
NdbBlob
*
theNext
;
// initialization
NdbBlob
();
NdbBlob
(
Ndb
*
);
void
init
();
void
release
();
// classify operations
...
...
@@ -329,6 +329,10 @@ private:
int
getOperationType
()
const
;
friend
class
NdbOut
&
operator
<<
(
NdbOut
&
,
const
NdbBlob
&
);
#endif
void
next
(
NdbBlob
*
obj
)
{
theNext
=
obj
;}
NdbBlob
*
next
()
{
return
theNext
;}
friend
struct
Ndb_free_list_t
<
NdbBlob
>
;
};
#endif
ndb/include/ndbapi/NdbIndexOperation.hpp
View file @
2119a88a
...
...
@@ -181,6 +181,7 @@ private:
// Private attributes
const
NdbIndexImpl
*
m_theIndex
;
friend
struct
Ndb_free_list_t
<
NdbIndexOperation
>
;
};
#endif
ndb/include/ndbapi/NdbIndexScanOperation.hpp
View file @
2119a88a
...
...
@@ -165,9 +165,10 @@ private:
int
compare
(
Uint32
key
,
Uint32
cols
,
const
NdbReceiver
*
,
const
NdbReceiver
*
);
Uint32
m_sort_columns
;
Uint32
m_this_bound_start
;
Uint32
*
m_first_bound_word
;
friend
struct
Ndb_free_list_t
<
NdbIndexScanOperation
>
;
};
#endif
ndb/include/ndbapi/NdbOperation.hpp
View file @
2119a88a
...
...
@@ -22,6 +22,7 @@
#include "NdbError.hpp"
#include "NdbReceiver.hpp"
#include "NdbDictionary.hpp"
#include "Ndb.hpp"
class
Ndb
;
class
NdbApiSignal
;
...
...
@@ -756,8 +757,6 @@ protected:
/******************************************************************************
* These are the methods used to create and delete the NdbOperation objects.
*****************************************************************************/
NdbOperation
(
Ndb
*
aNdb
);
virtual
~
NdbOperation
();
bool
needReply
();
/******************************************************************************
...
...
@@ -769,6 +768,8 @@ protected:
int
init
(
const
class
NdbTableImpl
*
,
NdbTransaction
*
aCon
);
void
initInterpreter
();
NdbOperation
(
Ndb
*
aNdb
);
virtual
~
NdbOperation
();
void
next
(
NdbOperation
*
);
// Set next pointer
NdbOperation
*
next
();
// Get next pointer
public:
...
...
@@ -965,6 +966,8 @@ protected:
* IgnoreError on connection level.
*/
Int8
m_abortOption
;
friend
struct
Ndb_free_list_t
<
NdbOperation
>
;
};
#ifdef NDB_NO_DROPPED_SIGNAL
...
...
ndb/include/ndbapi/NdbRecAttr.hpp
View file @
2119a88a
...
...
@@ -17,7 +17,8 @@
#ifndef NdbRecAttr_H
#define NdbRecAttr_H
#include <NdbDictionary.hpp>
#include "NdbDictionary.hpp"
#include "Ndb.hpp"
class
NdbOperation
;
...
...
@@ -248,7 +249,6 @@ public:
const
NdbRecAttr
*
next
()
const
;
#endif
private:
NdbRecAttr
();
Uint32
attrId
()
const
;
/* Get attribute id */
bool
setNULL
();
/* Set NULL indicator */
...
...
@@ -258,6 +258,7 @@ private:
void
release
();
/* Release memory if allocated */
void
init
();
/* Initialise object when allocated */
NdbRecAttr
(
Ndb
*
);
void
next
(
NdbRecAttr
*
aRecAttr
);
NdbRecAttr
*
next
();
...
...
@@ -280,6 +281,8 @@ private:
Uint32
theAttrSize
;
Uint32
theArraySize
;
const
NdbDictionary
::
Column
*
m_column
;
friend
struct
Ndb_free_list_t
<
NdbRecAttr
>
;
};
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
...
...
ndb/include/ndbapi/NdbTransaction.hpp
View file @
2119a88a
...
...
@@ -18,8 +18,9 @@
#define NdbTransaction_H
#include <ndb_types.h>
#include <NdbError.hpp>
#include <NdbDictionary.hpp>
#include "NdbError.hpp"
#include "NdbDictionary.hpp"
#include "Ndb.hpp"
class
NdbTransaction
;
class
NdbOperation
;
...
...
@@ -581,9 +582,7 @@ private:
/**************************************************************************
* These are the create and delete methods of this class. *
**************************************************************************/
NdbTransaction
(
Ndb
*
aNdb
);
~
NdbTransaction
();
void
init
();
// Initialize connection object for new transaction
...
...
@@ -807,6 +806,7 @@ private:
void
define_scan_op
(
NdbIndexScanOperation
*
);
friend
class
HugoOperations
;
friend
struct
Ndb_free_list_t
<
NdbConnection
>
;
};
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
...
...
ndb/src/ndbapi/NdbApiSignal.cpp
View file @
2119a88a
...
...
@@ -62,6 +62,25 @@ NdbApiSignal::NdbApiSignal(BlockReference ref)
theNextSignal
=
0
;
}
NdbApiSignal
::
NdbApiSignal
(
Ndb
*
ndb
)
{
BlockReference
ref
=
ndb
->
theMyRef
;
theVerId_signalNumber
=
0
;
// 4 bit ver id - 16 bit gsn
theReceiversBlockNumber
=
0
;
// Only 16 bit blocknum
theSendersBlockRef
=
refToBlock
(
ref
);
theLength
=
0
;
theSendersSignalId
=
0
;
theSignalId
=
0
;
theTrace
=
0
;
m_noOfSections
=
0
;
m_fragmentInfo
=
0
;
for
(
int
i
=
0
;
i
<
25
;
i
++
)
theData
[
i
]
=
0x13579753
;
setDataPtr
(
&
theData
[
0
]);
theNextSignal
=
0
;
}
/**
* Copy constructor
*/
...
...
ndb/src/ndbapi/NdbApiSignal.hpp
View file @
2119a88a
...
...
@@ -46,7 +46,8 @@
class
NdbApiSignal
:
public
SignalHeader
{
public:
NdbApiSignal
(
BlockReference
myRef
);
NdbApiSignal
(
Ndb
*
ndb
);
NdbApiSignal
(
BlockReference
ref
);
NdbApiSignal
(
const
NdbApiSignal
&
);
NdbApiSignal
(
const
SignalHeader
&
header
)
:
SignalHeader
(
header
),
theNextSignal
(
0
),
theRealData
(
0
)
{};
...
...
ndb/src/ndbapi/NdbBlob.cpp
View file @
2119a88a
...
...
@@ -111,7 +111,7 @@ NdbBlob::getBlobTable(NdbTableImpl& bt, const NdbTableImpl* t, const NdbColumnIm
// initialization
NdbBlob
::
NdbBlob
()
NdbBlob
::
NdbBlob
(
Ndb
*
)
{
init
();
}
...
...
ndb/src/ndbapi/NdbImpl.hpp
View file @
2119a88a
...
...
@@ -32,6 +32,21 @@
#include "NdbDictionaryImpl.hpp"
#include "ObjectMap.hpp"
template
<
class
T
>
struct
Ndb_free_list_t
{
Ndb_free_list_t
();
~
Ndb_free_list_t
();
void
fill
(
Ndb
*
,
Uint32
cnt
);
T
*
seize
(
Ndb
*
);
void
release
(
T
*
);
void
clear
();
Uint32
get_sizeof
()
const
{
return
sizeof
(
T
);
}
T
*
m_free_list
;
Uint32
m_alloc_cnt
,
m_free_cnt
;
};
/**
* Private parts of the Ndb object (corresponding to Ndb.hpp in public API)
*/
...
...
@@ -60,7 +75,6 @@ public:
int
m_optimized_node_selection
;
BaseString
m_dbname
;
// Database name
BaseString
m_schemaname
;
// Schema name
...
...
@@ -72,6 +86,22 @@ public:
m_schemaname
.
c_str
(),
table_name_separator
);
}
/**
* NOTE free lists must be _after_ theNdbObjectIdMap take
* assure that destructors are run in correct order
*/
Ndb_free_list_t
<
NdbTransaction
>
theConIdleList
;
Ndb_free_list_t
<
NdbOperation
>
theOpIdleList
;
Ndb_free_list_t
<
NdbIndexScanOperation
>
theScanOpIdleList
;
Ndb_free_list_t
<
NdbIndexOperation
>
theIndexOpIdleList
;
Ndb_free_list_t
<
NdbRecAttr
>
theRecAttrIdleList
;
Ndb_free_list_t
<
NdbApiSignal
>
theSignalIdleList
;
Ndb_free_list_t
<
NdbLabel
>
theLabelList
;
Ndb_free_list_t
<
NdbBranch
>
theBranchList
;
Ndb_free_list_t
<
NdbSubroutine
>
theSubroutineList
;
Ndb_free_list_t
<
NdbCall
>
theCallList
;
Ndb_free_list_t
<
NdbBlob
>
theNdbBlobIdleList
;
Ndb_free_list_t
<
NdbReceiver
>
theScanList
;
};
#ifdef VM_TRACE
...
...
@@ -146,4 +176,91 @@ enum LockMode {
Delete
};
template
<
class
T
>
inline
Ndb_free_list_t
<
T
>::
Ndb_free_list_t
()
{
m_free_list
=
0
;
m_alloc_cnt
=
m_free_cnt
=
0
;
}
template
<
class
T
>
inline
Ndb_free_list_t
<
T
>::~
Ndb_free_list_t
()
{
clear
();
}
template
<
class
T
>
inline
void
Ndb_free_list_t
<
T
>::
fill
(
Ndb
*
ndb
,
Uint32
cnt
)
{
if
(
m_free_list
==
0
)
{
m_free_cnt
++
;
m_alloc_cnt
++
;
m_free_list
=
new
T
(
ndb
);
}
while
(
m_alloc_cnt
<
cnt
)
{
T
*
obj
=
new
T
(
ndb
);
if
(
obj
==
0
)
return
;
obj
->
next
(
m_free_list
);
m_free_cnt
++
;
m_alloc_cnt
++
;
m_free_list
=
obj
;
}
}
template
<
class
T
>
inline
T
*
Ndb_free_list_t
<
T
>::
seize
(
Ndb
*
ndb
)
{
T
*
tmp
=
m_free_list
;
if
(
tmp
)
{
m_free_list
=
(
T
*
)
tmp
->
next
();
tmp
->
next
(
NULL
);
m_free_cnt
--
;
return
tmp
;
}
if
((
tmp
=
new
T
(
ndb
)))
{
m_alloc_cnt
++
;
}
return
tmp
;
}
template
<
class
T
>
inline
void
Ndb_free_list_t
<
T
>::
release
(
T
*
obj
)
{
obj
->
next
(
m_free_list
);
m_free_list
=
obj
;
m_free_cnt
++
;
}
template
<
class
T
>
inline
void
Ndb_free_list_t
<
T
>::
clear
()
{
T
*
obj
=
m_free_list
;
while
(
obj
)
{
T
*
curr
=
obj
;
obj
=
(
T
*
)
obj
->
next
();
delete
curr
;
m_alloc_cnt
--
;
}
}
#endif
ndb/src/ndbapi/NdbRecAttr.cpp
View file @
2119a88a
...
...
@@ -22,7 +22,7 @@
#include "NdbDictionaryImpl.hpp"
#include <NdbTCP.h>
NdbRecAttr
::
NdbRecAttr
()
NdbRecAttr
::
NdbRecAttr
(
Ndb
*
)
{
init
();
}
...
...
@@ -98,7 +98,7 @@ NdbRecAttr::copyout()
NdbRecAttr
*
NdbRecAttr
::
clone
()
const
{
NdbRecAttr
*
ret
=
new
NdbRecAttr
();
NdbRecAttr
*
ret
=
new
NdbRecAttr
(
0
);
ret
->
theAttrId
=
theAttrId
;
ret
->
theNULLind
=
theNULLind
;
...
...
ndb/src/ndbapi/NdbUtil.cpp
View file @
2119a88a
...
...
@@ -30,8 +30,7 @@ Comment:
#include "NdbUtil.hpp"
NdbLabel
::
NdbLabel
()
:
theNext
(
NULL
)
NdbLabel
::
NdbLabel
(
Ndb
*
)
{
}
...
...
@@ -39,8 +38,7 @@ NdbLabel::~NdbLabel()
{
}
NdbSubroutine
::
NdbSubroutine
()
:
theNext
(
NULL
)
NdbSubroutine
::
NdbSubroutine
(
Ndb
*
)
{
}
...
...
@@ -48,9 +46,8 @@ NdbSubroutine::~NdbSubroutine()
{
}
NdbBranch
::
NdbBranch
()
:
theSignal
(
NULL
),
theNext
(
NULL
)
NdbBranch
::
NdbBranch
(
Ndb
*
)
:
theSignal
(
NULL
)
{
}
...
...
@@ -58,9 +55,8 @@ NdbBranch::~NdbBranch()
{
}
NdbCall
::
NdbCall
()
:
theSignal
(
NULL
),
theNext
(
NULL
)
NdbCall
::
NdbCall
(
Ndb
*
)
:
theSignal
(
NULL
)
{
}
...
...
ndb/src/ndbapi/NdbUtil.hpp
View file @
2119a88a
...
...
@@ -34,41 +34,49 @@ Comment:
class
NdbApiSignal
;
class
NdbOperation
;
class
NdbLabel
template
<
class
T
>
struct
Free_list_element
{
Free_list_element
()
{
theNext
=
0
;}
void
next
(
T
*
obj
)
{
theNext
=
obj
;}
T
*
next
()
{
return
theNext
;}
T
*
theNext
;
};
class
NdbLabel
:
public
Free_list_element
<
NdbLabel
>
{
friend
class
NdbOperation
;
friend
class
Ndb
;
private:
NdbLabel
();
public:
NdbLabel
(
Ndb
*
);
~
NdbLabel
();
NdbLabel
*
theNext
;
private:
Uint32
theSubroutine
[
16
];
Uint32
theLabelAddress
[
16
];
Uint32
theLabelNo
[
16
];
};
class
NdbSubroutine
class
NdbSubroutine
:
public
Free_list_element
<
NdbSubroutine
>
{
friend
class
NdbOperation
;
friend
class
Ndb
;
p
rivate
:
NdbSubroutine
();
p
ublic
:
NdbSubroutine
(
Ndb
*
);
~
NdbSubroutine
();
NdbSubroutine
*
theNext
;
Uint32
theSubroutineAddress
[
16
];
};
class
NdbBranch
class
NdbBranch
:
public
Free_list_element
<
NdbBranch
>
{
friend
class
NdbOperation
;
friend
class
Ndb
;
p
rivate
:
NdbBranch
();
p
ublic
:
NdbBranch
(
Ndb
*
);
~
NdbBranch
();
NdbApiSignal
*
theSignal
;
...
...
@@ -76,22 +84,20 @@ private:
Uint32
theBranchAddress
;
Uint32
theBranchLabel
;
Uint32
theSubroutine
;
NdbBranch
*
theNext
;
};
class
NdbCall
class
NdbCall
:
public
Free_list_element
<
NdbCall
>
{
friend
class
NdbOperation
;
friend
class
Ndb
;
p
rivate
:
NdbCall
();
p
ublic
:
NdbCall
(
Ndb
*
);
~
NdbCall
();
NdbApiSignal
*
theSignal
;
Uint32
theSignalAddress
;
Uint32
theSubroutine
;
NdbCall
*
theNext
;
};
#endif
ndb/src/ndbapi/Ndbif.cpp
View file @
2119a88a
...
...
@@ -141,15 +141,6 @@ Ndb::init(int aMaxNoOfTransactions)
error_handler:
ndbout
<<
"error_handler"
<<
endl
;
releaseTransactionArrays
();
while
(
theConIdleList
!=
NULL
)
freeNdbCon
();
while
(
theSignalIdleList
!=
NULL
)
freeSignal
();
while
(
theRecAttrIdleList
!=
NULL
)
freeRecAttr
();
while
(
theOpIdleList
!=
NULL
)
freeOperation
();
delete
theDictionary
;
TransporterFacade
::
instance
()
->
close
(
theNdbBlockNumber
,
0
);
DBUG_RETURN
(
-
1
);
...
...
ndb/src/ndbapi/Ndbinit.cpp
View file @
2119a88a
...
...
@@ -62,20 +62,8 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
theRemainingStartTransactions
=
0
;
theMaxNoOfTransactions
=
0
;
theMinNoOfEventsToWakeUp
=
0
;
theConIdleList
=
NULL
;
theOpIdleList
=
NULL
;
theScanOpIdleList
=
NULL
;
theIndexOpIdleList
=
NULL
;
theTransactionList
=
NULL
;
theConnectionArray
=
NULL
;
theRecAttrIdleList
=
NULL
;
theSignalIdleList
=
NULL
;
theLabelList
=
NULL
;
theBranchList
=
NULL
;
theSubroutineList
=
NULL
;
theCallList
=
NULL
;
theScanList
=
NULL
;
theNdbBlobIdleList
=
NULL
;
the_last_check_time
=
0
;
theFirstTransId
=
0
;
theRestartGCI
=
0
;
...
...
@@ -150,33 +138,6 @@ Ndb::~Ndb()
TransporterFacade
::
instance
()
->
close
(
theNdbBlockNumber
,
theFirstTransId
);
}
// if (theSchemaConToNdbList != NULL)
// closeSchemaTransaction(theSchemaConToNdbList);
while
(
theConIdleList
!=
NULL
)
freeNdbCon
();
while
(
theOpIdleList
!=
NULL
)
freeOperation
();
while
(
theScanOpIdleList
!=
NULL
)
freeScanOperation
();
while
(
theIndexOpIdleList
!=
NULL
)
freeIndexOperation
();
while
(
theLabelList
!=
NULL
)
freeNdbLabel
();
while
(
theBranchList
!=
NULL
)
freeNdbBranch
();
while
(
theSubroutineList
!=
NULL
)
freeNdbSubroutine
();
while
(
theCallList
!=
NULL
)
freeNdbCall
();
while
(
theScanList
!=
NULL
)
freeNdbScanRec
();
while
(
theNdbBlobIdleList
!=
NULL
)
freeNdbBlob
();
while
(
theRecAttrIdleList
!=
NULL
)
freeRecAttr
();
while
(
theSignalIdleList
!=
NULL
)
freeSignal
();
releaseTransactionArrays
();
delete
[]
theConnectionArray
;
...
...
ndb/src/ndbapi/Ndblist.cpp
View file @
2119a88a
...
...
@@ -75,24 +75,7 @@ Ndb::checkFailedNode()
int
Ndb
::
createConIdleList
(
int
aNrOfCon
)
{
for
(
int
i
=
0
;
i
<
aNrOfCon
;
i
++
)
{
NdbTransaction
*
tNdbCon
=
new
NdbTransaction
(
this
);
if
(
tNdbCon
==
NULL
)
{
return
-
1
;
}
if
(
theConIdleList
==
NULL
)
{
theConIdleList
=
tNdbCon
;
theConIdleList
->
next
(
NULL
);
}
else
{
tNdbCon
->
next
(
theConIdleList
);
theConIdleList
=
tNdbCon
;
}
tNdbCon
->
Status
(
NdbTransaction
::
NotConnected
);
}
theImpl
->
theConIdleList
.
fill
(
this
,
aNrOfCon
);
return
aNrOfCon
;
}
...
...
@@ -108,19 +91,7 @@ Ndb::createConIdleList(int aNrOfCon)
int
Ndb
::
createOpIdleList
(
int
aNrOfOp
)
{
for
(
int
i
=
0
;
i
<
aNrOfOp
;
i
++
){
NdbOperation
*
tOp
=
new
NdbOperation
(
this
);
if
(
tOp
==
NULL
){
return
-
1
;
}
if
(
theOpIdleList
==
NULL
){
theOpIdleList
=
tOp
;
theOpIdleList
->
next
(
NULL
);
}
else
{
tOp
->
next
(
theOpIdleList
);
theOpIdleList
=
tOp
;
}
}
theImpl
->
theOpIdleList
.
fill
(
this
,
aNrOfOp
);
return
aNrOfOp
;
}
...
...
@@ -134,22 +105,7 @@ Ndb::createOpIdleList(int aNrOfOp)
NdbBranch
*
Ndb
::
getNdbBranch
()
{
NdbBranch
*
tNdbBranch
;
if
(
theBranchList
==
NULL
)
{
tNdbBranch
=
new
NdbBranch
;
if
(
tNdbBranch
==
NULL
)
{
return
NULL
;
}
tNdbBranch
->
theNext
=
NULL
;
}
else
{
tNdbBranch
=
theBranchList
;
theBranchList
=
tNdbBranch
->
theNext
;
tNdbBranch
->
theNext
=
NULL
;
}
return
tNdbBranch
;
return
theImpl
->
theBranchList
.
seize
(
this
);
}
/***************************************************************************
...
...
@@ -162,22 +118,7 @@ Ndb::getNdbBranch()
NdbCall
*
Ndb
::
getNdbCall
()
{
NdbCall
*
tNdbCall
;
if
(
theCallList
==
NULL
)
{
tNdbCall
=
new
NdbCall
;
if
(
tNdbCall
==
NULL
)
{
return
NULL
;
}
tNdbCall
->
theNext
=
NULL
;
}
else
{
tNdbCall
=
theCallList
;
theCallList
=
tNdbCall
->
theNext
;
tNdbCall
->
theNext
=
NULL
;
}
return
tNdbCall
;
return
theImpl
->
theCallList
.
seize
(
this
);
}
/***************************************************************************
...
...
@@ -190,19 +131,14 @@ Ndb::getNdbCall()
NdbTransaction
*
Ndb
::
getNdbCon
()
{
NdbTransaction
*
tNdbCon
;
if
(
theConIdleList
==
NULL
)
{
tNdbCon
=
new
NdbTransaction
(
this
);
if
(
tNdbCon
==
NULL
)
{
NdbTransaction
*
tNdbCon
=
theImpl
->
theConIdleList
.
seize
(
this
);
if
(
unlikely
(
theImpl
->
theConIdleList
.
m_alloc_cnt
>
theMaxNoOfTransactions
))
{
theImpl
->
theConIdleList
.
release
(
tNdbCon
);
ndbout
<<
"theNoOfAllocatedTransactions = "
<<
theNoOfAllocatedTransactions
<<
" theMaxNoOfTransactions = "
<<
theMaxNoOfTransactions
<<
endl
;
return
NULL
;
}
//if
tNdbCon
->
next
(
NULL
);
}
else
{
tNdbCon
=
theConIdleList
;
theConIdleList
=
tNdbCon
->
next
();
tNdbCon
->
next
(
NULL
);
}
tNdbCon
->
theMagicNumber
=
0x37412619
;
return
tNdbCon
;
}
...
...
@@ -217,22 +153,7 @@ Ndb::getNdbCon()
NdbLabel
*
Ndb
::
getNdbLabel
()
{
NdbLabel
*
tNdbLabel
;
if
(
theLabelList
==
NULL
)
{
tNdbLabel
=
new
NdbLabel
;
if
(
tNdbLabel
==
NULL
)
{
return
NULL
;
}
tNdbLabel
->
theNext
=
NULL
;
}
else
{
tNdbLabel
=
theLabelList
;
theLabelList
=
tNdbLabel
->
theNext
;
tNdbLabel
->
theNext
=
NULL
;
}
return
tNdbLabel
;
return
theImpl
->
theLabelList
.
seize
(
this
);
}
/***************************************************************************
...
...
@@ -246,23 +167,7 @@ Ndb::getNdbLabel()
NdbReceiver
*
Ndb
::
getNdbScanRec
()
{
NdbReceiver
*
tNdbScanRec
;
if
(
theScanList
==
NULL
)
{
tNdbScanRec
=
new
NdbReceiver
(
this
);
if
(
tNdbScanRec
==
NULL
)
{
return
NULL
;
}
tNdbScanRec
->
next
(
NULL
);
}
else
{
tNdbScanRec
=
theScanList
;
theScanList
=
tNdbScanRec
->
next
();
tNdbScanRec
->
next
(
NULL
);
}
return
tNdbScanRec
;
return
theImpl
->
theScanList
.
seize
(
this
);
}
/***************************************************************************
...
...
@@ -275,22 +180,7 @@ Ndb::getNdbScanRec()
NdbSubroutine
*
Ndb
::
getNdbSubroutine
()
{
NdbSubroutine
*
tNdbSubroutine
;
if
(
theSubroutineList
==
NULL
)
{
tNdbSubroutine
=
new
NdbSubroutine
;
if
(
tNdbSubroutine
==
NULL
)
{
return
NULL
;
}
tNdbSubroutine
->
theNext
=
NULL
;
}
else
{
tNdbSubroutine
=
theSubroutineList
;
theSubroutineList
=
tNdbSubroutine
->
theNext
;
tNdbSubroutine
->
theNext
=
NULL
;
}
return
tNdbSubroutine
;
return
theImpl
->
theSubroutineList
.
seize
(
this
);
}
/***************************************************************************
...
...
@@ -303,18 +193,7 @@ Remark: Get an operation from theOpIdleList and return the object .
NdbOperation
*
Ndb
::
getOperation
()
{
NdbOperation
*
tOp
=
theOpIdleList
;
if
(
tOp
!=
NULL
)
{
NdbOperation
*
tOpNext
=
tOp
->
next
();
tOp
->
next
(
NULL
);
theOpIdleList
=
tOpNext
;
return
tOp
;
}
else
{
tOp
=
new
NdbOperation
(
this
);
if
(
tOp
!=
NULL
)
tOp
->
next
(
NULL
);
}
return
tOp
;
return
theImpl
->
theOpIdleList
.
seize
(
this
);
}
/***************************************************************************
...
...
@@ -327,18 +206,7 @@ Remark: Get an operation from theScanOpIdleList and return the object .
NdbIndexScanOperation
*
Ndb
::
getScanOperation
()
{
NdbIndexScanOperation
*
tOp
=
theScanOpIdleList
;
if
(
tOp
!=
NULL
)
{
NdbIndexScanOperation
*
tOpNext
=
(
NdbIndexScanOperation
*
)
tOp
->
next
();
tOp
->
next
(
NULL
);
theScanOpIdleList
=
tOpNext
;
return
tOp
;
}
else
{
tOp
=
new
NdbIndexScanOperation
(
this
);
if
(
tOp
!=
NULL
)
tOp
->
next
(
NULL
);
}
return
tOp
;
return
theImpl
->
theScanOpIdleList
.
seize
(
this
);
}
/***************************************************************************
...
...
@@ -351,18 +219,7 @@ Remark: Get an operation from theIndexOpIdleList and return the object .
NdbIndexOperation
*
Ndb
::
getIndexOperation
()
{
NdbIndexOperation
*
tOp
=
theIndexOpIdleList
;
if
(
tOp
!=
NULL
)
{
NdbIndexOperation
*
tOpNext
=
(
NdbIndexOperation
*
)
tOp
->
next
();
tOp
->
next
(
NULL
);
theIndexOpIdleList
=
tOpNext
;
return
tOp
;
}
else
{
tOp
=
new
NdbIndexOperation
(
this
);
if
(
tOp
!=
NULL
)
tOp
->
next
(
NULL
);
}
return
tOp
;
return
theImpl
->
theIndexOpIdleList
.
seize
(
this
);
}
/***************************************************************************
...
...
@@ -374,21 +231,14 @@ Return Value: Return a reference to a receive attribute object.
NdbRecAttr
*
Ndb
::
getRecAttr
()
{
NdbRecAttr
*
tRecAttr
;
tRecAttr
=
theRecAttrIdleList
;
if
(
tRecAttr
!=
NULL
)
{
NdbRecAttr
*
tRecAttrNext
=
tRecAttr
->
next
();
NdbRecAttr
*
tRecAttr
=
theImpl
->
theRecAttrIdleList
.
seize
(
this
);
if
(
tRecAttr
!=
NULL
)
{
tRecAttr
->
init
();
theRecAttrIdleList
=
tRecAttrNext
;
return
tRecAttr
;
}
else
{
tRecAttr
=
new
NdbRecAttr
;
if
(
tRecAttr
==
NULL
)
}
return
NULL
;
tRecAttr
->
next
(
NULL
);
}
//if
tRecAttr
->
init
();
return
tRecAttr
;
}
/***************************************************************************
...
...
@@ -400,34 +250,16 @@ Return Value: Return a reference to a signal object.
NdbApiSignal
*
Ndb
::
getSignal
()
{
NdbApiSignal
*
tSignal
=
theSignalIdleList
;
if
(
tSignal
!=
NULL
){
NdbApiSignal
*
tSignalNext
=
tSignal
->
next
();
tSignal
->
next
(
NULL
);
theSignalIdleList
=
tSignalNext
;
}
else
{
tSignal
=
new
NdbApiSignal
(
theMyRef
);
#ifdef POORMANSPURIFY
cnewSignals
++
;
#endif
if
(
tSignal
!=
NULL
)
tSignal
->
next
(
NULL
);
}
#ifdef POORMANSPURIFY
cgetSignals
++
;
#endif
return
tSignal
;
return
theImpl
->
theSignalIdleList
.
seize
(
this
);
}
NdbBlob
*
Ndb
::
getNdbBlob
()
{
NdbBlob
*
tBlob
=
the
NdbBlobIdleList
;
if
(
tBlob
!=
NULL
)
{
theNdbBlobIdleList
=
tBlob
->
theNext
;
NdbBlob
*
tBlob
=
the
Impl
->
theNdbBlobIdleList
.
seize
(
this
)
;
if
(
tBlob
)
{
tBlob
->
init
();
}
else
{
tBlob
=
new
NdbBlob
;
}
return
tBlob
;
}
...
...
@@ -441,8 +273,7 @@ Remark: Add a NdbBranch object into the Branch idlelist.
void
Ndb
::
releaseNdbBranch
(
NdbBranch
*
aNdbBranch
)
{
aNdbBranch
->
theNext
=
theBranchList
;
theBranchList
=
aNdbBranch
;
theImpl
->
theBranchList
.
release
(
aNdbBranch
);
}
/***************************************************************************
...
...
@@ -454,8 +285,7 @@ Remark: Add a NdbBranch object into the Branch idlelist.
void
Ndb
::
releaseNdbCall
(
NdbCall
*
aNdbCall
)
{
aNdbCall
->
theNext
=
theCallList
;
theCallList
=
aNdbCall
;
theImpl
->
theCallList
.
release
(
aNdbCall
);
}
/***************************************************************************
...
...
@@ -467,9 +297,8 @@ Remark: Add a Connection object into the signal idlelist.
void
Ndb
::
releaseNdbCon
(
NdbTransaction
*
aNdbCon
)
{
aNdbCon
->
next
(
theConIdleList
);
aNdbCon
->
theMagicNumber
=
0xFE11DD
;
the
ConIdleList
=
aNdbCon
;
the
Impl
->
theConIdleList
.
release
(
aNdbCon
)
;
}
/***************************************************************************
...
...
@@ -481,8 +310,7 @@ Remark: Add a NdbLabel object into the Label idlelist.
void
Ndb
::
releaseNdbLabel
(
NdbLabel
*
aNdbLabel
)
{
aNdbLabel
->
theNext
=
theLabelList
;
theLabelList
=
aNdbLabel
;
theImpl
->
theLabelList
.
release
(
aNdbLabel
);
}
/***************************************************************************
...
...
@@ -494,8 +322,7 @@ Remark: Add a NdbScanReceiver object into the Scan idlelist.
void
Ndb
::
releaseNdbScanRec
(
NdbReceiver
*
aNdbScanRec
)
{
aNdbScanRec
->
next
(
theScanList
);
theScanList
=
aNdbScanRec
;
theImpl
->
theScanList
.
release
(
aNdbScanRec
);
}
/***************************************************************************
...
...
@@ -507,8 +334,7 @@ Remark: Add a NdbSubroutine object into theSubroutine idlelist.
void
Ndb
::
releaseNdbSubroutine
(
NdbSubroutine
*
aNdbSubroutine
)
{
aNdbSubroutine
->
theNext
=
theSubroutineList
;
theSubroutineList
=
aNdbSubroutine
;
theImpl
->
theSubroutineList
.
release
(
aNdbSubroutine
);
}
/***************************************************************************
...
...
@@ -521,16 +347,14 @@ void
Ndb
::
releaseOperation
(
NdbOperation
*
anOperation
)
{
if
(
anOperation
->
m_tcReqGSN
==
GSN_TCKEYREQ
){
anOperation
->
next
(
theOpIdleList
);
anOperation
->
theNdbCon
=
NULL
;
anOperation
->
theMagicNumber
=
0xFE11D0
;
the
OpIdleList
=
anOperation
;
the
Impl
->
theOpIdleList
.
release
(
anOperation
)
;
}
else
{
assert
(
anOperation
->
m_tcReqGSN
==
GSN_TCINDXREQ
);
anOperation
->
next
(
theIndexOpIdleList
);
anOperation
->
theNdbCon
=
NULL
;
anOperation
->
theMagicNumber
=
0xFE11D1
;
theI
ndexOpIdleList
=
(
NdbIndexOperation
*
)
anOperation
;
theI
mpl
->
theIndexOpIdleList
.
release
((
NdbIndexOperation
*
)
anOperation
)
;
}
}
...
...
@@ -553,10 +377,9 @@ Ndb::releaseScanOperation(NdbIndexScanOperation* aScanOperation)
}
}
#endif
aScanOperation
->
next
(
theScanOpIdleList
);
aScanOperation
->
theNdbCon
=
NULL
;
aScanOperation
->
theMagicNumber
=
0xFE11D2
;
the
ScanOpIdleList
=
aScanOperation
;
the
Impl
->
theScanOpIdleList
.
release
(
aScanOperation
)
;
DBUG_VOID_RETURN
;
}
...
...
@@ -570,8 +393,7 @@ void
Ndb
::
releaseRecAttr
(
NdbRecAttr
*
aRecAttr
)
{
aRecAttr
->
release
();
aRecAttr
->
next
(
theRecAttrIdleList
);
theRecAttrIdleList
=
aRecAttr
;
theImpl
->
theRecAttrIdleList
.
release
(
aRecAttr
);
}
/***************************************************************************
...
...
@@ -598,8 +420,7 @@ Ndb::releaseSignal(NdbApiSignal* aSignal)
#ifdef POORMANSPURIFY
creleaseSignals
++
;
#endif
aSignal
->
next
(
theSignalIdleList
);
theSignalIdleList
=
aSignal
;
theImpl
->
theSignalIdleList
.
release
(
aSignal
);
}
void
...
...
@@ -616,162 +437,7 @@ void
Ndb
::
releaseNdbBlob
(
NdbBlob
*
aBlob
)
{
aBlob
->
release
();
aBlob
->
theNext
=
theNdbBlobIdleList
;
theNdbBlobIdleList
=
aBlob
;
}
/***************************************************************************
void freeOperation();
Remark: Always release the first item in the free list
***************************************************************************/
void
Ndb
::
freeOperation
()
{
NdbOperation
*
tOp
=
theOpIdleList
;
theOpIdleList
=
theOpIdleList
->
next
();
delete
tOp
;
}
/***************************************************************************
void freeScanOperation();
Remark: Always release the first item in the free list
***************************************************************************/
void
Ndb
::
freeScanOperation
()
{
NdbIndexScanOperation
*
tOp
=
theScanOpIdleList
;
theScanOpIdleList
=
(
NdbIndexScanOperation
*
)
tOp
->
next
();
delete
tOp
;
}
/***************************************************************************
void freeIndexOperation();
Remark: Always release the first item in the free list
***************************************************************************/
void
Ndb
::
freeIndexOperation
()
{
NdbIndexOperation
*
tOp
=
theIndexOpIdleList
;
theIndexOpIdleList
=
(
NdbIndexOperation
*
)
theIndexOpIdleList
->
next
();
delete
tOp
;
}
/***************************************************************************
void freeNdbBranch();
Remark: Always release the first item in the free list
***************************************************************************/
void
Ndb
::
freeNdbBranch
()
{
NdbBranch
*
tNdbBranch
=
theBranchList
;
theBranchList
=
theBranchList
->
theNext
;
delete
tNdbBranch
;
}
/***************************************************************************
void freeNdbCall();
Remark: Always release the first item in the free list
***************************************************************************/
void
Ndb
::
freeNdbCall
()
{
NdbCall
*
tNdbCall
=
theCallList
;
theCallList
=
theCallList
->
theNext
;
delete
tNdbCall
;
}
/***************************************************************************
void freeNdbScanRec();
Remark: Always release the first item in the free list
***************************************************************************/
void
Ndb
::
freeNdbScanRec
()
{
NdbReceiver
*
tNdbScanRec
=
theScanList
;
theScanList
=
theScanList
->
next
();
delete
tNdbScanRec
;
}
/***************************************************************************
void freeNdbCon();
Remark: Always release the first item in the free list
***************************************************************************/
void
Ndb
::
freeNdbCon
()
{
NdbTransaction
*
tNdbCon
=
theConIdleList
;
theConIdleList
=
theConIdleList
->
next
();
delete
tNdbCon
;
}
/***************************************************************************
void freeNdbLabel();
Remark: Always release the first item in the free list
***************************************************************************/
void
Ndb
::
freeNdbLabel
()
{
NdbLabel
*
tNdbLabel
=
theLabelList
;
theLabelList
=
theLabelList
->
theNext
;
delete
tNdbLabel
;
}
/***************************************************************************
void freeNdbSubroutine();
Remark: Always release the first item in the free list
***************************************************************************/
void
Ndb
::
freeNdbSubroutine
()
{
NdbSubroutine
*
tNdbSubroutine
=
theSubroutineList
;
theSubroutineList
=
theSubroutineList
->
theNext
;
delete
tNdbSubroutine
;
}
/***************************************************************************
void freeRecAttr();
Remark: Always release the first item in the free list
***************************************************************************/
void
Ndb
::
freeRecAttr
()
{
NdbRecAttr
*
tRecAttr
=
theRecAttrIdleList
;
theRecAttrIdleList
=
theRecAttrIdleList
->
next
();
delete
tRecAttr
;
}
/***************************************************************************
void freeSignal();
Remark: Delete a signal object from the signal idlelist.
***************************************************************************/
void
Ndb
::
freeSignal
()
{
NdbApiSignal
*
tSignal
=
theSignalIdleList
;
theSignalIdleList
=
tSignal
->
next
();
delete
tSignal
;
#ifdef POORMANSPURIFY
cfreeSignals
++
;
#endif
}
void
Ndb
::
freeNdbBlob
()
{
NdbBlob
*
tBlob
=
theNdbBlobIdleList
;
theNdbBlobIdleList
=
tBlob
->
theNext
;
delete
tBlob
;
theImpl
->
theNdbBlobIdleList
.
release
(
aBlob
);
}
/****************************************************************************
...
...
@@ -826,3 +492,102 @@ Ndb::releaseConnectToNdb(NdbTransaction* a_con)
DBUG_VOID_RETURN
;
}
template
<
class
T
>
static
Ndb
::
Free_list_usage
*
update
(
Ndb
::
Free_list_usage
*
curr
,
Ndb_free_list_t
<
T
>
&
list
,
const
char
*
name
)
{
curr
->
m_name
=
name
;
curr
->
m_created
=
list
.
m_alloc_cnt
;
curr
->
m_free
=
list
.
m_free_cnt
;
curr
->
m_sizeof
=
sizeof
(
T
);
return
curr
;
}
Ndb
::
Free_list_usage
*
Ndb
::
get_free_list_usage
(
Ndb
::
Free_list_usage
*
curr
)
{
if
(
curr
==
0
)
{
return
0
;
}
if
(
curr
->
m_name
==
0
)
{
update
(
curr
,
theImpl
->
theConIdleList
,
"NdbTransaction"
);
}
else
if
(
!
strcmp
(
curr
->
m_name
,
"NdbTransaction"
))
{
update
(
curr
,
theImpl
->
theOpIdleList
,
"NdbOperation"
);
}
else
if
(
!
strcmp
(
curr
->
m_name
,
"NdbOperation"
))
{
update
(
curr
,
theImpl
->
theScanOpIdleList
,
"NdbIndexScanOperation"
);
}
else
if
(
!
strcmp
(
curr
->
m_name
,
"NdbIndexScanOperation"
))
{
update
(
curr
,
theImpl
->
theIndexOpIdleList
,
"NdbIndexOperation"
);
}
else
if
(
!
strcmp
(
curr
->
m_name
,
"NdbIndexOperation"
))
{
update
(
curr
,
theImpl
->
theRecAttrIdleList
,
"NdbRecAttr"
);
}
else
if
(
!
strcmp
(
curr
->
m_name
,
"NdbRecAttr"
))
{
update
(
curr
,
theImpl
->
theSignalIdleList
,
"NdbApiSignal"
);
}
else
if
(
!
strcmp
(
curr
->
m_name
,
"NdbApiSignal"
))
{
update
(
curr
,
theImpl
->
theLabelList
,
"NdbLabel"
);
}
else
if
(
!
strcmp
(
curr
->
m_name
,
"NdbLabel"
))
{
update
(
curr
,
theImpl
->
theBranchList
,
"NdbBranch"
);
}
else
if
(
!
strcmp
(
curr
->
m_name
,
"NdbBranch"
))
{
update
(
curr
,
theImpl
->
theSubroutineList
,
"NdbSubroutine"
);
}
else
if
(
!
strcmp
(
curr
->
m_name
,
"NdbSubroutine"
))
{
update
(
curr
,
theImpl
->
theCallList
,
"NdbCall"
);
}
else
if
(
!
strcmp
(
curr
->
m_name
,
"NdbCall"
))
{
update
(
curr
,
theImpl
->
theNdbBlobIdleList
,
"NdbBlob"
);
}
else
if
(
!
strcmp
(
curr
->
m_name
,
"NdbBlob"
))
{
update
(
curr
,
theImpl
->
theScanList
,
"NdbReceiver"
);
}
else
if
(
!
strcmp
(
curr
->
m_name
,
"NdbReceiver"
))
{
return
0
;
}
else
{
update
(
curr
,
theImpl
->
theConIdleList
,
"NdbTransaction"
);
}
return
curr
;
}
#define TI(T) \
template Ndb::Free_list_usage* \
update(Ndb::Free_list_usage*, Ndb_free_list_t<T> &, const char * name);\
template struct Ndb_free_list_t<T>
TI
(
NdbBlob
);
TI
(
NdbCall
);
TI
(
NdbLabel
);
TI
(
NdbBranch
);
TI
(
NdbSubroutine
);
TI
(
NdbApiSignal
);
TI
(
NdbRecAttr
);
TI
(
NdbOperation
);
TI
(
NdbReceiver
);
TI
(
NdbConnection
);
TI
(
NdbIndexOperation
);
TI
(
NdbIndexScanOperation
);
ndb/tools/restore/Restore.cpp
View file @
2119a88a
...
...
@@ -869,7 +869,7 @@ operator<<(NdbOut& ndbout, const AttributeS& attr){
return
ndbout
;
}
NdbRecAttr
tmprec
;
NdbRecAttr
tmprec
(
0
)
;
tmprec
.
setup
(
desc
.
m_column
,
(
char
*
)
data
.
void_value
);
ndbout
<<
tmprec
;
...
...
sql/ha_ndbcluster.cc
View file @
2119a88a
...
...
@@ -7392,4 +7392,50 @@ ha_ndbcluster::generate_scan_filter(Ndb_cond_stack *ndb_cond_stack,
DBUG_RETURN
(
0
);
}
int
ndbcluster_show_status
(
THD
*
thd
)
{
Protocol
*
protocol
=
thd
->
protocol
;
DBUG_ENTER
(
"ndbcluster_show_status"
);
if
(
have_ndbcluster
!=
SHOW_OPTION_YES
)
{
my_message
(
ER_NOT_SUPPORTED_YET
,
"Cannot call SHOW NDBCLUSTER STATUS because skip-ndbcluster is defined"
,
MYF
(
0
));
DBUG_RETURN
(
TRUE
);
}
List
<
Item
>
field_list
;
field_list
.
push_back
(
new
Item_empty_string
(
"free_list"
,
255
));
field_list
.
push_back
(
new
Item_return_int
(
"created"
,
10
,
MYSQL_TYPE_LONG
));
field_list
.
push_back
(
new
Item_return_int
(
"free"
,
10
,
MYSQL_TYPE_LONG
));
field_list
.
push_back
(
new
Item_return_int
(
"sizeof"
,
10
,
MYSQL_TYPE_LONG
));
if
(
protocol
->
send_fields
(
&
field_list
,
1
))
DBUG_RETURN
(
TRUE
);
if
(
thd
->
transaction
.
thd_ndb
&&
((
Thd_ndb
*
)
thd
->
transaction
.
thd_ndb
)
->
ndb
)
{
Ndb
*
ndb
=
((
Thd_ndb
*
)
thd
->
transaction
.
thd_ndb
)
->
ndb
;
Ndb
::
Free_list_usage
tmp
;
tmp
.
m_name
=
0
;
while
(
ndb
->
get_free_list_usage
(
&
tmp
))
{
protocol
->
prepare_for_resend
();
protocol
->
store
(
tmp
.
m_name
,
&
my_charset_bin
);
protocol
->
store
((
uint
)
tmp
.
m_created
);
protocol
->
store
((
uint
)
tmp
.
m_free
);
protocol
->
store
((
uint
)
tmp
.
m_sizeof
);
if
(
protocol
->
write
())
DBUG_RETURN
(
TRUE
);
}
}
send_eof
(
thd
);
DBUG_RETURN
(
FALSE
);
}
#endif
/* HAVE_NDBCLUSTER_DB */
sql/ha_ndbcluster.h
View file @
2119a88a
...
...
@@ -728,3 +728,5 @@ int ndbcluster_table_exists_in_engine(THD* thd,
int
ndbcluster_drop_database
(
const
char
*
path
);
void
ndbcluster_print_error
(
int
error
,
const
NdbOperation
*
error_op
);
int
ndbcluster_show_status
(
THD
*
);
sql/mysqld.cc
View file @
2119a88a
...
...
@@ -5818,6 +5818,7 @@ struct show_var_st status_vars[]= {
{
"Com_show_fields"
,
(
char
*
)
offsetof
(
STATUS_VAR
,
com_stat
[(
uint
)
SQLCOM_SHOW_FIELDS
]),
SHOW_LONG_STATUS
},
{
"Com_show_grants"
,
(
char
*
)
offsetof
(
STATUS_VAR
,
com_stat
[(
uint
)
SQLCOM_SHOW_GRANTS
]),
SHOW_LONG_STATUS
},
{
"Com_show_innodb_status"
,
(
char
*
)
offsetof
(
STATUS_VAR
,
com_stat
[(
uint
)
SQLCOM_SHOW_INNODB_STATUS
]),
SHOW_LONG_STATUS
},
{
"Com_show_ndb_status"
,
(
char
*
)
offsetof
(
STATUS_VAR
,
com_stat
[(
uint
)
SQLCOM_SHOW_NDBCLUSTER_STATUS
]),
SHOW_LONG_STATUS
},
{
"Com_show_keys"
,
(
char
*
)
offsetof
(
STATUS_VAR
,
com_stat
[(
uint
)
SQLCOM_SHOW_KEYS
]),
SHOW_LONG_STATUS
},
{
"Com_show_logs"
,
(
char
*
)
offsetof
(
STATUS_VAR
,
com_stat
[(
uint
)
SQLCOM_SHOW_LOGS
]),
SHOW_LONG_STATUS
},
{
"Com_show_master_status"
,
(
char
*
)
offsetof
(
STATUS_VAR
,
com_stat
[(
uint
)
SQLCOM_SHOW_MASTER_STAT
]),
SHOW_LONG_STATUS
},
...
...
sql/sql_lex.h
View file @
2119a88a
...
...
@@ -53,7 +53,7 @@ enum enum_sql_command {
SQLCOM_SHOW_DATABASES
,
SQLCOM_SHOW_TABLES
,
SQLCOM_SHOW_FIELDS
,
SQLCOM_SHOW_KEYS
,
SQLCOM_SHOW_VARIABLES
,
SQLCOM_SHOW_LOGS
,
SQLCOM_SHOW_STATUS
,
SQLCOM_SHOW_INNODB_STATUS
,
SQLCOM_SHOW_MUTEX_STATUS
,
SQLCOM_SHOW_INNODB_STATUS
,
SQLCOM_SHOW_
NDBCLUSTER_STATUS
,
SQLCOM_SHOW_
MUTEX_STATUS
,
SQLCOM_SHOW_PROCESSLIST
,
SQLCOM_SHOW_MASTER_STAT
,
SQLCOM_SHOW_SLAVE_STAT
,
SQLCOM_SHOW_GRANTS
,
SQLCOM_SHOW_CREATE
,
SQLCOM_SHOW_CHARSETS
,
SQLCOM_SHOW_COLLATIONS
,
SQLCOM_SHOW_CREATE_DB
,
SQLCOM_SHOW_TABLE_STATUS
,
...
...
sql/sql_parse.cc
View file @
2119a88a
...
...
@@ -25,6 +25,10 @@
#include "ha_innodb.h"
#endif
#ifdef HAVE_NDBCLUSTER_DB
#include "ha_ndbcluster.h"
#endif
#include "sp_head.h"
#include "sp.h"
#include "sp_cache.h"
...
...
@@ -2669,6 +2673,13 @@ mysql_execute_command(THD *thd)
res
=
load_master_data
(
thd
);
break
;
#endif
/* HAVE_REPLICATION */
#ifdef HAVE_NDBCLUSTER_DB
case
SQLCOM_SHOW_NDBCLUSTER_STATUS
:
{
res
=
ndbcluster_show_status
(
thd
);
break
;
}
#endif
#ifdef HAVE_INNOBASE_DB
case
SQLCOM_SHOW_INNODB_STATUS
:
{
...
...
sql/sql_yacc.yy
View file @
2119a88a
...
...
@@ -6648,6 +6648,9 @@ show_engine_param:
STATUS_SYM
{
switch (Lex->create_info.db_type) {
case DB_TYPE_NDBCLUSTER:
Lex->sql_command = SQLCOM_SHOW_NDBCLUSTER_STATUS;
break;
case DB_TYPE_INNODB:
Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS;
break;
...
...
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