Commit e5c17fb0 authored by tomas@poseidon.ndb.mysql.com's avatar tomas@poseidon.ndb.mysql.com

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb

into poseidon.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
parents 862e979e d19a42d8
...@@ -38,6 +38,8 @@ public: ...@@ -38,6 +38,8 @@ public:
STATIC_CONST( ROW_COUNT = 0xFFFD ); STATIC_CONST( ROW_COUNT = 0xFFFD );
STATIC_CONST( COMMIT_COUNT = 0xFFFC ); STATIC_CONST( COMMIT_COUNT = 0xFFFC );
STATIC_CONST( ROW_SIZE = 0xFFFA );
/** Initialize AttributeHeader at location aHeaderPtr */ /** Initialize AttributeHeader at location aHeaderPtr */
static AttributeHeader& init(void* aHeaderPtr, Uint32 anAttributeId, static AttributeHeader& init(void* aHeaderPtr, Uint32 anAttributeId,
Uint32 aDataSize); Uint32 aDataSize);
......
...@@ -388,6 +388,7 @@ public: ...@@ -388,6 +388,7 @@ public:
static const Column * FRAGMENT; static const Column * FRAGMENT;
static const Column * ROW_COUNT; static const Column * ROW_COUNT;
static const Column * COMMIT_COUNT; static const Column * COMMIT_COUNT;
static const Column * ROW_SIZE;
#endif #endif
private: private:
......
...@@ -814,7 +814,6 @@ inline void ...@@ -814,7 +814,6 @@ inline void
BitmaskImpl::getField(unsigned size, const Uint32 src[], BitmaskImpl::getField(unsigned size, const Uint32 src[],
unsigned pos, unsigned len, Uint32 dst[]) unsigned pos, unsigned len, Uint32 dst[])
{ {
assert(len > 0);
assert(pos + len < (size << 5)); assert(pos + len < (size << 5));
src += (pos >> 5); src += (pos >> 5);
...@@ -834,7 +833,6 @@ inline void ...@@ -834,7 +833,6 @@ inline void
BitmaskImpl::setField(unsigned size, Uint32 dst[], BitmaskImpl::setField(unsigned size, Uint32 dst[],
unsigned pos, unsigned len, const Uint32 src[]) unsigned pos, unsigned len, const Uint32 src[])
{ {
assert(len > 0);
assert(pos + len < (size << 5)); assert(pos + len < (size << 5));
dst += (pos >> 5); dst += (pos >> 5);
......
...@@ -344,6 +344,7 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* signal) ...@@ -344,6 +344,7 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* signal)
ljam(); ljam();
Uint32 bitCount = AttributeDescriptor::getArraySize(attrDescriptor); Uint32 bitCount = AttributeDescriptor::getArraySize(attrDescriptor);
fragOperPtr.p->currNullBit += bitCount; fragOperPtr.p->currNullBit += bitCount;
break;
} }
} }
default: default:
......
...@@ -1000,6 +1000,9 @@ Dbtup::read_psuedo(Uint32 attrId, Uint32* outBuffer){ ...@@ -1000,6 +1000,9 @@ Dbtup::read_psuedo(Uint32 attrId, Uint32* outBuffer){
case AttributeHeader::FRAGMENT: case AttributeHeader::FRAGMENT:
* outBuffer = operPtr.p->fragId >> 1; // remove "hash" bit * outBuffer = operPtr.p->fragId >> 1; // remove "hash" bit
return 1; return 1;
case AttributeHeader::ROW_SIZE:
* outBuffer = tabptr.p->tupheadsize << 2;
return 1;
case AttributeHeader::ROW_COUNT: case AttributeHeader::ROW_COUNT:
case AttributeHeader::COMMIT_COUNT: case AttributeHeader::COMMIT_COUNT:
signal->theData[0] = operPtr.p->userpointer; signal->theData[0] = operPtr.p->userpointer;
...@@ -1021,14 +1024,8 @@ Dbtup::readBitsNotNULL(Uint32* outBuffer, ...@@ -1021,14 +1024,8 @@ Dbtup::readBitsNotNULL(Uint32* outBuffer,
Uint32 attrDes2) Uint32 attrDes2)
{ {
Tablerec* const regTabPtr = tabptr.p; Tablerec* const regTabPtr = tabptr.p;
Uint32 pos = AttributeOffset::getNullFlagPos(attrDes2);
Uint32 bitCount = AttributeDescriptor::getArraySize(attrDescriptor); Uint32 bitCount = AttributeDescriptor::getArraySize(attrDescriptor);
Uint32 offsetInTuple = AttributeOffset::getNullFlagOffset(attrDes2);
Uint32 offsetInWord = AttributeOffset::getNullFlagBitOffset(attrDes2);
ndbrequire(offsetInTuple < regTabPtr->tupNullWords);
offsetInTuple += regTabPtr->tupNullIndex;
ndbrequire(offsetInTuple < tCheckOffset);
Uint32 pos = offsetInTuple << 5 + offsetInWord;
Uint32 indexBuf = tOutBufIndex; Uint32 indexBuf = tOutBufIndex;
Uint32 newIndexBuf = indexBuf + ((bitCount + 31) >> 5); Uint32 newIndexBuf = indexBuf + ((bitCount + 31) >> 5);
Uint32 maxRead = tMaxRead; Uint32 maxRead = tMaxRead;
...@@ -1059,17 +1056,12 @@ Dbtup::readBitsNULLable(Uint32* outBuffer, ...@@ -1059,17 +1056,12 @@ Dbtup::readBitsNULLable(Uint32* outBuffer,
Uint32 attrDes2) Uint32 attrDes2)
{ {
Tablerec* const regTabPtr = tabptr.p; Tablerec* const regTabPtr = tabptr.p;
Uint32 pos = AttributeOffset::getNullFlagPos(attrDes2);
Uint32 bitCount = AttributeDescriptor::getArraySize(attrDescriptor); Uint32 bitCount = AttributeDescriptor::getArraySize(attrDescriptor);
Uint32 offsetInTuple = AttributeOffset::getNullFlagOffset(attrDes2);
Uint32 offsetInWord = AttributeOffset::getNullFlagBitOffset(attrDes2);
ndbrequire(offsetInTuple < regTabPtr->tupNullWords);
offsetInTuple += regTabPtr->tupNullIndex;
ndbrequire(offsetInTuple < tCheckOffset);
Uint32 indexBuf = tOutBufIndex; Uint32 indexBuf = tOutBufIndex;
Uint32 newIndexBuf = indexBuf + (bitCount + 31) >> 5; Uint32 newIndexBuf = indexBuf + ((bitCount + 31) >> 5);
Uint32 maxRead = tMaxRead; Uint32 maxRead = tMaxRead;
Uint32 pos = offsetInWord << 5 + offsetInTuple;
if(BitmaskImpl::get(regTabPtr->tupNullWords, if(BitmaskImpl::get(regTabPtr->tupNullWords,
tTupleHeader+regTabPtr->tupNullIndex, tTupleHeader+regTabPtr->tupNullIndex,
...@@ -1108,15 +1100,9 @@ Dbtup::updateBitsNotNULL(Uint32* inBuffer, ...@@ -1108,15 +1100,9 @@ Dbtup::updateBitsNotNULL(Uint32* inBuffer,
Uint32 inBufLen = tInBufLen; Uint32 inBufLen = tInBufLen;
AttributeHeader ahIn(inBuffer[indexBuf]); AttributeHeader ahIn(inBuffer[indexBuf]);
Uint32 nullIndicator = ahIn.isNULL(); Uint32 nullIndicator = ahIn.isNULL();
Uint32 pos = AttributeOffset::getNullFlagPos(attrDes2);
Uint32 bitCount = AttributeDescriptor::getArraySize(attrDescriptor); Uint32 bitCount = AttributeDescriptor::getArraySize(attrDescriptor);
Uint32 newIndex = indexBuf + 1 + ((bitCount + 31) >> 5); Uint32 newIndex = indexBuf + 1 + ((bitCount + 31) >> 5);
Uint32 nullFlagOffset = AttributeOffset::getNullFlagOffset(attrDes2);
Uint32 nullFlagBitOffset = AttributeOffset::getNullFlagBitOffset(attrDes2);
Uint32 nullWordOffset = nullFlagOffset + regTabPtr->tupNullIndex;
ndbrequire((nullFlagOffset < regTabPtr->tupNullWords) &&
(nullWordOffset < tCheckOffset));
Uint32 nullBits = tTupleHeader[nullWordOffset];
Uint32 pos = (nullFlagOffset << 5) + nullFlagBitOffset;
if (newIndex <= inBufLen) { if (newIndex <= inBufLen) {
if (!nullIndicator) { if (!nullIndicator) {
...@@ -1149,14 +1135,8 @@ Dbtup::updateBitsNULLable(Uint32* inBuffer, ...@@ -1149,14 +1135,8 @@ Dbtup::updateBitsNULLable(Uint32* inBuffer,
AttributeHeader ahIn(inBuffer[tInBufIndex]); AttributeHeader ahIn(inBuffer[tInBufIndex]);
Uint32 indexBuf = tInBufIndex; Uint32 indexBuf = tInBufIndex;
Uint32 nullIndicator = ahIn.isNULL(); Uint32 nullIndicator = ahIn.isNULL();
Uint32 nullFlagOffset = AttributeOffset::getNullFlagOffset(attrDes2); Uint32 pos = AttributeOffset::getNullFlagPos(attrDes2);
Uint32 nullFlagBitOffset = AttributeOffset::getNullFlagBitOffset(attrDes2);
Uint32 nullWordOffset = nullFlagOffset + regTabPtr->tupNullIndex;
ndbrequire((nullFlagOffset < regTabPtr->tupNullWords) &&
(nullWordOffset < tCheckOffset));
Uint32 nullBits = tTupleHeader[nullWordOffset];
Uint32 bitCount = AttributeDescriptor::getArraySize(attrDescriptor); Uint32 bitCount = AttributeDescriptor::getArraySize(attrDescriptor);
Uint32 pos = (nullFlagOffset << 5) + nullFlagBitOffset;
if (!nullIndicator) { if (!nullIndicator) {
BitmaskImpl::clear(regTabPtr->tupNullWords, BitmaskImpl::clear(regTabPtr->tupNullWords,
......
...@@ -922,6 +922,9 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col) ...@@ -922,6 +922,9 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col)
case NdbDictionary::Column::Undefined: case NdbDictionary::Column::Undefined:
out << "Undefined"; out << "Undefined";
break; break;
case NdbDictionary::Column::Bit:
out << "Bit(" << col.getLength() << ")";
break;
default: default:
out << "Type" << (Uint32)col.getType(); out << "Type" << (Uint32)col.getType();
break; break;
...@@ -942,4 +945,4 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col) ...@@ -942,4 +945,4 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col)
const NdbDictionary::Column * NdbDictionary::Column::FRAGMENT = 0; const NdbDictionary::Column * NdbDictionary::Column::FRAGMENT = 0;
const NdbDictionary::Column * NdbDictionary::Column::ROW_COUNT = 0; const NdbDictionary::Column * NdbDictionary::Column::ROW_COUNT = 0;
const NdbDictionary::Column * NdbDictionary::Column::COMMIT_COUNT = 0; const NdbDictionary::Column * NdbDictionary::Column::COMMIT_COUNT = 0;
const NdbDictionary::Column * NdbDictionary::Column::ROW_SIZE = 0;
...@@ -218,6 +218,11 @@ NdbColumnImpl::create_psuedo(const char * name){ ...@@ -218,6 +218,11 @@ NdbColumnImpl::create_psuedo(const char * name){
col->m_impl.m_attrId = AttributeHeader::COMMIT_COUNT; col->m_impl.m_attrId = AttributeHeader::COMMIT_COUNT;
col->m_impl.m_attrSize = 8; col->m_impl.m_attrSize = 8;
col->m_impl.m_arraySize = 1; col->m_impl.m_arraySize = 1;
} else if(!strcmp(name, "NDB$ROW_SIZE")){
col->setType(NdbDictionary::Column::Unsigned);
col->m_impl.m_attrId = AttributeHeader::ROW_SIZE;
col->m_impl.m_attrSize = 4;
col->m_impl.m_arraySize = 1;
} else { } else {
abort(); abort();
} }
...@@ -1157,6 +1162,7 @@ columnTypeMapping[] = { ...@@ -1157,6 +1162,7 @@ columnTypeMapping[] = {
{ DictTabInfo::ExtTimespec, NdbDictionary::Column::Timespec }, { DictTabInfo::ExtTimespec, NdbDictionary::Column::Timespec },
{ DictTabInfo::ExtBlob, NdbDictionary::Column::Blob }, { DictTabInfo::ExtBlob, NdbDictionary::Column::Blob },
{ DictTabInfo::ExtText, NdbDictionary::Column::Text }, { DictTabInfo::ExtText, NdbDictionary::Column::Text },
{ DictTabInfo::ExtBit, NdbDictionary::Column::Bit },
{ -1, -1 } { -1, -1 }
}; };
...@@ -1266,6 +1272,11 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret, ...@@ -1266,6 +1272,11 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret,
col->m_attrType =attrDesc.AttributeType; col->m_attrType =attrDesc.AttributeType;
col->m_attrSize = (1 << attrDesc.AttributeSize) / 8; col->m_attrSize = (1 << attrDesc.AttributeSize) / 8;
col->m_arraySize = attrDesc.AttributeArraySize; col->m_arraySize = attrDesc.AttributeArraySize;
if(attrDesc.AttributeSize == 0)
{
col->m_attrSize = 4;
col->m_arraySize = (attrDesc.AttributeArraySize + 31) >> 5;
}
col->m_pk = attrDesc.AttributeKeyFlag; col->m_pk = attrDesc.AttributeKeyFlag;
col->m_distributionKey = attrDesc.AttributeDKey; col->m_distributionKey = attrDesc.AttributeDKey;
......
...@@ -169,6 +169,9 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r) ...@@ -169,6 +169,9 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
case NdbDictionary::Column::Bigunsigned: case NdbDictionary::Column::Bigunsigned:
out << r.u_64_value(); out << r.u_64_value();
break; break;
case NdbDictionary::Column::Bit:
out << hex << "H'" << r.u_32_value() << dec;
break;
case NdbDictionary::Column::Unsigned: case NdbDictionary::Column::Unsigned:
out << r.u_32_value(); out << r.u_32_value();
break; break;
......
...@@ -137,13 +137,16 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{ ...@@ -137,13 +137,16 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
if (i != m_updatesCol && id != m_idCol) { if (i != m_updatesCol && id != m_idCol) {
const NdbDictionary::Column* attr = m_tab.getColumn(i); const NdbDictionary::Column* attr = m_tab.getColumn(i);
Uint32 len = attr->getLength();
switch (attr->getType()){ switch (attr->getType()){
case NdbDictionary::Column::Bit:
len = 4 * ((len + 31) >> 5);
case NdbDictionary::Column::Char: case NdbDictionary::Column::Char:
case NdbDictionary::Column::Varchar: case NdbDictionary::Column::Varchar:
case NdbDictionary::Column::Binary: case NdbDictionary::Column::Binary:
case NdbDictionary::Column::Varbinary:{ case NdbDictionary::Column::Varbinary:{
int result = 0; int result = 0;
char* buf = new char[attr->getLength()+1]; char* buf = new char[len+1];
const char* res = calcValue(id, i, updates, buf); const char* res = calcValue(id, i, updates, buf);
if (res == NULL){ if (res == NULL){
if (!pRow->attributeStore(i)->isNULL()){ if (!pRow->attributeStore(i)->isNULL()){
...@@ -180,7 +183,6 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{ ...@@ -180,7 +183,6 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
} }
} }
delete []buf; delete []buf;
if (result != 0)
return result; return result;
} }
break; break;
...@@ -194,7 +196,7 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{ ...@@ -194,7 +196,7 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
g_err << "|- The row: \"" << (* pRow) << "\"" << endl; g_err << "|- The row: \"" << (* pRow) << "\"" << endl;
return -1; return -1;
} }
break; return 0;
} }
case NdbDictionary::Column::Bigint: case NdbDictionary::Column::Bigint:
case NdbDictionary::Column::Bigunsigned:{ case NdbDictionary::Column::Bigunsigned:{
...@@ -207,6 +209,7 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{ ...@@ -207,6 +209,7 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
g_err << "|- The row: \"" << (* pRow) << "\"" << endl; g_err << "|- The row: \"" << (* pRow) << "\"" << endl;
return -1; return -1;
} }
return 0;
} }
break; break;
case NdbDictionary::Column::Float:{ case NdbDictionary::Column::Float:{
...@@ -218,17 +221,16 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{ ...@@ -218,17 +221,16 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
g_err << "|- The row: \"" << (* pRow) << "\"" << endl; g_err << "|- The row: \"" << (* pRow) << "\"" << endl;
return -1; return -1;
} }
return 0;
} }
break; break;
case NdbDictionary::Column::Undefined: case NdbDictionary::Column::Undefined:
default:
assert(false);
break; break;
} }
} }
} }
return 0; assert(0);
return -1;
} }
int int
......
...@@ -407,7 +407,7 @@ HugoOperations::~HugoOperations(){ ...@@ -407,7 +407,7 @@ HugoOperations::~HugoOperations(){
int HugoOperations::equalForAttr(NdbOperation* pOp, int HugoOperations::equalForAttr(NdbOperation* pOp,
int attrId, int attrId,
int rowId){ int rowId){
int check = 0; int check = -1;
const NdbDictionary::Column* attr = tab.getColumn(attrId); const NdbDictionary::Column* attr = tab.getColumn(attrId);
if (attr->getPrimaryKey() == false){ if (attr->getPrimaryKey() == false){
g_info << "Can't call equalForAttr on non PK attribute" << endl; g_info << "Can't call equalForAttr on non PK attribute" << endl;
...@@ -415,6 +415,7 @@ int HugoOperations::equalForAttr(NdbOperation* pOp, ...@@ -415,6 +415,7 @@ int HugoOperations::equalForAttr(NdbOperation* pOp,
} }
switch (attr->getType()){ switch (attr->getType()){
case NdbDictionary::Column::Bit:
case NdbDictionary::Column::Char: case NdbDictionary::Column::Char:
case NdbDictionary::Column::Varchar: case NdbDictionary::Column::Varchar:
case NdbDictionary::Column::Binary: case NdbDictionary::Column::Binary:
...@@ -440,11 +441,6 @@ int HugoOperations::equalForAttr(NdbOperation* pOp, ...@@ -440,11 +441,6 @@ int HugoOperations::equalForAttr(NdbOperation* pOp,
g_info << "Float not allowed as PK value" << endl; g_info << "Float not allowed as PK value" << endl;
check = -1; check = -1;
break; break;
default:
g_info << "default" << endl;
check = -1;
break;
} }
return check; return check;
} }
...@@ -453,10 +449,11 @@ int HugoOperations::setValueForAttr(NdbOperation* pOp, ...@@ -453,10 +449,11 @@ int HugoOperations::setValueForAttr(NdbOperation* pOp,
int attrId, int attrId,
int rowId, int rowId,
int updateId){ int updateId){
int check = 0; int check = -1;
const NdbDictionary::Column* attr = tab.getColumn(attrId); const NdbDictionary::Column* attr = tab.getColumn(attrId);
switch (attr->getType()){ switch (attr->getType()){
case NdbDictionary::Column::Bit:
case NdbDictionary::Column::Char: case NdbDictionary::Column::Char:
case NdbDictionary::Column::Varchar: case NdbDictionary::Column::Varchar:
case NdbDictionary::Column::Binary: case NdbDictionary::Column::Binary:
...@@ -492,9 +489,6 @@ int HugoOperations::setValueForAttr(NdbOperation* pOp, ...@@ -492,9 +489,6 @@ int HugoOperations::setValueForAttr(NdbOperation* pOp,
check = pOp->setValue( attr->getName(), check = pOp->setValue( attr->getName(),
(float)calc.calcValue(rowId, attrId, updateId)); (float)calc.calcValue(rowId, attrId, updateId));
break; break;
default:
check = -1;
break;
} }
return check; return check;
} }
......
...@@ -48,7 +48,7 @@ const ...@@ -48,7 +48,7 @@ const
NDBT_Attribute T2Attribs[] = { NDBT_Attribute T2Attribs[] = {
NDBT_Attribute("KOL1", NdbDictionary::Column::Bigunsigned, 1, true), NDBT_Attribute("KOL1", NdbDictionary::Column::Bigunsigned, 1, true),
NDBT_Attribute("KOL2", NdbDictionary::Column::Unsigned), NDBT_Attribute("KOL2", NdbDictionary::Column::Unsigned),
NDBT_Attribute("KOL3", NdbDictionary::Column::Unsigned), NDBT_Attribute("KOL3", NdbDictionary::Column::Bit, 23),
NDBT_Attribute("KOL4", NdbDictionary::Column::Unsigned, NDBT_Attribute("KOL4", NdbDictionary::Column::Unsigned,
1, false, true), // Nullable 1, false, true), // Nullable
NDBT_Attribute("KOL5", NdbDictionary::Column::Unsigned) NDBT_Attribute("KOL5", NdbDictionary::Column::Unsigned)
......
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