Commit 9c60927d authored by unknown's avatar unknown
Browse files

Merge orca.ndb.mysql.com:/export/home/space/pekka/ndb/version/my50-bug21017

into  orca.ndb.mysql.com:/export/home/space/pekka/ndb/version/my51-bug21017


storage/ndb/include/kernel/signaldata/CreateIndx.hpp:
  SCCS merged
storage/ndb/include/kernel/signaldata/DropIndx.hpp:
  SCCS merged
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  SCCS merged
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
  SCCS merged
storage/ndb/src/kernel/vm/DLHashTable2.hpp:
  SCCS merged
storage/ndb/test/include/NDBT_Tables.hpp:
  SCCS merged
storage/ndb/test/ndbapi/testDict.cpp:
  manual
storage/ndb/test/src/NDBT_Tables.cpp:
  SCCS merged
parents 1b6858ea 74aca9aa
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -192,6 +192,7 @@ public:
  enum ErrorCode {
    NoError = 0,
    Busy = 701,
    BusyWithNR = 711,
    NotMaster = 702,
    IndexOnDiskAttributeError = 756,
    TriggerNotFound = 4238,
+1 −0
Original line number Diff line number Diff line
@@ -168,6 +168,7 @@ public:
    NoError = 0,
    InvalidIndexVersion = 241,
    Busy = 701,
    BusyWithNR = 711,
    NotMaster = 702,
    IndexNotFound = 4243,
    BadRequestType = 4247,
+36 −8
Original line number Diff line number Diff line
@@ -7584,9 +7584,18 @@ Dbdict::execCREATE_INDX_REQ(Signal* signal)
    }
    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;
@@ -7594,13 +7603,12 @@ Dbdict::execCREATE_INDX_REQ(Signal* signal)
	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);
@@ -8185,10 +8193,19 @@ Dbdict::execDROP_INDX_REQ(Signal* signal)
    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
@@ -13491,6 +13508,17 @@ Dbdict::execDICT_LOCK_REQ(Signal* signal)
    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)
{
@@ -13511,7 +13539,7 @@ Dbdict::checkDictLockQueue(Signal* signal, bool poll)
      break;
    }

    if (c_opRecordPool.getNoOfFree() != c_opRecordPool.getSize()) {
    if (hasDictLockSchemaOp()) {
      jam();
      break;
    }
@@ -13544,7 +13572,7 @@ Dbdict::execDICT_UNLOCK_ORD(Signal* signal)
  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;
@@ -13640,7 +13668,7 @@ Dbdict::removeStaleDictLocks(Signal* signal, const Uint32* theFailedNodes)
      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;
+3 −0
Original line number Diff line number Diff line
@@ -2107,6 +2107,9 @@ private:
  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);
+2 −0
Original line number Diff line number Diff line
@@ -147,6 +147,8 @@ public:
   */
  bool next(Uint32 bucket, Iterator & iter) const;

  inline bool isEmpty() const { Iterator iter; return ! first(iter); }
  
private:
  Uint32 mask;
  Uint32 * hashValues;
Loading