Commit 02f33cd9 authored by unknown's avatar unknown

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

into poseidon.ndb.mysql.com:/home/tomas/mysql-5.0-ndb

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