summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.ndb.mysql.com>2005-01-05 17:59:24 +0100
committerunknown <tomas@poseidon.ndb.mysql.com>2005-01-05 17:59:24 +0100
commit3add897ef9126487a5d6bf299bc46268df17072e (patch)
tree31a7aa1cf97babdadbd0e3128ce315f9ed3ae400
parentae736acfc3d94537d48be8d85d2c260154d76a52 (diff)
downloadmariadb-git-3add897ef9126487a5d6bf299bc46268df17072e.tar.gz
changed to using NdbTransaction scoped enums
and removed usage of Ndb::waitUntilReady()
-rw-r--r--ndb/examples/ndbapi_async_example/ndbapi_async.cpp2
-rw-r--r--ndb/examples/ndbapi_async_example1/ndbapi_async1.cpp3
-rw-r--r--ndb/examples/ndbapi_retries_example/ndbapi_retries.cpp4
-rw-r--r--ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp14
-rw-r--r--ndb/examples/ndbapi_simple_example/ndbapi_simple.cpp8
-rw-r--r--ndb/examples/ndbapi_simple_index_example/ndbapi_simple_index.cpp10
-rw-r--r--ndb/include/ndbapi/NdbDictionary.hpp5
-rw-r--r--ndb/include/ndbapi/NdbTransaction.hpp2
-rw-r--r--ndb/src/ndbapi/NdbDictionary.cpp14
-rw-r--r--ndb/tools/delete_all.cpp18
-rw-r--r--ndb/tools/desc.cpp24
-rw-r--r--ndb/tools/drop_index.cpp10
-rw-r--r--ndb/tools/drop_tab.cpp11
-rw-r--r--ndb/tools/listTables.cpp11
-rw-r--r--ndb/tools/restore/consumer_restore.cpp7
-rw-r--r--ndb/tools/select_all.cpp15
-rw-r--r--ndb/tools/select_count.cpp14
-rw-r--r--sql/ha_ndbcluster.cc22
18 files changed, 119 insertions, 75 deletions
diff --git a/ndb/examples/ndbapi_async_example/ndbapi_async.cpp b/ndb/examples/ndbapi_async_example/ndbapi_async.cpp
index 9fd37f3a670..c11b6e849e4 100644
--- a/ndb/examples/ndbapi_async_example/ndbapi_async.cpp
+++ b/ndb/examples/ndbapi_async_example/ndbapi_async.cpp
@@ -381,7 +381,7 @@ int populate(Ndb * myNdb, int data, async_callback_t * cbData)
}
/*Prepare transaction (the transaction is NOT yet sent to NDB)*/
- transaction[current].conn->executeAsynchPrepare(Commit,
+ transaction[current].conn->executeAsynchPrepare(NdbTransaction::Commit,
&callback,
cb);
/**
diff --git a/ndb/examples/ndbapi_async_example1/ndbapi_async1.cpp b/ndb/examples/ndbapi_async_example1/ndbapi_async1.cpp
index 9af9c72c260..fb806a5bbb5 100644
--- a/ndb/examples/ndbapi_async_example1/ndbapi_async1.cpp
+++ b/ndb/examples/ndbapi_async_example1/ndbapi_async1.cpp
@@ -99,7 +99,8 @@ int main()
myNdbOperation->setValue("ATTR2", 20 + i);
// Prepare transaction (the transaction is NOT yet sent to NDB)
- myNdbTransaction[i]->executeAsynchPrepare(Commit, &callback, NULL);
+ myNdbTransaction[i]->executeAsynchPrepare(NdbTransaction::Commit,
+ &callback, NULL);
}
// Send all transactions to NDB
diff --git a/ndb/examples/ndbapi_retries_example/ndbapi_retries.cpp b/ndb/examples/ndbapi_retries_example/ndbapi_retries.cpp
index e832964ee94..d14e0cf4553 100644
--- a/ndb/examples/ndbapi_retries_example/ndbapi_retries.cpp
+++ b/ndb/examples/ndbapi_retries_example/ndbapi_retries.cpp
@@ -104,7 +104,7 @@ int insert(int transactionId, NdbTransaction* myTransaction) {
exit(-1);
}
- return myTransaction->execute(NoCommit);
+ return myTransaction->execute(NdbTransaction::NoCommit);
}
@@ -131,7 +131,7 @@ int executeInsertTransaction(int transactionId, Ndb* myNdb) {
result = -1; // Failure
} else if (insert(transactionId, myTransaction) ||
insert(10000+transactionId, myTransaction) ||
- myTransaction->execute(Commit)) {
+ myTransaction->execute(NdbTransaction::Commit)) {
TRANSERROR(myTransaction);
ndberror = myTransaction->getNdbError();
result = -1; // Failure
diff --git a/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp b/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
index e886fc08d46..183dd69f648 100644
--- a/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
+++ b/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
@@ -187,7 +187,7 @@ int populate(Ndb * myNdb)
myNdbOperation->setValue("COLOR", cars[i].color);
}
- int check = myTrans->execute(Commit);
+ int check = myTrans->execute(NdbTransaction::Commit);
myTrans->close();
@@ -280,7 +280,7 @@ int scan_delete(Ndb* myNdb,
/**
* Start scan (NoCommit since we are only reading at this stage);
*/
- if(myTrans->execute(NoCommit) != 0){
+ if(myTrans->execute(NdbTransaction::NoCommit) != 0){
err = myTrans->getNdbError();
if(err.status == NdbError::TemporaryError){
std::cout << myTrans->getNdbError().message << std::endl;
@@ -322,7 +322,7 @@ int scan_delete(Ndb* myNdb,
*/
if(check != -1)
{
- check = myTrans->execute(Commit);
+ check = myTrans->execute(NdbTransaction::Commit);
}
if(check == -1)
@@ -453,7 +453,7 @@ int scan_update(Ndb* myNdb,
/**
* Start scan (NoCommit since we are only reading at this stage);
*/
- if(myTrans->execute(NoCommit) != 0)
+ if(myTrans->execute(NdbTransaction::NoCommit) != 0)
{
err = myTrans->getNdbError();
if(err.status == NdbError::TemporaryError){
@@ -501,7 +501,7 @@ int scan_update(Ndb* myNdb,
*/
if(check != -1)
{
- check = myTrans->execute(NoCommit);
+ check = myTrans->execute(NdbTransaction::NoCommit);
}
/**
@@ -525,7 +525,7 @@ int scan_update(Ndb* myNdb,
/**
* Commit all prepared operations
*/
- if(myTrans->execute(Commit) == -1)
+ if(myTrans->execute(NdbTransaction::Commit) == -1)
{
if(err.status == NdbError::TemporaryError){
std::cout << myTrans->getNdbError().message << std::endl;
@@ -640,7 +640,7 @@ int scan_print(Ndb * myNdb)
/**
* Start scan (NoCommit since we are only reading at this stage);
*/
- if(myTrans->execute(NoCommit) != 0){
+ if(myTrans->execute(NdbTransaction::NoCommit) != 0){
err = myTrans->getNdbError();
if(err.status == NdbError::TemporaryError){
std::cout << myTrans->getNdbError().message << std::endl;
diff --git a/ndb/examples/ndbapi_simple_example/ndbapi_simple.cpp b/ndb/examples/ndbapi_simple_example/ndbapi_simple.cpp
index f97032f66ed..c8fa494345c 100644
--- a/ndb/examples/ndbapi_simple_example/ndbapi_simple.cpp
+++ b/ndb/examples/ndbapi_simple_example/ndbapi_simple.cpp
@@ -170,7 +170,7 @@ static void do_insert(Ndb &myNdb)
myOperation->equal("ATTR1", i+5);
myOperation->setValue("ATTR2", i+5);
- if (myTransaction->execute( Commit ) == -1)
+ if (myTransaction->execute( NdbTransaction::Commit ) == -1)
APIERROR(myTransaction->getNdbError());
myNdb.closeTransaction(myTransaction);
@@ -193,7 +193,7 @@ static void do_update(Ndb &myNdb)
myOperation->equal( "ATTR1", i );
myOperation->setValue( "ATTR2", i+10);
- if( myTransaction->execute( Commit ) == -1 )
+ if( myTransaction->execute( NdbTransaction::Commit ) == -1 )
APIERROR(myTransaction->getNdbError());
myNdb.closeTransaction(myTransaction);
@@ -214,7 +214,7 @@ static void do_delete(Ndb &myNdb)
myOperation->deleteTuple();
myOperation->equal( "ATTR1", 3 );
- if (myTransaction->execute(Commit) == -1)
+ if (myTransaction->execute(NdbTransaction::Commit) == -1)
APIERROR(myTransaction->getNdbError());
myNdb.closeTransaction(myTransaction);
@@ -240,7 +240,7 @@ static void do_read(Ndb &myNdb)
NdbRecAttr *myRecAttr= myOperation->getValue("ATTR2", NULL);
if (myRecAttr == NULL) APIERROR(myTransaction->getNdbError());
- if(myTransaction->execute( Commit ) == -1)
+ if(myTransaction->execute( NdbTransaction::Commit ) == -1)
if (i == 3) {
std::cout << "Detected that deleted tuple doesn't exist!" << std::endl;
} else {
diff --git a/ndb/examples/ndbapi_simple_index_example/ndbapi_simple_index.cpp b/ndb/examples/ndbapi_simple_index_example/ndbapi_simple_index.cpp
index 39574fae208..7d70dc723f8 100644
--- a/ndb/examples/ndbapi_simple_index_example/ndbapi_simple_index.cpp
+++ b/ndb/examples/ndbapi_simple_index_example/ndbapi_simple_index.cpp
@@ -127,7 +127,7 @@ int main()
myOperation->equal("ATTR1", i+5);
myOperation->setValue("ATTR2", i+5);
- if (myTransaction->execute( Commit ) == -1)
+ if (myTransaction->execute( NdbTransaction::Commit ) == -1)
APIERROR(myTransaction->getNdbError());
myNdb->closeTransaction(myTransaction);
@@ -152,7 +152,7 @@ int main()
NdbRecAttr *myRecAttr= myIndexOperation->getValue("ATTR1", NULL);
if (myRecAttr == NULL) APIERROR(myTransaction->getNdbError());
- if(myTransaction->execute( Commit ) != -1)
+ if(myTransaction->execute( NdbTransaction::Commit ) != -1)
printf(" %2d %2d\n", myRecAttr->u_32_value(), i);
myNdb->closeTransaction(myTransaction);
@@ -173,7 +173,7 @@ int main()
myIndexOperation->equal( "ATTR2", i );
myIndexOperation->setValue( "ATTR2", i+10);
- if( myTransaction->execute( Commit ) == -1 )
+ if( myTransaction->execute( NdbTransaction::Commit ) == -1 )
APIERROR(myTransaction->getNdbError());
myNdb->closeTransaction(myTransaction);
@@ -193,7 +193,7 @@ int main()
myIndexOperation->deleteTuple();
myIndexOperation->equal( "ATTR2", 3 );
- if (myTransaction->execute(Commit) == -1)
+ if (myTransaction->execute(NdbTransaction::Commit) == -1)
APIERROR(myTransaction->getNdbError());
myNdb->closeTransaction(myTransaction);
@@ -218,7 +218,7 @@ int main()
NdbRecAttr *myRecAttr= myOperation->getValue("ATTR2", NULL);
if (myRecAttr == NULL) APIERROR(myTransaction->getNdbError());
- if(myTransaction->execute( Commit ) == -1)
+ if(myTransaction->execute( NdbTransaction::Commit ) == -1)
if (i == 3) {
std::cout << "Detected that deleted tuple doesn't exist!\n";
} else {
diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp
index f25b3a7fbfa..b82ba79463e 100644
--- a/ndb/include/ndbapi/NdbDictionary.hpp
+++ b/ndb/include/ndbapi/NdbDictionary.hpp
@@ -698,7 +698,7 @@ public:
/** @} *******************************************************************/
-#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
void setStoredTable(bool x) { setLogging(x); }
bool getStoredTable() const { return getLogging(); }
@@ -1010,6 +1010,8 @@ public:
* Fetch list of all objects, optionally restricted to given type.
*/
int listObjects(List & list, Object::Type type = Object::TypeUndefined);
+ int listObjects(const List & list,
+ Object::Type type = Object::TypeUndefined) const;
/**
* Get the latest error
@@ -1048,6 +1050,7 @@ public:
* @return 0 if successful, otherwise -1
*/
int listIndexes(List & list, const char * tableName);
+ int listIndexes(const List & list, const char * tableName) const;
/** @} *******************************************************************/
/**
diff --git a/ndb/include/ndbapi/NdbTransaction.hpp b/ndb/include/ndbapi/NdbTransaction.hpp
index cbb3ca37994..78724206b4f 100644
--- a/ndb/include/ndbapi/NdbTransaction.hpp
+++ b/ndb/include/ndbapi/NdbTransaction.hpp
@@ -42,7 +42,7 @@ class NdbBlob;
typedef void (* NdbAsynchCallback)(int, NdbTransaction*, void*);
#endif
-#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
enum AbortOption {
CommitIfFailFree= 0,
TryCommit= 0,
diff --git a/ndb/src/ndbapi/NdbDictionary.cpp b/ndb/src/ndbapi/NdbDictionary.cpp
index b7a4419a491..24cd48cb2a3 100644
--- a/ndb/src/ndbapi/NdbDictionary.cpp
+++ b/ndb/src/ndbapi/NdbDictionary.cpp
@@ -824,6 +824,13 @@ NdbDictionary::Dictionary::listObjects(List& list, Object::Type type)
}
int
+NdbDictionary::Dictionary::listObjects(const List& list,
+ Object::Type type) const
+{
+ return m_impl.listObjects(*(List*)&list, type);
+}
+
+int
NdbDictionary::Dictionary::listIndexes(List& list, const char * tableName)
{
const NdbDictionary::Table* tab= getTable(tableName);
@@ -834,6 +841,13 @@ NdbDictionary::Dictionary::listIndexes(List& list, const char * tableName)
return m_impl.listIndexes(list, tab->getTableId());
}
+int
+NdbDictionary::Dictionary::listIndexes(const List& list,
+ const char * tableName) const
+{
+ return listIndexes(*(List *)&list, tableName);
+}
+
const struct NdbError &
NdbDictionary::Dictionary::getNdbError() const {
return m_impl.getNdbError();
diff --git a/ndb/tools/delete_all.cpp b/ndb/tools/delete_all.cpp
index 250fe85d546..38a9cdd9354 100644
--- a/ndb/tools/delete_all.cpp
+++ b/ndb/tools/delete_all.cpp
@@ -80,19 +80,21 @@ int main(int argc, char** argv){
Ndb_cluster_connection con(opt_connect_str);
if(con.connect(12, 5, 1) != 0)
{
+ ndbout << "Unable to connect to management server." << endl;
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+ if (con.wait_until_ready(30,0) < 0)
+ {
+ ndbout << "Cluster nodes not ready in 30 seconds." << endl;
return NDBT_ProgramExit(NDBT_FAILED);
}
- Ndb MyNdb(&con, _dbname );
+ Ndb MyNdb(&con, _dbname );
if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError());
return NDBT_ProgramExit(NDBT_FAILED);
}
- // Connect to Ndb and wait for it to become ready
- while(MyNdb.waitUntilReady() != 0)
- ndbout << "Waiting for ndb to become ready..." << endl;
-
// Check if table exists in db
int res = NDBT_OK;
for(int i = 0; i<argc; i++){
@@ -148,11 +150,11 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism)
goto failed;
}
- if( pOp->readTuplesExclusive(par) ) {
+ if( pOp->readTuples(NdbOperation::LM_Exclusive,par) ) {
goto failed;
}
- if(pTrans->execute(NoCommit) != 0){
+ if(pTrans->execute(NdbTransaction::NoCommit) != 0){
err = pTrans->getNdbError();
if(err.status == NdbError::TemporaryError){
ERR(err);
@@ -172,7 +174,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism)
} while((check = pOp->nextResult(false)) == 0);
if(check != -1){
- check = pTrans->execute(Commit);
+ check = pTrans->execute(NdbTransaction::Commit);
pTrans->restart();
}
diff --git a/ndb/tools/desc.cpp b/ndb/tools/desc.cpp
index 8c84802ef51..4129f775540 100644
--- a/ndb/tools/desc.cpp
+++ b/ndb/tools/desc.cpp
@@ -80,25 +80,28 @@ int main(int argc, char** argv){
Ndb_cluster_connection con(opt_connect_str);
if(con.connect(12, 5, 1) != 0)
{
+ ndbout << "Unable to connect to management server." << endl;
return NDBT_ProgramExit(NDBT_FAILED);
}
-
- Ndb* pMyNdb = new Ndb(&con, _dbname);
- pMyNdb->init();
-
- ndbout << "Waiting...";
- while (pMyNdb->waitUntilReady() != 0) {
- ndbout << "...";
+ if (con.wait_until_ready(30,0) < 0)
+ {
+ ndbout << "Cluster nodes not ready in 30 seconds." << endl;
+ return NDBT_ProgramExit(NDBT_FAILED);
}
- ndbout << endl;
- NdbDictionary::Dictionary * dict = pMyNdb->getDictionary();
+ Ndb MyNdb(&con, _dbname);
+ if(MyNdb.init() != 0){
+ ERR(MyNdb.getNdbError());
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+
+ const NdbDictionary::Dictionary * dict= MyNdb.getDictionary();
for (int i = 0; i < argc; i++) {
NDBT_Table* pTab = (NDBT_Table*)dict->getTable(argv[i]);
if (pTab != 0){
ndbout << (* pTab) << endl;
- NdbDictionary::Dictionary::List list;
+ const NdbDictionary::Dictionary::List list;
if (dict->listIndexes(list, argv[i]) != 0){
ndbout << argv[i] << ": " << dict->getNdbError() << endl;
return NDBT_ProgramExit(NDBT_FAILED);
@@ -132,6 +135,5 @@ int main(int argc, char** argv){
ndbout << argv[i] << ": " << dict->getNdbError() << endl;
}
- delete pMyNdb;
return NDBT_ProgramExit(NDBT_OK);
}
diff --git a/ndb/tools/drop_index.cpp b/ndb/tools/drop_index.cpp
index cc0dd9a8be6..47baee0b66f 100644
--- a/ndb/tools/drop_index.cpp
+++ b/ndb/tools/drop_index.cpp
@@ -83,16 +83,18 @@ int main(int argc, char** argv){
{
return NDBT_ProgramExit(NDBT_FAILED);
}
- Ndb MyNdb(&con, _dbname );
+ if (con.wait_until_ready(30,0) < 0)
+ {
+ ndbout << "Cluster nodes not ready in 30 seconds." << endl;
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+ Ndb MyNdb(&con, _dbname );
if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError());
return NDBT_ProgramExit(NDBT_FAILED);
}
- while(MyNdb.waitUntilReady() != 0)
- ndbout << "Waiting for ndb to become ready..." << endl;
-
int res = 0;
for(int i = 0; i<argc; i++){
ndbout << "Dropping index " << argv[i] << "...";
diff --git a/ndb/tools/drop_tab.cpp b/ndb/tools/drop_tab.cpp
index 81131c9060a..6d128321994 100644
--- a/ndb/tools/drop_tab.cpp
+++ b/ndb/tools/drop_tab.cpp
@@ -81,18 +81,21 @@ int main(int argc, char** argv){
Ndb_cluster_connection con(opt_connect_str);
if(con.connect(12, 5, 1) != 0)
{
+ ndbout << "Unable to connect to management server." << endl;
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+ if (con.wait_until_ready(30,0) < 0)
+ {
+ ndbout << "Cluster nodes not ready in 30 seconds." << endl;
return NDBT_ProgramExit(NDBT_FAILED);
}
- Ndb MyNdb(&con, _dbname );
+ Ndb MyNdb(&con, _dbname );
if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError());
return NDBT_ProgramExit(NDBT_FAILED);
}
- while(MyNdb.waitUntilReady() != 0)
- ndbout << "Waiting for ndb to become ready..." << endl;
-
int res = 0;
for(int i = 0; i<argc; i++){
ndbout << "Dropping table " << argv[i] << "...";
diff --git a/ndb/tools/listTables.cpp b/ndb/tools/listTables.cpp
index 710af66f4de..fbad9eeba87 100644
--- a/ndb/tools/listTables.cpp
+++ b/ndb/tools/listTables.cpp
@@ -29,7 +29,7 @@
static Ndb_cluster_connection *ndb_cluster_connection= 0;
static Ndb* ndb = 0;
-static NdbDictionary::Dictionary* dic = 0;
+static NdbDictionary::Dictionary * dic = 0;
static int _unqualified = 0;
static void
@@ -233,16 +233,19 @@ int main(int argc, char** argv){
ndb_cluster_connection = new Ndb_cluster_connection(opt_connect_str);
if (ndb_cluster_connection->connect(12,5,1))
- fatal("unable to connect");
+ fatal("Unable to connect to management server.");
+ if (ndb_cluster_connection->wait_until_ready(30,0) < 0)
+ fatal("Cluster nodes not ready in 30 seconds.");
+
ndb = new Ndb(ndb_cluster_connection, _dbname);
if (ndb->init() != 0)
fatal("init");
- if (ndb->waitUntilReady(30) < 0)
- fatal("waitUntilReady");
dic = ndb->getDictionary();
for (int i = 0; _loops == 0 || i < _loops; i++) {
list(_tabname, (NdbDictionary::Object::Type)_type);
}
+ delete ndb;
+ delete ndb_cluster_connection;
return NDBT_ProgramExit(NDBT_OK);
}
diff --git a/ndb/tools/restore/consumer_restore.cpp b/ndb/tools/restore/consumer_restore.cpp
index 2a5cda29027..d72b82569e2 100644
--- a/ndb/tools/restore/consumer_restore.cpp
+++ b/ndb/tools/restore/consumer_restore.cpp
@@ -375,7 +375,8 @@ void BackupRestore::tuple_a(restore_callback_t *cb)
}
// Prepare transaction (the transaction is NOT yet sent to NDB)
- cb->connection->executeAsynchPrepare(Commit, &callback, cb);
+ cb->connection->executeAsynchPrepare(NdbTransaction::Commit,
+ &callback, cb);
m_transactions++;
return;
}
@@ -543,7 +544,7 @@ BackupRestore::logEntry(const LogEntry & tup)
op->setValue(attr->Desc->attrId, dataPtr, length);
}
- const int ret = trans->execute(Commit);
+ const int ret = trans->execute(NdbTransaction::Commit);
if (ret != 0)
{
// Both insert update and delete can fail during log running
@@ -654,7 +655,7 @@ BackupRestore::tuple(const TupleS & tup)
else
op->setValue(i, dataPtr, length);
}
- int ret = trans->execute(Commit);
+ int ret = trans->execute(NdbTransaction::Commit);
if (ret != 0)
{
ndbout << "execute failed: ";
diff --git a/ndb/tools/select_all.cpp b/ndb/tools/select_all.cpp
index 94007d422e1..ecb7db91060 100644
--- a/ndb/tools/select_all.cpp
+++ b/ndb/tools/select_all.cpp
@@ -24,7 +24,6 @@
#include <NdbMain.h>
#include <NDBT.hpp>
#include <NdbSleep.h>
-#include <NdbScanFilter.hpp>
int scanReadRecords(Ndb*,
const NdbDictionary::Table*,
@@ -127,19 +126,21 @@ int main(int argc, char** argv){
Ndb_cluster_connection con(opt_connect_str);
if(con.connect(12, 5, 1) != 0)
{
+ ndbout << "Unable to connect to management server." << endl;
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+ if (con.wait_until_ready(30,0) < 0)
+ {
+ ndbout << "Cluster nodes not ready in 30 seconds." << endl;
return NDBT_ProgramExit(NDBT_FAILED);
}
- Ndb MyNdb(&con, _dbname );
+ Ndb MyNdb(&con, _dbname );
if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError());
return NDBT_ProgramExit(NDBT_FAILED);
}
- // Connect to Ndb and wait for it to become ready
- while(MyNdb.waitUntilReady() != 0)
- ndbout << "Waiting for ndb to become ready..." << endl;
-
// Check if table exists in db
const NdbDictionary::Table* pTab = NDBT_Table::discoverTableFromDb(&MyNdb, _tabname);
const NdbDictionary::Index * pIdx = 0;
@@ -320,7 +321,7 @@ int scanReadRecords(Ndb* pNdb,
}
}
- check = pTrans->execute(NoCommit);
+ check = pTrans->execute(NdbTransaction::NoCommit);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
diff --git a/ndb/tools/select_count.cpp b/ndb/tools/select_count.cpp
index abba39c4d2e..f2b78de4b37 100644
--- a/ndb/tools/select_count.cpp
+++ b/ndb/tools/select_count.cpp
@@ -100,19 +100,21 @@ int main(int argc, char** argv){
Ndb_cluster_connection con(opt_connect_str);
if(con.connect(12, 5, 1) != 0)
{
+ ndbout << "Unable to connect to management server." << endl;
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+ if (con.wait_until_ready(30,0) < 0)
+ {
+ ndbout << "Cluster nodes not ready in 30 seconds." << endl;
return NDBT_ProgramExit(NDBT_FAILED);
}
- Ndb MyNdb(&con, _dbname );
+ Ndb MyNdb(&con, _dbname );
if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError());
return NDBT_ProgramExit(NDBT_FAILED);
}
- // Connect to Ndb and wait for it to become ready
- while(MyNdb.waitUntilReady() != 0)
- ndbout << "Waiting for ndb to become ready..." << endl;
-
for(int i = 0; i<argc; i++){
// Check if table exists in db
const NdbDictionary::Table * pTab = NDBT_Table::discoverTableFromDb(&MyNdb, argv[i]);
@@ -189,7 +191,7 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab,
Uint32 row_size;
pOp->getValue(NdbDictionary::Column::ROW_COUNT, (char*)&tmp);
pOp->getValue(NdbDictionary::Column::ROW_SIZE, (char*)&row_size);
- check = pTrans->execute(NoCommit);
+ check = pTrans->execute(NdbTransaction::NoCommit);
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 37b3e6cfa00..3cd418b776a 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -161,7 +161,9 @@ int execute_no_commit(ha_ndbcluster *h, NdbTransaction *trans)
if (m_batch_execute)
return 0;
#endif
- return trans->execute(NoCommit,AbortOnError,h->m_force_send);
+ return trans->execute(NdbTransaction::NoCommit,
+ NdbTransaction::AbortOnError,
+ h->m_force_send);
}
inline
@@ -172,7 +174,9 @@ int execute_commit(ha_ndbcluster *h, NdbTransaction *trans)
if (m_batch_execute)
return 0;
#endif
- return trans->execute(Commit,AbortOnError,h->m_force_send);
+ return trans->execute(NdbTransaction::Commit,
+ NdbTransaction::AbortOnError,
+ h->m_force_send);
}
inline
@@ -183,7 +187,9 @@ int execute_commit(THD *thd, NdbTransaction *trans)
if (m_batch_execute)
return 0;
#endif
- return trans->execute(Commit,AbortOnError,thd->variables.ndb_force_send);
+ return trans->execute(NdbTransaction::Commit,
+ NdbTransaction::AbortOnError,
+ thd->variables.ndb_force_send);
}
inline
@@ -194,7 +200,9 @@ int execute_no_commit_ie(ha_ndbcluster *h, NdbTransaction *trans)
if (m_batch_execute)
return 0;
#endif
- return trans->execute(NoCommit,AO_IgnoreError,h->m_force_send);
+ return trans->execute(NdbTransaction::NoCommit,
+ NdbTransaction::AO_IgnoreError,
+ h->m_force_send);
}
/*
@@ -3345,7 +3353,7 @@ int ndbcluster_rollback(THD *thd, void *ndb_transaction)
"stmt" : "all"));
DBUG_ASSERT(ndb && trans);
- if (trans->execute(Rollback) != 0)
+ if (trans->execute(NdbTransaction::Rollback) != 0)
{
const NdbError err= trans->getNdbError();
const NdbOperation *error_op= trans->getNdbErrorOperation();
@@ -4863,7 +4871,9 @@ ndb_get_table_statistics(Ndb* ndb, const char * table,
pOp->getValue(NdbDictionary::Column::ROW_COUNT, (char*)&rows);
pOp->getValue(NdbDictionary::Column::COMMIT_COUNT, (char*)&commits);
- check= pTrans->execute(NoCommit, AbortOnError, TRUE);
+ check= pTrans->execute(NdbTransaction::NoCommit,
+ NdbTransaction::AbortOnError,
+ TRUE);
if (check == -1)
break;