Commit 352d5f6a authored by unknown's avatar unknown

Merge mysql.com:/home/stewart/Documents/MySQL/5.0/ndb

into mysql.com:/home/stewart/Documents/MySQL/5.0/ndb-dynamic-port

parents d779a039 bd6f3850
...@@ -190,7 +190,7 @@ DISTRIBUTE_GROUP_DOC = NO ...@@ -190,7 +190,7 @@ DISTRIBUTE_GROUP_DOC = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab. # The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments. # Doxygen uses this value to replace tabs by spaces in code fragments.
TAB_SIZE = 8 TAB_SIZE = 2
# The GENERATE_TODOLIST tag can be used to enable (YES) or # The GENERATE_TODOLIST tag can be used to enable (YES) or
# disable (NO) the todo list. This list is created by putting \todo # disable (NO) the todo list. This list is created by putting \todo
...@@ -245,7 +245,7 @@ OPTIMIZE_OUTPUT_FOR_C = NO ...@@ -245,7 +245,7 @@ OPTIMIZE_OUTPUT_FOR_C = NO
# at the bottom of the documentation of classes and structs. If set to YES the # at the bottom of the documentation of classes and structs. If set to YES the
# list will mention the files that were used to generate the documentation. # list will mention the files that were used to generate the documentation.
SHOW_USED_FILES = YES SHOW_USED_FILES = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to warning and progress messages # configuration options related to warning and progress messages
...@@ -447,7 +447,7 @@ HTML_STYLESHEET = ...@@ -447,7 +447,7 @@ HTML_STYLESHEET =
# files or namespaces will be aligned in HTML using tables. If set to # files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used. # NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES HTML_ALIGN_MEMBERS = NO
# If the GENERATE_HTMLHELP tag is set to YES, additional index files # If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the # will be generated that can be used as input for tools like the
...@@ -477,7 +477,7 @@ TOC_EXPAND = NO ...@@ -477,7 +477,7 @@ TOC_EXPAND = NO
# top of each HTML page. The value NO (the default) enables the index and # top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it. # the value YES disables it.
DISABLE_INDEX = NO DISABLE_INDEX = YES
# This tag can be used to set the number of enum values (range [1..20]) # This tag can be used to set the number of enum values (range [1..20])
# that doxygen will group on one line in the generated HTML documentation. # that doxygen will group on one line in the generated HTML documentation.
......
...@@ -201,7 +201,7 @@ DISTRIBUTE_GROUP_DOC = NO ...@@ -201,7 +201,7 @@ DISTRIBUTE_GROUP_DOC = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab. # The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments. # Doxygen uses this value to replace tabs by spaces in code fragments.
TAB_SIZE = 8 TAB_SIZE = 2
# The GENERATE_TODOLIST tag can be used to enable (YES) or # The GENERATE_TODOLIST tag can be used to enable (YES) or
# disable (NO) the todo list. This list is created by putting \todo # disable (NO) the todo list. This list is created by putting \todo
...@@ -485,7 +485,7 @@ HTML_STYLESHEET = ...@@ -485,7 +485,7 @@ HTML_STYLESHEET =
# files or namespaces will be aligned in HTML using tables. If set to # files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used. # NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES HTML_ALIGN_MEMBERS = NO
# If the GENERATE_HTMLHELP tag is set to YES, additional index files # If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the # will be generated that can be used as input for tools like the
...@@ -515,7 +515,7 @@ TOC_EXPAND = NO ...@@ -515,7 +515,7 @@ TOC_EXPAND = NO
# top of each HTML page. The value NO (the default) enables the index and # top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it. # the value YES disables it.
DISABLE_INDEX = NO DISABLE_INDEX = YES
# This tag can be used to set the number of enum values (range [1..20]) # This tag can be used to set the number of enum values (range [1..20])
# that doxygen will group on one line in the generated HTML documentation. # that doxygen will group on one line in the generated HTML documentation.
......
...@@ -190,7 +190,7 @@ DISTRIBUTE_GROUP_DOC = NO ...@@ -190,7 +190,7 @@ DISTRIBUTE_GROUP_DOC = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab. # The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments. # Doxygen uses this value to replace tabs by spaces in code fragments.
TAB_SIZE = 8 TAB_SIZE = 2
# The GENERATE_TODOLIST tag can be used to enable (YES) or # The GENERATE_TODOLIST tag can be used to enable (YES) or
# disable (NO) the todo list. This list is created by putting \todo # disable (NO) the todo list. This list is created by putting \todo
...@@ -245,7 +245,7 @@ OPTIMIZE_OUTPUT_FOR_C = NO ...@@ -245,7 +245,7 @@ OPTIMIZE_OUTPUT_FOR_C = NO
# at the bottom of the documentation of classes and structs. If set to YES the # at the bottom of the documentation of classes and structs. If set to YES the
# list will mention the files that were used to generate the documentation. # list will mention the files that were used to generate the documentation.
SHOW_USED_FILES = YES SHOW_USED_FILES = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to warning and progress messages # configuration options related to warning and progress messages
...@@ -447,7 +447,7 @@ HTML_STYLESHEET = ...@@ -447,7 +447,7 @@ HTML_STYLESHEET =
# files or namespaces will be aligned in HTML using tables. If set to # files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used. # NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES HTML_ALIGN_MEMBERS = NO
# If the GENERATE_HTMLHELP tag is set to YES, additional index files # If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the # will be generated that can be used as input for tools like the
...@@ -477,7 +477,7 @@ TOC_EXPAND = NO ...@@ -477,7 +477,7 @@ TOC_EXPAND = NO
# top of each HTML page. The value NO (the default) enables the index and # top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it. # the value YES disables it.
DISABLE_INDEX = NO DISABLE_INDEX = YES
# This tag can be used to set the number of enum values (range [1..20]) # This tag can be used to set the number of enum values (range [1..20])
# that doxygen will group on one line in the generated HTML documentation. # that doxygen will group on one line in the generated HTML documentation.
......
...@@ -201,7 +201,7 @@ DISTRIBUTE_GROUP_DOC = NO ...@@ -201,7 +201,7 @@ DISTRIBUTE_GROUP_DOC = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab. # The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments. # Doxygen uses this value to replace tabs by spaces in code fragments.
TAB_SIZE = 8 TAB_SIZE = 2
# The GENERATE_TODOLIST tag can be used to enable (YES) or # The GENERATE_TODOLIST tag can be used to enable (YES) or
# disable (NO) the todo list. This list is created by putting \todo # disable (NO) the todo list. This list is created by putting \todo
...@@ -256,7 +256,7 @@ OPTIMIZE_OUTPUT_FOR_C = NO ...@@ -256,7 +256,7 @@ OPTIMIZE_OUTPUT_FOR_C = NO
# at the bottom of the documentation of classes and structs. If set to YES the # at the bottom of the documentation of classes and structs. If set to YES the
# list will mention the files that were used to generate the documentation. # list will mention the files that were used to generate the documentation.
SHOW_USED_FILES = YES SHOW_USED_FILES = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to warning and progress messages # configuration options related to warning and progress messages
...@@ -469,7 +469,7 @@ HTML_STYLESHEET = ...@@ -469,7 +469,7 @@ HTML_STYLESHEET =
# files or namespaces will be aligned in HTML using tables. If set to # files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used. # NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES HTML_ALIGN_MEMBERS = NO
# If the GENERATE_HTMLHELP tag is set to YES, additional index files # If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the # will be generated that can be used as input for tools like the
...@@ -499,7 +499,7 @@ TOC_EXPAND = NO ...@@ -499,7 +499,7 @@ TOC_EXPAND = NO
# top of each HTML page. The value NO (the default) enables the index and # top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it. # the value YES disables it.
DISABLE_INDEX = NO DISABLE_INDEX = YES
# This tag can be used to set the number of enum values (range [1..20]) # This tag can be used to set the number of enum values (range [1..20])
# that doxygen will group on one line in the generated HTML documentation. # that doxygen will group on one line in the generated HTML documentation.
......
...@@ -201,7 +201,7 @@ DISTRIBUTE_GROUP_DOC = NO ...@@ -201,7 +201,7 @@ DISTRIBUTE_GROUP_DOC = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab. # The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments. # Doxygen uses this value to replace tabs by spaces in code fragments.
TAB_SIZE = 8 TAB_SIZE = 2
# The GENERATE_TODOLIST tag can be used to enable (YES) or # The GENERATE_TODOLIST tag can be used to enable (YES) or
# disable (NO) the todo list. This list is created by putting \todo # disable (NO) the todo list. This list is created by putting \todo
...@@ -256,7 +256,7 @@ OPTIMIZE_OUTPUT_FOR_C = NO ...@@ -256,7 +256,7 @@ OPTIMIZE_OUTPUT_FOR_C = NO
# at the bottom of the documentation of classes and structs. If set to YES the # at the bottom of the documentation of classes and structs. If set to YES the
# list will mention the files that were used to generate the documentation. # list will mention the files that were used to generate the documentation.
SHOW_USED_FILES = YES SHOW_USED_FILES = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to warning and progress messages # configuration options related to warning and progress messages
...@@ -469,7 +469,7 @@ HTML_STYLESHEET = ...@@ -469,7 +469,7 @@ HTML_STYLESHEET =
# files or namespaces will be aligned in HTML using tables. If set to # files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used. # NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES HTML_ALIGN_MEMBERS = NO
# If the GENERATE_HTMLHELP tag is set to YES, additional index files # If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the # will be generated that can be used as input for tools like the
...@@ -499,7 +499,7 @@ TOC_EXPAND = NO ...@@ -499,7 +499,7 @@ TOC_EXPAND = NO
# top of each HTML page. The value NO (the default) enables the index and # top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it. # the value YES disables it.
DISABLE_INDEX = NO DISABLE_INDEX = YES
# This tag can be used to set the number of enum values (range [1..20]) # This tag can be used to set the number of enum values (range [1..20])
# that doxygen will group on one line in the generated HTML documentation. # that doxygen will group on one line in the generated HTML documentation.
......
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
* @section General Concepts * @section General Concepts
* *
* Each MGM API function needs a management server handle * Each MGM API function needs a management server handle
* of type <code>Mgm_C_Api::NdbMgmHandle</code>. * of type Mgm_C_Api::NdbMgmHandle.
* This handle is initally created by calling the * This handle is initally created by calling the
* function <code>ndb_mgm_create_handle()</code>. * function ndb_mgm_create_handle().
* *
* A function can return: * A function can return:
* -# An integer value. * -# An integer value.
......
...@@ -23,31 +23,31 @@ ...@@ -23,31 +23,31 @@
The <em>NDB API</em> is a MySQL Cluster application interface The <em>NDB API</em> is a MySQL Cluster application interface
that implements transactions. that implements transactions.
The NDB API consists of the following fundamental classes: The NDB API consists of the following fundamental classes:
- <code>Ndb_cluster_connection</code>, representing a connection to a cluster, - Ndb_cluster_connection, representing a connection to a cluster,
- <code>Ndb</code> is the main class, representing the database, - Ndb is the main class, representing the database,
- <code>NdbTransaction</code> represents a transaction, - NdbTransaction represents a transaction,
- <code>NdbOperation</code> represents an operation using a primary key, - NdbOperation represents an operation using a primary key,
- <code>NdbScanOperation</code> represents an operation performing a full table scan. - NdbScanOperation represents an operation performing a full table scan.
- <code>NdbIndexOperation</code> represents an operation using a unique hash index, - NdbIndexOperation represents an operation using a unique hash index,
- <code>NdbIndexScanOperation</code> represents an operation performing a scan using - NdbIndexScanOperation represents an operation performing a scan using
an ordered index, an ordered index,
- <code>NdbRecAttr</code> represents an attribute value - NdbRecAttr represents an attribute value
- <code>NdbDictionary</code> represents meta information about tables and attributes. - NdbDictionary represents meta information about tables and attributes.
- <code>NdbError</code> contains the specification for an error. - NdbError contains the specification for an error.
There are also some auxiliary classes. There are also some auxiliary classes.
The main structure of an application program is as follows: The main structure of an application program is as follows:
-# Construct and connect to a cluster using the <code>Ndb_cluster_connection</code> -# Construct and connect to a cluster using the Ndb_cluster_connection
object. object.
-# Construct and initialize <code>Ndb</code> object(s). -# Construct and initialize Ndb object(s).
-# Define and execute transactions using <code>NdbTransaction</code> and <code>Ndb*Operation</code>. -# Define and execute transactions using NdbTransaction and Ndb*Operation.
-# Delete <code>Ndb</code> objects -# Delete Ndb objects
-# Delete cluster connection -# Delete cluster connection
The main structure of a transaction is as follows: The main structure of a transaction is as follows:
-# Start transaction (an <code>NdbTransaction</code>) -# Start transaction (an NdbTransaction)
-# Add and define operations associated with the transaction using -# Add and define operations associated with the transaction using
<code>Ndb*Operation</code> Ndb*Operation
-# Execute transaction -# Execute transaction
The execution can be of two different types, The execution can be of two different types,
...@@ -69,41 +69,41 @@ ...@@ -69,41 +69,41 @@
Synchronous transactions are defined and executed as follows: Synchronous transactions are defined and executed as follows:
-# Start (create) the transaction, which is -# Start (create) the transaction, which is
referenced by an <code>NdbTransaction</code> object referenced by an NdbTransaction object
(typically created using <code>Ndb::startTransaction()</code>). (typically created using Ndb::startTransaction()).
At this point, the transaction is only being defined, At this point, the transaction is only being defined,
and is not yet sent to the NDB kernel. and is not yet sent to the NDB kernel.
-# Define operations and add them to the transaction, -# Define operations and add them to the transaction,
using <code>NdbTransaction::getNdb*Operation()</code> and using NdbTransaction::getNdb*Operation() and
methods of the <code>Ndb*Operation</code> class. methods of the Ndb*Operation class.
Note that the transaction has still not yet been sent to the NDB kernel. Note that the transaction has still not yet been sent to the NDB kernel.
-# Execute the transaction, using the <code>NdbTransaction::execute()</code> method. -# Execute the transaction, using the NdbTransaction::execute() method.
-# Close the transaction (using <code>Ndb::closeTransaction()</code>). -# Close the transaction (using Ndb::closeTransaction()).
For an example of this process, see the program listing in @ref ndbapi_example1.cpp. For an example of this process, see the program listing in @ref ndbapi_example1.cpp.
To execute several parallel synchronous transactions, one can either To execute several parallel synchronous transactions, one can either
use multiple <code>Ndb</code> objects in several threads, or start multiple use multiple Ndb objects in several threads, or start multiple
applications programs. applications programs.
@section secNdbOperations Operations @section secNdbOperations Operations
Each <code>NdbTransaction</code> Each NdbTransaction
consists of a list of operations which are represented by instances consists of a list of operations which are represented by instances
of <code>Ndb*Operation</code>. of Ndb*Operation.
<h3>Single row operations</h3> <h3>Single row operations</h3>
After the operation is created using <code>NdbTransaction::getNdbOperation()</code> After the operation is created using NdbTransaction::getNdbOperation()
(or <code>NdbTransaction::getNdbIndexOperation()</code>), it is defined in the following (or NdbTransaction::getNdbIndexOperation()), it is defined in the following
three steps: three steps:
-# Define the standard operation type, using <code>NdbOperation::readTuple()</code> -# Define the standard operation type, using NdbOperation::readTuple()
-# Specify search conditions, using <code>NdbOperation::equal()</code> -# Specify search conditions, using NdbOperation::equal()
-# Specify attribute actions, using <code>NdbOperation::getValue()</code> -# Specify attribute actions, using NdbOperation::getValue()
Here are two brief examples illustrating this process. For the sake of brevity, Here are two brief examples illustrating this process. For the sake of brevity,
we omit error-handling. we omit error-handling.
This first example uses an <code>NdbOperation</code>: This first example uses an NdbOperation:
@code @code
// 1. Create // 1. Create
MyOperation= MyTransaction->getNdbOperation("MYTABLENAME"); MyOperation= MyTransaction->getNdbOperation("MYTABLENAME");
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
For additional examples of this sort, see @ref ndbapi_example1.cpp and For additional examples of this sort, see @ref ndbapi_example1.cpp and
@ref ndbapi_example2.cpp. @ref ndbapi_example2.cpp.
The second example uses an <code>NdbIndexOperation</code>: The second example uses an NdbIndexOperation:
@code @code
// 1. Create // 1. Create
MyOperation= MyTransaction->getNdbIndexOperation("MYINDEX", "MYTABLENAME"); MyOperation= MyTransaction->getNdbIndexOperation("MYINDEX", "MYTABLENAME");
...@@ -139,8 +139,6 @@ ...@@ -139,8 +139,6 @@
We will now discuss in somewhat greater detail each step involved in the creation We will now discuss in somewhat greater detail each step involved in the creation
and use of synchronous transactions. and use of synchronous transactions.
// Edit stop point - JS, 20041228 0425+1000
<h4>Step 1: Define single row operation type</h4> <h4>Step 1: Define single row operation type</h4>
The following types of operations exist: The following types of operations exist:
-# NdbOperation::insertTuple : -# NdbOperation::insertTuple :
...@@ -211,19 +209,19 @@ ...@@ -211,19 +209,19 @@
- They can be used to update or delete multiple rows - They can be used to update or delete multiple rows
- They can operate on several nodes in parallell - They can operate on several nodes in parallell
After the operation is created using <code>NdbTransaction::getNdbScanOperation()</code> After the operation is created using NdbTransaction::getNdbScanOperation()
(or <code>NdbTransaction::getNdbIndexScanOperation()</code>), it is defined in the following (or NdbTransaction::getNdbIndexScanOperation()), it is defined in the following
three steps: three steps:
-# Define the standard operation type, using <code>NdbScanOperation::readTuples()</code> -# Define the standard operation type, using NdbScanOperation::readTuples()
-# Specify search conditions, using @ref NdbScanFilter and/or @ref NdbIndexScanOperation::setBound -# Specify search conditions, using @ref NdbScanFilter and/or @ref NdbIndexScanOperation::setBound
-# Specify attribute actions, using <code>NdbOperation::getValue()</code> -# Specify attribute actions, using NdbOperation::getValue()
-# Executing the transaction, using <code>NdbTransaction::execute()</code> -# Executing the transaction, using NdbTransaction::execute()
-# Iterating through the result set using <code>NdbScanOperation::nextResult</code> -# Iterating through the result set using NdbScanOperation::nextResult
Here are two brief examples illustrating this process. For the sake of brevity, Here are two brief examples illustrating this process. For the sake of brevity,
we omit error-handling. we omit error-handling.
This first example uses an <code>NdbScanOperation</code>: This first example uses an NdbScanOperation:
@code @code
// 1. Create // 1. Create
MyOperation= MyTransaction->getNdbScanOperation("MYTABLENAME"); MyOperation= MyTransaction->getNdbScanOperation("MYTABLENAME");
...@@ -242,7 +240,7 @@ ...@@ -242,7 +240,7 @@
MyRecAttr= MyOperation->getValue("ATTR2", NULL); MyRecAttr= MyOperation->getValue("ATTR2", NULL);
@endcode @endcode
The second example uses an <code>NdbIndexScanOperation</code>: The second example uses an NdbIndexScanOperation:
@code @code
// 1. Create // 1. Create
MyOperation= MyTransaction->getNdbIndexScanOperation("MYORDEREDINDEX", "MYTABLENAME"); MyOperation= MyTransaction->getNdbIndexScanOperation("MYORDEREDINDEX", "MYTABLENAME");
...@@ -309,7 +307,7 @@ ...@@ -309,7 +307,7 @@
-# When iterating through the result set, for each row optionally call -# When iterating through the result set, for each row optionally call
either NdbScanOperation::updateCurrentTuple or either NdbScanOperation::updateCurrentTuple or
NdbScanOperation::deleteCurrentTuple NdbScanOperation::deleteCurrentTuple
-# If performing <code>NdbScanOperation::updateCurrentTuple</code>, -# If performing NdbScanOperation::updateCurrentTuple,
set new values on record using ordinary @ref NdbOperation::setValue. set new values on record using ordinary @ref NdbOperation::setValue.
NdbOperation::equal should _not_ be called as the primary key is NdbOperation::equal should _not_ be called as the primary key is
retreived from the scan. retreived from the scan.
...@@ -337,10 +335,10 @@ ...@@ -337,10 +335,10 @@
But Ndb will only lock a batch of rows per fragment at a time. But Ndb will only lock a batch of rows per fragment at a time.
How many rows will be locked per fragment is controlled by the How many rows will be locked per fragment is controlled by the
<code>batch</code> parameter to @ref NdbScanOperation::readTuples. batch parameter to @ref NdbScanOperation::readTuples.
To let the application handle how locks are released To let the application handle how locks are released
@ref NdbScanOperation::nextResult have a parameter <code>fetch_allow</code>. @ref NdbScanOperation::nextResult have a parameter fetch_allow.
If NdbScanOperation::nextResult is called with fetch_allow = false, no If NdbScanOperation::nextResult is called with fetch_allow = false, no
locks may be released as result of the function call. Otherwise the locks locks may be released as result of the function call. Otherwise the locks
for the current batch may be released. for the current batch may be released.
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <NdbCondition.h> #include <NdbCondition.h>
#include <NdbTimer.hpp> #include <NdbTimer.hpp>
#include <Vector.hpp> #include <Vector.hpp>
#include <NdbApi.hpp>
#include <NdbDictionary.hpp> #include <NdbDictionary.hpp>
class NDBT_Step; class NDBT_Step;
...@@ -34,7 +35,9 @@ class NDBT_TestCaseImpl1; ...@@ -34,7 +35,9 @@ class NDBT_TestCaseImpl1;
class NDBT_Context { class NDBT_Context {
public: public:
NDBT_Context(); Ndb_cluster_connection& m_cluster_connection;
NDBT_Context(Ndb_cluster_connection&);
~NDBT_Context(); ~NDBT_Context();
const NdbDictionary::Table* getTab(); const NdbDictionary::Table* getTab();
NDBT_TestSuite* getSuite(); NDBT_TestSuite* getSuite();
...@@ -120,7 +123,7 @@ public: ...@@ -120,7 +123,7 @@ public:
NDBT_TESTFUNC* pfunc); NDBT_TESTFUNC* pfunc);
virtual ~NDBT_Step() {} virtual ~NDBT_Step() {}
int execute(NDBT_Context*); int execute(NDBT_Context*);
virtual int setUp() = 0; virtual int setUp(Ndb_cluster_connection&) = 0;
virtual void tearDown() = 0; virtual void tearDown() = 0;
void setContext(NDBT_Context*); void setContext(NDBT_Context*);
NDBT_Context* getContext(); NDBT_Context* getContext();
...@@ -142,7 +145,7 @@ public: ...@@ -142,7 +145,7 @@ public:
const char* pname, const char* pname,
NDBT_TESTFUNC* pfunc); NDBT_TESTFUNC* pfunc);
virtual ~NDBT_NdbApiStep() {} virtual ~NDBT_NdbApiStep() {}
virtual int setUp(); virtual int setUp(Ndb_cluster_connection&);
virtual void tearDown(); virtual void tearDown();
Ndb* getNdb(); Ndb* getNdb();
...@@ -347,10 +350,13 @@ public: ...@@ -347,10 +350,13 @@ public:
int addTest(NDBT_TestCase* pTest); int addTest(NDBT_TestCase* pTest);
private: private:
int executeOne(const char* _tabname, const char* testname = NULL); int executeOne(Ndb_cluster_connection&,
int executeAll(const char* testname = NULL); const char* _tabname, const char* testname = NULL);
int executeAll(Ndb_cluster_connection&,
const char* testname = NULL);
void execute(Ndb_cluster_connection&,
Ndb*, const NdbDictionary::Table*, const char* testname = NULL);
void execute(Ndb*, const NdbDictionary::Table*, const char* testname = NULL);
int report(const char* _tcname = NULL); int report(const char* _tcname = NULL);
int reportAllTables(const char* ); int reportAllTables(const char* );
const char* name; const char* name;
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
#include <NdbSleep.h> #include <NdbSleep.h>
#include <UtilTransactions.hpp> #include <UtilTransactions.hpp>
Bank::Bank(): Bank::Bank(Ndb_cluster_connection& con):
m_ndb("BANK"), m_ndb(&con, "BANK"),
m_maxAccount(-1), m_maxAccount(-1),
m_initialized(false) m_initialized(false)
{ {
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
class Bank { class Bank {
public: public:
Bank(); Bank(Ndb_cluster_connection&);
int createAndLoadBank(bool overWrite, int num_accounts=10); int createAndLoadBank(bool overWrite, int num_accounts=10);
int dropBank(); int dropBank();
......
...@@ -43,7 +43,13 @@ int main(int argc, const char** argv){ ...@@ -43,7 +43,13 @@ int main(int argc, const char** argv){
return NDBT_ProgramExit(NDBT_WRONGARGS); return NDBT_ProgramExit(NDBT_WRONGARGS);
} }
Bank bank; Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Bank bank(con);
int overWriteExisting = true; int overWriteExisting = true;
if (bank.createAndLoadBank(overWriteExisting) != NDBT_OK) if (bank.createAndLoadBank(overWriteExisting) != NDBT_OK)
return NDBT_ProgramExit(NDBT_FAILED); return NDBT_ProgramExit(NDBT_FAILED);
......
...@@ -43,7 +43,13 @@ int main(int argc, const char** argv){ ...@@ -43,7 +43,13 @@ int main(int argc, const char** argv){
return NDBT_ProgramExit(NDBT_WRONGARGS); return NDBT_ProgramExit(NDBT_WRONGARGS);
} }
Bank bank; Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Bank bank(con);
if (bank.performMakeGLs() != 0) if (bank.performMakeGLs() != 0)
return NDBT_ProgramExit(NDBT_FAILED); return NDBT_ProgramExit(NDBT_FAILED);
......
...@@ -43,7 +43,13 @@ int main(int argc, const char** argv){ ...@@ -43,7 +43,13 @@ int main(int argc, const char** argv){
return NDBT_ProgramExit(NDBT_WRONGARGS); return NDBT_ProgramExit(NDBT_WRONGARGS);
} }
Bank bank; Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Bank bank(con);
if (bank.performSumAccounts() != 0) if (bank.performSumAccounts() != 0)
return NDBT_ProgramExit(NDBT_FAILED); return NDBT_ProgramExit(NDBT_FAILED);
......
...@@ -46,7 +46,13 @@ int main(int argc, const char** argv){ ...@@ -46,7 +46,13 @@ int main(int argc, const char** argv){
return NDBT_ProgramExit(NDBT_WRONGARGS); return NDBT_ProgramExit(NDBT_WRONGARGS);
} }
Bank bank; Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Bank bank(con);
if (bank.performIncreaseTime(_wait) != 0) if (bank.performIncreaseTime(_wait) != 0)
return NDBT_ProgramExit(NDBT_FAILED); return NDBT_ProgramExit(NDBT_FAILED);
......
...@@ -46,7 +46,13 @@ int main(int argc, const char** argv){ ...@@ -46,7 +46,13 @@ int main(int argc, const char** argv){
return NDBT_ProgramExit(NDBT_WRONGARGS); return NDBT_ProgramExit(NDBT_WRONGARGS);
} }
Bank bank; Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Bank bank(con);
if (bank.performTransactions(_wait) != 0) if (bank.performTransactions(_wait) != 0)
return NDBT_ProgramExit(NDBT_FAILED); return NDBT_ProgramExit(NDBT_FAILED);
......
...@@ -44,7 +44,13 @@ int main(int argc, const char** argv){ ...@@ -44,7 +44,13 @@ int main(int argc, const char** argv){
return NDBT_ProgramExit(NDBT_WRONGARGS); return NDBT_ProgramExit(NDBT_WRONGARGS);
} }
Bank bank; Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Bank bank(con);
if (bank.performValidateAllGLs() != 0) if (bank.performValidateAllGLs() != 0)
return NDBT_ProgramExit(NDBT_FAILED); return NDBT_ProgramExit(NDBT_FAILED);
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "Bank.hpp" #include "Bank.hpp"
int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){ int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){
Bank bank; Bank bank(ctx->m_cluster_connection);
int overWriteExisting = true; int overWriteExisting = true;
if (bank.createAndLoadBank(overWriteExisting) != NDBT_OK) if (bank.createAndLoadBank(overWriteExisting) != NDBT_OK)
return NDBT_FAILED; return NDBT_FAILED;
...@@ -40,7 +40,7 @@ int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -40,7 +40,7 @@ int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){
} }
int runBankTimer(NDBT_Context* ctx, NDBT_Step* step){ int runBankTimer(NDBT_Context* ctx, NDBT_Step* step){
Bank bank; Bank bank(ctx->m_cluster_connection);
int wait = 30; // Max seconds between each "day" int wait = 30; // Max seconds between each "day"
int yield = 1; // Loops before bank returns int yield = 1; // Loops before bank returns
...@@ -51,7 +51,7 @@ int runBankTimer(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -51,7 +51,7 @@ int runBankTimer(NDBT_Context* ctx, NDBT_Step* step){
} }
int runBankTransactions(NDBT_Context* ctx, NDBT_Step* step){ int runBankTransactions(NDBT_Context* ctx, NDBT_Step* step){
Bank bank; Bank bank(ctx->m_cluster_connection);
int wait = 10; // Max ms between each transaction int wait = 10; // Max ms between each transaction
int yield = 100; // Loops before bank returns int yield = 100; // Loops before bank returns
...@@ -62,7 +62,7 @@ int runBankTransactions(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -62,7 +62,7 @@ int runBankTransactions(NDBT_Context* ctx, NDBT_Step* step){
} }
int runBankGL(NDBT_Context* ctx, NDBT_Step* step){ int runBankGL(NDBT_Context* ctx, NDBT_Step* step){
Bank bank; Bank bank(ctx->m_cluster_connection);
int yield = 20; // Loops before bank returns int yield = 20; // Loops before bank returns
int result = NDBT_OK; int result = NDBT_OK;
...@@ -76,7 +76,7 @@ int runBankGL(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -76,7 +76,7 @@ int runBankGL(NDBT_Context* ctx, NDBT_Step* step){
} }
int runBankSum(NDBT_Context* ctx, NDBT_Step* step){ int runBankSum(NDBT_Context* ctx, NDBT_Step* step){
Bank bank; Bank bank(ctx->m_cluster_connection);
int wait = 2000; // Max ms between each sum of accounts int wait = 2000; // Max ms between each sum of accounts
int yield = 1; // Loops before bank returns int yield = 1; // Loops before bank returns
int result = NDBT_OK; int result = NDBT_OK;
...@@ -91,7 +91,7 @@ int runBankSum(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -91,7 +91,7 @@ int runBankSum(NDBT_Context* ctx, NDBT_Step* step){
} }
int runDropBank(NDBT_Context* ctx, NDBT_Step* step){ int runDropBank(NDBT_Context* ctx, NDBT_Step* step){
Bank bank; Bank bank(ctx->m_cluster_connection);
if (bank.dropBank() != NDBT_OK) if (bank.dropBank() != NDBT_OK)
return NDBT_FAILED; return NDBT_FAILED;
return NDBT_OK; return NDBT_OK;
......
...@@ -47,7 +47,12 @@ int main(int argc, const char** argv){ ...@@ -47,7 +47,12 @@ int main(int argc, const char** argv){
} }
// Connect to Ndb // Connect to Ndb
Ndb MyNdb( "TEST_DB" ); Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, "TEST_DB" );
if(MyNdb.init() != 0){ if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError()); ERR(MyNdb.getNdbError());
......
...@@ -77,8 +77,12 @@ int main(int argc, const char** argv){ ...@@ -77,8 +77,12 @@ int main(int argc, const char** argv){
*/ */
// Connect to Ndb // Connect to Ndb
Ndb MyNdb( "TEST_DB" ); Ndb_cluster_connection con(_connectstr);
MyNdb.setConnectString(_connectstr); if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, "TEST_DB" );
if(MyNdb.init() != 0){ if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError()); ERR(MyNdb.getNdbError());
......
...@@ -40,7 +40,13 @@ int main(int argc, const char** argv){ ...@@ -40,7 +40,13 @@ int main(int argc, const char** argv){
} }
// Connect to Ndb // Connect to Ndb
Ndb MyNdb( "TEST_DB" ); Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, "TEST_DB" );
if(MyNdb.init() != 0){ if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError()); ERR(MyNdb.getNdbError());
......
...@@ -279,6 +279,8 @@ tellThreads(ThreadData* pt, StartType what) ...@@ -279,6 +279,8 @@ tellThreads(ThreadData* pt, StartType what)
pt[i].threadStart = what; pt[i].threadStart = what;
} }
static Ndb_cluster_connection *g_cluster_connection= 0;
NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535) NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535)
{ {
ndb_init(); ndb_init();
...@@ -326,8 +328,16 @@ NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535) ...@@ -326,8 +328,16 @@ NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535)
NdbThread_SetConcurrencyLevel(tNoOfThreads + 2); NdbThread_SetConcurrencyLevel(tNoOfThreads + 2);
Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
g_cluster_connection= &con;
Ndb* pNdb; Ndb* pNdb;
pNdb = new Ndb( "TEST_DB" ); pNdb = new Ndb(&con, "TEST_DB" );
pNdb->init(); pNdb->init();
tNodeId = pNdb->getNodeId(); tNodeId = pNdb->getNodeId();
...@@ -605,7 +615,7 @@ static void* flexBenchThread(void* pArg) ...@@ -605,7 +615,7 @@ static void* flexBenchThread(void* pArg)
attrValue = (int*)malloc(nReadBuffSize) ; attrValue = (int*)malloc(nReadBuffSize) ;
attrRefValue = (int*)malloc(nRefBuffSize) ; attrRefValue = (int*)malloc(nRefBuffSize) ;
pOps = (NdbOperation**)malloc(tNoOfTables*sizeof(NdbOperation*)) ; pOps = (NdbOperation**)malloc(tNoOfTables*sizeof(NdbOperation*)) ;
pNdb = new Ndb( "TEST_DB" ); pNdb = new Ndb(g_cluster_connection, "TEST_DB" );
if(!attrValue || !attrRefValue || !pOps || !pNdb){ if(!attrValue || !attrRefValue || !pOps || !pNdb){
// Check allocations to make sure we got all the memory we asked for // Check allocations to make sure we got all the memory we asked for
......
...@@ -216,7 +216,7 @@ int runDropTable(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -216,7 +216,7 @@ int runDropTable(NDBT_Context* ctx, NDBT_Step* step){
#include "bank/Bank.hpp" #include "bank/Bank.hpp"
int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){ int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){
Bank bank; Bank bank(ctx->m_cluster_connection);
int overWriteExisting = true; int overWriteExisting = true;
if (bank.createAndLoadBank(overWriteExisting, 10) != NDBT_OK) if (bank.createAndLoadBank(overWriteExisting, 10) != NDBT_OK)
return NDBT_FAILED; return NDBT_FAILED;
...@@ -224,7 +224,7 @@ int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -224,7 +224,7 @@ int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){
} }
int runBankTimer(NDBT_Context* ctx, NDBT_Step* step){ int runBankTimer(NDBT_Context* ctx, NDBT_Step* step){
Bank bank; Bank bank(ctx->m_cluster_connection);
int wait = 30; // Max seconds between each "day" int wait = 30; // Max seconds between each "day"
int yield = 1; // Loops before bank returns int yield = 1; // Loops before bank returns
...@@ -235,7 +235,7 @@ int runBankTimer(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -235,7 +235,7 @@ int runBankTimer(NDBT_Context* ctx, NDBT_Step* step){
} }
int runBankTransactions(NDBT_Context* ctx, NDBT_Step* step){ int runBankTransactions(NDBT_Context* ctx, NDBT_Step* step){
Bank bank; Bank bank(ctx->m_cluster_connection);
int wait = 10; // Max ms between each transaction int wait = 10; // Max ms between each transaction
int yield = 100; // Loops before bank returns int yield = 100; // Loops before bank returns
...@@ -246,7 +246,7 @@ int runBankTransactions(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -246,7 +246,7 @@ int runBankTransactions(NDBT_Context* ctx, NDBT_Step* step){
} }
int runBankGL(NDBT_Context* ctx, NDBT_Step* step){ int runBankGL(NDBT_Context* ctx, NDBT_Step* step){
Bank bank; Bank bank(ctx->m_cluster_connection);
int yield = 20; // Loops before bank returns int yield = 20; // Loops before bank returns
int result = NDBT_OK; int result = NDBT_OK;
...@@ -260,7 +260,7 @@ int runBankGL(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -260,7 +260,7 @@ int runBankGL(NDBT_Context* ctx, NDBT_Step* step){
} }
int runBankSum(NDBT_Context* ctx, NDBT_Step* step){ int runBankSum(NDBT_Context* ctx, NDBT_Step* step){
Bank bank; Bank bank(ctx->m_cluster_connection);
int wait = 2000; // Max ms between each sum of accounts int wait = 2000; // Max ms between each sum of accounts
int yield = 1; // Loops before bank returns int yield = 1; // Loops before bank returns
int result = NDBT_OK; int result = NDBT_OK;
...@@ -275,7 +275,7 @@ int runBankSum(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -275,7 +275,7 @@ int runBankSum(NDBT_Context* ctx, NDBT_Step* step){
} }
int runDropBank(NDBT_Context* ctx, NDBT_Step* step){ int runDropBank(NDBT_Context* ctx, NDBT_Step* step){
Bank bank; Bank bank(ctx->m_cluster_connection);
if (bank.dropBank() != NDBT_OK) if (bank.dropBank() != NDBT_OK)
return NDBT_FAILED; return NDBT_FAILED;
return NDBT_OK; return NDBT_OK;
...@@ -349,7 +349,7 @@ int runRestoreBankAndVerify(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -349,7 +349,7 @@ int runRestoreBankAndVerify(NDBT_Context* ctx, NDBT_Step* step){
// To erase all tables from cache(s) // To erase all tables from cache(s)
// To be removed, maybe replaced by ndb.invalidate(); // To be removed, maybe replaced by ndb.invalidate();
{ {
Bank bank; Bank bank(ctx->m_cluster_connection);
if (bank.dropBank() != NDBT_OK){ if (bank.dropBank() != NDBT_OK){
result = NDBT_FAILED; result = NDBT_FAILED;
...@@ -372,7 +372,7 @@ int runRestoreBankAndVerify(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -372,7 +372,7 @@ int runRestoreBankAndVerify(NDBT_Context* ctx, NDBT_Step* step){
ndbout << "Backup " << backupId << " restored" << endl; ndbout << "Backup " << backupId << " restored" << endl;
// Let bank verify // Let bank verify
Bank bank; Bank bank(ctx->m_cluster_connection);
int wait = 0; int wait = 0;
int yield = 1; int yield = 1;
......
...@@ -26,7 +26,9 @@ ...@@ -26,7 +26,9 @@
// No verbose outxput // No verbose outxput
NDBT_Context::NDBT_Context(){ NDBT_Context::NDBT_Context(Ndb_cluster_connection& con)
: m_cluster_connection(con)
{
tab = NULL; tab = NULL;
suite = NULL; suite = NULL;
testcase = NULL; testcase = NULL;
...@@ -239,7 +241,7 @@ int NDBT_Step::execute(NDBT_Context* ctx) { ...@@ -239,7 +241,7 @@ int NDBT_Step::execute(NDBT_Context* ctx) {
g_info << " |- " << name << " started [" << ctx->suite->getDate() << "]" g_info << " |- " << name << " started [" << ctx->suite->getDate() << "]"
<< endl; << endl;
result = setUp(); result = setUp(ctx->m_cluster_connection);
if (result != NDBT_OK){ if (result != NDBT_OK){
return result; return result;
} }
...@@ -279,8 +281,8 @@ NDBT_NdbApiStep::NDBT_NdbApiStep(NDBT_TestCase* ptest, ...@@ -279,8 +281,8 @@ NDBT_NdbApiStep::NDBT_NdbApiStep(NDBT_TestCase* ptest,
int int
NDBT_NdbApiStep::setUp(){ NDBT_NdbApiStep::setUp(Ndb_cluster_connection& con){
ndb = new Ndb( "TEST_DB" ); ndb = new Ndb(&con, "TEST_DB" );
ndb->init(1024); ndb->init(1024);
int result = ndb->waitUntilReady(300); // 5 minutes int result = ndb->waitUntilReady(300); // 5 minutes
...@@ -745,14 +747,15 @@ int NDBT_TestSuite::addTest(NDBT_TestCase* pTest){ ...@@ -745,14 +747,15 @@ int NDBT_TestSuite::addTest(NDBT_TestCase* pTest){
return 0; return 0;
} }
int NDBT_TestSuite::executeAll(const char* _testname){ int NDBT_TestSuite::executeAll(Ndb_cluster_connection& con,
const char* _testname){
if(tests.size() == 0) if(tests.size() == 0)
return NDBT_FAILED; return NDBT_FAILED;
Ndb ndb("TEST_DB"); Ndb ndb(&con, "TEST_DB");
ndb.init(1024); ndb.init(1024);
int result = ndb.waitUntilReady(300); // 5 minutes int result = ndb.waitUntilReady(500); // 5 minutes
if (result != 0){ if (result != 0){
g_err << name <<": Ndb was not ready" << endl; g_err << name <<": Ndb was not ready" << endl;
return NDBT_FAILED; return NDBT_FAILED;
...@@ -765,18 +768,19 @@ int NDBT_TestSuite::executeAll(const char* _testname){ ...@@ -765,18 +768,19 @@ int NDBT_TestSuite::executeAll(const char* _testname){
for (int t=0; t < NDBT_Tables::getNumTables(); t++){ for (int t=0; t < NDBT_Tables::getNumTables(); t++){
const NdbDictionary::Table* ptab = NDBT_Tables::getTable(t); const NdbDictionary::Table* ptab = NDBT_Tables::getTable(t);
ndbout << "|- " << ptab->getName() << endl; ndbout << "|- " << ptab->getName() << endl;
execute(&ndb, ptab, _testname); execute(con, &ndb, ptab, _testname);
} }
testSuiteTimer.doStop(); testSuiteTimer.doStop();
return reportAllTables(_testname); return reportAllTables(_testname);
} }
int int
NDBT_TestSuite::executeOne(const char* _tabname, const char* _testname){ NDBT_TestSuite::executeOne(Ndb_cluster_connection& con,
const char* _tabname, const char* _testname){
if(tests.size() == 0) if(tests.size() == 0)
return NDBT_FAILED; return NDBT_FAILED;
Ndb ndb("TEST_DB"); Ndb ndb(&con, "TEST_DB");
ndb.init(1024); ndb.init(1024);
int result = ndb.waitUntilReady(300); // 5 minutes int result = ndb.waitUntilReady(300); // 5 minutes
...@@ -793,7 +797,7 @@ NDBT_TestSuite::executeOne(const char* _tabname, const char* _testname){ ...@@ -793,7 +797,7 @@ NDBT_TestSuite::executeOne(const char* _tabname, const char* _testname){
ndbout << "|- " << ptab->getName() << endl; ndbout << "|- " << ptab->getName() << endl;
execute(&ndb, ptab, _testname); execute(con, &ndb, ptab, _testname);
if (numTestsFail > 0){ if (numTestsFail > 0){
return NDBT_FAILED; return NDBT_FAILED;
...@@ -802,7 +806,8 @@ NDBT_TestSuite::executeOne(const char* _tabname, const char* _testname){ ...@@ -802,7 +806,8 @@ NDBT_TestSuite::executeOne(const char* _tabname, const char* _testname){
} }
} }
void NDBT_TestSuite::execute(Ndb* ndb, const NdbDictionary::Table* pTab, void NDBT_TestSuite::execute(Ndb_cluster_connection& con,
Ndb* ndb, const NdbDictionary::Table* pTab,
const char* _testname){ const char* _testname){
int result; int result;
...@@ -844,7 +849,7 @@ void NDBT_TestSuite::execute(Ndb* ndb, const NdbDictionary::Table* pTab, ...@@ -844,7 +849,7 @@ void NDBT_TestSuite::execute(Ndb* ndb, const NdbDictionary::Table* pTab,
pTab2 = pTab; pTab2 = pTab;
} }
ctx = new NDBT_Context(); ctx = new NDBT_Context(con);
ctx->setTab(pTab2); ctx->setTab(pTab2);
ctx->setNumRecords(records); ctx->setNumRecords(records);
ctx->setNumLoops(loops); ctx->setNumLoops(loops);
...@@ -1023,14 +1028,19 @@ int NDBT_TestSuite::execute(int argc, const char** argv){ ...@@ -1023,14 +1028,19 @@ int NDBT_TestSuite::execute(int argc, const char** argv){
loops = _loops; loops = _loops;
timer = _timer; timer = _timer;
Ndb_cluster_connection con;
if(con.connect(12, 5, 1))
{
return NDBT_ProgramExit(NDBT_FAILED);
}
if(optind == argc){ if(optind == argc){
// No table specified // No table specified
res = executeAll(_testname); res = executeAll(con, _testname);
} else { } else {
testSuiteTimer.doStart(); testSuiteTimer.doStart();
Ndb ndb("TEST_DB"); ndb.init();
for(int i = optind; i<argc; i++){ for(int i = optind; i<argc; i++){
executeOne(argv[i], _testname); executeOne(con, argv[i], _testname);
} }
testSuiteTimer.doStop(); testSuiteTimer.doStop();
res = report(_testname); res = report(_testname);
......
...@@ -56,9 +56,12 @@ int main(int argc, const char** argv){ ...@@ -56,9 +56,12 @@ int main(int argc, const char** argv){
_tabname = argv[optind]; _tabname = argv[optind];
_to_tabname = argv[optind+1]; _to_tabname = argv[optind+1];
if (_connectstr) Ndb_cluster_connection con(_connectstr);
Ndb::setConnectString(_connectstr); if(con.connect(12, 5, 1) != 0)
Ndb MyNdb(_dbname); {
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con,_dbname);
if(MyNdb.init() != 0){ if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError()); ERR(MyNdb.getNdbError());
return NDBT_ProgramExit(NDBT_FAILED); return NDBT_ProgramExit(NDBT_FAILED);
......
...@@ -53,8 +53,13 @@ main(int argc, const char** argv){ ...@@ -53,8 +53,13 @@ main(int argc, const char** argv){
return NDBT_ProgramExit(NDBT_WRONGARGS); return NDBT_ProgramExit(NDBT_WRONGARGS);
} }
Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(_dbname); Ndb MyNdb(&con, _dbname);
if(MyNdb.init() != 0){ if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError()); ERR(MyNdb.getNdbError());
return NDBT_ProgramExit(NDBT_FAILED); return NDBT_ProgramExit(NDBT_FAILED);
......
...@@ -51,7 +51,12 @@ int main(int argc, const char** argv){ ...@@ -51,7 +51,12 @@ int main(int argc, const char** argv){
_tabname = argv[optind]; _tabname = argv[optind];
// Connect to Ndb // Connect to Ndb
Ndb MyNdb( "TEST_DB" ); Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, "TEST_DB" );
if(MyNdb.init() != 0){ if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError()); ERR(MyNdb.getNdbError());
......
...@@ -54,7 +54,12 @@ int main(int argc, const char** argv){ ...@@ -54,7 +54,12 @@ int main(int argc, const char** argv){
_tabname = argv[optind]; _tabname = argv[optind];
// Connect to Ndb // Connect to Ndb
Ndb MyNdb( "TEST_DB" ); Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, "TEST_DB" );
if(MyNdb.init() != 0){ if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError()); ERR(MyNdb.getNdbError());
......
...@@ -59,7 +59,12 @@ int main(int argc, const char** argv){ ...@@ -59,7 +59,12 @@ int main(int argc, const char** argv){
_tabname = argv[optind]; _tabname = argv[optind];
// Connect to Ndb // Connect to Ndb
Ndb MyNdb( "TEST_DB" ); Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, "TEST_DB" );
if(MyNdb.init() != 0){ if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError()); ERR(MyNdb.getNdbError());
......
...@@ -55,7 +55,12 @@ int main(int argc, const char** argv){ ...@@ -55,7 +55,12 @@ int main(int argc, const char** argv){
_tabname = argv[optind]; _tabname = argv[optind];
// Connect to Ndb // Connect to Ndb
Ndb MyNdb( "TEST_DB" ); Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, "TEST_DB" );
if(MyNdb.init() != 0){ if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError()); ERR(MyNdb.getNdbError());
......
...@@ -60,7 +60,12 @@ int main(int argc, const char** argv){ ...@@ -60,7 +60,12 @@ int main(int argc, const char** argv){
// Connect to Ndb // Connect to Ndb
Ndb MyNdb( "TEST_DB" ); Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, "TEST_DB" );
if(MyNdb.init() != 0){ if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError()); ERR(MyNdb.getNdbError());
......
...@@ -62,7 +62,12 @@ int main(int argc, const char** argv) ...@@ -62,7 +62,12 @@ int main(int argc, const char** argv)
<< "Row: " << _row << ", PrimaryKey: " << _primaryKey << "Row: " << _row << ", PrimaryKey: " << _primaryKey
<< endl; << endl;
Ndb* ndb = new Ndb("TEST_DB"); Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb* ndb = new Ndb(&con, "TEST_DB");
if (ndb->init() == 0 && ndb->waitUntilReady(30) == 0) if (ndb->init() == 0 && ndb->waitUntilReady(30) == 0)
{ {
NdbConnection* conn = ndb->startTransaction(); NdbConnection* conn = ndb->startTransaction();
......
...@@ -57,7 +57,12 @@ int main(int argc, const char** argv){ ...@@ -57,7 +57,12 @@ int main(int argc, const char** argv){
_tabname = argv[optind]; _tabname = argv[optind];
// Connect to Ndb // Connect to Ndb
Ndb MyNdb( "TEST_DB" ); Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, "TEST_DB" );
if(MyNdb.init() != 0){ if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError()); ERR(MyNdb.getNdbError());
......
...@@ -61,7 +61,12 @@ int main(int argc, const char** argv){ ...@@ -61,7 +61,12 @@ int main(int argc, const char** argv){
_tabname = argv[optind]; _tabname = argv[optind];
// Connect to Ndb // Connect to Ndb
Ndb MyNdb( "TEST_DB" ); Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, "TEST_DB" );
if(MyNdb.init() != 0){ if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError()); ERR(MyNdb.getNdbError());
......
...@@ -58,7 +58,12 @@ int main(int argc, const char** argv){ ...@@ -58,7 +58,12 @@ int main(int argc, const char** argv){
_tabname = argv[optind]; _tabname = argv[optind];
// Connect to Ndb // Connect to Ndb
Ndb MyNdb( "TEST_DB" ); Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, "TEST_DB" );
if(MyNdb.init() != 0){ if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError()); ERR(MyNdb.getNdbError());
......
...@@ -53,7 +53,12 @@ int main(int argc, const char** argv){ ...@@ -53,7 +53,12 @@ int main(int argc, const char** argv){
_indexname = argv[optind+1]; _indexname = argv[optind+1];
// Connect to Ndb // Connect to Ndb
Ndb MyNdb( "TEST_DB" ); Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, "TEST_DB" );
if(MyNdb.init() != 0){ if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError()); ERR(MyNdb.getNdbError());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment