diff options
author | unknown <aelkin@mysql.com> | 2006-02-06 09:55:20 +0200 |
---|---|---|
committer | unknown <aelkin@mysql.com> | 2006-02-06 09:55:20 +0200 |
commit | 0dc6d4928944d56fff3a969b3f9e559b3d792a8c (patch) | |
tree | b94808cd699704f89458a2c211a4f49f399df51a /ndb/tools/delete_all.cpp | |
parent | 4b0b18cad12427b72d23625d964061727437ad02 (diff) | |
parent | 69ebb4e370db62f1ad556e46b66fa721f9ec4c56 (diff) | |
download | mariadb-git-base_4_16217.tar.gz |
Merge aelkin@bk-internal.mysql.com:/home/bk/mysql-5.0base_4_16217
into mysql.com:/usr_rh9/home/elkin.rh9/MySQL/BARE/mysql-5.0
Diffstat (limited to 'ndb/tools/delete_all.cpp')
-rw-r--r-- | ndb/tools/delete_all.cpp | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/ndb/tools/delete_all.cpp b/ndb/tools/delete_all.cpp index 2c395a67900..d6972e33cc0 100644 --- a/ndb/tools/delete_all.cpp +++ b/ndb/tools/delete_all.cpp @@ -22,7 +22,8 @@ #include <NdbSleep.h> #include <NDBT.hpp> -static int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism=240); +static int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, + bool commit_across_open_cursor, int parallelism=240); NDB_STD_OPTS_VARS; @@ -83,8 +84,18 @@ int main(int argc, char** argv){ ndbout << " Table " << argv[i] << " does not exist!" << endl; return NDBT_ProgramExit(NDBT_WRONGARGS); } + // Check if we have any blobs + bool commit_across_open_cursor = true; + for (int j = 0; j < pTab->getNoOfColumns(); j++) { + NdbDictionary::Column::Type t = pTab->getColumn(j)->getType(); + if (t == NdbDictionary::Column::Blob || + t == NdbDictionary::Column::Text) { + commit_across_open_cursor = false; + break; + } + } ndbout << "Deleting all from " << argv[i] << "..."; - if(clear_table(&MyNdb, pTab) == NDBT_FAILED){ + if(clear_table(&MyNdb, pTab, commit_across_open_cursor) == NDBT_FAILED){ res = NDBT_FAILED; ndbout << "FAILED" << endl; } @@ -93,7 +104,8 @@ int main(int argc, char** argv){ } -int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism) +int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, + bool commit_across_open_cursor, int parallelism) { // Scan all records exclusive and delete // them one by one @@ -154,8 +166,12 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism) } while((check = pOp->nextResult(false)) == 0); if(check != -1){ - check = pTrans->execute(NdbTransaction::Commit); - pTrans->restart(); + if (commit_across_open_cursor) { + check = pTrans->execute(NdbTransaction::Commit); + pTrans->restart(); // new tx id + } else { + check = pTrans->execute(NdbTransaction::NoCommit); + } } err = pTrans->getNdbError(); @@ -181,6 +197,11 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism) } goto failed; } + if (! commit_across_open_cursor && + pTrans->execute(NdbTransaction::Commit) != 0) { + err = pTrans->getNdbError(); + goto failed; + } pNdb->closeTransaction(pTrans); return NDBT_OK; } |