1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge mysql.com:/home/kostja/mysql/mysql-5.0-root

into  mysql.com:/home/kostja/mysql/mysql-5.1-merge
This commit is contained in:
konstantin@mysql.com
2006-02-09 13:35:59 +03:00
43 changed files with 651 additions and 163 deletions

View File

@ -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
@ -155,8 +167,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();
@ -182,6 +198,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;
}