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 07:10:58+02:00, jonas@stripped +2 -0
ndb - rp
add bits to outindex, change so read functions update their position exactly
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp@stripped, 2007-04-13 07:10:56+02:00,
jonas@stripped +1 -0
add bits to outindex, change so read functions update their position exactly
storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp@stripped, 2007-04-13 07:10:56+02:00,
jonas@stripped +104 -117
add bits to outindex, change so read functions update their position exactly
# 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.69/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp 2007-04-13 07:11:03 +02:00
+++ 1.70/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp 2007-04-13 07:11:03 +02:00
@@ -1516,6 +1516,7 @@
TableDescriptor *attr_descr;
Uint32 max_read;
Uint32 out_buf_index;
+ Uint32 out_buf_bits;
Uint32 in_buf_index;
Uint32 in_buf_len;
Uint32 attr_descriptor;
--- 1.42/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp 2007-04-13 07:11:03 +02:00
+++ 1.43/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp 2007-04-13 07:11:03 +02:00
@@ -262,7 +262,7 @@
Uint32 maxRead,
bool xfrm_flag)
{
- Uint32 attributeId, descr_index, tmpAttrBufIndex, inBufIndex;
+ Uint32 attributeId, descr_index, tmpAttrBufIndex, tmpAttrBufBits, inBufIndex;
Uint32 attributeOffset;
TableDescriptor* attr_descr;
AttributeHeader* ahOut;
@@ -272,20 +272,24 @@
inBufIndex= 0;
req_struct->out_buf_index= 0;
+ req_struct->out_buf_bits = 0;
req_struct->max_read= 4*maxRead;
req_struct->xfrm_flag= xfrm_flag;
Uint8*outBuffer = (Uint8*)outBuf;
while (inBufIndex < inBufLen) {
tmpAttrBufIndex= req_struct->out_buf_index;
+ tmpAttrBufBits = req_struct->out_buf_bits;
AttributeHeader ahIn(inBuffer[inBufIndex]);
inBufIndex++;
attributeId= ahIn.getAttributeId();
descr_index= attributeId << ZAD_LOG_SIZE;
jam();
+ tmpAttrBufIndex = pad32(tmpAttrBufIndex, tmpAttrBufBits);
AttributeHeader::init(&outBuffer[tmpAttrBufIndex], attributeId, 0);
ahOut= (AttributeHeader*)&outBuffer[tmpAttrBufIndex];
req_struct->out_buf_index= tmpAttrBufIndex + 4;
+ req_struct->out_buf_bits = 0;
attr_descr= req_struct->attr_descr;
if (attributeId < numAttributes) {
attributeOffset= attr_descr[descr_index + 1].tabDescr;
@@ -313,7 +317,7 @@
return -1;
}//if
}//while
- return (req_struct->out_buf_index + 3) >> 2;
+ return pad32(req_struct->out_buf_index, req_struct->out_buf_bits) >> 2;
}
bool
@@ -389,19 +393,19 @@
Uint32 *tuple_header= req_struct->m_tuple_ptr->m_data;
Uint32 indexBuf= req_struct->out_buf_index;
Uint32 readOffset= AttributeOffset::getOffset(attrDes2);
- Uint32 attrNoOfWords= AttributeDescriptor::getSizeInWords(attrDescriptor);
+ Uint32 srcBytes = AttributeDescriptor::getSizeInBytes(attrDescriptor);
+ Uint32 attrNoOfWords= (srcBytes + 3) >> 2;
Uint32 maxRead= req_struct->max_read;
Uint32 charsetFlag = AttributeOffset::getCharsetFlag(attrDes2);
- ndbassert((indexBuf & 3) == 0);
- Uint32 newIndexBuf = indexBuf + 4*attrNoOfWords;
+ Uint32 newIndexBuf = indexBuf + srcBytes;
Uint32* dst = (Uint32*)(outBuffer + indexBuf);
ndbrequire((readOffset + attrNoOfWords - 1) < req_struct->check_offset[MM]);
if (! charsetFlag || ! req_struct->xfrm_flag) {
if (newIndexBuf <= maxRead) {
jam();
- ahOut->setByteSize(AttributeDescriptor::getSizeInBytes(attrDescriptor));
+ ahOut->setByteSize(srcBytes);
MEMCOPY_NO_WORDS(dst, &tuple_header[readOffset], attrNoOfWords);
req_struct->out_buf_index = newIndexBuf;
return true;
@@ -412,7 +416,6 @@
} else {
jam();
Tablerec* regTabPtr = tabptr.p;
- Uint32 srcBytes = AttributeDescriptor::getSizeInBytes(attrDescriptor);
Uint8* dstPtr = (uchar*)dst;
const Uint8* srcPtr = (uchar*)&tuple_header[readOffset];
Uint32 i = AttributeOffset::getCharsetPos(attrDes2);
@@ -435,7 +438,7 @@
dstPtr[m++] = 0;
}
ahOut->setByteSize(n);
- Uint32 newIndexBuf = indexBuf + m;
+ Uint32 newIndexBuf = indexBuf + n;
ndbrequire(newIndexBuf <= maxRead);
req_struct->out_buf_index = newIndexBuf;
return true;
@@ -554,7 +557,7 @@
Uint32 max_read= req_struct->max_read;
Uint32 vsize_in_words= convert_byte_to_word_size(vsize_in_bytes);
- Uint32 newIndexBuf = indexBuf + 4*vsize_in_words;
+ Uint32 newIndexBuf = indexBuf + vsize_in_bytes;
Uint8* dst = (outBuffer + indexBuf);
ndbrequire(vsize_in_words <= max_var_size);
@@ -598,7 +601,7 @@
dstPtr[m++] = 0;
}
ah_out->setByteSize(n);
- Uint32 newIndexBuf = indexBuf + m;
+ Uint32 newIndexBuf = indexBuf + n;
ndbrequire(newIndexBuf <= max_read);
req_struct->out_buf_index = newIndexBuf;
return true;
@@ -988,13 +991,16 @@
pos-= bitCount;
Uint32 indexBuf = req_struct->out_buf_index;
- Uint32 newIndexBuf = indexBuf + 4*((bitCount + 31) >> 5);
+ 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();
- ahOut->setDataSize((bitCount + 31) >> 5);
+ 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));
@@ -1043,13 +1049,16 @@
pos-= bitCount;
Uint32 indexBuf = req_struct->out_buf_index;
- Uint32 newIndexBuf = indexBuf + 4*((bitCount + 31) >> 5);
+ 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();
- ahOut->setDataSize((bitCount + 31) >> 5);
+ 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));
@@ -1229,17 +1238,17 @@
Uint32 *tuple_header= req_struct->m_disk_ptr->m_data;
Uint32 indexBuf= req_struct->out_buf_index;
Uint32 readOffset= AttributeOffset::getOffset(attrDes2);
- Uint32 attrNoOfWords= AttributeDescriptor::getSizeInWords(attrDescriptor);
+ Uint32 srcBytes = AttributeDescriptor::getSizeInBytes(attrDescriptor);
+ Uint32 attrNoOfWords= (srcBytes + 3) >> 2;
Uint32 maxRead= req_struct->max_read;
Uint32 charsetFlag = AttributeOffset::getCharsetFlag(attrDes2);
- ndbassert((indexBuf & 3) == 0);
ndbrequire((readOffset + attrNoOfWords - 1) < req_struct->check_offset[DD]);
if (! charsetFlag || ! req_struct->xfrm_flag) {
- Uint32 newIndexBuf = indexBuf + 4*attrNoOfWords;
+ Uint32 newIndexBuf = indexBuf + srcBytes;
if (newIndexBuf <= maxRead) {
jam();
- ahOut->setByteSize(AttributeDescriptor::getSizeInBytes(attrDescriptor));
+ ahOut->setByteSize(srcBytes);
MEMCOPY_NO_WORDS(outBuffer + indexBuf,
&tuple_header[readOffset],
attrNoOfWords);
@@ -1252,7 +1261,6 @@
} else {
jam();
Tablerec* regTabPtr = tabptr.p;
- Uint32 srcBytes = AttributeDescriptor::getSizeInBytes(attrDescriptor);
Uint8* dstPtr = (uchar*)(outBuffer + indexBuf);
const Uint8* srcPtr = (uchar*)&tuple_header[readOffset];
Uint32 i = AttributeOffset::getCharsetPos(attrDes2);
@@ -1275,7 +1283,7 @@
dstPtr[m++] = 0;
}
ahOut->setByteSize(n);
- Uint32 newIndexBuf = indexBuf + m;
+ Uint32 newIndexBuf = indexBuf + n;
ndbrequire(newIndexBuf <= maxRead);
req_struct->out_buf_index = newIndexBuf;
return true;
@@ -1312,35 +1320,7 @@
AttributeHeader* ah_out,
Uint32 attr_des2)
{
- Uint32 attr_descriptor, index_buf, var_index;
- Uint32 vsize_in_bytes, vsize_in_words, new_index, max_var_size;
- Uint32 var_attr_pos, max_read;
-
- Uint32 idx= req_struct->m_var_data[DD].m_var_len_offset;
- var_index= AttributeOffset::getOffset(attr_des2);
- var_attr_pos= req_struct->m_var_data[DD].m_offset_array_ptr[var_index];
- vsize_in_bytes= req_struct->m_var_data[DD].m_offset_array_ptr[var_index+idx] -
var_attr_pos;
- attr_descriptor= req_struct->attr_descriptor;
- index_buf= req_struct->out_buf_index;
- max_var_size= AttributeDescriptor::getSizeInWords(attr_descriptor);
- max_read= req_struct->max_read;
- vsize_in_words= convert_byte_to_word_size(vsize_in_bytes);
- new_index= index_buf + 4 * vsize_in_words;
-
- ndbrequire(vsize_in_words <= max_var_size);
- if (new_index <= max_read) {
- jam();
- ah_out->setByteSize(vsize_in_bytes);
- memcpy(out_buffer+index_buf,
- req_struct->m_var_data[DD].m_data_ptr+var_attr_pos,
- vsize_in_bytes);
- req_struct->out_buf_index= new_index;
- return true;
- } else {
- jam();
- terrorCode= ZTRY_TO_READ_TOO_MUCH_ERROR;
- return false;
- }
+ ndbrequire(false);
}
bool
@@ -1362,6 +1342,80 @@
}
}
+bool
+Dbtup::readDiskBitsNotNULL(Uint8* outBuffer,
+ KeyReqStruct* req_struct,
+ AttributeHeader* ahOut,
+ Uint32 attrDes2)
+{
+ Tablerec* const regTabPtr = tabptr.p;
+ 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;
+
+ 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
+Dbtup::readDiskBitsNULLable(Uint8* outBuffer,
+ KeyReqStruct* req_struct,
+ AttributeHeader* ahOut,
+ Uint32 attrDes2)
+{
+ Tablerec* const regTabPtr = tabptr.p;
+ 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(BitmaskImpl::get(regTabPtr->m_offsets[DD].m_null_words, bits, 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
+}
+
+
/* ---------------------------------------------------------------------- */
/* THIS ROUTINE IS USED TO UPDATE A NUMBER OF ATTRIBUTES. IT IS */
@@ -1498,7 +1552,7 @@
attributeOffset));
req_struct->xfrm_flag = tmp;
- ndbrequire(req_struct->out_buf_index == 4*ahOut->getDataSize());
+ ndbrequire(req_struct->out_buf_index == ahOut->getByteSize());
if (ahIn.getDataSize() != ahOut->getDataSize()) {
jam();
return true;
@@ -2494,73 +2548,6 @@
return false;
}
}
-}
-
-bool
-Dbtup::readDiskBitsNotNULL(Uint8* outBuffer,
- KeyReqStruct* req_struct,
- AttributeHeader* ahOut,
- Uint32 attrDes2)
-{
- Tablerec* const regTabPtr = tabptr.p;
- 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_disk_ptr->get_null_bits(regTabPtr, DD);
- if (newIndexBuf <= maxRead) {
- jam();
- ahOut->setDataSize((bitCount + 31) >> 5);
- req_struct->out_buf_index = newIndexBuf;
-
- 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
-Dbtup::readDiskBitsNULLable(Uint8* outBuffer,
- KeyReqStruct* req_struct,
- AttributeHeader* ahOut,
- Uint32 attrDes2)
-{
- Tablerec* const regTabPtr = tabptr.p;
- 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_disk_ptr->get_null_bits(regTabPtr, DD);
-
- if(BitmaskImpl::get(regTabPtr->m_offsets[DD].m_null_words, bits, 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[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
}
bool
| Thread |
|---|
| • bk commit into 5.1 tree (jonas:1.2528) | jonas | 13 Apr |