Commit 854ff21d authored by unknown's avatar unknown

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
...@@ -26,9 +26,13 @@ ...@@ -26,9 +26,13 @@
typedef Bitmask<MAXNROFATTRIBUTESINWORDS> AttributeMask; typedef Bitmask<MAXNROFATTRIBUTESINWORDS> AttributeMask;
struct AttributeList { template <Uint32 SZ>
struct Id_array
{
Uint32 sz; Uint32 sz;
Uint32 id[MAX_ATTRIBUTES_IN_INDEX]; Uint32 id[SZ];
}; };
typedef Id_array<MAX_ATTRIBUTES_IN_INDEX> AttributeList;
#endif #endif
...@@ -12128,7 +12128,8 @@ Dbdict::alterTrigger_sendReply(Signal* signal, OpAlterTriggerPtr opPtr, ...@@ -12128,7 +12128,8 @@ Dbdict::alterTrigger_sendReply(Signal* signal, OpAlterTriggerPtr opPtr,
*/ */
void void
Dbdict::getTableKeyList(TableRecordPtr tablePtr, AttributeList& list) Dbdict::getTableKeyList(TableRecordPtr tablePtr,
Id_array<MAX_ATTRIBUTES_IN_INDEX+1>& list)
{ {
jam(); jam();
list.sz = 0; list.sz = 0;
...@@ -12139,6 +12140,7 @@ Dbdict::getTableKeyList(TableRecordPtr tablePtr, AttributeList& list) ...@@ -12139,6 +12140,7 @@ Dbdict::getTableKeyList(TableRecordPtr tablePtr, AttributeList& list)
list.id[list.sz++] = aRec->attributeId; list.id[list.sz++] = aRec->attributeId;
tAttr = aRec->nextAttrInTable; tAttr = aRec->nextAttrInTable;
} }
ndbrequire(list.sz <= MAX_ATTRIBUTES_IN_INDEX + 1);
} }
// XXX should store the primary attribute id // XXX should store the primary attribute id
......
...@@ -1263,7 +1263,7 @@ private: ...@@ -1263,7 +1263,7 @@ private:
// original request plus buffer for attribute lists // original request plus buffer for attribute lists
BuildIndxReq m_request; BuildIndxReq m_request;
AttributeList m_attrList; AttributeList m_attrList;
AttributeList m_tableKeyList; Id_array<MAX_ATTRIBUTES_IN_INDEX+1> m_tableKeyList;
// coordinator DICT // coordinator DICT
Uint32 m_coordinatorRef; Uint32 m_coordinatorRef;
bool m_isMaster; bool m_isMaster;
...@@ -2048,7 +2048,8 @@ private: ...@@ -2048,7 +2048,8 @@ private:
void alterTrigger_sendSlaveReq(Signal* signal, OpAlterTriggerPtr opPtr); void alterTrigger_sendSlaveReq(Signal* signal, OpAlterTriggerPtr opPtr);
void alterTrigger_sendReply(Signal* signal, OpAlterTriggerPtr opPtr, bool); void alterTrigger_sendReply(Signal* signal, OpAlterTriggerPtr opPtr, bool);
// support // 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 getIndexAttr(TableRecordPtr indexPtr, Uint32 itAttr, Uint32* id);
void getIndexAttrList(TableRecordPtr indexPtr, AttributeList& list); void getIndexAttrList(TableRecordPtr indexPtr, AttributeList& list);
void getIndexAttrMask(TableRecordPtr indexPtr, AttributeMask& mask); void getIndexAttrMask(TableRecordPtr indexPtr, AttributeMask& mask);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment