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
1.1984 05/09/05 21:01:25 jonas@eel.(none) +7 -0
ndb diskdata
fix SR with varsize keys
storage/ndb/src/kernel/vm/SimulatedBlock.cpp
1.18 05/09/05 21:01:21 jonas@eel.(none) +29 -5
Fix xfrm_key wrt varsize
dont expand non varchar attributes if not necessary
storage/ndb/src/kernel/vm/KeyDescriptor.hpp
1.3 05/09/05 21:01:21 jonas@eel.(none) +4 -2
Add noOfVarKeys
storage/ndb/src/kernel/blocks/restore.hpp
1.11 05/09/05 21:01:21 jonas@eel.(none) +3 -0
Fix handling of xfrm in restore
storage/ndb/src/kernel/blocks/restore.cpp
1.22 05/09/05 21:01:21 jonas@eel.(none) +73 -3
Fix handling of xfrm in restore
storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
1.43 05/09/05 21:01:21 jonas@eel.(none) +1 -0
Reset last word of varsize attributes
storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp
1.74 05/09/05 21:01:21 jonas@eel.(none) +1 -1
Dont set undo_space if no disk attributes
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
1.94 05/09/05 21:01:20 jonas@eel.(none) +9 -4
Init noOfVarKeys
# 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: eel.(none)
# Root: /home/jonas/src/mysql-5.1-ndb-dd
--- 1.2/storage/ndb/src/kernel/vm/KeyDescriptor.hpp 2005-08-25 20:51:23 +02:00
+++ 1.3/storage/ndb/src/kernel/vm/KeyDescriptor.hpp 2005-09-05 21:01:21 +02:00
@@ -23,12 +23,14 @@
struct KeyDescriptor
{
- KeyDescriptor () { noOfKeyAttr = hasCharAttr = noOfDistrKeys = 0; }
+ KeyDescriptor () {
+ noOfKeyAttr = hasCharAttr = noOfDistrKeys = noOfVarKeys = 0;
+ }
Uint8 noOfKeyAttr;
Uint8 hasCharAttr;
Uint8 noOfDistrKeys;
- Uint8 unused;
+ Uint8 noOfVarKeys;
struct KeyAttr
{
Uint32 attributeDescriptor;
--- 1.21/storage/ndb/src/kernel/blocks/restore.cpp 2005-08-24 08:49:49 +02:00
+++ 1.22/storage/ndb/src/kernel/blocks/restore.cpp 2005-09-05 21:01:21 +02:00
@@ -29,6 +29,7 @@
#include <md5_hash.hpp>
#include <Dblqh.hpp>
#include <dbtup/Dbtup.hpp>
+#include <KeyDescriptor.hpp>
#define PAGES (4*32)
@@ -985,7 +986,7 @@
if(c.m_flags & Column::COL_KEY)
{
assert(! c.m_nulloffset && c.m_flags & Column::COL_VAR);
- memcpy(keyData, data, sz);
+ memcpy(keyData, data, 4 * sz32);
keyData += sz32;
}
@@ -1005,8 +1006,19 @@
Uint32 attrLen = attrData - attr_start;
LqhKeyReq * req = (LqhKeyReq *)signal->getDataPtrSend();
- Uint32 hashValue = md5_hash((Uint64*)key_start, keyLen);
-
+ Uint32 tableId = file_ptr.p->m_table_id;
+ const KeyDescriptor* desc = g_key_descriptor_pool.getPtr(tableId);
+ if (desc->noOfKeyAttr != desc->noOfVarKeys)
+ {
+ reorder_key(desc, key_start, keyLen);
+ }
+
+ Uint32 hashValue;
+ if (g_key_descriptor_pool.getPtr(tableId)->hasCharAttr)
+ hashValue = calulate_hash(tableId, key_start);
+ else
+ hashValue = md5_hash((Uint64*)key_start, keyLen);
+
Uint32 tmp= 0;
LqhKeyReq::setAttrLen(tmp, attrLen);
req->attrLen = tmp;
@@ -1050,6 +1062,64 @@
}
c_lqh->receive_attrinfo(signal, attr_start, attrLen);
+}
+
+void
+Restore::reorder_key(const KeyDescriptor* desc,
+ Uint32 *data, Uint32 len)
+{
+ Uint32 i;
+ Uint32 *var= data;
+ Uint32 Tmp[MAX_KEY_SIZE_IN_WORDS];
+ for(i = 0; i<desc->noOfKeyAttr; i++)
+ {
+ Uint32 attr = desc->keyAttr[i].attributeDescriptor;
+ switch(AttributeDescriptor::getArrayType(attr)){
+ case NDB_ARRAYTYPE_FIXED:
+ var += AttributeDescriptor::getSizeInWords(attr);
+ }
+ }
+
+ Uint32 *dst = Tmp;
+ Uint32 *src = data;
+ for(i = 0; i<desc->noOfKeyAttr; i++)
+ {
+ Uint32 sz;
+ Uint32 attr = desc->keyAttr[i].attributeDescriptor;
+ switch(AttributeDescriptor::getArrayType(attr)){
+ case NDB_ARRAYTYPE_FIXED:
+ sz = AttributeDescriptor::getSizeInWords(attr);
+ memcpy(dst, src, 4 * sz);
+ src += sz;
+ break;
+ case NDB_ARRAYTYPE_SHORT_VAR:
+ sz = (1 + ((char*)var)[0] + 3) >> 2;
+ memcpy(dst, var, 4 * sz);
+ var += sz;
+ break;
+ case NDB_ARRAYTYPE_MEDIUM_VAR:
+ sz = (2 + ((char*)var)[0] + 256*((char*)var)[1] + 3) >> 2;
+ memcpy(dst, var, 4 * sz);
+ var += sz;
+ break;
+ }
+ dst += sz;
+ }
+ assert((dst - Tmp) == len);
+ memcpy(data, Tmp, 4*len);
+}
+
+Uint32
+Restore::calulate_hash(Uint32 tableId, const Uint32 *src)
+{
+ jam();
+ Uint64 Tmp[(MAX_KEY_SIZE_IN_WORDS*MAX_XFRM_MULTIPLY) >> 1];
+ Uint32 keyPartLen[MAX_ATTRIBUTES_IN_INDEX];
+ Uint32 keyLen = xfrm_key(tableId, src, (Uint32*)Tmp, sizeof(Tmp) >> 2,
+ keyPartLen);
+ ndbrequire(keyLen);
+
+ return md5_hash(Tmp, keyLen);
}
void
--- 1.10/storage/ndb/src/kernel/blocks/restore.hpp 2005-04-30 13:42:59 +02:00
+++ 1.11/storage/ndb/src/kernel/blocks/restore.hpp 2005-09-05 21:01:21 +02:00
@@ -133,6 +133,9 @@
void parse_gcp_entry(Signal*, FilePtr, const Uint32*, Uint32 len);
void close_file(Signal*, FilePtr);
+ void reorder_key(const struct KeyDescriptor*, Uint32* data, Uint32 len);
+ Uint32 calulate_hash(Uint32 tableId, const Uint32 *src);
+
void parse_error(Signal*, FilePtr, Uint32 line, Uint32 extra);
public:
--- 1.93/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2005-08-29 06:41:00 +02:00
+++ 1.94/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2005-09-05 21:01:20 +02:00
@@ -5017,11 +5017,12 @@
AttributeRecord* aRec = attrPtr.p;
if (aRec->tupleKey)
{
+ Uint32 attr = aRec->attributeDescriptor;
+
desc->noOfKeyAttr ++;
- desc->keyAttr[key].attributeDescriptor = aRec->attributeDescriptor;
-
+ desc->keyAttr[key].attributeDescriptor = attr;
Uint32 csNumber = (aRec->extPrecision >> 16);
- if(csNumber)
+ if (csNumber)
{
desc->keyAttr[key].charsetInfo = all_charsets[csNumber];
ndbrequire(all_charsets[csNumber]);
@@ -5031,9 +5032,13 @@
{
desc->keyAttr[key].charsetInfo = 0;
}
- if(AttributeDescriptor::getDKey(aRec->attributeDescriptor))
+ if (AttributeDescriptor::getDKey(attr))
{
desc->noOfDistrKeys ++;
+ }
+ if (AttributeDescriptor::getArrayType(attr) != NDB_ARRAYTYPE_FIXED)
+ {
+ desc->noOfVarKeys ++;
}
key++;
}
--- 1.73/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp 2005-08-31 10:32:18 +02:00
+++ 1.74/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp 2005-09-05 21:01:21 +02:00
@@ -1225,7 +1225,7 @@
regOperPtr->nextActiveOp= RNIL;
regOperPtr->prevActiveOp= RNIL;
regOperPtr->op_struct.in_active_list= true;
- regOperPtr->m_undo_buffer_space= sizeof(Dbtup::Disk_undo::Alloc) >> 2;
+ regOperPtr->m_undo_buffer_space= regTabPtr->m_no_of_disk_attributes ? sizeof(Dbtup::Disk_undo::Alloc) >> 2 : 0;
req_struct->check_offset[MM]= regTabPtr->get_check_offset(MM);
req_struct->check_offset[DD]= regTabPtr->get_check_offset(DD);
--- 1.42/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp 2005-07-22 08:57:46 +02:00
+++ 1.43/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp 2005-09-05 21:01:21 +02:00
@@ -478,6 +478,7 @@
if (new_index <= max_read) {
ljam();
ah_out->setByteSize(vsize_in_bytes);
+ out_buffer[index_buf + (vsize_in_bytes >> 2)] = 0;
memcpy(out_buffer+index_buf,
req_struct->m_var_data[MM].m_data_ptr+var_attr_pos,
vsize_in_bytes);
--- 1.17/storage/ndb/src/kernel/vm/SimulatedBlock.cpp 2005-08-27 13:10:12 +02:00
+++ 1.18/storage/ndb/src/kernel/vm/SimulatedBlock.cpp 2005-09-05 21:01:21 +02:00
@@ -1822,21 +1822,42 @@
{
const KeyDescriptor::KeyAttr& keyAttr = desc->keyAttr[i];
+ Uint32 array =
+ AttributeDescriptor::getArrayType(keyAttr.attributeDescriptor);
Uint32 srcBytes =
AttributeDescriptor::getSizeInBytes(keyAttr.attributeDescriptor);
- Uint32 srcWords = (srcBytes + 3) / 4;
+
+ Uint32 srcWords = ~0;
Uint32 dstWords = ~0;
uchar* dstPtr = (uchar*)&dst[dstPos];
const uchar* srcPtr = (const uchar*)&src[srcPos];
CHARSET_INFO* cs = keyAttr.charsetInfo;
- if (cs == NULL)
+ if (cs == NULL)
{
jam();
- memcpy(dstPtr, srcPtr, srcWords << 2);
- dstWords = srcWords;
+ Uint32 lb, len;
+ switch(array){
+ case NDB_ARRAYTYPE_SHORT_VAR:
+ lb = 1;
+ len = srcPtr[0];
+ break;
+ case NDB_ARRAYTYPE_MEDIUM_VAR:
+ lb = 2;
+ len = srcPtr[0] + (srcPtr[1] << 8);
+ break;
+#ifndef VM_TRACE
+ default:
+#endif
+ case NDB_ARRAYTYPE_FIXED:
+ lb = 0;
+ len = srcBytes;
+ }
+ srcWords = (lb + len + 3) >> 2;
+ dstWords = (len + 3) >> 2;
+ memcpy(dstPtr, srcPtr+lb, dstWords << 2);
}
- else
+ else
{
jam();
Uint32 typeId =
@@ -1861,7 +1882,9 @@
dstPtr[n++] = 0;
}
dstWords = (n >> 2);
+ srcWords = (lb + len + 3) >> 2;
}
+
dstPos += dstWords;
srcPos += srcWords;
keyPartLen[i++] = dstWords;
@@ -1907,6 +1930,7 @@
{
Uint32 attr = desc->keyAttr[i].attributeDescriptor;
Uint32 len = AttributeDescriptor::getSizeInWords(attr);
+ ndbrequire(AttributeDescriptor::getArrayType(attr) == NDB_ARRAYTYPE_FIXED);
if(AttributeDescriptor::getDKey(attr))
{
noOfDistrKeys--;
| Thread |
|---|
| • bk commit into 5.1 tree (jonas:1.1984) | jonas | 5 Sep |