Commit 18d803c7 authored by unknown's avatar unknown

Merge perch.ndb.mysql.com:/home/jonas/src/51-telco-gca

into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new-ndb


sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_ndbcluster_binlog.cc:
  Auto merged
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp:
  Auto merged
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp:
  merge
storage/ndb/test/tools/Makefile.am:
  merge
parents 6ba1aa83 f760e188
...@@ -8112,7 +8112,7 @@ ndb_get_table_statistics(ha_ndbcluster* file, bool report_error, Ndb* ndb, const ...@@ -8112,7 +8112,7 @@ ndb_get_table_statistics(ha_ndbcluster* file, bool report_error, Ndb* ndb, const
NdbError error; NdbError error;
int retries= 10; int retries= 10;
int reterr= 0; int reterr= 0;
int retry_sleep= 30 * 1000; /* 30 milliseconds */ int retry_sleep= 30; /* 30 milliseconds, transaction */
#ifndef DBUG_OFF #ifndef DBUG_OFF
char buff[22], buff2[22], buff3[22], buff4[22]; char buff[22], buff2[22], buff3[22], buff4[22];
#endif #endif
......
...@@ -1021,6 +1021,7 @@ ndbcluster_update_slock(THD *thd, ...@@ -1021,6 +1021,7 @@ ndbcluster_update_slock(THD *thd,
const NDBTAB *ndbtab= ndbtab_g.get_table(); const NDBTAB *ndbtab= ndbtab_g.get_table();
NdbTransaction *trans= 0; NdbTransaction *trans= 0;
int retries= 100; int retries= 100;
int retry_sleep= 10; /* 10 milliseconds, transaction */
const NDBCOL *col[SCHEMA_SIZE]; const NDBCOL *col[SCHEMA_SIZE];
unsigned sz[SCHEMA_SIZE]; unsigned sz[SCHEMA_SIZE];
...@@ -1122,6 +1123,7 @@ ndbcluster_update_slock(THD *thd, ...@@ -1122,6 +1123,7 @@ ndbcluster_update_slock(THD *thd,
{ {
if (trans) if (trans)
ndb->closeTransaction(trans); ndb->closeTransaction(trans);
my_sleep(retry_sleep);
continue; // retry continue; // retry
} }
} }
...@@ -1333,6 +1335,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share, ...@@ -1333,6 +1335,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
const NDBTAB *ndbtab= ndbtab_g.get_table(); const NDBTAB *ndbtab= ndbtab_g.get_table();
NdbTransaction *trans= 0; NdbTransaction *trans= 0;
int retries= 100; int retries= 100;
int retry_sleep= 10; /* 10 milliseconds, transaction */
const NDBCOL *col[SCHEMA_SIZE]; const NDBCOL *col[SCHEMA_SIZE];
unsigned sz[SCHEMA_SIZE]; unsigned sz[SCHEMA_SIZE];
...@@ -1443,6 +1446,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share, ...@@ -1443,6 +1446,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
{ {
if (trans) if (trans)
ndb->closeTransaction(trans); ndb->closeTransaction(trans);
my_sleep(retry_sleep);
continue; // retry continue; // retry
} }
} }
...@@ -2841,6 +2845,11 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab, ...@@ -2841,6 +2845,11 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab,
TABLE *table= share->table; TABLE *table= share->table;
int retries= 100; int retries= 100;
/*
100 milliseconds, temporary error on schema operation can
take some time to be resolved
*/
int retry_sleep= 100;
while (1) while (1)
{ {
pthread_mutex_lock(&injector_mutex); pthread_mutex_lock(&injector_mutex);
...@@ -2969,7 +2978,10 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab, ...@@ -2969,7 +2978,10 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab,
ndb->dropEventOperation(op); ndb->dropEventOperation(op);
pthread_mutex_unlock(&injector_mutex); pthread_mutex_unlock(&injector_mutex);
if (retries) if (retries)
{
my_sleep(retry_sleep);
continue; continue;
}
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
pthread_mutex_unlock(&injector_mutex); pthread_mutex_unlock(&injector_mutex);
......
...@@ -1021,18 +1021,12 @@ ArrayPool<TupTriggerData> c_triggerPool; ...@@ -1021,18 +1021,12 @@ ArrayPool<TupTriggerData> c_triggerPool;
Uint8 m_null_words; Uint8 m_null_words;
Uint8 m_null_offset; Uint8 m_null_offset;
Uint16 m_disk_ref_offset; // In words relative m_data Uint16 m_disk_ref_offset; // In words relative m_data
union { Uint16 m_fix_header_size; // For fix size tuples= total rec size(part)
Uint16 m_varpart_offset; // In words relative m_data
Uint16 m_fix_header_size; // For fix size tuples= total rec size(part)
};
Uint16 m_max_var_offset; // In bytes relative m_var_data.m_data_ptr Uint16 m_max_var_offset; // In bytes relative m_var_data.m_data_ptr
} m_offsets[2]; } m_offsets[2];
Uint32 get_check_offset(Uint32 mm) const { Uint32 get_check_offset(Uint32 mm) const {
Uint32 cnt= m_attributes[mm].m_no_of_varsize; return m_offsets[mm].m_fix_header_size;
Uint32 off= m_offsets[mm].m_varpart_offset;
return off - (cnt ? 0 : Tuple_header::HeaderSize);
} }
struct { struct {
...@@ -1321,6 +1315,11 @@ typedef Ptr<HostBuffer> HostBufferPtr; ...@@ -1321,6 +1315,11 @@ typedef Ptr<HostBuffer> HostBufferPtr;
#endif #endif
}; };
struct Disk_part_ref
{
STATIC_CONST( SZ32 = 2 );
};
struct Tuple_header struct Tuple_header
{ {
union { union {
...@@ -1370,14 +1369,24 @@ typedef Ptr<HostBuffer> HostBufferPtr; ...@@ -1370,14 +1369,24 @@ typedef Ptr<HostBuffer> HostBufferPtr;
return m_null_bits+tabPtrP->m_offsets[mm].m_null_offset; return m_null_bits+tabPtrP->m_offsets[mm].m_null_offset;
} }
Uint32* get_var_part_ptr(const Tablerec* tabPtrP) { Var_part_ref* get_var_part_ref_ptr(const Tablerec* tabPtrP) {
return m_data + tabPtrP->m_offsets[MM].m_varpart_offset; return (Var_part_ref*)(get_disk_ref_ptr(tabPtrP) + Disk_part_ref::SZ32);
} }
const Uint32* get_var_part_ptr(const Tablerec* tabPtrP) const { const Var_part_ref* get_var_part_ref_ptr(const Tablerec* tabPtrP) const {
return m_data + tabPtrP->m_offsets[MM].m_varpart_offset; return (Var_part_ref*)(get_disk_ref_ptr(tabPtrP) + Disk_part_ref::SZ32);
} }
Uint32* get_end_of_fix_part_ptr(const Tablerec* tabPtrP) {
return m_data + tabPtrP->m_offsets[MM].m_fix_header_size -
Tuple_header::HeaderSize;
}
const Uint32* get_end_of_fix_part_ptr(const Tablerec* tabPtrP) const {
return m_data + tabPtrP->m_offsets[MM].m_fix_header_size -
Tuple_header::HeaderSize;
}
Uint32* get_disk_ref_ptr(const Tablerec* tabPtrP) { Uint32* get_disk_ref_ptr(const Tablerec* tabPtrP) {
return m_data + tabPtrP->m_offsets[MM].m_disk_ref_offset; return m_data + tabPtrP->m_offsets[MM].m_disk_ref_offset;
} }
......
...@@ -152,8 +152,7 @@ void Dbtup::do_tup_abortreq(Signal* signal, Uint32 flags) ...@@ -152,8 +152,7 @@ void Dbtup::do_tup_abortreq(Signal* signal, Uint32 flags)
ndbassert(tuple_ptr->m_header_bits & Tuple_header::CHAINED_ROW); ndbassert(tuple_ptr->m_header_bits & Tuple_header::CHAINED_ROW);
Var_part_ref *ref = Var_part_ref *ref = tuple_ptr->get_var_part_ref_ptr(regTabPtr.p);
(Var_part_ref*)tuple_ptr->get_var_part_ptr(regTabPtr.p);
Local_key tmp; Local_key tmp;
ref->copyout(&tmp); ref->copyout(&tmp);
......
...@@ -233,16 +233,22 @@ Dbtup::commit_operation(Signal* signal, ...@@ -233,16 +233,22 @@ Dbtup::commit_operation(Signal* signal,
} }
else else
{ {
Var_part_ref *ref= (Var_part_ref*)tuple_ptr->get_var_part_ptr(regTabPtr); /**
memcpy(tuple_ptr, copy, 4*(Tuple_header::HeaderSize+fixsize)); * Var_part_ref is only stored in *allocated* tuple
* so memcpy from copy, will over write it...
* hence subtle copyout/assign...
*/
Local_key tmp; Local_key tmp;
Var_part_ref *ref= tuple_ptr->get_var_part_ref_ptr(regTabPtr);
ref->copyout(&tmp); ref->copyout(&tmp);
memcpy(tuple_ptr, copy, 4*fixsize);
ref->assign(&tmp);
PagePtr vpagePtr; PagePtr vpagePtr;
Uint32 *dst= get_ptr(&vpagePtr, *ref); Uint32 *dst= get_ptr(&vpagePtr, *ref);
Var_page* vpagePtrP = (Var_page*)vpagePtr.p; Var_page* vpagePtrP = (Var_page*)vpagePtr.p;
Uint32 *src= copy->get_var_part_ptr(regTabPtr); Uint32 *src= copy->get_end_of_fix_part_ptr(regTabPtr);
Uint32 sz= ((mm_vars + 1) << 1) + (((Uint16*)src)[mm_vars]); Uint32 sz= ((mm_vars + 1) << 1) + (((Uint16*)src)[mm_vars]);
ndbassert(4*vpagePtrP->get_entry_len(tmp.m_page_idx) >= sz); ndbassert(4*vpagePtrP->get_entry_len(tmp.m_page_idx) >= sz);
memcpy(dst, src, sz); memcpy(dst, src, sz);
...@@ -255,9 +261,8 @@ Dbtup::commit_operation(Signal* signal, ...@@ -255,9 +261,8 @@ Dbtup::commit_operation(Signal* signal,
update_free_page_list(regFragPtr, vpagePtr); update_free_page_list(regFragPtr, vpagePtr);
} }
disk_ptr = (Tuple_header*) disk_ptr = (Tuple_header*)(((Uint32*)copy)+fixsize+((sz + 3) >> 2));
(((Uint32*)copy)+Tuple_header::HeaderSize+fixsize+((sz + 3) >> 2)); }
}
if (regTabPtr->m_no_of_disk_attributes && if (regTabPtr->m_no_of_disk_attributes &&
(copy_bits & Tuple_header::DISK_INLINE)) (copy_bits & Tuple_header::DISK_INLINE))
......
...@@ -366,7 +366,7 @@ operator<<(NdbOut& out, const Dbtup::Tablerec::Tuple_offsets& off) ...@@ -366,7 +366,7 @@ operator<<(NdbOut& out, const Dbtup::Tablerec::Tuple_offsets& off)
out << "[ null_words: " << (Uint32)off.m_null_words out << "[ null_words: " << (Uint32)off.m_null_words
<< " null off: " << (Uint32)off.m_null_offset << " null off: " << (Uint32)off.m_null_offset
<< " disk_off: " << off.m_disk_ref_offset << " disk_off: " << off.m_disk_ref_offset
<< " var_off: " << off.m_varpart_offset << " fixheadsz: " << off.m_fix_header_size
<< " max_var_off: " << off.m_max_var_offset << " max_var_off: " << off.m_max_var_offset
<< " ]"; << " ]";
......
...@@ -222,9 +222,6 @@ Dbtup::calculateChecksum(Tuple_header* tuple_ptr, ...@@ -222,9 +222,6 @@ Dbtup::calculateChecksum(Tuple_header* tuple_ptr,
// includes tupVersion // includes tupVersion
//printf("%p - ", tuple_ptr); //printf("%p - ", tuple_ptr);
if (regTabPtr->m_attributes[MM].m_no_of_varsize)
rec_size += Tuple_header::HeaderSize;
for (i= 0; i < rec_size-2; i++) { for (i= 0; i < rec_size-2; i++) {
checksum ^= tuple_header[i]; checksum ^= tuple_header[i];
//printf("%.8x ", tuple_header[i]); //printf("%.8x ", tuple_header[i]);
...@@ -1107,7 +1104,7 @@ Dbtup::prepare_initial_insert(KeyReqStruct *req_struct, ...@@ -1107,7 +1104,7 @@ Dbtup::prepare_initial_insert(KeyReqStruct *req_struct,
const Uint32 cnt1= regTabPtr->m_attributes[MM].m_no_of_varsize; const Uint32 cnt1= regTabPtr->m_attributes[MM].m_no_of_varsize;
const Uint32 cnt2= regTabPtr->m_attributes[DD].m_no_of_varsize; const Uint32 cnt2= regTabPtr->m_attributes[DD].m_no_of_varsize;
Uint32 *ptr= req_struct->m_tuple_ptr->get_var_part_ptr(regTabPtr); Uint32 *ptr= req_struct->m_tuple_ptr->get_end_of_fix_part_ptr(regTabPtr);
if(cnt1) if(cnt1)
{ {
...@@ -1129,22 +1126,10 @@ Dbtup::prepare_initial_insert(KeyReqStruct *req_struct, ...@@ -1129,22 +1126,10 @@ Dbtup::prepare_initial_insert(KeyReqStruct *req_struct,
pos += AttributeDescriptor::getSizeInBytes(tab_descr[*order++].tabDescr); pos += AttributeDescriptor::getSizeInBytes(tab_descr[*order++].tabDescr);
} }
} }
else
{
ptr -= Tuple_header::HeaderSize;
}
req_struct->m_disk_ptr= (Tuple_header*)ptr; req_struct->m_disk_ptr= (Tuple_header*)ptr;
if(cnt2) ndbrequire(cnt2 == 0);
{
KeyReqStruct::Var_data *dst= &req_struct->m_var_data[DD];
ptr=((Tuple_header*)ptr)->m_data+regTabPtr->m_offsets[DD].m_varpart_offset;
dst->m_data_ptr= (char*)(((Uint16*)ptr)+cnt2+1);
dst->m_offset_array_ptr= req_struct->var_pos_array + (cnt1 << 1);
dst->m_var_len_offset= cnt2;
dst->m_max_var_offset= regTabPtr->m_offsets[DD].m_max_var_offset;
}
// Set all null bits // Set all null bits
memset(req_struct->m_tuple_ptr->m_null_bits+ memset(req_struct->m_tuple_ptr->m_null_bits+
...@@ -2524,13 +2509,14 @@ Dbtup::expand_tuple(KeyReqStruct* req_struct, ...@@ -2524,13 +2509,14 @@ Dbtup::expand_tuple(KeyReqStruct* req_struct,
Uint16 dd_tot= tabPtrP->m_no_of_disk_attributes; Uint16 dd_tot= tabPtrP->m_no_of_disk_attributes;
Uint16 mm_vars= tabPtrP->m_attributes[MM].m_no_of_varsize; Uint16 mm_vars= tabPtrP->m_attributes[MM].m_no_of_varsize;
Uint32 fix_size= tabPtrP->m_offsets[MM].m_varpart_offset; Uint32 fix_size= tabPtrP->m_offsets[MM].m_fix_header_size;
Uint32 order_desc= tabPtrP->m_real_order_descriptor; Uint32 order_desc= tabPtrP->m_real_order_descriptor;
Uint32 *dst_ptr= ptr->get_var_part_ptr(tabPtrP); Uint32 *dst_ptr= ptr->get_end_of_fix_part_ptr(tabPtrP);
const Uint32 *disk_ref= src->get_disk_ref_ptr(tabPtrP); const Uint32 *disk_ref= src->get_disk_ref_ptr(tabPtrP);
const Uint32 *src_ptr= src->get_var_part_ptr(tabPtrP); const Uint32 *src_ptr= src->get_end_of_fix_part_ptr(tabPtrP);
const Uint32 * desc= (Uint32*)req_struct->attr_descr; const Var_part_ref* var_ref = src->get_var_part_ref_ptr(tabPtrP);
const Uint32 *desc= (Uint32*)req_struct->attr_descr;
const Uint16 *order = (Uint16*)(&tableDescriptor[order_desc]); const Uint16 *order = (Uint16*)(&tableDescriptor[order_desc]);
order += tabPtrP->m_attributes[MM].m_no_of_fixsize; order += tabPtrP->m_attributes[MM].m_no_of_fixsize;
...@@ -2543,7 +2529,7 @@ Dbtup::expand_tuple(KeyReqStruct* req_struct, ...@@ -2543,7 +2529,7 @@ Dbtup::expand_tuple(KeyReqStruct* req_struct,
if(bits & Tuple_header::CHAINED_ROW) if(bits & Tuple_header::CHAINED_ROW)
{ {
Ptr<Page> var_page; Ptr<Page> var_page;
src_data= get_ptr(&var_page, * (Var_part_ref*)src_ptr); src_data= get_ptr(&var_page, *var_ref);
step= 4; step= 4;
sizes[MM]= (2 + (mm_vars << 1) + ((Uint16*)src_data)[mm_vars] + 3) >> 2; sizes[MM]= (2 + (mm_vars << 1) + ((Uint16*)src_data)[mm_vars] + 3) >> 2;
req_struct->m_varpart_page_ptr = var_page; req_struct->m_varpart_page_ptr = var_page;
...@@ -2564,14 +2550,12 @@ Dbtup::expand_tuple(KeyReqStruct* req_struct, ...@@ -2564,14 +2550,12 @@ Dbtup::expand_tuple(KeyReqStruct* req_struct,
ndbassert((UintPtr(src_ptr) & 3) == 0); ndbassert((UintPtr(src_ptr) & 3) == 0);
src_ptr = ALIGN_WORD(((char*)src_ptr)+step); src_ptr = ALIGN_WORD(((char*)src_ptr)+step);
sizes[MM] += fix_size + Tuple_header::HeaderSize; sizes[MM] += fix_size;
memcpy(ptr, src, 4*(fix_size + Tuple_header::HeaderSize)); memcpy(ptr, src, 4*fix_size);
} }
else else
{ {
sizes[MM]= 1; sizes[MM]= 1;
dst_ptr -= Tuple_header::HeaderSize;
src_ptr -= Tuple_header::HeaderSize;
memcpy(ptr, src, 4*fix_size); memcpy(ptr, src, 4*fix_size);
} }
...@@ -2605,20 +2589,7 @@ Dbtup::expand_tuple(KeyReqStruct* req_struct, ...@@ -2605,20 +2589,7 @@ Dbtup::expand_tuple(KeyReqStruct* req_struct,
ndbassert(! (req_struct->m_disk_ptr->m_header_bits & Tuple_header::FREE)); ndbassert(! (req_struct->m_disk_ptr->m_header_bits & Tuple_header::FREE));
if(dd_vars) ndbrequire(dd_vars == 0);
{
KeyReqStruct::Var_data* dst= &req_struct->m_var_data[DD];
dst_ptr += tabPtrP->m_offsets[DD].m_varpart_offset;
src_ptr += tabPtrP->m_offsets[DD].m_varpart_offset;
order += tabPtrP->m_attributes[DD].m_no_of_fixsize;
dst->m_data_ptr= (char*)(char*)(((Uint16*)dst_ptr)+dd_vars+1);
dst->m_offset_array_ptr= req_struct->var_pos_array + (mm_vars << 1);
dst->m_var_len_offset= dd_vars;
dst->m_max_var_offset= tabPtrP->m_offsets[DD].m_max_var_offset;
expand_var_part(dst, src_ptr, desc, order);
}
} }
ptr->m_header_bits= (bits & ~(Uint32)(Tuple_header::CHAINED_ROW)); ptr->m_header_bits= (bits & ~(Uint32)(Tuple_header::CHAINED_ROW));
...@@ -2634,9 +2605,9 @@ Dbtup::prepare_read(KeyReqStruct* req_struct, ...@@ -2634,9 +2605,9 @@ Dbtup::prepare_read(KeyReqStruct* req_struct,
Uint16 dd_tot= tabPtrP->m_no_of_disk_attributes; Uint16 dd_tot= tabPtrP->m_no_of_disk_attributes;
Uint16 mm_vars= tabPtrP->m_attributes[MM].m_no_of_varsize; Uint16 mm_vars= tabPtrP->m_attributes[MM].m_no_of_varsize;
const Uint32 *src_ptr= ptr->get_var_part_ptr(tabPtrP); const Uint32 *src_ptr= ptr->get_end_of_fix_part_ptr(tabPtrP);
const Uint32 *disk_ref= ptr->get_disk_ref_ptr(tabPtrP); const Uint32 *disk_ref= ptr->get_disk_ref_ptr(tabPtrP);
const Var_part_ref* var_ref = ptr->get_var_part_ref_ptr(tabPtrP);
if(mm_vars) if(mm_vars)
{ {
const Uint32 *src_data= src_ptr; const Uint32 *src_data= src_ptr;
...@@ -2646,7 +2617,7 @@ Dbtup::prepare_read(KeyReqStruct* req_struct, ...@@ -2646,7 +2617,7 @@ Dbtup::prepare_read(KeyReqStruct* req_struct,
#if VM_TRACE #if VM_TRACE
#endif #endif
src_data= get_ptr(* (Var_part_ref*)src_ptr); src_data= get_ptr(* var_ref);
} }
dst->m_data_ptr= (char*)(((Uint16*)src_data)+mm_vars+1); dst->m_data_ptr= (char*)(((Uint16*)src_data)+mm_vars+1);
dst->m_offset_array_ptr= (Uint16*)src_data; dst->m_offset_array_ptr= (Uint16*)src_data;
...@@ -2656,11 +2627,6 @@ Dbtup::prepare_read(KeyReqStruct* req_struct, ...@@ -2656,11 +2627,6 @@ Dbtup::prepare_read(KeyReqStruct* req_struct,
// disk part start after varsize (aligned) // disk part start after varsize (aligned)
src_ptr = ALIGN_WORD(dst->m_data_ptr + dst->m_max_var_offset); src_ptr = ALIGN_WORD(dst->m_data_ptr + dst->m_max_var_offset);
} }
else
{
// disk part if after fixsize part...
src_ptr -= Tuple_header::HeaderSize;
}
if(disk && dd_tot) if(disk && dd_tot)
{ {
...@@ -2682,16 +2648,7 @@ Dbtup::prepare_read(KeyReqStruct* req_struct, ...@@ -2682,16 +2648,7 @@ Dbtup::prepare_read(KeyReqStruct* req_struct,
// Fix diskpart // Fix diskpart
req_struct->m_disk_ptr= (Tuple_header*)src_ptr; req_struct->m_disk_ptr= (Tuple_header*)src_ptr;
ndbassert(! (req_struct->m_disk_ptr->m_header_bits & Tuple_header::FREE)); ndbassert(! (req_struct->m_disk_ptr->m_header_bits & Tuple_header::FREE));
if(dd_vars) ndbrequire(dd_vars == 0);
{
KeyReqStruct::Var_data* dst= &req_struct->m_var_data[DD];
src_ptr += tabPtrP->m_offsets[DD].m_varpart_offset;
dst->m_data_ptr= (char*)(char*)(((Uint16*)src_ptr)+dd_vars+1);
dst->m_offset_array_ptr= (Uint16*)src_ptr;
dst->m_var_len_offset= 1;
dst->m_max_var_offset= ((Uint16*)src_ptr)[dd_vars];
}
} }
} }
...@@ -2706,10 +2663,11 @@ Dbtup::shrink_tuple(KeyReqStruct* req_struct, Uint32 sizes[2], ...@@ -2706,10 +2663,11 @@ Dbtup::shrink_tuple(KeyReqStruct* req_struct, Uint32 sizes[2],
Uint16 mm_vars= tabPtrP->m_attributes[MM].m_no_of_varsize; Uint16 mm_vars= tabPtrP->m_attributes[MM].m_no_of_varsize;
Uint16 dd_vars= tabPtrP->m_attributes[DD].m_no_of_varsize; Uint16 dd_vars= tabPtrP->m_attributes[DD].m_no_of_varsize;
Uint32 *dst_ptr= ptr->get_var_part_ptr(tabPtrP); Uint32 *dst_ptr= ptr->get_end_of_fix_part_ptr(tabPtrP);
Uint16* src_off_ptr= req_struct->var_pos_array; Uint16* src_off_ptr= req_struct->var_pos_array;
sizes[MM]= sizes[DD]= 0; sizes[MM] = 1;
sizes[DD] = 0;
if(mm_vars) if(mm_vars)
{ {
Uint16* dst_off_ptr= (Uint16*)dst_ptr; Uint16* dst_off_ptr= (Uint16*)dst_ptr;
...@@ -2733,25 +2691,14 @@ Dbtup::shrink_tuple(KeyReqStruct* req_struct, Uint32 sizes[2], ...@@ -2733,25 +2691,14 @@ Dbtup::shrink_tuple(KeyReqStruct* req_struct, Uint32 sizes[2],
dst_ptr = ALIGN_WORD(dst_data_ptr); dst_ptr = ALIGN_WORD(dst_data_ptr);
} }
else
{
sizes[MM] = 1;
dst_ptr -= Tuple_header::HeaderSize;
}
if(disk && dd_tot) if(disk && dd_tot)
{ {
Uint32 * src_ptr = (Uint32*)req_struct->m_disk_ptr; Uint32 * src_ptr = (Uint32*)req_struct->m_disk_ptr;
req_struct->m_disk_ptr = (Tuple_header*)dst_ptr; req_struct->m_disk_ptr = (Tuple_header*)dst_ptr;
if (unlikely(dd_vars)) ndbrequire(dd_vars == 0);
{ sizes[DD] = tabPtrP->m_offsets[DD].m_fix_header_size;
abort(); memmove(dst_ptr, src_ptr, 4*tabPtrP->m_offsets[DD].m_fix_header_size);
}
else
{
sizes[DD] = tabPtrP->m_offsets[DD].m_fix_header_size;
memmove(dst_ptr, src_ptr, 4*tabPtrP->m_offsets[DD].m_fix_header_size);
}
} }
} }
...@@ -2785,7 +2732,7 @@ Dbtup::validate_page(Tablerec* regTabPtr, Var_page* p) ...@@ -2785,7 +2732,7 @@ Dbtup::validate_page(Tablerec* regTabPtr, Var_page* p)
if(!(idx & Var_page::FREE) && !(idx & Var_page::CHAIN)) if(!(idx & Var_page::FREE) && !(idx & Var_page::CHAIN))
{ {
Tuple_header *ptr= (Tuple_header*)page->get_ptr(i); Tuple_header *ptr= (Tuple_header*)page->get_ptr(i);
Uint32 *part= ptr->get_var_part_ptr(regTabPtr); Uint32 *part= ptr->get_end_of_fix_part_ptr(regTabPtr);
if(ptr->m_header_bits & Tuple_header::CHAINED_ROW) if(ptr->m_header_bits & Tuple_header::CHAINED_ROW)
{ {
ndbassert(len == fix_sz + 1); ndbassert(len == fix_sz + 1);
...@@ -2849,8 +2796,7 @@ Dbtup::handle_size_change_after_update(KeyReqStruct* req_struct, ...@@ -2849,8 +2796,7 @@ Dbtup::handle_size_change_after_update(KeyReqStruct* req_struct,
Uint32 bits= org->m_header_bits; Uint32 bits= org->m_header_bits;
Uint32 copy_bits= req_struct->m_tuple_ptr->m_header_bits; Uint32 copy_bits= req_struct->m_tuple_ptr->m_header_bits;
Uint32 fix_sz = Tuple_header::HeaderSize + Uint32 fix_sz = regTabPtr->m_offsets[MM].m_fix_header_size;
regTabPtr->m_offsets[MM].m_fix_header_size;
if(sizes[MM] == sizes[2+MM]) if(sizes[MM] == sizes[2+MM])
; ;
...@@ -2865,7 +2811,7 @@ Dbtup::handle_size_change_after_update(KeyReqStruct* req_struct, ...@@ -2865,7 +2811,7 @@ Dbtup::handle_size_change_after_update(KeyReqStruct* req_struct,
Ptr<Page> pagePtr = req_struct->m_varpart_page_ptr; Ptr<Page> pagePtr = req_struct->m_varpart_page_ptr;
Var_page* pageP= (Var_page*)pagePtr.p; Var_page* pageP= (Var_page*)pagePtr.p;
Uint32 idx, alloc, needed; Uint32 idx, alloc, needed;
Var_part_ref *refptr = (Var_part_ref*)org->get_var_part_ptr(regTabPtr); Var_part_ref *refptr = org->get_var_part_ref_ptr(regTabPtr);
ndbassert(bits & Tuple_header::CHAINED_ROW); ndbassert(bits & Tuple_header::CHAINED_ROW);
Local_key ref; Local_key ref;
...@@ -2914,18 +2860,7 @@ Dbtup::nr_update_gci(Uint32 fragPtrI, const Local_key* key, Uint32 gci) ...@@ -2914,18 +2860,7 @@ Dbtup::nr_update_gci(Uint32 fragPtrI, const Local_key* key, Uint32 gci)
Local_key tmp = *key; Local_key tmp = *key;
PagePtr page_ptr; PagePtr page_ptr;
int ret; int ret = alloc_page(tablePtr.p, fragPtr.p, &page_ptr, tmp.m_page_no);
if (tablePtr.p->m_attributes[MM].m_no_of_varsize)
{
const Uint32 XXX = Tuple_header::HeaderSize+Var_part_ref::SZ32;
tablePtr.p->m_offsets[MM].m_fix_header_size += XXX;
ret = alloc_page(tablePtr.p, fragPtr.p, &page_ptr, tmp.m_page_no);
tablePtr.p->m_offsets[MM].m_fix_header_size -= XXX;
}
else
{
ret = alloc_page(tablePtr.p, fragPtr.p, &page_ptr, tmp.m_page_no);
}
if (ret) if (ret)
return -1; return -1;
...@@ -2953,19 +2888,9 @@ Dbtup::nr_read_pk(Uint32 fragPtrI, ...@@ -2953,19 +2888,9 @@ Dbtup::nr_read_pk(Uint32 fragPtrI,
Local_key tmp = *key; Local_key tmp = *key;
int ret;
PagePtr page_ptr; PagePtr page_ptr;
if (tablePtr.p->m_attributes[MM].m_no_of_varsize) int ret = alloc_page(tablePtr.p, fragPtr.p, &page_ptr, tmp.m_page_no);
{
const Uint32 XXX = Tuple_header::HeaderSize+Var_part_ref::SZ32;
tablePtr.p->m_offsets[MM].m_fix_header_size += XXX;
ret = alloc_page(tablePtr.p, fragPtr.p, &page_ptr, tmp.m_page_no);
tablePtr.p->m_offsets[MM].m_fix_header_size -= XXX;
}
else
{
ret = alloc_page(tablePtr.p, fragPtr.p, &page_ptr, tmp.m_page_no);
}
if (ret) if (ret)
return -1; return -1;
......
...@@ -476,8 +476,7 @@ Dbtup::buildIndex(Signal* signal, Uint32 buildPtrI) ...@@ -476,8 +476,7 @@ Dbtup::buildIndex(Signal* signal, Uint32 buildPtrI)
ptrCheckGuard(tablePtr, cnoOfTablerec, tablerec); ptrCheckGuard(tablePtr, cnoOfTablerec, tablerec);
const Uint32 firstTupleNo = 0; const Uint32 firstTupleNo = 0;
const Uint32 tupheadsize = tablePtr.p->m_offsets[MM].m_fix_header_size + const Uint32 tupheadsize = tablePtr.p->m_offsets[MM].m_fix_header_size;
(buildPtr.p->m_build_vs? Tuple_header::HeaderSize + Var_part_ref::SZ32: 0);
#ifdef TIME_MEASUREMENT #ifdef TIME_MEASUREMENT
MicroSecondTimer start; MicroSecondTimer start;
......
...@@ -175,12 +175,12 @@ void Dbtup::execTUPFRAGREQ(Signal* signal) ...@@ -175,12 +175,12 @@ void Dbtup::execTUPFRAGREQ(Signal* signal)
regTabPtr.p->m_offsets[MM].m_disk_ref_offset= 0; regTabPtr.p->m_offsets[MM].m_disk_ref_offset= 0;
regTabPtr.p->m_offsets[MM].m_null_words= 0; regTabPtr.p->m_offsets[MM].m_null_words= 0;
regTabPtr.p->m_offsets[MM].m_varpart_offset= 0; regTabPtr.p->m_offsets[MM].m_fix_header_size= 0;
regTabPtr.p->m_offsets[MM].m_max_var_offset= 0; regTabPtr.p->m_offsets[MM].m_max_var_offset= 0;
regTabPtr.p->m_offsets[DD].m_disk_ref_offset= 0; regTabPtr.p->m_offsets[DD].m_disk_ref_offset= 0;
regTabPtr.p->m_offsets[DD].m_null_words= 0; regTabPtr.p->m_offsets[DD].m_null_words= 0;
regTabPtr.p->m_offsets[DD].m_varpart_offset= 0; regTabPtr.p->m_offsets[DD].m_fix_header_size= 0;
regTabPtr.p->m_offsets[DD].m_max_var_offset= 0; regTabPtr.p->m_offsets[DD].m_max_var_offset= 0;
regTabPtr.p->m_attributes[MM].m_no_of_fixsize= 0; regTabPtr.p->m_attributes[MM].m_no_of_fixsize= 0;
...@@ -463,7 +463,19 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* signal) ...@@ -463,7 +463,19 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* signal)
if(regTabPtr.p->m_no_of_disk_attributes > 0) if(regTabPtr.p->m_no_of_disk_attributes > 0)
{ {
regTabPtr.p->m_offsets[MM].m_disk_ref_offset= pos[MM]; regTabPtr.p->m_offsets[MM].m_disk_ref_offset= pos[MM];
pos[MM] += 2; // 8 bytes pos[MM] += Disk_part_ref::SZ32; // 8 bytes
}
else
{
/**
* var part ref is stored at m_disk_ref_offset + Disk_part_ref::SZ32
*/
regTabPtr.p->m_offsets[MM].m_disk_ref_offset= pos[MM]-Disk_part_ref::SZ32;
}
if (regTabPtr.p->m_attributes[MM].m_no_of_varsize)
{
pos[MM] += Var_part_ref::SZ32;
} }
regTabPtr.p->m_offsets[MM].m_null_offset= pos[MM]; regTabPtr.p->m_offsets[MM].m_null_offset= pos[MM];
...@@ -489,16 +501,14 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* signal) ...@@ -489,16 +501,14 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* signal)
} }
regTabPtr.p->m_offsets[MM].m_fix_header_size= regTabPtr.p->m_offsets[MM].m_fix_header_size=
Tuple_header::HeaderSize +
fragOperPtr.p->m_fix_attributes_size[MM] + fragOperPtr.p->m_fix_attributes_size[MM] +
pos[MM]; pos[MM];
regTabPtr.p->m_offsets[DD].m_fix_header_size= regTabPtr.p->m_offsets[DD].m_fix_header_size=
fragOperPtr.p->m_fix_attributes_size[DD] + fragOperPtr.p->m_fix_attributes_size[DD] +
pos[DD]; pos[DD];
if(regTabPtr.p->m_attributes[MM].m_no_of_varsize == 0)
regTabPtr.p->m_offsets[MM].m_fix_header_size += Tuple_header::HeaderSize;
if(regTabPtr.p->m_attributes[DD].m_no_of_varsize == 0 && if(regTabPtr.p->m_attributes[DD].m_no_of_varsize == 0 &&
regTabPtr.p->m_attributes[DD].m_no_of_fixsize > 0) regTabPtr.p->m_attributes[DD].m_no_of_fixsize > 0)
regTabPtr.p->m_offsets[DD].m_fix_header_size += Tuple_header::HeaderSize; regTabPtr.p->m_offsets[DD].m_fix_header_size += Tuple_header::HeaderSize;
...@@ -538,8 +548,6 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* signal) ...@@ -538,8 +548,6 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* signal)
{ {
Uint32 fix_tupheader = regTabPtr.p->m_offsets[MM].m_fix_header_size; Uint32 fix_tupheader = regTabPtr.p->m_offsets[MM].m_fix_header_size;
if(regTabPtr.p->m_attributes[MM].m_no_of_varsize != 0)
fix_tupheader += Tuple_header::HeaderSize + Var_part_ref::SZ32;
ndbassert(fix_tupheader > 0); ndbassert(fix_tupheader > 0);
Uint32 noRowsPerPage = ZWORDS_ON_PAGE / fix_tupheader; Uint32 noRowsPerPage = ZWORDS_ON_PAGE / fix_tupheader;
Uint32 noAllocatedPages = Uint32 noAllocatedPages =
......
...@@ -600,8 +600,7 @@ Dbtup::scanNext(Signal* signal, ScanOpPtr scanPtr) ...@@ -600,8 +600,7 @@ Dbtup::scanNext(Signal* signal, ScanOpPtr scanPtr)
const bool lcp = (bits & ScanOp::SCAN_LCP); const bool lcp = (bits & ScanOp::SCAN_LCP);
Uint32 lcp_list = fragPtr.p->m_lcp_keep_list; Uint32 lcp_list = fragPtr.p->m_lcp_keep_list;
Uint32 size = table.m_offsets[mm].m_fix_header_size + Uint32 size = table.m_offsets[mm].m_fix_header_size;
(bits&ScanOp::SCAN_VS ? Tuple_header::HeaderSize + Var_part_ref::SZ32 : 0);
if (lcp && lcp_list != RNIL) if (lcp && lcp_list != RNIL)
goto found_lcp_keep; goto found_lcp_keep;
......
...@@ -68,27 +68,22 @@ Uint32* Dbtup::alloc_var_rec(Fragrecord* fragPtr, ...@@ -68,27 +68,22 @@ Uint32* Dbtup::alloc_var_rec(Fragrecord* fragPtr,
/** /**
* TODO alloc fix+var part * TODO alloc fix+var part
*/ */
const Uint32 XXX = Tuple_header::HeaderSize + Var_part_ref::SZ32;
tabPtr->m_offsets[MM].m_fix_header_size += XXX;
Uint32 *ptr = alloc_fix_rec(fragPtr, tabPtr, key, out_frag_page_id); Uint32 *ptr = alloc_fix_rec(fragPtr, tabPtr, key, out_frag_page_id);
tabPtr->m_offsets[MM].m_fix_header_size -= XXX;
if (unlikely(ptr == 0)) if (unlikely(ptr == 0))
{ {
return 0; return 0;
} }
ndbassert(alloc_size >= tabPtr->m_offsets[MM].m_fix_header_size + ndbassert(alloc_size >= tabPtr->m_offsets[MM].m_fix_header_size);
Tuple_header::HeaderSize);
alloc_size -= tabPtr->m_offsets[MM].m_fix_header_size + alloc_size -= tabPtr->m_offsets[MM].m_fix_header_size;
Tuple_header::HeaderSize;
Local_key varref; Local_key varref;
if (likely(alloc_var_part(fragPtr, tabPtr, alloc_size, &varref) != 0)) if (likely(alloc_var_part(fragPtr, tabPtr, alloc_size, &varref) != 0))
{ {
Tuple_header* tuple = (Tuple_header*)ptr; Tuple_header* tuple = (Tuple_header*)ptr;
Var_part_ref* dst = (Var_part_ref*)tuple->get_var_part_ptr(tabPtr); Var_part_ref* dst = tuple->get_var_part_ref_ptr(tabPtr);
dst->assign(&varref); dst->assign(&varref);
return ptr; return ptr;
} }
...@@ -166,7 +161,7 @@ void Dbtup::free_var_rec(Fragrecord* fragPtr, ...@@ -166,7 +161,7 @@ void Dbtup::free_var_rec(Fragrecord* fragPtr,
Tuple_header* tuple = (Tuple_header*)ptr; Tuple_header* tuple = (Tuple_header*)ptr;
Local_key ref; Local_key ref;
Var_part_ref * varref = (Var_part_ref*)tuple->get_var_part_ptr(tabPtr); Var_part_ref * varref = tuple->get_var_part_ref_ptr(tabPtr);
varref->copyout(&ref); varref->copyout(&ref);
free_fix_rec(fragPtr, tabPtr, key, (Fix_page*)pagePtr.p); free_fix_rec(fragPtr, tabPtr, key, (Fix_page*)pagePtr.p);
...@@ -398,26 +393,21 @@ Dbtup::alloc_var_rowid(Fragrecord* fragPtr, ...@@ -398,26 +393,21 @@ Dbtup::alloc_var_rowid(Fragrecord* fragPtr,
Local_key* key, Local_key* key,
Uint32 * out_frag_page_id) Uint32 * out_frag_page_id)
{ {
const Uint32 XXX = Tuple_header::HeaderSize + Var_part_ref::SZ32;
tabPtr->m_offsets[MM].m_fix_header_size += XXX;
Uint32 *ptr = alloc_fix_rowid(fragPtr, tabPtr, key, out_frag_page_id); Uint32 *ptr = alloc_fix_rowid(fragPtr, tabPtr, key, out_frag_page_id);
tabPtr->m_offsets[MM].m_fix_header_size -= XXX;
if (unlikely(ptr == 0)) if (unlikely(ptr == 0))
{ {
return 0; return 0;
} }
ndbassert(alloc_size >= tabPtr->m_offsets[MM].m_fix_header_size + ndbassert(alloc_size >= tabPtr->m_offsets[MM].m_fix_header_size);
Tuple_header::HeaderSize);
alloc_size -= tabPtr->m_offsets[MM].m_fix_header_size + alloc_size -= tabPtr->m_offsets[MM].m_fix_header_size;
Tuple_header::HeaderSize;
Local_key varref; Local_key varref;
if (likely(alloc_var_part(fragPtr, tabPtr, alloc_size, &varref) != 0)) if (likely(alloc_var_part(fragPtr, tabPtr, alloc_size, &varref) != 0))
{ {
Tuple_header* tuple = (Tuple_header*)ptr; Tuple_header* tuple = (Tuple_header*)ptr;
Var_part_ref* dst = (Var_part_ref*)tuple->get_var_part_ptr(tabPtr); Var_part_ref* dst = (Var_part_ref*)tuple->get_var_part_ref_ptr(tabPtr);
dst->assign(&varref); dst->assign(&varref);
return ptr; return ptr;
} }
......
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