Commit 2d3db7e1 authored by unknown's avatar unknown

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.1-new-ndb

into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new-ndb
parents 460451a6 e4e45a09
...@@ -7295,7 +7295,7 @@ void Dbdict::execGET_TABINFOREQ(Signal* signal) ...@@ -7295,7 +7295,7 @@ void Dbdict::execGET_TABINFOREQ(Signal* signal)
if(objEntry->m_tableType==DictTabInfo::Datafile) if(objEntry->m_tableType==DictTabInfo::Datafile)
{ {
jam(); jam();
GetTabInfoReq *req= (GetTabInfoReq*)signal->theData; GetTabInfoReq *req= (GetTabInfoReq*)signal->getDataPtrSend();
req->senderData= c_retrieveRecord.retrievePage; req->senderData= c_retrieveRecord.retrievePage;
req->senderRef= reference(); req->senderRef= reference();
req->requestType= GetTabInfoReq::RequestById; req->requestType= GetTabInfoReq::RequestById;
...@@ -7307,7 +7307,7 @@ void Dbdict::execGET_TABINFOREQ(Signal* signal) ...@@ -7307,7 +7307,7 @@ void Dbdict::execGET_TABINFOREQ(Signal* signal)
else if(objEntry->m_tableType==DictTabInfo::LogfileGroup) else if(objEntry->m_tableType==DictTabInfo::LogfileGroup)
{ {
jam(); jam();
GetTabInfoReq *req= (GetTabInfoReq*)signal->theData; GetTabInfoReq *req= (GetTabInfoReq*)signal->getDataPtrSend();
req->senderData= c_retrieveRecord.retrievePage; req->senderData= c_retrieveRecord.retrievePage;
req->senderRef= reference(); req->senderRef= reference();
req->requestType= GetTabInfoReq::RequestById; req->requestType= GetTabInfoReq::RequestById;
......
...@@ -57,6 +57,8 @@ Restore::Restore(Block_context& ctx) : ...@@ -57,6 +57,8 @@ Restore::Restore(Block_context& ctx) :
addRecSignal(GSN_LQHKEYREF, &Restore::execLQHKEYREF); addRecSignal(GSN_LQHKEYREF, &Restore::execLQHKEYREF);
addRecSignal(GSN_LQHKEYCONF, &Restore::execLQHKEYCONF); addRecSignal(GSN_LQHKEYCONF, &Restore::execLQHKEYCONF);
ndbrequire(sizeof(Column) == 8);
} }
Restore::~Restore() Restore::~Restore()
...@@ -794,10 +796,10 @@ Restore::parse_table_description(Signal* signal, FilePtr file_ptr, ...@@ -794,10 +796,10 @@ Restore::parse_table_description(Signal* signal, FilePtr file_ptr,
return; return;
} }
DataBuffer<15> variable(m_databuffer_pool);
Uint32 null_offset = 0; Uint32 null_offset = 0;
union { Column c; Uint32 _align[2];}; Column c;
Uint32 colstore[sizeof(Column)/sizeof(Uint32)];
for(Uint32 i = 0; i<tmpTab.NoOfAttributes; i++) { for(Uint32 i = 0; i<tmpTab.NoOfAttributes; i++) {
jam(); jam();
DictTabInfo::Attribute tmp; tmp.init(); DictTabInfo::Attribute tmp; tmp.init();
...@@ -814,10 +816,6 @@ Restore::parse_table_description(Signal* signal, FilePtr file_ptr, ...@@ -814,10 +816,6 @@ Restore::parse_table_description(Signal* signal, FilePtr file_ptr,
const Uint32 sz32 = (sz * arr + 31) >> 5; const Uint32 sz32 = (sz * arr + 31) >> 5;
const bool varsize = tmp.AttributeArrayType != NDB_ARRAYTYPE_FIXED; const bool varsize = tmp.AttributeArrayType != NDB_ARRAYTYPE_FIXED;
union {
Column c;
Uint32 _align[2];
};
c.m_id = tmp.AttributeId; c.m_id = tmp.AttributeId;
c.m_size = sz32; c.m_size = sz32;
c.m_flags = (tmp.AttributeKeyFlag ? Column::COL_KEY : 0); c.m_flags = (tmp.AttributeKeyFlag ? Column::COL_KEY : 0);
...@@ -836,22 +834,19 @@ Restore::parse_table_description(Signal* signal, FilePtr file_ptr, ...@@ -836,22 +834,19 @@ Restore::parse_table_description(Signal* signal, FilePtr file_ptr,
if(!tmp.AttributeNullableFlag && !varsize) if(!tmp.AttributeNullableFlag && !varsize)
{ {
if(!columns.append(_align, sizeof(Column)/sizeof(Uint32)))
{
parse_error(signal, file_ptr, __LINE__, i);
return;
}
} }
else if (true) // null mask dropped in 5.1 else if (true) // null mask dropped in 5.1
{ {
c.m_flags |= (varsize ? Column::COL_VAR : 0); c.m_flags |= (varsize ? Column::COL_VAR : 0);
c.m_flags |= (tmp.AttributeNullableFlag ? Column::COL_NULL : 0); c.m_flags |= (tmp.AttributeNullableFlag ? Column::COL_NULL : 0);
if(!columns.append(_align, sizeof(Column)/sizeof(Uint32)))
{
parse_error(signal, file_ptr, __LINE__, i);
return;
}
} }
memcpy(colstore, &c, sizeof(Column));
if(!columns.append(colstore, sizeof(Column)/sizeof(Uint32)))
{
parse_error(signal, file_ptr, __LINE__, i);
return;
}
} }
if(lcp) if(lcp)
...@@ -861,7 +856,8 @@ Restore::parse_table_description(Signal* signal, FilePtr file_ptr, ...@@ -861,7 +856,8 @@ Restore::parse_table_description(Signal* signal, FilePtr file_ptr,
c.m_id = AttributeHeader::DISK_REF; c.m_id = AttributeHeader::DISK_REF;
c.m_size = 2; c.m_size = 2;
c.m_flags = 0; c.m_flags = 0;
if(!columns.append(_align, sizeof(Column)/sizeof(Uint32))) memcpy(colstore, &c, sizeof(Column));
if(!columns.append(colstore, sizeof(Column)/sizeof(Uint32)))
{ {
parse_error(signal, file_ptr, __LINE__, 0); parse_error(signal, file_ptr, __LINE__, 0);
return; return;
...@@ -872,7 +868,8 @@ Restore::parse_table_description(Signal* signal, FilePtr file_ptr, ...@@ -872,7 +868,8 @@ Restore::parse_table_description(Signal* signal, FilePtr file_ptr,
c.m_id = AttributeHeader::ROWID; c.m_id = AttributeHeader::ROWID;
c.m_size = 2; c.m_size = 2;
c.m_flags = 0; c.m_flags = 0;
if(!columns.append(_align, sizeof(Column)/sizeof(Uint32))) memcpy(colstore, &c, sizeof(Column));
if(!columns.append(colstore, sizeof(Column)/sizeof(Uint32)))
{ {
parse_error(signal, file_ptr, __LINE__, 0); parse_error(signal, file_ptr, __LINE__, 0);
return; return;
...@@ -884,7 +881,8 @@ Restore::parse_table_description(Signal* signal, FilePtr file_ptr, ...@@ -884,7 +881,8 @@ Restore::parse_table_description(Signal* signal, FilePtr file_ptr,
c.m_id = AttributeHeader::ROW_GCI; c.m_id = AttributeHeader::ROW_GCI;
c.m_size = 2; c.m_size = 2;
c.m_flags = 0; c.m_flags = 0;
if(!columns.append(_align, sizeof(Column)/sizeof(Uint32))) memcpy(colstore, &c, sizeof(Column));
if(!columns.append(colstore, sizeof(Column)/sizeof(Uint32)))
{ {
parse_error(signal, file_ptr, __LINE__, 0); parse_error(signal, file_ptr, __LINE__, 0);
return; return;
...@@ -942,7 +940,7 @@ Restore::parse_record(Signal* signal, FilePtr file_ptr, ...@@ -942,7 +940,7 @@ Restore::parse_record(Signal* signal, FilePtr file_ptr,
Uint32 *attrData = attr_start; Uint32 *attrData = attr_start;
union { union {
Column c; Column c;
Uint32 _align[2]; Uint32 _align[sizeof(Column)/sizeof(Uint32)];
}; };
bool disk = false; bool disk = false;
bool rowid = false; bool rowid = false;
......
...@@ -32,19 +32,33 @@ public: ...@@ -32,19 +32,33 @@ public:
bool find(Ptr<T>& ptr, Uint32 key) const { bool find(Ptr<T>& ptr, Uint32 key) const {
U rec; U rec;
rec.key = key; rec.key = key;
return m_ref.find(*(Ptr<U>*)&ptr, rec); Ptr<U> tmp;
bool ret = m_ref.find(tmp, rec);
ptr.i = tmp.i;
ptr.p = static_cast<T*>(tmp.p);
return ret;
} }
bool seize(Ptr<T> & ptr) { bool seize(Ptr<T> & ptr) {
return m_ref.seize(*(Ptr<U>*)&ptr); Ptr<U> tmp;
bool ret = m_ref.seize(tmp);
ptr.i = tmp.i;
ptr.p = static_cast<T*>(tmp.p);
return ret;
} }
void add(Ptr<T> & ptr) { void add(Ptr<T> & ptr) {
m_ref.add(*(Ptr<U>*)&ptr); Ptr<U> tmp;
tmp.i = ptr.i;
tmp.p = static_cast<U*>(ptr.p);
m_ref.add(tmp);
} }
void release(Ptr<T> & ptr) { void release(Ptr<T> & ptr) {
m_ref.release(*(Ptr<U>*)&ptr); Ptr<U> tmp;
tmp.i = ptr.i;
tmp.p = static_cast<U*>(ptr.p);
m_ref.release(tmp);
} }
}; };
......
...@@ -324,7 +324,10 @@ inline ...@@ -324,7 +324,10 @@ inline
void void
RecordPool<T, P>::release(Ptr<T> ptr) RecordPool<T, P>::release(Ptr<T> ptr)
{ {
m_pool.release(*(Ptr<void>*)&ptr); Ptr<void> tmp;
tmp.i = ptr.i;
tmp.p = ptr.p;
m_pool.release(tmp);
} }
#endif #endif
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