summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <jonas@perch.ndb.mysql.com>2006-06-22 10:24:44 +0200
committerunknown <jonas@perch.ndb.mysql.com>2006-06-22 10:24:44 +0200
commit8751d63e3aceeb90d3d8874e3766a0f11aa769ce (patch)
tree58ab94eca9d721ea4330e2baf883b5018c223bb5 /sql
parentcd58d39138fb43e365ffccc7f7c1b0ca30e11129 (diff)
downloadmariadb-git-8751d63e3aceeb90d3d8874e3766a0f11aa769ce.tar.gz
ndb - bug#16341
create tablespace/logfile group should "back out changes" mysql-test/r/ndb_dd_ddl.result: add testcase for bug#16341 mysql-test/t/ndb_dd_ddl.test: add testcase for bug#16341 sql/ha_ndbcluster.cc: If create data/undo file fails, check if filegroup is same version, and if it is drop it (wo/ checking error) storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: add version to createfileconf storage/ndb/include/ndbapi/NdbDictionary.hpp: Add NdbDictionary::ObjectId, that can be used to get [ id, version ] during create (only for DD object so far) storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp: add version to createfileconf storage/ndb/src/ndbapi/NdbDictionary.cpp: Add NdbDictionary::ObjectId, that can be used to get [ id, version ] during create (only for DD object so far) storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: Add NdbDictionary::ObjectId, that can be used to get [ id, version ] during create (only for DD object so far) storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp: Add NdbDictionary::ObjectId, that can be used to get [ id, version ] during create (only for DD object so far)
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_ndbcluster.cc33
1 files changed, 27 insertions, 6 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 27fe2e889af..986014a36d1 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -9947,7 +9947,8 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
{
DBUG_RETURN(HA_ERR_NO_CONNECTION);
}
-
+
+ NdbError err;
NDBDICT *dict = ndb->getDictionary();
int error;
const char * errmsg;
@@ -9960,6 +9961,7 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
NdbDictionary::Tablespace ndb_ts;
NdbDictionary::Datafile ndb_df;
+ NdbDictionary::ObjectId objid;
if (set_up_tablespace(info, &ndb_ts))
{
DBUG_RETURN(1);
@@ -9969,7 +9971,7 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
DBUG_RETURN(1);
}
errmsg= "TABLESPACE";
- if (dict->createTablespace(ndb_ts))
+ if (dict->createTablespace(ndb_ts, &objid))
{
DBUG_PRINT("error", ("createTablespace returned %d", error));
goto ndberror;
@@ -9978,8 +9980,17 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
errmsg= "DATAFILE";
if (dict->createDatafile(ndb_df))
{
+ err= dict->getNdbError();
+ NdbDictionary::Tablespace tmp= dict->getTablespace(ndb_ts.getName());
+ if (dict->getNdbError().code == 0 &&
+ tmp.getObjectId() == objid.getObjectId() &&
+ tmp.getObjectVersion() == objid.getObjectVersion())
+ {
+ dict->dropTablespace(tmp);
+ }
+
DBUG_PRINT("error", ("createDatafile returned %d", error));
- goto ndberror;
+ goto ndberror2;
}
is_tablespace= 1;
break;
@@ -10033,6 +10044,7 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
error= ER_CREATE_FILEGROUP_FAILED;
NdbDictionary::LogfileGroup ndb_lg;
NdbDictionary::Undofile ndb_uf;
+ NdbDictionary::ObjectId objid;
if (info->undo_file_name == NULL)
{
/*
@@ -10045,7 +10057,7 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
DBUG_RETURN(1);
}
errmsg= "LOGFILE GROUP";
- if (dict->createLogfileGroup(ndb_lg))
+ if (dict->createLogfileGroup(ndb_lg, &objid))
{
goto ndberror;
}
@@ -10057,7 +10069,15 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
errmsg= "UNDOFILE";
if (dict->createUndofile(ndb_uf))
{
- goto ndberror;
+ err= dict->getNdbError();
+ NdbDictionary::LogfileGroup tmp= dict->getLogfileGroup(ndb_lg.getName());
+ if (dict->getNdbError().code == 0 &&
+ tmp.getObjectId() == objid.getObjectId() &&
+ tmp.getObjectVersion() == objid.getObjectVersion())
+ {
+ dict->dropLogfileGroup(tmp);
+ }
+ goto ndberror2;
}
break;
}
@@ -10134,7 +10154,8 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
DBUG_RETURN(FALSE);
ndberror:
- const NdbError err= dict->getNdbError();
+ err= dict->getNdbError();
+ndberror2:
ERR_PRINT(err);
ndb_to_mysql_error(&err);