diff options
author | unknown <mats@romeo.(none)> | 2007-04-20 10:46:58 +0200 |
---|---|---|
committer | unknown <mats@romeo.(none)> | 2007-04-20 10:46:58 +0200 |
commit | dadde7fb866f0d25599e471907d2d7c0256af8ec (patch) | |
tree | 44a10d56daf367ccca2ba562acd1642e610f9e8f /storage/ndb/test | |
parent | 4b7b0bf9d391aee492af1277d01eab6fca7ed74d (diff) | |
parent | 9340cb193e40516d051f02cdd074dd30b99816a4 (diff) | |
download | mariadb-git-dadde7fb866f0d25599e471907d2d7c0256af8ec.tar.gz |
Merge romeo.(none):/home/bkroot/mysql-5.1-rpl
into romeo.(none):/home/bk/merge-mysql-5.1
BitKeeper/etc/ignore:
auto-union
client/mysql.cc:
Auto merged
client/mysqlbinlog.cc:
Auto merged
configure.in:
Auto merged
client/mysqltest.c:
Auto merged
mysql-test/r/rpl_ndb_basic.result:
Auto merged
mysql-test/t/disabled.def:
Auto merged
sql/CMakeLists.txt:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/ha_ndbcluster.h:
Auto merged
sql/ha_ndbcluster_binlog.cc:
Auto merged
sql/log.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_repl.cc:
Auto merged
Diffstat (limited to 'storage/ndb/test')
-rw-r--r-- | storage/ndb/test/include/HugoOperations.hpp | 2 | ||||
-rw-r--r-- | storage/ndb/test/ndbapi/testBasic.cpp | 62 | ||||
-rw-r--r-- | storage/ndb/test/run-test/daily-basic-tests.txt | 4 | ||||
-rw-r--r-- | storage/ndb/test/src/HugoAsynchTransactions.cpp | 58 | ||||
-rw-r--r-- | storage/ndb/test/src/HugoOperations.cpp | 93 | ||||
-rw-r--r-- | storage/ndb/test/src/HugoTransactions.cpp | 82 | ||||
-rw-r--r-- | storage/ndb/test/tools/Makefile.am | 3 | ||||
-rw-r--r-- | storage/ndb/test/tools/log_listner.cpp | 88 |
8 files changed, 243 insertions, 149 deletions
diff --git a/storage/ndb/test/include/HugoOperations.hpp b/storage/ndb/test/include/HugoOperations.hpp index 3147ee57d4d..a0766af4b50 100644 --- a/storage/ndb/test/include/HugoOperations.hpp +++ b/storage/ndb/test/include/HugoOperations.hpp @@ -83,6 +83,8 @@ public: int equalForAttr(NdbOperation*, int attrId, int rowId); + + int equalForRow(NdbOperation*, int rowid); int setValues(NdbOperation*, int rowId, int updateId); diff --git a/storage/ndb/test/ndbapi/testBasic.cpp b/storage/ndb/test/ndbapi/testBasic.cpp index 83c2628f8b0..a032e29bc74 100644 --- a/storage/ndb/test/ndbapi/testBasic.cpp +++ b/storage/ndb/test/ndbapi/testBasic.cpp @@ -1318,6 +1318,64 @@ runDeleteRead(NDBT_Context* ctx, NDBT_Step* step){ return NDBT_OK; } +int +runBug27756(NDBT_Context* ctx, NDBT_Step* step) +{ + + Ndb* pNdb = GETNDB(step); + NdbDictionary::Dictionary * dict = pNdb->getDictionary(); + + HugoOperations ops(*ctx->getTab()); + + int loops = ctx->getNumLoops(); + const int rows = ctx->getNumRecords(); + + Vector<Uint64> copies; + while (loops--) + { + ops.startTransaction(pNdb); + ops.pkInsertRecord(pNdb, 1, 1); + ops.execute_NoCommit(pNdb); + + NdbTransaction* pTrans = ops.getTransaction(); + NdbOperation* op = pTrans->getNdbOperation(ctx->getTab()->getName()); + op->interpretedUpdateTuple(); + ops.equalForRow(op, 1); + NdbRecAttr* attr = op->getValue(NdbDictionary::Column::COPY_ROWID); + ops.execute_NoCommit(pNdb); + + copies.push_back(attr->u_64_value()); + ndbout_c("copy at: %llx", copies.back()); + ops.execute_NoCommit(pNdb); + + ops.pkDeleteRecord(pNdb, 1, 1); + ops.execute_NoCommit(pNdb); + + if (loops & 1) + { + ops.execute_Rollback(pNdb); + ops.closeTransaction(pNdb); + } + else + { + ops.execute_Commit(pNdb); + ops.closeTransaction(pNdb); + ops.clearTable(pNdb, 100); + } + } + + for (Uint32 i = 0; i<copies.size(); i++) + if (copies[i] != copies.back()) + { + ndbout_c("Memleak detected"); + return NDBT_FAILED; + } + + return NDBT_OK; +} + +template class Vector<Uint64>; + NDBT_TESTSUITE(testBasic); TESTCASE("PkInsert", "Verify that we can insert and delete from this table using PK" @@ -1594,6 +1652,10 @@ TESTCASE("DeleteRead", INITIALIZER(runDeleteRead); FINALIZER(runClearTable2); } +TESTCASE("Bug27756", + "Verify what happens when we fill the db" ){ + STEP(runBug27756); +} NDBT_TESTSUITE_END(testBasic); #if 0 diff --git a/storage/ndb/test/run-test/daily-basic-tests.txt b/storage/ndb/test/run-test/daily-basic-tests.txt index 59535958249..4693dbfa781 100644 --- a/storage/ndb/test/run-test/daily-basic-tests.txt +++ b/storage/ndb/test/run-test/daily-basic-tests.txt @@ -239,6 +239,10 @@ max-time: 500 cmd: testBasic args: -n Bug25090 T1 +max-time: 1000 +cmd: testBasic +args: -n Bug27756 + max-time: 500 cmd: testIndex args: -n Bug25059 -r 3000 T1 diff --git a/storage/ndb/test/src/HugoAsynchTransactions.cpp b/storage/ndb/test/src/HugoAsynchTransactions.cpp index 6926c8a973e..0a5991d9e20 100644 --- a/storage/ndb/test/src/HugoAsynchTransactions.cpp +++ b/storage/ndb/test/src/HugoAsynchTransactions.cpp @@ -188,14 +188,11 @@ HugoAsynchTransactions::pkUpdateRecordsAsynch(Ndb* pNdb, // Read // Define primary keys check = pOp->readTupleExclusive(); - for (a = 0; a < tab.getNoOfColumns(); a++) { - if (tab.getColumn(a)->getPrimaryKey() == true) { - if (equalForAttr(pOp, a, cReadRecords) != 0){ - ERR(transactions[t]->getNdbError()); - pNdb->closeTransaction(transactions[t]); - return NDBT_FAILED; - } - } + if (equalForRow(pOp, cReadRecords) != 0) + { + ERR(transactions[t]->getNdbError()); + pNdb->closeTransaction(transactions[t]); + return NDBT_FAILED; } // Define attributes to read for (a = 0; a < tab.getNoOfColumns(); a++) { @@ -259,15 +256,12 @@ HugoAsynchTransactions::pkUpdateRecordsAsynch(Ndb* pNdb, } // Set search condition for the record - for (a = 0; a < tab.getNoOfColumns(); a++) { - if (tab.getColumn(a)->getPrimaryKey() == true) { - if (equalForAttr(pOp, a, cRecords) != 0) { - ERR(transactions[t]->getNdbError()); - pNdb->closeTransaction(transactions[t]); - return NDBT_FAILED; - } - } - } + if (equalForRow(pOp, cReadRecords) != 0) + { + ERR(transactions[t]->getNdbError()); + pNdb->closeTransaction(transactions[t]); + return NDBT_FAILED; + } // Update the record for (a = 0; a < tab.getNoOfColumns(); a++) { @@ -396,15 +390,12 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb, case NO_READ: // Define primary keys check = pOp->readTuple(); - for (a = 0; a < tab.getNoOfColumns(); a++) { - if (tab.getColumn(a)->getPrimaryKey() == true) { - if (equalForAttr(pOp, a, cRecords) != 0){ - ERR(transactions[t]->getNdbError()); - pNdb->closeTransaction(transactions[t]); - return NDBT_FAILED; - } - } - } + if (equalForRow(pOp, cRecords) != 0) + { + ERR(transactions[t]->getNdbError()); + pNdb->closeTransaction(transactions[t]); + return NDBT_FAILED; + } // Define attributes to read for (a = 0; a < tab.getNoOfColumns(); a++) { if ((rows[cIndex]->attributeStore(a) = @@ -425,15 +416,12 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb, } // Define primary keys - for (a = 0; a < tab.getNoOfColumns(); a++) { - if (tab.getColumn(a)->getPrimaryKey() == true){ - if (equalForAttr(pOp, a, cRecords) != 0) { - ERR(transactions[t]->getNdbError()); - pNdb->closeTransaction(transactions[t]); - return NDBT_FAILED; - } - } - } + if (equalForRow(pOp, cRecords) != 0) + { + ERR(transactions[t]->getNdbError()); + pNdb->closeTransaction(transactions[t]); + return NDBT_FAILED; + } break; default: // Should not happen... diff --git a/storage/ndb/test/src/HugoOperations.cpp b/storage/ndb/test/src/HugoOperations.cpp index 9a286a71b91..481ce0c0567 100644 --- a/storage/ndb/test/src/HugoOperations.cpp +++ b/storage/ndb/test/src/HugoOperations.cpp @@ -111,14 +111,8 @@ rand_lock_mode: } // Define primary keys - for(a = 0; a<tab.getNoOfColumns(); a++){ - if (tab.getColumn(a)->getPrimaryKey() == true){ - if(equalForAttr(pOp, a, r+recordNo) != 0){ - ERR(pTrans->getNdbError()); - return NDBT_FAILED; - } - } - } + if (equalForRow(pOp, r+recordNo) != 0) + return NDBT_FAILED; if(pIndexScanOp) pIndexScanOp->end_of_bound(r); @@ -143,7 +137,6 @@ int HugoOperations::pkUpdateRecord(Ndb* pNdb, int recordNo, int numRecords, int updatesValue){ - int a; allocRows(numRecords); int check; for(int r=0; r < numRecords; r++){ @@ -172,14 +165,8 @@ HugoOperations::setValues(NdbOperation* pOp, int rowId, int updateId) { // Define primary keys int a; - for(a = 0; a<tab.getNoOfColumns(); a++){ - if (tab.getColumn(a)->getPrimaryKey() == true){ - if(equalForAttr(pOp, a, rowId) != 0){ - ERR(pTrans->getNdbError()); - return NDBT_FAILED; - } - } - } + if (equalForRow(pOp, rowId) != 0) + return NDBT_FAILED; for(a = 0; a<tab.getNoOfColumns(); a++){ if (tab.getColumn(a)->getPrimaryKey() == false){ @@ -198,7 +185,7 @@ int HugoOperations::pkInsertRecord(Ndb* pNdb, int numRecords, int updatesValue){ - int a, check; + int check; for(int r=0; r < numRecords; r++){ NdbOperation* pOp = getOperation(pTrans, NdbOperation::InsertRequest); if (pOp == NULL) { @@ -240,14 +227,8 @@ int HugoOperations::pkWriteRecord(Ndb* pNdb, } // Define primary keys - for(a = 0; a<tab.getNoOfColumns(); a++){ - if (tab.getColumn(a)->getPrimaryKey() == true){ - if(equalForAttr(pOp, a, r+recordNo) != 0){ - ERR(pTrans->getNdbError()); - return NDBT_FAILED; - } - } - } + if (equalForRow(pOp, r+recordNo) != 0) + return NDBT_FAILED; // Define attributes to update for(a = 0; a<tab.getNoOfColumns(); a++){ @@ -266,7 +247,7 @@ int HugoOperations::pkWritePartialRecord(Ndb* pNdb, int recordNo, int numRecords){ - int a, check; + int check; for(int r=0; r < numRecords; r++){ NdbOperation* pOp = pTrans->getNdbOperation(tab.getName()); if (pOp == NULL) { @@ -281,14 +262,8 @@ int HugoOperations::pkWritePartialRecord(Ndb* pNdb, } // Define primary keys - for(a = 0; a<tab.getNoOfColumns(); a++){ - if (tab.getColumn(a)->getPrimaryKey() == true){ - if(equalForAttr(pOp, a, r+recordNo) != 0){ - ERR(pTrans->getNdbError()); - return NDBT_FAILED; - } - } - } + if (equalForRow(pOp, r+recordNo) != 0) + return NDBT_FAILED; } return NDBT_OK; } @@ -297,7 +272,7 @@ int HugoOperations::pkDeleteRecord(Ndb* pNdb, int recordNo, int numRecords){ - int a, check; + int check; for(int r=0; r < numRecords; r++){ NdbOperation* pOp = getOperation(pTrans, NdbOperation::DeleteRequest); if (pOp == NULL) { @@ -312,14 +287,8 @@ int HugoOperations::pkDeleteRecord(Ndb* pNdb, } // Define primary keys - for(a = 0; a<tab.getNoOfColumns(); a++){ - if (tab.getColumn(a)->getPrimaryKey() == true){ - if(equalForAttr(pOp, a, r+recordNo) != 0){ - ERR(pTrans->getNdbError()); - return NDBT_FAILED; - } - } - } + if (equalForRow(pOp, r+recordNo) != 0) + return NDBT_FAILED; } return NDBT_OK; } @@ -521,6 +490,22 @@ HugoOperations::~HugoOperations(){ } } +int +HugoOperations::equalForRow(NdbOperation* pOp, int row) +{ + for(int a = 0; a<tab.getNoOfColumns(); a++) + { + if (tab.getColumn(a)->getPrimaryKey() == true) + { + if(equalForAttr(pOp, a, row) != 0) + { + ERR(pOp->getNdbError()); + return NDBT_FAILED; + } + } + } + return NDBT_OK; +} int HugoOperations::equalForAttr(NdbOperation* pOp, int attrId, @@ -679,14 +664,8 @@ int HugoOperations::indexReadRecords(Ndb*, const char * idxName, int recordNo, } // Define primary keys - for(a = 0; a<tab.getNoOfColumns(); a++){ - if (tab.getColumn(a)->getPrimaryKey() == true){ - if(equalForAttr(pOp, a, r+recordNo) != 0){ - ERR(pTrans->getNdbError()); - return NDBT_FAILED; - } - } - } + if (equalForRow(pOp, r+recordNo) != 0) + return NDBT_FAILED; // Define attributes to read for(a = 0; a<tab.getNoOfColumns(); a++){ @@ -723,14 +702,8 @@ HugoOperations::indexUpdateRecord(Ndb*, } // Define primary keys - for(a = 0; a<tab.getNoOfColumns(); a++){ - if (tab.getColumn(a)->getPrimaryKey() == true){ - if(equalForAttr(pOp, a, r+recordNo) != 0){ - ERR(pTrans->getNdbError()); - return NDBT_FAILED; - } - } - } + if (equalForRow(pOp, r+recordNo) != 0) + return NDBT_FAILED; // Define attributes to update for(a = 0; a<tab.getNoOfColumns(); a++){ diff --git a/storage/ndb/test/src/HugoTransactions.cpp b/storage/ndb/test/src/HugoTransactions.cpp index 34f77d9a2da..f0f042d306b 100644 --- a/storage/ndb/test/src/HugoTransactions.cpp +++ b/storage/ndb/test/src/HugoTransactions.cpp @@ -520,10 +520,9 @@ HugoTransactions::loadTable(Ndb* pNdb, bool oneTrans, int value, bool abort){ - int check, a; + int check; int retryAttempt = 0; int retryMax = 5; - NdbOperation *pOp; bool first_batch = true; const int org = batch; @@ -667,10 +666,9 @@ HugoTransactions::loadTable(Ndb* pNdb, int HugoTransactions::fillTable(Ndb* pNdb, int batch){ - int check, a, b; + int check; int retryAttempt = 0; int retryMax = 5; - NdbOperation *pOp; const int org = batch; const int cols = tab.getNoOfColumns(); @@ -791,7 +789,7 @@ HugoTransactions::pkReadRecords(Ndb* pNdb, int reads = 0; int r = 0; int retryAttempt = 0; - int check, a; + int check; if (batch == 0) { g_info << "ERROR: Argument batch == 0 in pkReadRecords(). Not allowed." << endl; @@ -910,8 +908,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb, int updated = 0; int r = 0; int retryAttempt = 0; - int check, a, b; - NdbOperation *pOp; + int check, b; allocRows(batch); @@ -1097,14 +1094,10 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb, } // Define primary keys - for(a = 0; a<tab.getNoOfColumns(); a++){ - if (tab.getColumn(a)->getPrimaryKey() == true){ - if(equalForAttr(pOp, a, r) != 0){ - ERR(pTrans->getNdbError()); - closeTransaction(pNdb); - return NDBT_FAILED; - } - } + if (equalForRow(pOp, r) != 0) + { + closeTransaction(pNdb); + return NDBT_FAILED; } // Read update value @@ -1153,14 +1146,10 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb, } // PKs - for(a = 0; a<tab.getNoOfColumns(); a++){ - if (tab.getColumn(a)->getPrimaryKey() == true){ - if(equalForAttr(pUpdOp, a, r) != 0){ - ERR(pTrans->getNdbError()); - closeTransaction(pNdb); - return NDBT_FAILED; - } - } + if (equalForRow(pOp, r) != 0) + { + closeTransaction(pNdb); + return NDBT_FAILED; } // Update col @@ -1236,8 +1225,7 @@ HugoTransactions::pkDelRecords(Ndb* pNdb, int deleted = 0; int r = 0; int retryAttempt = 0; - int check, a; - NdbOperation *pOp; + int check; g_info << "|- Deleting records..." << endl; while (r < records){ @@ -1335,8 +1323,7 @@ HugoTransactions::lockRecords(Ndb* pNdb, // and lock som other records int r = 0; int retryAttempt = 0; - int check, a, b; - NdbOperation *pOp; + int check; NdbOperation::LockMode lm = NdbOperation::LM_Exclusive; // Calculate how many records to lock in each batch @@ -1522,14 +1509,10 @@ HugoTransactions::indexReadRecords(Ndb* pNdb, } // Define primary keys - for(a = 0; a<tab.getNoOfColumns(); a++){ - if (tab.getColumn(a)->getPrimaryKey() == true){ - if(equalForAttr(pOp, a, r+b) != 0){ - ERR(pTrans->getNdbError()); - closeTransaction(pNdb); - return NDBT_FAILED; - } - } + if (equalForRow(pOp, r+b) != 0) + { + closeTransaction(pNdb); + return NDBT_FAILED; } // Define attributes to read @@ -1663,14 +1646,10 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, } // Define primary keys - for(a = 0; a<tab.getNoOfColumns(); a++){ - if (tab.getColumn(a)->getPrimaryKey() == true){ - if(equalForAttr(pOp, a, r+b) != 0){ - ERR(pTrans->getNdbError()); - closeTransaction(pNdb); - return NDBT_FAILED; - } - } + if (equalForRow(pOp, r+b) != 0) + { + closeTransaction(pNdb); + return NDBT_FAILED; } // Define attributes to read @@ -1733,16 +1712,13 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, return NDBT_FAILED; } - if(!ordered){ - for(a = 0; a<tab.getNoOfColumns(); a++){ - if (tab.getColumn(a)->getPrimaryKey() == true){ - if(equalForAttr(pUpdOp, a, r+b) != 0){ - ERR(pTrans->getNdbError()); - closeTransaction(pNdb); - return NDBT_FAILED; - } - } - } + if(!ordered) + { + if (equalForRow(pOp, r+b) != 0) + { + closeTransaction(pNdb); + return NDBT_FAILED; + } } for(a = 0; a<tab.getNoOfColumns(); a++){ diff --git a/storage/ndb/test/tools/Makefile.am b/storage/ndb/test/tools/Makefile.am index 386a59f723f..25b4e20a682 100644 --- a/storage/ndb/test/tools/Makefile.am +++ b/storage/ndb/test/tools/Makefile.am @@ -13,7 +13,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -ndbtest_PROGRAMS = hugoLoad hugoFill hugoLockRecords hugoPkDelete hugoPkRead hugoPkReadRecord hugoPkUpdate hugoScanRead hugoScanUpdate restart verify_index copy_tab create_index ndb_cpcc listen_event +ndbtest_PROGRAMS = hugoLoad hugoFill hugoLockRecords hugoPkDelete hugoPkRead hugoPkReadRecord hugoPkUpdate hugoScanRead hugoScanUpdate restart verify_index copy_tab create_index ndb_cpcc listen_event eventlog # transproxy @@ -33,6 +33,7 @@ copy_tab_SOURCES = copy_tab.cpp create_index_SOURCES = create_index.cpp ndb_cpcc_SOURCES = cpcc.cpp listen_event_SOURCES = listen.cpp +eventlog_SOURCES = log_listner.cpp include $(top_srcdir)/storage/ndb/config/common.mk.am include $(top_srcdir)/storage/ndb/config/type_ndbapitest.mk.am diff --git a/storage/ndb/test/tools/log_listner.cpp b/storage/ndb/test/tools/log_listner.cpp new file mode 100644 index 00000000000..c5125ef7414 --- /dev/null +++ b/storage/ndb/test/tools/log_listner.cpp @@ -0,0 +1,88 @@ +#include <mgmapi.h> +#include <ndb_global.h> +#include <ndb_opts.h> +#include <NDBT.hpp> + +NDB_STD_OPTS_VARS; + +static struct my_option my_long_options[] = +{ + NDB_STD_OPTS("ndb_logevent_listen"), + { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} +}; +static void usage() +{ + char desc[] = + "tabname\n"\ + "This program list all properties of table(s) in NDB Cluster.\n"\ + " ex: desc T1 T2 T4\n"; + ndb_std_print_version(); + my_print_help(my_long_options); + my_print_variables(my_long_options); +} + +int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, + 15, NDB_MGM_EVENT_CATEGORY_CONNECTION, + 15, NDB_MGM_EVENT_CATEGORY_NODE_RESTART, + 15, NDB_MGM_EVENT_CATEGORY_STARTUP, + 15, NDB_MGM_EVENT_CATEGORY_SHUTDOWN, + 15, NDB_MGM_EVENT_CATEGORY_STATISTIC, + 15, NDB_MGM_EVENT_CATEGORY_ERROR, + 15, NDB_MGM_EVENT_CATEGORY_CHECKPOINT, + 15, NDB_MGM_EVENT_CATEGORY_CONGESTION, + 0 }; + +int +main(int argc, char** argv) +{ + NDB_INIT(argv[0]); + const char *load_default_groups[]= { "mysql_cluster",0 }; + load_defaults("my",load_default_groups,&argc,&argv); + int ho_error; +#ifndef DBUG_OFF + opt_debug= "d:t:O,/tmp/ndb_desc.trace"; +#endif + if ((ho_error=handle_options(&argc, &argv, my_long_options, + ndb_std_get_one_option))) + return NDBT_ProgramExit(NDBT_WRONGARGS); + + NdbMgmHandle handle= ndb_mgm_create_handle(); + ndb_mgm_set_connectstring(handle, opt_connect_str); + + while (true) + { + if (ndb_mgm_connect(handle,0,0,0) == -1) + { + ndbout_c("Failed to connect"); + exit(0); + } + + NdbLogEventHandle le = ndb_mgm_create_logevent_handle(handle, filter); + if (le == 0) + { + ndbout_c("Failed to create logevent handle"); + exit(0); + } + + struct ndb_logevent event; + while (true) + { + int r= ndb_logevent_get_next(le, &event,5000); + if (r < 0) + { + ndbout_c("Error while getting next event"); + break; + } + if (r == 0) + { + continue; + } + ndbout_c("Got event: %d", event.type); + } + + ndb_mgm_destroy_logevent_handle(&le); + ndb_mgm_disconnect(handle); + } + + return 0; +} |