Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-05-15 09:08:16+02:00, jonas@stripped +6 -0
ndb - bug#24631
add Dbdict::restartDropObj*
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp@stripped, 2007-05-15 09:08:13+02:00,
jonas@stripped +185 -4
add restartDropObj
- handle undo files "specially"
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp@stripped, 2007-05-15 09:08:13+02:00,
jonas@stripped +8 -1
add restartDropObj*
storage/ndb/src/kernel/blocks/lgman.cpp@stripped, 2007-05-15 09:08:13+02:00,
jonas@stripped +12 -1
allow drop of meta files
storage/ndb/src/kernel/blocks/tsman.cpp@stripped, 2007-05-15 09:08:13+02:00,
jonas@stripped +6 -0
allow drop of meta files
storage/ndb/test/ndbapi/testDict.cpp@stripped, 2007-05-15 09:08:13+02:00,
jonas@stripped +157 -0
add testcase
storage/ndb/test/run-test/daily-basic-tests.txt@stripped, 2007-05-15 09:08:13+02:00,
jonas@stripped +4 -0
add testcase
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jonas
# Host: perch.ndb.mysql.com
# Root: /home/jonas/src/mysql-5.1-new-ndb
--- 1.28/storage/ndb/src/kernel/blocks/lgman.cpp 2007-05-15 09:08:22 +02:00
+++ 1.29/storage/ndb/src/kernel/blocks/lgman.cpp 2007-05-15 09:08:22 +02:00
@@ -436,7 +436,6 @@
{
jam();
ndbrequire(! (ptr.p->m_state & Logfile_group::LG_THREAD_MASK));
- ndbrequire(ptr.p->m_meta_files.isEmpty());
ndbrequire(ptr.p->m_outstanding_fs == 0);
Local_undofile_list list(m_file_pool, ptr.p->m_files);
@@ -446,6 +445,18 @@
{
jam();
ndbrequire(! (file_ptr.p->m_state & Undofile::FS_OUTSTANDING));
+ file_ptr.p->m_create.m_senderRef = ref;
+ file_ptr.p->m_create.m_senderData = data;
+ create_file_abort(signal, ptr, file_ptr);
+ return;
+ }
+
+ Local_undofile_list metalist(m_file_pool, ptr.p->m_meta_files);
+ if (metalist.first(file_ptr))
+ {
+ jam();
+ metalist.remove(file_ptr);
+ list.add(file_ptr);
file_ptr.p->m_create.m_senderRef = ref;
file_ptr.p->m_create.m_senderData = data;
create_file_abort(signal, ptr, file_ptr);
--- 1.16/storage/ndb/src/kernel/blocks/tsman.cpp 2007-05-15 09:08:22 +02:00
+++ 1.17/storage/ndb/src/kernel/blocks/tsman.cpp 2007-05-15 09:08:22 +02:00
@@ -1309,6 +1309,12 @@
Local_datafile_list free(m_file_pool, fg_ptr.p->m_free_files);
free.remove(file_ptr);
}
+ else if(find_file_by_id(file_ptr, fg_ptr.p->m_meta_files, req.file_id))
+ {
+ jam();
+ Local_datafile_list meta(m_file_pool, fg_ptr.p->m_meta_files);
+ meta.remove(file_ptr);
+ }
else
{
errorCode = DropFileImplRef::NoSuchFile;
--- 1.85/storage/ndb/test/run-test/daily-basic-tests.txt 2007-05-15 09:08:22 +02:00
+++ 1.86/storage/ndb/test/run-test/daily-basic-tests.txt 2007-05-15 09:08:22 +02:00
@@ -619,6 +619,10 @@
cmd: testDict
args: -l 25 -n DictRestart T1
+max-time: 500
+cmd: testDict
+args: -n Bug24631 T1
+
#
# TEST NDBAPI
#
--- 1.132/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2007-05-15 09:08:22 +02:00
+++ 1.133/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2007-05-15 09:08:22 +02:00
@@ -188,7 +188,7 @@
0, 0, 0, 0,
&Dbdict::drop_undofile_prepare_start, 0,
0,
- 0, 0,
+ 0, &Dbdict::drop_undofile_commit_complete,
0, 0, 0
}
};
@@ -3209,9 +3209,7 @@
case DictTabInfo::LogfileGroup:
case DictTabInfo::Datafile:
case DictTabInfo::Undofile:
- warningEvent("Dont drop object: %d", tableId);
- c_restartRecord.activeTable++;
- checkSchemaStatus(signal);
+ restartDropObj(signal, tableId, old_entry);
return;
}
@@ -3254,6 +3252,9 @@
checkSchemaStatus(signal);
}
+/**
+ * Create Obj during NR/SR
+ */
void
Dbdict::restartCreateObj(Signal* signal,
Uint32 tableId,
@@ -3482,6 +3483,170 @@
checkSchemaStatus(signal);
}
+/**
+ * Drop object during NR/SR
+ */
+void
+Dbdict::restartDropObj(Signal* signal,
+ Uint32 tableId,
+ const SchemaFile::TableEntry * entry)
+{
+ jam();
+
+ DropObjRecordPtr dropObjPtr;
+ ndbrequire(c_opDropObj.seize(dropObjPtr));
+
+ const Uint32 key = ++c_opRecordSequence;
+ dropObjPtr.p->key = key;
+ c_opDropObj.add(dropObjPtr);
+ dropObjPtr.p->m_errorCode = 0;
+ dropObjPtr.p->m_senderRef = reference();
+ dropObjPtr.p->m_senderData = tableId;
+ dropObjPtr.p->m_clientRef = reference();
+ dropObjPtr.p->m_clientData = tableId;
+
+ dropObjPtr.p->m_obj_id = tableId;
+ dropObjPtr.p->m_obj_type = entry->m_tableType;
+ dropObjPtr.p->m_obj_version = entry->m_tableVersion;
+
+ dropObjPtr.p->m_callback.m_callbackData = key;
+ dropObjPtr.p->m_callback.m_callbackFunction=
+ safe_cast(&Dbdict::restartDropObj_prepare_start_done);
+
+ ndbout_c("Dropping %d %d", tableId, entry->m_tableType);
+ switch(entry->m_tableType){
+ case DictTabInfo::Tablespace:
+ case DictTabInfo::LogfileGroup:{
+ jam();
+ Ptr<Filegroup> fg_ptr;
+ ndbrequire(c_filegroup_hash.find(fg_ptr, tableId));
+ dropObjPtr.p->m_obj_ptr_i = fg_ptr.i;
+ dropObjPtr.p->m_vt_index = 3;
+ break;
+ }
+ case DictTabInfo::Datafile:{
+ jam();
+ Ptr<File> file_ptr;
+ dropObjPtr.p->m_vt_index = 2;
+ ndbrequire(c_file_hash.find(file_ptr, tableId));
+ dropObjPtr.p->m_obj_ptr_i = file_ptr.i;
+ break;
+ }
+ case DictTabInfo::Undofile:{
+ jam();
+ Ptr<File> file_ptr;
+ dropObjPtr.p->m_vt_index = 4;
+ ndbrequire(c_file_hash.find(file_ptr, tableId));
+ dropObjPtr.p->m_obj_ptr_i = file_ptr.i;
+
+ /**
+ * Undofiles are only removed from logfile groups file list
+ * as drop undofile is currently not supported...
+ * file will be dropped by lgman when dropping filegroup
+ */
+ dropObjPtr.p->m_callback.m_callbackFunction=
+ safe_cast(&Dbdict::restartDropObj_commit_complete_done);
+
+ if (f_dict_op[dropObjPtr.p->m_vt_index].m_commit_complete)
+ (this->*f_dict_op[dropObjPtr.p->m_vt_index].m_commit_complete)
+ (signal, dropObjPtr.p);
+ else
+ execute(signal, dropObjPtr.p->m_callback, 0);
+ return;
+ }
+ default:
+ jamLine(entry->m_tableType);
+ ndbrequire(false);
+ }
+
+ if (f_dict_op[dropObjPtr.p->m_vt_index].m_prepare_start)
+ (this->*f_dict_op[dropObjPtr.p->m_vt_index].m_prepare_start)
+ (signal, dropObjPtr.p);
+ else
+ execute(signal, dropObjPtr.p->m_callback, 0);
+}
+
+void
+Dbdict::restartDropObj_prepare_start_done(Signal* signal,
+ Uint32 callbackData,
+ Uint32 returnCode)
+{
+ jam();
+ ndbrequire(returnCode == 0);
+ DropObjRecordPtr dropObjPtr;
+ ndbrequire(c_opDropObj.find(dropObjPtr, callbackData));
+ ndbrequire(dropObjPtr.p->m_errorCode == 0);
+
+ dropObjPtr.p->m_callback.m_callbackFunction =
+ safe_cast(&Dbdict::restartDropObj_prepare_complete_done);
+
+ if (f_dict_op[dropObjPtr.p->m_vt_index].m_prepare_complete)
+ (this->*f_dict_op[dropObjPtr.p->m_vt_index].m_prepare_complete)
+ (signal, dropObjPtr.p);
+ else
+ execute(signal, dropObjPtr.p->m_callback, 0);
+}
+
+void
+Dbdict::restartDropObj_prepare_complete_done(Signal* signal,
+ Uint32 callbackData,
+ Uint32 returnCode)
+{
+ jam();
+ ndbrequire(returnCode == 0);
+ DropObjRecordPtr dropObjPtr;
+ ndbrequire(c_opDropObj.find(dropObjPtr, callbackData));
+ ndbrequire(dropObjPtr.p->m_errorCode == 0);
+
+ dropObjPtr.p->m_callback.m_callbackFunction =
+ safe_cast(&Dbdict::restartDropObj_commit_start_done);
+
+ if (f_dict_op[dropObjPtr.p->m_vt_index].m_commit_start)
+ (this->*f_dict_op[dropObjPtr.p->m_vt_index].m_commit_start)
+ (signal, dropObjPtr.p);
+ else
+ execute(signal, dropObjPtr.p->m_callback, 0);
+}
+
+void
+Dbdict::restartDropObj_commit_start_done(Signal* signal,
+ Uint32 callbackData,
+ Uint32 returnCode)
+{
+ jam();
+ ndbrequire(returnCode == 0);
+ DropObjRecordPtr dropObjPtr;
+ ndbrequire(c_opDropObj.find(dropObjPtr, callbackData));
+ ndbrequire(dropObjPtr.p->m_errorCode == 0);
+
+ dropObjPtr.p->m_callback.m_callbackFunction =
+ safe_cast(&Dbdict::restartDropObj_commit_complete_done);
+
+ if (f_dict_op[dropObjPtr.p->m_vt_index].m_commit_complete)
+ (this->*f_dict_op[dropObjPtr.p->m_vt_index].m_commit_complete)
+ (signal, dropObjPtr.p);
+ else
+ execute(signal, dropObjPtr.p->m_callback, 0);
+}
+
+
+void
+Dbdict::restartDropObj_commit_complete_done(Signal* signal,
+ Uint32 callbackData,
+ Uint32 returnCode)
+{
+ jam();
+ ndbrequire(returnCode == 0);
+ DropObjRecordPtr dropObjPtr;
+ ndbrequire(c_opDropObj.find(dropObjPtr, callbackData));
+ ndbrequire(dropObjPtr.p->m_errorCode == 0);
+
+ c_opDropObj.release(dropObjPtr);
+
+ c_restartRecord.activeTable++;
+ checkSchemaStatus(signal);
+}
+
/* **************************************************************** */
/* ---------------------------------------------------------------- */
/* MODULE: NODE FAILURE HANDLING ------------------------- */
@@ -16234,6 +16399,22 @@
c_file_pool.getPtr(f_ptr, op->m_obj_ptr_i);
ndbrequire(c_filegroup_hash.find(fg_ptr, f_ptr.p->m_filegroup_id));
decrease_ref_count(fg_ptr.p->m_obj_ptr_i);
+ release_object(f_ptr.p->m_obj_ptr_i);
+ c_file_hash.release(f_ptr);
+ execute(signal, op->m_callback, 0);
+}
+
+void
+Dbdict::drop_undofile_commit_complete(Signal* signal, SchemaOp* op)
+{
+ FilePtr f_ptr;
+ FilegroupPtr fg_ptr;
+
+ jam();
+ c_file_pool.getPtr(f_ptr, op->m_obj_ptr_i);
+ ndbrequire(c_filegroup_hash.find(fg_ptr, f_ptr.p->m_filegroup_id));
+ Local_file_list list(c_file_pool, fg_ptr.p->m_logfilegroup.m_files);
+ list.remove(f_ptr);
release_object(f_ptr.p->m_obj_ptr_i);
c_file_hash.release(f_ptr);
execute(signal, op->m_callback, 0);
--- 1.54/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2007-05-15 09:08:22 +02:00
+++ 1.55/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2007-05-15 09:08:22 +02:00
@@ -2565,6 +2565,12 @@
const SchemaFile::TableEntry *,
const SchemaFile::TableEntry *);
void restartDropTab_complete(Signal*, Uint32 callback, Uint32);
+
+ void restartDropObj(Signal*, Uint32, const SchemaFile::TableEntry *);
+ void restartDropObj_prepare_start_done(Signal*, Uint32, Uint32);
+ void restartDropObj_prepare_complete_done(Signal*, Uint32, Uint32);
+ void restartDropObj_commit_start_done(Signal*, Uint32, Uint32);
+ void restartDropObj_commit_complete_done(Signal*, Uint32, Uint32);
void restart_checkSchemaStatusComplete(Signal*, Uint32 callback, Uint32);
void restart_writeSchemaConf(Signal*, Uint32 callbackData, Uint32);
@@ -2657,7 +2663,8 @@
void send_drop_fg(Signal*, SchemaOp*, DropFilegroupImplReq::RequestInfo);
void drop_undofile_prepare_start(Signal* signal, SchemaOp*);
-
+ void drop_undofile_commit_complete(Signal* signal, SchemaOp*);
+
int checkSingleUserMode(Uint32 senderRef);
};
--- 1.36/storage/ndb/test/ndbapi/testDict.cpp 2007-05-15 09:08:22 +02:00
+++ 1.37/storage/ndb/test/ndbapi/testDict.cpp 2007-05-15 09:08:22 +02:00
@@ -2204,6 +2204,159 @@
return NDBT_OK;
}
+static
+int
+create_tablespace(NdbDictionary::Dictionary* pDict,
+ const char * lgname,
+ const char * tsname,
+ const char * dfname)
+{
+ 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 << "Failed to create datafile:"
+ << endl << pDict->getNdbError() << endl;
+ return NDBT_FAILED;
+ }
+ return 0;
+}
+
+int
+runBug24631(NDBT_Context* ctx, NDBT_Step* step)
+{
+ char tsname[256];
+ char dfname[256];
+ char lgname[256];
+ char ufname[256];
+ NdbRestarter res;
+
+ if (res.getNumDbNodes() < 2)
+ return NDBT_OK;
+
+ Ndb* pNdb = GETNDB(step);
+ NdbDictionary::Dictionary* pDict = pNdb->getDictionary();
+
+ NdbDictionary::Dictionary::List list;
+ if (pDict->listObjects(list) == -1)
+ return NDBT_FAILED;
+
+ 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;
+ }
+
+ 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 << "Failed to create undofile:"
+ << endl << pDict->getNdbError() << endl;
+ return NDBT_FAILED;
+ }
+ }
+ else
+ {
+ BaseString::snprintf(lgname, sizeof(lgname), "%s", lgfound);
+ }
+
+ BaseString::snprintf(tsname, sizeof(tsname), "TS-%u", rand());
+ BaseString::snprintf(dfname, sizeof(dfname), "%s-%u.dat", tsname, rand());
+
+ if (create_tablespace(pDict, lgname, tsname, dfname))
+ return NDBT_FAILED;
+
+
+ int node = res.getRandomNotMasterNodeId(rand());
+ res.restartOneDbNode(node, false, true, true);
+ NdbSleep_SecSleep(3);
+
+ if (pDict->dropDatafile(pDict->getDatafile(0, dfname)) != 0)
+ {
+ g_err << "Failed to drop datafile: " << pDict->getNdbError() <<
endl;
+ return NDBT_FAILED;
+ }
+
+ if (pDict->dropTablespace(pDict->getTablespace(tsname)) != 0)
+ {
+ g_err << "Failed to drop tablespace: " << pDict->getNdbError()
<< endl;
+ return NDBT_FAILED;
+ }
+
+ if (res.waitNodesNoStart(&node, 1))
+ return NDBT_FAILED;
+
+ res.startNodes(&node, 1);
+ if (res.waitClusterStarted())
+ return NDBT_FAILED;
+
+ if (create_tablespace(pDict, lgname, tsname, dfname))
+ return NDBT_FAILED;
+
+ if (pDict->dropDatafile(pDict->getDatafile(0, dfname)) != 0)
+ {
+ g_err << "Failed to drop datafile: " << pDict->getNdbError() <<
endl;
+ return NDBT_FAILED;
+ }
+
+ 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
@@ -2706,6 +2859,10 @@
TESTCASE("DictRestart",
""){
INITIALIZER(runDictRestart);
+}
+TESTCASE("Bug24631",
+ ""){
+ INITIALIZER(runBug24631);
}
NDBT_TESTSUITE_END(testDict);
| Thread |
|---|
| • bk commit into 5.1 tree (jonas:1.2517) BUG#24631 | jonas | 15 May |