Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-04-13 10:03:35+02:00, jonas@stripped +2 -0
ndb - rp
finish changing of infrastructur for introducing read-packed
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp@stripped, 2007-04-13 10:03:32+02:00,
jonas@stripped +15 -1
put xfrm-ing into separate routine
put bits-reader into separate routine
storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp@stripped, 2007-04-13 10:03:32+02:00,
jonas@stripped +184 -251
split into separate routines
add correct assert(s) for bits/padding in outbuffer
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jonas
# Host: perch.ndb.mysql.com
# Root: /home/jonas/src/51-telco-rp
--- 1.70/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp 2007-04-13 10:03:40 +02:00
+++ 1.71/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp 2007-04-13 10:03:40 +02:00
@@ -2142,8 +2142,22 @@
KeyReqStruct *req_struct,
AttributeHeader* ah_out,
Uint32 attr_des2,
- char * src_ptr,
+ const void* src_ptr,
Uint32 vsize_in_bytes);
+
+ bool xfrm_reader(Uint8* out_buffer,
+ KeyReqStruct *req_struct,
+ AttributeHeader* ah_out,
+ Uint32 attr_des2,
+ const void* src_ptr,
+ Uint32 srcBytes);
+
+ bool bits_reader(Uint8* out_buffer,
+ KeyReqStruct *req_struct,
+ AttributeHeader* ah_out,
+ const Uint32* bm_ptr, Uint32 bm_len,
+ Uint32 bitPos, Uint32 bitCnt);
+
bool varsize_updater(Uint32* in_buffer,
KeyReqStruct *req_struct,
char *var_data_start,
--- 1.43/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp 2007-04-13 10:03:40 +02:00
+++ 1.44/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp 2007-04-13 10:03:40 +02:00
@@ -326,12 +326,14 @@
AttributeHeader* ahOut,
Uint32 attrDes2)
{
+ ndbassert((req_struct->out_buf_index & 3) == 0);
+ ndbassert(req_struct->out_buf_bits == 0);
+
Uint32 *tuple_header= req_struct->m_tuple_ptr->m_data;
Uint32 indexBuf= req_struct->out_buf_index;
Uint32 readOffset= AttributeOffset::getOffset(attrDes2);
Uint32 const wordRead= tuple_header[readOffset];
- ndbassert((indexBuf & 3) == 0);
Uint32 newIndexBuf = indexBuf + 4;
Uint32* dst = (Uint32*)(outBuffer + indexBuf);
Uint32 maxRead= req_struct->max_read;
@@ -356,6 +358,9 @@
AttributeHeader* ahOut,
Uint32 attrDes2)
{
+ ndbassert((req_struct->out_buf_index & 3) == 0);
+ ndbassert(req_struct->out_buf_bits == 0);
+
Uint32 *tuple_header= req_struct->m_tuple_ptr->m_data;
Uint32 indexBuf= req_struct->out_buf_index;
Uint32 readOffset= AttributeOffset::getOffset(attrDes2);
@@ -363,7 +368,6 @@
Uint32 const wordReadSecond= tuple_header[readOffset + 1];
Uint32 maxRead= req_struct->max_read;
- ndbassert((indexBuf & 3) == 0);
Uint32 newIndexBuf = indexBuf + 8;
Uint32* dst = (Uint32*)(outBuffer + indexBuf);
@@ -382,6 +386,16 @@
}
}
+static
+inline
+void
+zero32(Uint8* dstPtr, Uint32 len)
+{
+ while ((len & 3) != 0)
+ {
+ dstPtr[len++] = 0;
+ }
+}
bool
Dbtup::readFixedSizeTHManyWordNotNULL(Uint8* outBuffer,
@@ -389,6 +403,9 @@
AttributeHeader* ahOut,
Uint32 attrDes2)
{
+ ndbassert((req_struct->out_buf_index & 3) == 0);
+ ndbassert(req_struct->out_buf_bits == 0);
+
Uint32 attrDescriptor= req_struct->attr_descriptor;
Uint32 *tuple_header= req_struct->m_tuple_ptr->m_data;
Uint32 indexBuf= req_struct->out_buf_index;
@@ -399,55 +416,28 @@
Uint32 charsetFlag = AttributeOffset::getCharsetFlag(attrDes2);
Uint32 newIndexBuf = indexBuf + srcBytes;
- Uint32* dst = (Uint32*)(outBuffer + indexBuf);
+ Uint8* dst = (outBuffer + indexBuf);
+ const Uint8* src = (Uint8*)(tuple_header + readOffset);
ndbrequire((readOffset + attrNoOfWords - 1) < req_struct->check_offset[MM]);
if (! charsetFlag || ! req_struct->xfrm_flag) {
if (newIndexBuf <= maxRead) {
jam();
ahOut->setByteSize(srcBytes);
- MEMCOPY_NO_WORDS(dst, &tuple_header[readOffset], attrNoOfWords);
+ memcpy(dst, src, srcBytes);
+ zero32(dst, srcBytes);
req_struct->out_buf_index = newIndexBuf;
return true;
} else {
jam();
terrorCode = ZTRY_TO_READ_TOO_MUCH_ERROR;
+ return false;
}//if
- } else {
- jam();
- Tablerec* regTabPtr = tabptr.p;
- Uint8* dstPtr = (uchar*)dst;
- const Uint8* srcPtr = (uchar*)&tuple_header[readOffset];
- Uint32 i = AttributeOffset::getCharsetPos(attrDes2);
- ndbrequire(i < regTabPtr->noOfCharsets);
- CHARSET_INFO* cs = regTabPtr->charsetArray[i];
- Uint32 typeId = AttributeDescriptor::getType(attrDescriptor);
- Uint32 lb, len;
- bool ok = NdbSqlUtil::get_var_length(typeId, srcPtr, srcBytes, lb, len);
- Uint32 xmul = cs->strxfrm_multiply;
- if (xmul == 0)
- xmul = 1;
- Uint32 dstLen = xmul * (srcBytes - lb);
- Uint32 maxIndexBuf = indexBuf + (dstLen >> 2);
- if (maxIndexBuf <= maxRead && ok) {
- jam();
- int n = NdbSqlUtil::strnxfrm_bug7284(cs, dstPtr, dstLen, srcPtr + lb, len);
- ndbrequire(n != -1);
- int m = n;
- while ((m & 3) != 0) {
- dstPtr[m++] = 0;
- }
- ahOut->setByteSize(n);
- Uint32 newIndexBuf = indexBuf + n;
- ndbrequire(newIndexBuf <= maxRead);
- req_struct->out_buf_index = newIndexBuf;
- return true;
- } else {
- jam();
- terrorCode = ZTRY_TO_READ_TOO_MUCH_ERROR;
- }
}
- return false;
+ else
+ {
+ return xfrm_reader(dst, req_struct, ahOut, attrDes2, src, srcBytes);
+ }
}//Dbtup::readFixedSizeTHManyWordNotNULL()
bool
@@ -547,90 +537,138 @@
KeyReqStruct *req_struct,
AttributeHeader* ah_out,
Uint32 attr_des2,
- char * src_ptr,
- Uint32 vsize_in_bytes)
+ const void * srcPtr,
+ Uint32 srcBytes)
{
+ ndbassert(req_struct->out_buf_bits == 0);
+
Uint32 charsetFlag = AttributeOffset::getCharsetFlag(attr_des2);
Uint32 attr_descriptor= req_struct->attr_descriptor;
Uint32 indexBuf= req_struct->out_buf_index;
- Uint32 max_var_size= AttributeDescriptor::getSizeInWords(attr_descriptor);
+ Uint32 max_var_size= AttributeDescriptor::getSizeInBytes(attr_descriptor);
Uint32 max_read= req_struct->max_read;
- Uint32 vsize_in_words= convert_byte_to_word_size(vsize_in_bytes);
- Uint32 newIndexBuf = indexBuf + vsize_in_bytes;
+ Uint32 newIndexBuf = indexBuf + srcBytes;
Uint8* dst = (outBuffer + indexBuf);
- ndbrequire(vsize_in_words <= max_var_size);
+ ndbrequire(srcBytes <= max_var_size);
if (! charsetFlag || ! req_struct->xfrm_flag)
{
if (newIndexBuf <= max_read) {
jam();
- ah_out->setByteSize(vsize_in_bytes);
- memcpy(dst, src_ptr, vsize_in_bytes);
- bzero(dst+vsize_in_bytes, 4*vsize_in_words - vsize_in_bytes);
+ ah_out->setByteSize(srcBytes);
+ memcpy(dst, srcPtr, srcBytes);
+ zero32(dst, srcBytes);
req_struct->out_buf_index= newIndexBuf;
return true;
}
}
else
{
- jam();
- Tablerec* regTabPtr = tabptr.p;
- Uint32 maxBytes = AttributeDescriptor::getSizeInBytes(attr_descriptor);
- Uint32 srcBytes = vsize_in_bytes;
- Uint8* dstPtr = (uchar*)dst;
- const Uint8* srcPtr = (uchar*)src_ptr;
- Uint32 i = AttributeOffset::getCharsetPos(attr_des2);
- ndbrequire(i < regTabPtr->noOfCharsets);
- CHARSET_INFO* cs = regTabPtr->charsetArray[i];
- Uint32 typeId = AttributeDescriptor::getType(attr_descriptor);
- Uint32 lb, len;
- bool ok = NdbSqlUtil::get_var_length(typeId, srcPtr, srcBytes, lb, len);
- Uint32 xmul = cs->strxfrm_multiply;
- if (xmul == 0)
- xmul = 1;
- // see comment in DbtcMain.cpp
- Uint32 dstLen = xmul * (maxBytes - lb);
- Uint32 maxIndexBuf = indexBuf + dstLen;
- if (maxIndexBuf <= max_read && ok) {
- jam();
- int n = NdbSqlUtil::strnxfrm_bug7284(cs, dstPtr, dstLen, srcPtr + lb, len);
- ndbrequire(n != -1);
- int m = n;
- while ((m & 3) != 0) {
- dstPtr[m++] = 0;
- }
- ah_out->setByteSize(n);
- Uint32 newIndexBuf = indexBuf + n;
- ndbrequire(newIndexBuf <= max_read);
- req_struct->out_buf_index = newIndexBuf;
- return true;
- }
+ return xfrm_reader(dst, req_struct, ah_out, attr_des2, srcPtr, srcBytes);
}
+
jam();
terrorCode= ZTRY_TO_READ_TOO_MUCH_ERROR;
return false;
}
bool
+Dbtup::xfrm_reader(Uint8* dstPtr,
+ KeyReqStruct* req_struct,
+ AttributeHeader* ahOut,
+ Uint32 attrDes2,
+ const void* srcPtr, Uint32 srcBytes)
+{
+ jam();
+ ndbassert(req_struct->out_buf_bits == 0);
+
+ Tablerec* regTabPtr = tabptr.p;
+ Uint32 attrDes1 = req_struct->attr_descriptor;
+ Uint32 indexBuf= req_struct->out_buf_index;
+ Uint32 maxRead= req_struct->max_read;
+ Uint32 i = AttributeOffset::getCharsetPos(attrDes2);
+ Uint32 typeId = AttributeDescriptor::getType(attrDes1);
+ Uint32 maxBytes = AttributeDescriptor::getSizeInBytes(attrDes1);
+
+ ndbrequire(i < regTabPtr->noOfCharsets);
+ CHARSET_INFO* cs = regTabPtr->charsetArray[i];
+
+ Uint32 lb, len;
+ bool ok = NdbSqlUtil::get_var_length(typeId, srcPtr, srcBytes, lb, len);
+ Uint32 xmul = cs->strxfrm_multiply;
+ if (xmul == 0)
+ xmul = 1;
+ Uint32 dstLen = xmul * (maxBytes - lb);
+ Uint32 maxIndexBuf = indexBuf + (dstLen >> 2);
+ if (maxIndexBuf <= maxRead && ok)
+ {
+ jam();
+ int n = NdbSqlUtil::strnxfrm_bug7284(cs, dstPtr, dstLen,
+ (const Uint8*)srcPtr + lb, len);
+ ndbrequire(n != -1);
+ zero32(dstPtr, n);
+ ahOut->setByteSize(n);
+ Uint32 newIndexBuf = indexBuf + n;
+ ndbrequire(newIndexBuf <= maxRead);
+ req_struct->out_buf_index = newIndexBuf;
+ return true;
+ } else {
+ jam();
+ terrorCode = ZTRY_TO_READ_TOO_MUCH_ERROR;
+ }
+ return false;
+}
+
+bool
+Dbtup::bits_reader(Uint8* outBuffer,
+ KeyReqStruct *req_struct,
+ AttributeHeader* ahOut,
+ const Uint32* bmptr, Uint32 bmlen,
+ Uint32 bitPos, Uint32 bitCount)
+{
+ ndbassert((req_struct->out_buf_index & 3) == 0);
+
+ Uint32 indexBuf = req_struct->out_buf_index;
+ Uint32 indexBits = req_struct->out_buf_bits;
+ Uint32 maxRead = req_struct->max_read;
+
+ Uint32 sz32 = (bitCount + 31) >> 5;
+ Uint32 newIndexBuf = indexBuf + 4 * ((indexBits + bitCount) >> 5);
+ Uint32 newIndexBits = (indexBits + bitCount) & 31;
+
+ if (newIndexBuf <= maxRead) {
+ jam();
+ ahOut->setDataSize(sz32);
+ req_struct->out_buf_index = newIndexBuf;
+ req_struct->out_buf_bits = newIndexBits;
+
+ BitmaskImpl::getField(bmlen, bmptr, bitPos, bitCount,
+ (Uint32*)(outBuffer+indexBuf));
+
+ return true;
+ } else {
+ jam();
+ terrorCode = ZTRY_TO_READ_TOO_MUCH_ERROR;
+ return false;
+ }//if
+}
+
+bool
Dbtup::readVarSizeNotNULL(Uint8* out_buffer,
KeyReqStruct *req_struct,
AttributeHeader* ah_out,
Uint32 attr_des2)
{
- Uint32 var_index;
- Uint32 vsize_in_bytes;
- Uint32 var_attr_pos;
- char *src_ptr;
-
- var_index= AttributeOffset::getOffset(attr_des2);
- var_attr_pos= req_struct->m_var_data[MM].m_offset_array_ptr[var_index];
+ Uint32 var_idx= AttributeOffset::getOffset(attr_des2);
+ Uint32 var_attr_pos= req_struct->m_var_data[MM].m_offset_array_ptr[var_idx];
Uint32 idx= req_struct->m_var_data[MM].m_var_len_offset;
- vsize_in_bytes=
- req_struct->m_var_data[MM].m_offset_array_ptr[var_index+idx] - var_attr_pos;
- src_ptr= req_struct->m_var_data[MM].m_data_ptr+var_attr_pos;
+ Uint32 srcBytes =
+ req_struct->m_var_data[MM].m_offset_array_ptr[var_idx+idx] - var_attr_pos;
+ const char* src_ptr= req_struct->m_var_data[MM].m_data_ptr+var_attr_pos;
+
return varsize_reader(out_buffer, req_struct, ah_out, attr_des2,
- src_ptr, vsize_in_bytes);
+ src_ptr, srcBytes);
}
bool
@@ -767,7 +805,7 @@
Uint32 *data_ptr= bm_ptr + dyn_len - bit_count - vsize_in_words;
return varsize_reader(outBuffer, req_struct, ahOut, attrDes2,
- (char *)data_ptr, vsize_in_bytes);
+ (Uint8 *)data_ptr, vsize_in_bytes);
}
static
@@ -990,26 +1028,9 @@
ndbassert(pos>bitCount);
pos-= bitCount;
- Uint32 indexBuf = req_struct->out_buf_index;
- Uint32 indexBits = req_struct->out_buf_bits;
- Uint32 newIndexBuf = indexBuf + 4*((indexBits + bitCount) >> 5);
- Uint32 maxRead = req_struct->max_read;
- ndbassert((indexBuf & 3) == 0);
- if (newIndexBuf <= maxRead) {
- jam();
- Uint32 sz = (bitCount + 31) >> 5;
- ahOut->setDataSize(sz);
- req_struct->out_buf_index = newIndexBuf;
- req_struct->out_buf_bits = (indexBits + bitCount) & 31;
-
- BitmaskImpl::getField(bm_len, bm_ptr, pos, bitCount,
- (Uint32*)(outBuffer+indexBuf));
- return true;
- } else {
- jam();
- terrorCode = ZTRY_TO_READ_TOO_MUCH_ERROR;
- return false;
- }//if
+ return bits_reader(outBuffer, req_struct, ahOut,
+ bm_ptr, bm_len,
+ pos, bitCount);
}
bool
@@ -1048,26 +1069,9 @@
ndbassert(pos>bitCount);
pos-= bitCount;
- Uint32 indexBuf = req_struct->out_buf_index;
- Uint32 indexBits = req_struct->out_buf_bits;
- Uint32 newIndexBuf = indexBuf + 4*((indexBits + bitCount) >> 5);
- Uint32 maxRead = req_struct->max_read;
- ndbassert((indexBuf & 3) == 0);
- if (newIndexBuf <= maxRead) {
- jam();
- Uint32 sz = (bitCount + 31) >> 5;
- ahOut->setDataSize(sz);
- req_struct->out_buf_index = newIndexBuf;
- req_struct->out_buf_bits = (indexBits + bitCount) & 31;
-
- BitmaskImpl::getField(bm_len, bm_ptr, pos, bitCount,
- (Uint32*)(outBuffer+indexBuf));
- return true;
- } else {
- jam();
- terrorCode = ZTRY_TO_READ_TOO_MUCH_ERROR;
- return false;
- }//if
+ return bits_reader(outBuffer, req_struct, ahOut,
+ bm_ptr, bm_len,
+ pos, bitCount);
}
bool
@@ -1234,6 +1238,8 @@
AttributeHeader* ahOut,
Uint32 attrDes2)
{
+ ndbassert(req_struct->out_buf_bits == 0);
+
Uint32 attrDescriptor= req_struct->attr_descriptor;
Uint32 *tuple_header= req_struct->m_disk_ptr->m_data;
Uint32 indexBuf= req_struct->out_buf_index;
@@ -1242,56 +1248,30 @@
Uint32 attrNoOfWords= (srcBytes + 3) >> 2;
Uint32 maxRead= req_struct->max_read;
Uint32 charsetFlag = AttributeOffset::getCharsetFlag(attrDes2);
+ Uint32 newIndexBuf = indexBuf + srcBytes;
+ Uint8* dst = (outBuffer + indexBuf);
+ const Uint8* src = (Uint8*)(tuple_header+readOffset);
ndbrequire((readOffset + attrNoOfWords - 1) < req_struct->check_offset[DD]);
- if (! charsetFlag || ! req_struct->xfrm_flag) {
- Uint32 newIndexBuf = indexBuf + srcBytes;
- if (newIndexBuf <= maxRead) {
+ if (! charsetFlag || ! req_struct->xfrm_flag)
+ {
+ if (newIndexBuf <= maxRead)
+ {
jam();
ahOut->setByteSize(srcBytes);
- MEMCOPY_NO_WORDS(outBuffer + indexBuf,
- &tuple_header[readOffset],
- attrNoOfWords);
+ memcpy(dst, src, srcBytes);
+ zero32(dst, srcBytes);
req_struct->out_buf_index = newIndexBuf;
return true;
- } else {
- jam();
- terrorCode = ZTRY_TO_READ_TOO_MUCH_ERROR;
- }//if
- } else {
- jam();
- Tablerec* regTabPtr = tabptr.p;
- Uint8* dstPtr = (uchar*)(outBuffer + indexBuf);
- const Uint8* srcPtr = (uchar*)&tuple_header[readOffset];
- Uint32 i = AttributeOffset::getCharsetPos(attrDes2);
- ndbrequire(i < regTabPtr->noOfCharsets);
- CHARSET_INFO* cs = regTabPtr->charsetArray[i];
- Uint32 typeId = AttributeDescriptor::getType(attrDescriptor);
- Uint32 lb, len;
- bool ok = NdbSqlUtil::get_var_length(typeId, srcPtr, srcBytes, lb, len);
- Uint32 xmul = cs->strxfrm_multiply;
- if (xmul == 0)
- xmul = 1;
- Uint32 dstLen = xmul * (srcBytes - lb);
- Uint32 maxIndexBuf = indexBuf + (dstLen >> 2);
- if (maxIndexBuf <= maxRead && ok) {
- jam();
- int n = NdbSqlUtil::strnxfrm_bug7284(cs, dstPtr, dstLen, srcPtr + lb, len);
- ndbrequire(n != -1);
- int m = n;
- while ((m & 3) != 0) {
- dstPtr[m++] = 0;
- }
- ahOut->setByteSize(n);
- Uint32 newIndexBuf = indexBuf + n;
- ndbrequire(newIndexBuf <= maxRead);
- req_struct->out_buf_index = newIndexBuf;
- return true;
- } else {
- jam();
- terrorCode = ZTRY_TO_READ_TOO_MUCH_ERROR;
}
}
+ else
+ {
+ return xfrm_reader(dst, req_struct, ahOut, attrDes2, src, srcBytes);
+ }
+
+ jam();
+ terrorCode = ZTRY_TO_READ_TOO_MUCH_ERROR;
return false;
}
@@ -1321,6 +1301,7 @@
Uint32 attr_des2)
{
ndbrequire(false);
+ return 0;
}
bool
@@ -1352,27 +1333,13 @@
Uint32 pos = AttributeOffset::getNullFlagPos(attrDes2);
Uint32 bitCount =
AttributeDescriptor::getArraySize(req_struct->attr_descriptor);
- Uint32 indexBuf = req_struct->out_buf_index;
- Uint32 indexBits = req_struct->out_buf_bits;
- Uint32 newIndexBuf = indexBuf + 4 * ((indexBits + bitCount) >> 5);
- Uint32 maxRead = req_struct->max_read;
- Uint32 *bits= req_struct->m_disk_ptr->get_null_bits(regTabPtr, DD);
- if (newIndexBuf <= maxRead) {
- jam();
- Uint32 sz = (bitCount + 31) >> 5;
- ahOut->setDataSize(sz);
- req_struct->out_buf_index = newIndexBuf;
- req_struct->out_buf_bits = (indexBits + bitCount) & 31;
+ Uint32 bm_len = regTabPtr->m_offsets[DD].m_null_words;
+ Uint32* bm_ptr = req_struct->m_disk_ptr->get_null_bits(regTabPtr, DD);
+
+ return bits_reader(outBuffer, req_struct, ahOut,
+ bm_ptr, bm_len,
+ pos, bitCount);
- BitmaskImpl::getField(regTabPtr->m_offsets[DD].m_null_words, bits, pos,
- bitCount, (Uint32*)(outBuffer+indexBuf));
-
- return true;
- } else {
- jam();
- terrorCode = ZTRY_TO_READ_TOO_MUCH_ERROR;
- return false;
- }//if
}
bool
@@ -1386,33 +1353,19 @@
Uint32 bitCount =
AttributeDescriptor::getArraySize(req_struct->attr_descriptor);
- Uint32 indexBuf = req_struct->out_buf_index;
- Uint32 indexBits = req_struct->out_buf_bits;
- Uint32 newIndexBuf = indexBuf + 4 * ((indexBits + bitCount) >> 5);
- Uint32 maxRead = req_struct->max_read;
- Uint32 *bits= req_struct->m_disk_ptr->get_null_bits(regTabPtr, DD);
+ Uint32 bm_len = regTabPtr->m_offsets[DD].m_null_words;
+ Uint32 *bm_ptr= req_struct->m_disk_ptr->get_null_bits(regTabPtr, DD);
- if(BitmaskImpl::get(regTabPtr->m_offsets[DD].m_null_words, bits, pos))
+ if(BitmaskImpl::get(bm_len, bm_ptr, pos))
{
jam();
ahOut->setNULL();
return true;
}
-
- if (newIndexBuf <= maxRead) {
- jam();
- Uint32 sz = (bitCount + 31) >> 5;
- ahOut->setDataSize(sz);
- req_struct->out_buf_index = newIndexBuf;
- req_struct->out_buf_bits = (indexBits + bitCount) & 31;
- BitmaskImpl::getField(regTabPtr->m_offsets[DD].m_null_words, bits, pos+1,
- bitCount, (Uint32*)(outBuffer+indexBuf));
- return true;
- } else {
- jam();
- terrorCode = ZTRY_TO_READ_TOO_MUCH_ERROR;
- return false;
- }//if
+
+ return bits_reader(outBuffer, req_struct, ahOut,
+ bm_ptr, bm_len,
+ pos+1, bitCount);
}
@@ -1541,9 +1494,10 @@
AttributeHeader::init(&attributeHeader, attributeId, 0);
req_struct->out_buf_index = 0;
- req_struct->max_read = MAX_KEY_SIZE_IN_WORDS;
+ req_struct->out_buf_bits = 0;
+ req_struct->max_read = sizeof(keyReadBuffer);
req_struct->attr_descriptor = attrDescriptor;
-
+
bool tmp = req_struct->xfrm_flag;
req_struct->xfrm_flag = true;
ndbrequire((this->*f)((Uint8*)keyReadBuffer,
@@ -2238,24 +2192,14 @@
Uint32 pos = AttributeOffset::getNullFlagPos(attrDes2);
Uint32 bitCount =
AttributeDescriptor::getArraySize(req_struct->attr_descriptor);
- Uint32 indexBuf = req_struct->out_buf_index;
- Uint32 newIndexBuf = indexBuf + 4 * ((bitCount + 31) >> 5);
- Uint32 maxRead = req_struct->max_read;
- Uint32 *bits= req_struct->m_tuple_ptr->get_null_bits(regTabPtr);
- if (newIndexBuf <= maxRead) {
- jam();
- ahOut->setDataSize((bitCount + 31) >> 5);
- req_struct->out_buf_index = newIndexBuf;
-
- BitmaskImpl::getField(regTabPtr->m_offsets[MM].m_null_words, bits, pos,
- bitCount, (Uint32*)(outBuffer+indexBuf));
-
- return true;
- } else {
- jam();
- terrorCode = ZTRY_TO_READ_TOO_MUCH_ERROR;
- return false;
- }//if
+ Uint32 *bmptr= req_struct->m_tuple_ptr->get_null_bits(regTabPtr);
+ Uint32 bmlen = regTabPtr->m_offsets[MM].m_null_words;
+
+ return bits_reader(outBuffer,
+ req_struct,
+ ahOut,
+ bmptr, bmlen,
+ pos, bitCount);
}
bool
@@ -2269,30 +2213,19 @@
Uint32 bitCount =
AttributeDescriptor::getArraySize(req_struct->attr_descriptor);
- Uint32 indexBuf = req_struct->out_buf_index;
- Uint32 newIndexBuf = indexBuf + 4 * ((bitCount + 31) >> 5);
- Uint32 maxRead = req_struct->max_read;
- Uint32 *bits= req_struct->m_tuple_ptr->get_null_bits(regTabPtr);
+ Uint32 *bm_ptr= req_struct->m_tuple_ptr->get_null_bits(regTabPtr);
+ Uint32 bm_len = regTabPtr->m_offsets[MM].m_null_words;
- if(BitmaskImpl::get(regTabPtr->m_offsets[MM].m_null_words, bits, pos))
+ if(BitmaskImpl::get(bm_len, bm_ptr, pos))
{
jam();
ahOut->setNULL();
return true;
}
- if (newIndexBuf <= maxRead) {
- jam();
- ahOut->setDataSize((bitCount + 31) >> 5);
- req_struct->out_buf_index = newIndexBuf;
- BitmaskImpl::getField(regTabPtr->m_offsets[MM].m_null_words, bits, pos+1,
- bitCount, (Uint32*)(outBuffer+indexBuf));
- return true;
- } else {
- jam();
- terrorCode = ZTRY_TO_READ_TOO_MUCH_ERROR;
- return false;
- }//if
+ return bits_reader(outBuffer, req_struct, ahOut,
+ bm_ptr, bm_len,
+ pos+1, bitCount);
}
bool
| Thread |
|---|
| • bk commit into 5.1 tree (jonas:1.2529) | jonas | 13 Apr |