Commit 854ff21d authored by unknown's avatar unknown
Browse files

ndb - bug with index build of unique index with 32 attributes

     since NDB$FRAGMENT is automatically added, there was a over run in the struct


storage/ndb/include/kernel/AttributeList.hpp:
  Fix unique index with 32 attributes
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  Fix unique index with 32 attributes
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
  Fix unique index with 32 attributes
parent 3d7e31f9
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -26,9 +26,13 @@

typedef Bitmask<MAXNROFATTRIBUTESINWORDS> AttributeMask;

struct AttributeList {
template <Uint32 SZ>
struct Id_array
{
  Uint32 sz;
  Uint32 id[MAX_ATTRIBUTES_IN_INDEX];
  Uint32 id[SZ];
};

typedef Id_array<MAX_ATTRIBUTES_IN_INDEX> AttributeList;

#endif
+3 −1
Original line number Diff line number Diff line
@@ -12128,7 +12128,8 @@ Dbdict::alterTrigger_sendReply(Signal* signal, OpAlterTriggerPtr opPtr,
*/

void
Dbdict::getTableKeyList(TableRecordPtr tablePtr, AttributeList& list)
Dbdict::getTableKeyList(TableRecordPtr tablePtr, 
			Id_array<MAX_ATTRIBUTES_IN_INDEX+1>& list)
{
  jam();
  list.sz = 0;
@@ -12139,6 +12140,7 @@ Dbdict::getTableKeyList(TableRecordPtr tablePtr, AttributeList& list)
      list.id[list.sz++] = aRec->attributeId;
    tAttr = aRec->nextAttrInTable;
  }
  ndbrequire(list.sz <= MAX_ATTRIBUTES_IN_INDEX + 1);
}

// XXX should store the primary attribute id
+3 −2
Original line number Diff line number Diff line
@@ -1263,7 +1263,7 @@ private:
    // original request plus buffer for attribute lists
    BuildIndxReq m_request;
    AttributeList m_attrList;
    AttributeList m_tableKeyList;
    Id_array<MAX_ATTRIBUTES_IN_INDEX+1> m_tableKeyList;
    // coordinator DICT
    Uint32 m_coordinatorRef;
    bool m_isMaster;
@@ -2048,7 +2048,8 @@ private:
  void alterTrigger_sendSlaveReq(Signal* signal, OpAlterTriggerPtr opPtr);
  void alterTrigger_sendReply(Signal* signal, OpAlterTriggerPtr opPtr, bool);
  // support
  void getTableKeyList(TableRecordPtr tablePtr, AttributeList& list);
  void getTableKeyList(TableRecordPtr, 
		       Id_array<MAX_ATTRIBUTES_IN_INDEX+1>& list);
  void getIndexAttr(TableRecordPtr indexPtr, Uint32 itAttr, Uint32* id);
  void getIndexAttrList(TableRecordPtr indexPtr, AttributeList& list);
  void getIndexAttrMask(TableRecordPtr indexPtr, AttributeMask& mask);