Below is the list of changes that have just been committed into a local
5.0 repository of pekka. When pekka 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, 2006-08-18 09:56:52+02:00, pekka@stripped +8 -0
ndb - bug#18781 bug#21017 bug#21050 : block index ops during NR + fix asserts
ndb/include/kernel/signaldata/CreateIndx.hpp@stripped, 2006-08-18 09:44:34+02:00,
pekka@stripped +1 -0
add 711
ndb/include/kernel/signaldata/DropIndx.hpp@stripped, 2006-08-18 09:44:34+02:00,
pekka@stripped +1 -0
add 711
ndb/src/kernel/blocks/dbdict/Dbdict.cpp@stripped, 2006-08-18 09:47:24+02:00,
pekka@stripped +36 -8
block index create/drop during NR.
fix 2 ndbrequires by checking exact schema op types
ndb/src/kernel/blocks/dbdict/Dbdict.hpp@stripped, 2006-08-18 09:47:25+02:00,
pekka@stripped +3 -0
block index create/drop during NR.
fix 2 ndbrequires by checking exact schema op types
ndb/src/kernel/vm/DLHashTable2.hpp@stripped, 2006-08-18 09:36:14+02:00,
pekka@stripped +2 -0
add isEmpty for use in DICT
ndb/test/include/NDBT_Tables.hpp@stripped, 2006-08-18 09:39:06+02:00,
pekka@stripped +2 -0
getIndexes - return index cols of standard test table
ndb/test/ndbapi/testDict.cpp@stripped, 2006-08-18 09:43:58+02:00, pekka@stripped
+75 -3
bug#21017: index create/drop during NR
ndb/test/src/NDBT_Tables.cpp@stripped, 2006-08-18 09:39:06+02:00, pekka@stripped
+11 -0
getIndexes - return index cols of standard test table
# 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: pekka
# Host: orca.ndb.mysql.com
# Root: /export/home/space/pekka/ndb/version/my50-bug21017
--- 1.6/ndb/include/kernel/signaldata/CreateIndx.hpp 2006-08-18 09:57:09 +02:00
+++ 1.7/ndb/include/kernel/signaldata/CreateIndx.hpp 2006-08-18 09:57:09 +02:00
@@ -192,6 +192,7 @@
enum ErrorCode {
NoError = 0,
Busy = 701,
+ BusyWithNR = 711,
NotMaster = 702,
TriggerNotFound = 4238,
TriggerExists = 4239,
--- 1.3/ndb/include/kernel/signaldata/DropIndx.hpp 2006-08-18 09:57:09 +02:00
+++ 1.4/ndb/include/kernel/signaldata/DropIndx.hpp 2006-08-18 09:57:09 +02:00
@@ -168,6 +168,7 @@
NoError = 0,
InvalidIndexVersion = 241,
Busy = 701,
+ BusyWithNR = 711,
NotMaster = 702,
IndexNotFound = 4243,
BadRequestType = 4247,
--- 1.67/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2006-08-18 09:57:09 +02:00
+++ 1.68/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2006-08-18 09:57:09 +02:00
@@ -6520,9 +6520,18 @@
}
if (signal->getLength() == CreateIndxReq::SignalLength) {
jam();
+ CreateIndxRef::ErrorCode tmperr = CreateIndxRef::NoError;
if (getOwnNodeId() != c_masterNodeId) {
jam();
-
+ tmperr = CreateIndxRef::NotMaster;
+ } else if (c_blockState == BS_NODE_RESTART) {
+ jam();
+ tmperr = CreateIndxRef::BusyWithNR;
+ } else if (c_blockState != BS_IDLE) {
+ jam();
+ tmperr = CreateIndxRef::Busy;
+ }
+ if (tmperr != CreateIndxRef::NoError) {
releaseSections(signal);
OpCreateIndex opBusy;
opPtr.p = &opBusy;
@@ -6530,13 +6539,12 @@
opPtr.p->m_isMaster = (senderRef == reference());
opPtr.p->key = 0;
opPtr.p->m_requestType = CreateIndxReq::RT_DICT_PREPARE;
- opPtr.p->m_errorCode = CreateIndxRef::NotMaster;
+ opPtr.p->m_errorCode = tmperr;
opPtr.p->m_errorLine = __LINE__;
opPtr.p->m_errorNode = c_masterNodeId;
createIndex_sendReply(signal, opPtr, true);
return;
}
-
// forward initial request plus operation key to all
req->setOpKey(++c_opRecordSequence);
NodeReceiverGroup rg(DBDICT, c_aliveNodes);
@@ -7082,10 +7090,19 @@
jam();
if (signal->getLength() == DropIndxReq::SignalLength) {
jam();
+ DropIndxRef::ErrorCode tmperr = DropIndxRef::NoError;
if (getOwnNodeId() != c_masterNodeId) {
jam();
-
- err = DropIndxRef::NotMaster;
+ tmperr = DropIndxRef::NotMaster;
+ } else if (c_blockState == BS_NODE_RESTART) {
+ jam();
+ tmperr = DropIndxRef::BusyWithNR;
+ } else if (c_blockState != BS_IDLE) {
+ jam();
+ tmperr = DropIndxRef::Busy;
+ }
+ if (tmperr != DropIndxRef::NoError) {
+ err = tmperr;
goto error;
}
// forward initial request plus operation key to all
@@ -10130,6 +10147,17 @@
sendDictLockInfoEvent(lockPtr, "lock request by node");
}
+// only table and index ops are checked
+bool
+Dbdict::hasDictLockSchemaOp()
+{
+ return
+ ! c_opCreateTable.isEmpty() ||
+ ! c_opDropTable.isEmpty() ||
+ ! c_opCreateIndex.isEmpty() ||
+ ! c_opDropIndex.isEmpty();
+}
+
void
Dbdict::checkDictLockQueue(Signal* signal, bool poll)
{
@@ -10150,7 +10178,7 @@
break;
}
- if (c_opRecordPool.getNoOfFree() != c_opRecordPool.getSize()) {
+ if (hasDictLockSchemaOp()) {
jam();
break;
}
@@ -10183,7 +10211,7 @@
if (lockPtr.p->locked) {
jam();
ndbrequire(c_blockState == lockPtr.p->lt->blockState);
- ndbrequire(c_opRecordPool.getNoOfFree() == c_opRecordPool.getSize());
+ ndbrequire(! hasDictLockSchemaOp());
ndbrequire(! c_dictLockQueue.hasPrev(lockPtr));
c_blockState = BS_IDLE;
@@ -10279,7 +10307,7 @@
if (lockPtr.p->locked) {
jam();
ndbrequire(c_blockState == lockPtr.p->lt->blockState);
- ndbrequire(c_opRecordPool.getNoOfFree() == c_opRecordPool.getSize());
+ ndbrequire(! hasDictLockSchemaOp());
ndbrequire(! c_dictLockQueue.hasPrev(lockPtr));
c_blockState = BS_IDLE;
--- 1.23/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2006-08-18 09:57:09 +02:00
+++ 1.24/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2006-08-18 09:57:09 +02:00
@@ -1650,6 +1650,9 @@
void sendDictLockInfoEvent(Uint32 pollCount);
void sendDictLockInfoEvent(DictLockPtr lockPtr, const char* text);
+ // check if any schema op exists (conflicting with dict lock)
+ bool hasDictLockSchemaOp();
+
void checkDictLockQueue(Signal* signal, bool poll);
void sendDictLockConf(Signal* signal, DictLockPtr lockPtr);
void sendDictLockRef(Signal* signal, DictLockReq req, Uint32 errorCode);
--- 1.3/ndb/src/kernel/vm/DLHashTable2.hpp 2006-08-18 09:57:09 +02:00
+++ 1.4/ndb/src/kernel/vm/DLHashTable2.hpp 2006-08-18 09:57:09 +02:00
@@ -147,6 +147,8 @@
* @param iter - An "uninitialized" iterator
*/
bool next(Uint32 bucket, Iterator & iter) const;
+
+ inline bool isEmpty() const { Iterator iter; return ! first(iter); }
private:
Uint32 mask;
--- 1.3/ndb/test/include/NDBT_Tables.hpp 2006-08-18 09:57:09 +02:00
+++ 1.4/ndb/test/include/NDBT_Tables.hpp 2006-08-18 09:57:09 +02:00
@@ -42,6 +42,8 @@
static const NdbDictionary::Table* getTable(int _num);
static int getNumTables();
+ static const char** getIndexes(const char* table);
+
private:
static const NdbDictionary::Table* tableWithPkSize(const char* _nam, Uint32 pkSize);
};
--- 1.26/ndb/test/ndbapi/testDict.cpp 2006-08-18 09:57:09 +02:00
+++ 1.27/ndb/test/ndbapi/testDict.cpp 2006-08-18 09:57:09 +02:00
@@ -1022,8 +1022,8 @@
if (!pTab->equal(*pTab2)){
g_err << "equal failed" << endl;
- g_info << *pTab;
- g_info << *pTab2;
+ g_info << *(NDBT_Table*)pTab; // gcc-4.1.2
+ g_info << *(NDBT_Table*)pTab2;
return NDBT_FAILED;
}
return NDBT_OK;
@@ -1033,7 +1033,7 @@
Ndb* pNdb = GETNDB(step);
const NdbDictionary::Table* pTab = ctx->getTab();
ndbout << "|- " << pTab->getName() << endl;
- g_info << *pTab;
+ g_info << *(NDBT_Table*)pTab;
// Try to create table in db
if (pTab->createTableInDb(pNdb) != 0){
return NDBT_FAILED;
@@ -1890,6 +1890,52 @@
// replace by the Retrieved table
pTab = pTab2;
+ // create indexes
+ const char** indlist = NDBT_Tables::getIndexes(tabName);
+ uint indnum = 0;
+ while (*indlist != 0) {
+ uint count = 0;
+ try_create_index:
+ count++;
+ if (count == 1)
+ g_info << "2: create index " << indnum << " " << *indlist
<< endl;
+ NdbDictionary::Index ind;
+ char indName[200];
+ sprintf(indName, "%s_X%u", tabName, indnum);
+ ind.setName(indName);
+ ind.setTable(tabName);
+ if (strcmp(*indlist, "UNIQUE") == 0) {
+ ind.setType(NdbDictionary::Index::UniqueHashIndex);
+ ind.setLogging(pTab->getLogging());
+ } else if (strcmp(*indlist, "ORDERED") == 0) {
+ ind.setType(NdbDictionary::Index::OrderedIndex);
+ ind.setLogging(false);
+ } else {
+ assert(false);
+ }
+ const char** indtemp = indlist;
+ while (*++indtemp != 0) {
+ ind.addColumn(*indtemp);
+ }
+ if (pDic->createIndex(ind) != 0) {
+ const NdbError err = pDic->getNdbError();
+ if (count == 1)
+ g_err << "2: " << indName << ": create failed: " << err
<< endl;
+ if (err.code != 711) {
+ result = NDBT_FAILED;
+ break;
+ }
+ NdbSleep_MilliSleep(myRandom48(maxsleep));
+ goto try_create_index;
+ }
+ indlist = ++indtemp;
+ indnum++;
+ }
+ if (result == NDBT_FAILED)
+ break;
+
+ uint indcount = indnum;
+
int records = myRandom48(ctx->getNumRecords());
g_info << "2: load " << records << " records" << endl;
HugoTransactions hugoTrans(*pTab);
@@ -1900,6 +1946,32 @@
break;
}
NdbSleep_MilliSleep(myRandom48(maxsleep));
+
+ // drop indexes
+ indnum = 0;
+ while (indnum < indcount) {
+ uint count = 0;
+ try_drop_index:
+ count++;
+ if (count == 1)
+ g_info << "2: drop index " << indnum << endl;
+ char indName[200];
+ sprintf(indName, "%s_X%u", tabName, indnum);
+ if (pDic->dropIndex(indName, tabName) != 0) {
+ const NdbError err = pDic->getNdbError();
+ if (count == 1)
+ g_err << "2: " << indName << ": drop failed: " << err
<< endl;
+ if (err.code != 711) {
+ result = NDBT_FAILED;
+ break;
+ }
+ NdbSleep_MilliSleep(myRandom48(maxsleep));
+ goto try_drop_index;
+ }
+ indnum++;
+ }
+ if (result == NDBT_FAILED)
+ break;
g_info << "2: drop" << endl;
{
--- 1.14/ndb/test/src/NDBT_Tables.cpp 2006-08-18 09:57:09 +02:00
+++ 1.15/ndb/test/src/NDBT_Tables.cpp 2006-08-18 09:57:09 +02:00
@@ -799,6 +799,17 @@
return numTestTables;
}
+const char**
+NDBT_Tables::getIndexes(const char* table)
+{
+ Uint32 i = 0;
+ for (i = 0; indexes[i].m_table != 0; i++) {
+ if (strcmp(indexes[i].m_table, table) == 0)
+ return indexes[i].m_indexes;
+ }
+ return 0;
+}
+
int
NDBT_Tables::createAllTables(Ndb* pNdb, bool _temp, bool existsOk){
| Thread |
|---|
| • bk commit into 5.0 tree (pekka:1.2245) BUG#21050 | pekka | 18 Aug |