summaryrefslogtreecommitdiff
path: root/storage/ndb/test
diff options
context:
space:
mode:
authorunknown <gni@dev3-221.dev.cn.tlan>2008-01-10 19:49:32 +0800
committerunknown <gni@dev3-221.dev.cn.tlan>2008-01-10 19:49:32 +0800
commitd8d857e0ccc63ffbe8c1a90994d51884d1ee46a0 (patch)
tree63007427eb160d7aad0a35714150fb41708d748e /storage/ndb/test
parent44ccc30b030863dde6a65ac380d5e5e85e32abf6 (diff)
parent20764f80ae34eea5f4b05bf24ea2949b098d0054 (diff)
downloadmariadb-git-d8d857e0ccc63ffbe8c1a90994d51884d1ee46a0.tar.gz
Merge dev3-221.dev.cn.tlan:/home/ngb/mysql/mysql-5.1/mysql-5.1-new-ndb
into dev3-221.dev.cn.tlan:/home/ngb/mysql/mysql-5.1/mysql-5.1-new-ndb-bj storage/ndb/src/kernel/blocks/backup/Backup.cpp: Auto merged storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp: Auto merged storage/ndb/src/kernel/blocks/lgman.cpp: Auto merged storage/ndb/src/kernel/blocks/tsman.cpp: Auto merged storage/ndb/test/ndbapi/testDict.cpp: Auto merged storage/ndb/src/kernel/blocks/ERROR_codes.txt: SCCS merged storage/ndb/src/ndbapi/ndberror.c: SCCS merged
Diffstat (limited to 'storage/ndb/test')
-rw-r--r--storage/ndb/test/ndbapi/testDict.cpp166
-rw-r--r--storage/ndb/test/src/NdbBackup.cpp3
2 files changed, 168 insertions, 1 deletions
diff --git a/storage/ndb/test/ndbapi/testDict.cpp b/storage/ndb/test/ndbapi/testDict.cpp
index e1b8f2b3c7f..ae940074067 100644
--- a/storage/ndb/test/ndbapi/testDict.cpp
+++ b/storage/ndb/test/ndbapi/testDict.cpp
@@ -2357,6 +2357,168 @@ runBug24631(NDBT_Context* ctx, NDBT_Step* step)
return NDBT_OK;
}
+int
+runBug29186(NDBT_Context* ctx, NDBT_Step* step)
+{
+ int lgError = 15000;
+ int tsError = 16000;
+ int res;
+ char lgname[256];
+ char ufname[256];
+ char tsname[256];
+ char dfname[256];
+
+ NdbRestarter restarter;
+
+ if (restarter.getNumDbNodes() < 2){
+ ctx->stopTest();
+ return NDBT_OK;
+ }
+
+ Ndb* pNdb = GETNDB(step);
+ NdbDictionary::Dictionary* pDict = pNdb->getDictionary();
+ NdbDictionary::Dictionary::List list;
+
+ if (pDict->listObjects(list) == -1)
+ return NDBT_FAILED;
+
+ // 1.create logfile group
+ const char * lgfound = 0;
+
+ for (Uint32 i = 0; i<list.count; i++)
+ {
+ switch(list.elements[i].type){
+ case NdbDictionary::Object::LogfileGroup:
+ lgfound = list.elements[i].name;
+ break;
+ default:
+ break;
+ }
+ if (lgfound)
+ break;
+ }
+
+ if (lgfound == 0)
+ {
+ BaseString::snprintf(lgname, sizeof(lgname), "LG-%u", rand());
+ NdbDictionary::LogfileGroup lg;
+
+ lg.setName(lgname);
+ lg.setUndoBufferSize(8*1024*1024);
+ if(pDict->createLogfileGroup(lg) != 0)
+ {
+ g_err << "Failed to create logfilegroup:"
+ << endl << pDict->getNdbError() << endl;
+ return NDBT_FAILED;
+ }
+ }
+ else
+ {
+ BaseString::snprintf(lgname, sizeof(lgname), "%s", lgfound);
+ }
+
+ if(restarter.waitClusterStarted(60)){
+ g_err << "waitClusterStarted failed"<< endl;
+ return NDBT_FAILED;
+ }
+
+ if(restarter.insertErrorInAllNodes(lgError) != 0){
+ g_err << "failed to set error insert"<< endl;
+ return NDBT_FAILED;
+ }
+
+ g_info << "error inserted" << endl;
+ g_info << "waiting some before add log file" << endl;
+ g_info << "starting create log file group" << endl;
+
+ NdbDictionary::Undofile uf;
+ BaseString::snprintf(ufname, sizeof(ufname), "%s-%u", lgname, rand());
+ uf.setPath(ufname);
+ uf.setSize(2*1024*1024);
+ uf.setLogfileGroup(lgname);
+
+ if(pDict->createUndofile(uf) == 0)
+ {
+ g_err << "Create log file group should fail on error_insertion " << lgError << endl;
+ return NDBT_FAILED;
+ }
+
+ //clear lg error
+ if(restarter.insertErrorInAllNodes(15099) != 0){
+ g_err << "failed to set error insert"<< endl;
+ return NDBT_FAILED;
+ }
+ NdbSleep_SecSleep(5);
+
+ //lg error has been cleared, so we can add undo file
+ if(pDict->createUndofile(uf) != 0)
+ {
+ g_err << "Failed to create undofile:"
+ << endl << pDict->getNdbError() << endl;
+ return NDBT_FAILED;
+ }
+
+ if(restarter.waitClusterStarted(60)){
+ g_err << "waitClusterStarted failed"<< endl;
+ return NDBT_FAILED;
+ }
+
+ if(restarter.insertErrorInAllNodes(tsError) != 0){
+ g_err << "failed to set error insert"<< endl;
+ return NDBT_FAILED;
+ }
+ g_info << "error inserted" << endl;
+ g_info << "waiting some before create table space" << endl;
+ g_info << "starting create table space" << endl;
+
+ //r = runCreateTablespace(ctx, step);
+ BaseString::snprintf(tsname, sizeof(tsname), "TS-%u", rand());
+ BaseString::snprintf(dfname, sizeof(dfname), "%s-%u-1.dat", tsname, rand());
+
+ NdbDictionary::Tablespace ts;
+ ts.setName(tsname);
+ ts.setExtentSize(1024*1024);
+ ts.setDefaultLogfileGroup(lgname);
+
+ if(pDict->createTablespace(ts) != 0)
+ {
+ g_err << "Failed to create tablespace:"
+ << endl << pDict->getNdbError() << endl;
+ return NDBT_FAILED;
+ }
+
+ NdbDictionary::Datafile df;
+ df.setPath(dfname);
+ df.setSize(1*1024*1024);
+ df.setTablespace(tsname);
+
+ if(pDict->createDatafile(df) == 0)
+ {
+ g_err << "Create table space should fail on error_insertion " << tsError << endl;
+ return NDBT_FAILED;
+ }
+ //Clear the inserted error
+ if(restarter.insertErrorInAllNodes(16099) != 0){
+ g_err << "failed to set error insert"<< endl;
+ return NDBT_FAILED;
+ }
+ NdbSleep_SecSleep(5);
+
+ if (pDict->dropTablespace(pDict->getTablespace(tsname)) != 0)
+ {
+ g_err << "Failed to drop tablespace: " << pDict->getNdbError() << endl;
+ return NDBT_FAILED;
+ }
+
+ if (lgfound == 0)
+ {
+ if (pDict->dropLogfileGroup(pDict->getLogfileGroup(lgname)) != 0)
+ return NDBT_FAILED;
+ }
+
+ return NDBT_OK;
+}
+
struct RandSchemaOp
{
struct Obj
@@ -3123,6 +3285,10 @@ TESTCASE("Bug24631",
""){
INITIALIZER(runBug24631);
}
+TESTCASE("Bug29186",
+ ""){
+ INITIALIZER(runBug29186);
+}
NDBT_TESTSUITE_END(testDict);
int main(int argc, const char** argv){
diff --git a/storage/ndb/test/src/NdbBackup.cpp b/storage/ndb/test/src/NdbBackup.cpp
index 42b15885089..3fb4de461f0 100644
--- a/storage/ndb/test/src/NdbBackup.cpp
+++ b/storage/ndb/test/src/NdbBackup.cpp
@@ -350,7 +350,8 @@ FailS_codes[] = {
10025,
10027,
10033,
- 10035
+ 10035,
+ 10036
};
int