#At file:///home/jonas/src/telco-7.1/ based on revid:jonas@stripped
3951 Jonas Oreland 2010-11-04 [merge]
ndb - merge 70 to 71
modified:
storage/ndb/include/kernel/AttributeHeader.hpp
storage/ndb/include/transporter/TransporterDefinitions.hpp
storage/ndb/include/util/Vector.hpp
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
storage/ndb/src/kernel/vm/KeyDescriptor.hpp
storage/ndb/src/kernel/vm/SLFifoList.hpp
storage/ndb/src/kernel/vm/SectionReader.cpp
storage/ndb/src/kernel/vm/SectionReader.hpp
storage/ndb/src/kernel/vm/SimulatedBlock.hpp
storage/ndb/test/include/HugoCalculator.hpp
storage/ndb/test/include/NDBT_ResultRow.hpp
storage/ndb/test/include/NDBT_Test.hpp
storage/ndb/test/src/NDBT_Test.cpp
=== modified file 'storage/ndb/include/kernel/AttributeHeader.hpp'
--- a/storage/ndb/include/kernel/AttributeHeader.hpp 2010-01-28 15:16:46 +0000
+++ b/storage/ndb/include/kernel/AttributeHeader.hpp 2010-11-04 09:58:34 +0000
@@ -62,6 +62,10 @@ public:
// Free but allocated DD extent space
STATIC_CONST( FRAGMENT_FREE_EXTENT_SPACE = 0xFFEB );
+ STATIC_CONST( FLUSH_AI = 0xFFEA );
+ STATIC_CONST( CORR_FACTOR32 = 0xFFE9 ); // excluding root-frag
+ STATIC_CONST( CORR_FACTOR64 = 0xFFE8 ); // including root-frag
+
/**
* Optimize pseudo column and optimization options
*/
@@ -103,7 +107,8 @@ public:
static Uint32 getByteSize(Uint32);
static Uint32 getDataSize(Uint32);
-
+ static Uint32 getAttributeId(Uint32 id);
+
public:
AttributeHeader(Uint32 = 0);
AttributeHeader(Uint32 anAttributeId, Uint32 aByteSize);
@@ -257,6 +262,13 @@ AttributeHeader::getDataSize(Uint32 m_va
return (((m_value & 0xFFFF) + 3) >> 2);
}
+inline
+Uint32
+AttributeHeader::getAttributeId(Uint32 m_value)
+{
+ return m_value >> 16;
+}
+
#endif
=== modified file 'storage/ndb/include/transporter/TransporterDefinitions.hpp'
--- a/storage/ndb/include/transporter/TransporterDefinitions.hpp 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/include/transporter/TransporterDefinitions.hpp 2010-11-04 07:12:01 +0000
@@ -132,6 +132,17 @@ struct LinearSectionPtr {
Uint32 * p;
};
+struct SegmentedSectionPtrPOD
+{
+ Uint32 sz;
+ Uint32 i;
+ struct SectionSegment * p;
+
+ void setNull() { p = 0;}
+ bool isNull() const { return p == 0;}
+ inline SegmentedSectionPtrPOD& assign(struct SegmentedSectionPtr&);
+};
+
struct SegmentedSectionPtr {
Uint32 sz;
Uint32 i;
@@ -142,10 +153,24 @@ struct SegmentedSectionPtr {
struct SectionSegment *p_arg)
:sz(sz_arg), i(i_arg), p(p_arg)
{}
+ SegmentedSectionPtr(const SegmentedSectionPtrPOD & src)
+ :sz(src.sz), i(src.i), p(src.p)
+ {}
+
void setNull() { p = 0;}
bool isNull() const { return p == 0;}
};
+inline
+SegmentedSectionPtrPOD&
+SegmentedSectionPtrPOD::assign(struct SegmentedSectionPtr& src)
+{
+ this->i = src.i;
+ this->p = src.p;
+ this->sz = src.sz;
+ return *this;
+}
+
/* Abstract interface for iterating over
* words in a section
*/
=== modified file 'storage/ndb/include/util/Vector.hpp'
--- a/storage/ndb/include/util/Vector.hpp 2009-11-08 12:52:27 +0000
+++ b/storage/ndb/include/util/Vector.hpp 2010-11-04 10:05:12 +0000
@@ -45,6 +45,8 @@ public:
Vector<T>& operator=(const Vector<T>&);
+ /** Does deep copy.*/
+ Vector(const Vector&);
/**
* Shallow equal (i.e does memcmp)
*/
@@ -79,6 +81,26 @@ Vector<T>::Vector(int i){
}
template<class T>
+Vector<T>::Vector(const Vector& src):
+ m_items(new T[src.m_size]),
+ m_size(src.m_size),
+ m_incSize(src.m_incSize),
+ m_arraySize(src.m_size)
+
+{
+ if (unlikely(m_items == NULL)){
+ errno = ENOMEM;
+ m_size = 0;
+ m_arraySize = 0;
+ m_incSize = 0;
+ return;
+ }
+ for(Uint32 i = 0; i < m_size; i++){
+ m_items[i] = src.m_items[i];
+ }
+}
+
+template<class T>
Vector<T>::~Vector(){
delete[] m_items;
// safety for placement new usage
=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2010-11-01 15:43:44 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2010-11-04 09:48:03 +0000
@@ -6176,6 +6176,17 @@ Dbdict::createTab_local(Signal* signal,
KeyDescriptor* desc= g_key_descriptor_pool.getPtr(tabPtr.i);
new (desc) KeyDescriptor();
+ if (tabPtr.p->primaryTableId == RNIL)
+ {
+ jam();
+ desc->primaryTableId = createTabPtr.p->m_request.tableId;
+ }
+ else
+ {
+ jam();
+ desc->primaryTableId = tabPtr.p->primaryTableId;
+ }
+
Uint32 key = 0;
Ptr<AttributeRecord> attrPtr;
LocalDLFifoList<AttributeRecord> list(c_attributeRecordPool,
=== modified file 'storage/ndb/src/kernel/vm/KeyDescriptor.hpp'
--- a/storage/ndb/src/kernel/vm/KeyDescriptor.hpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/vm/KeyDescriptor.hpp 2010-11-04 09:48:03 +0000
@@ -26,9 +26,11 @@
struct KeyDescriptor
{
KeyDescriptor () {
+ primaryTableId = RNIL;
noOfKeyAttr = hasCharAttr = noOfDistrKeys = noOfVarKeys = 0;
}
+ Uint32 primaryTableId;
Uint8 noOfKeyAttr;
Uint8 hasCharAttr;
Uint8 noOfDistrKeys;
=== modified file 'storage/ndb/src/kernel/vm/SLFifoList.hpp'
--- a/storage/ndb/src/kernel/vm/SLFifoList.hpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/vm/SLFifoList.hpp 2010-11-04 07:00:46 +0000
@@ -34,19 +34,31 @@ public:
/**
* List head
*/
- struct Head
+ struct HeadPOD
{
- Head();
Uint32 firstItem;
Uint32 lastItem;
#ifdef VM_TRACE
bool in_use;
#endif
-
+ void init();
inline bool isEmpty() const { return firstItem == RNIL;}
};
+ struct Head : public HeadPOD
+ {
+ Head() { this->init();}
+
+ Head& operator=(const HeadPOD& src) {
+ this->firstItem = src.firstItem;
+ this->lastItem = src.lastItem;
+#ifdef VM_TRACE
+ this->in_use = src.in_use;
+#endif
+ return *this;
+ }
+ };
SLFifoListImpl(P & thePool);
bool seizeFirst(Ptr<T> &);
@@ -59,7 +71,8 @@ public:
void addLast(Ptr<T> &);
void removeFirst(Ptr<T> &);
-
+ void remove() { head.init(); }
+
/**
* Update i & p value according to <b>i</b>
*/
@@ -114,7 +127,7 @@ template <typename P, typename T, typena
class LocalSLFifoListImpl : public SLFifoListImpl<P,T,U>
{
public:
- LocalSLFifoListImpl(P & thePool, typename SLFifoListImpl<P,T,U>::Head &_src)
+ LocalSLFifoListImpl(P & thePool, typename SLFifoListImpl<P,T,U>::HeadPOD&_src)
: SLFifoListImpl<P,T,U>(thePool), src(_src)
{
this->head = src;
@@ -131,7 +144,7 @@ public:
src = this->head;
}
private:
- typename SLFifoListImpl<P,T,U>::Head & src;
+ typename SLFifoListImpl<P,T,U>::HeadPOD & src;
};
template <typename P, typename T, typename U>
@@ -143,12 +156,13 @@ SLFifoListImpl<P,T,U>::SLFifoListImpl(P
template <typename P, typename T, typename U>
inline
-SLFifoListImpl<P,T,U>::Head::Head()
+void
+SLFifoListImpl<P,T,U>::HeadPOD::init()
{
- firstItem = RNIL;
- lastItem = RNIL;
+ this->firstItem = RNIL;
+ this->lastItem = RNIL;
#ifdef VM_TRACE
- in_use = false;
+ this->in_use = false;
#endif
}
=== modified file 'storage/ndb/src/kernel/vm/SectionReader.cpp'
--- a/storage/ndb/src/kernel/vm/SectionReader.cpp 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/src/kernel/vm/SectionReader.cpp 2010-11-04 09:55:53 +0000
@@ -117,6 +117,17 @@ SectionReader::peekWord(Uint32 * dst) co
}
bool
+SectionReader::updateWord(Uint32 value) const
+{
+ if(m_pos < m_len){
+ Uint32 ind = m_pos % SectionSegment::DataLength;
+ m_currentSegment->theData[ind] = value;
+ return true;
+ }
+ return false;
+}
+
+bool
SectionReader::peekWords(Uint32 * dst, Uint32 len) const {
if(m_pos + len > m_len)
return false;
=== modified file 'storage/ndb/src/kernel/vm/SectionReader.hpp'
--- a/storage/ndb/src/kernel/vm/SectionReader.hpp 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/src/kernel/vm/SectionReader.hpp 2010-11-04 09:55:53 +0000
@@ -70,6 +70,11 @@ public:
PosInfo getPos();
bool setPos(PosInfo posinfo);
+ /**
+ * Update word at current position to <em>value</em>
+ */
+ bool updateWord(Uint32 value) const ;
+
private:
Uint32 m_pos;
Uint32 m_len;
=== modified file 'storage/ndb/src/kernel/vm/SimulatedBlock.hpp'
--- a/storage/ndb/src/kernel/vm/SimulatedBlock.hpp 2010-10-20 07:12:58 +0000
+++ b/storage/ndb/src/kernel/vm/SimulatedBlock.hpp 2010-11-04 07:12:01 +0000
@@ -330,6 +330,11 @@ protected:
class SectionSegmentPool& getSectionSegmentPool();
void release(SegmentedSectionPtr & ptr);
+ void release(SegmentedSectionPtrPOD & ptr) {
+ SegmentedSectionPtr tmp(ptr);
+ release(tmp);
+ ptr.setNull();
+ }
void releaseSection(Uint32 firstSegmentIVal);
void releaseSections(struct SectionHandle&);
@@ -1241,11 +1246,11 @@ SimulatedBlock::EXECUTE_DIRECT(Uint32 bl
b = b->getInstance(instanceNo);
ndbassert(b != 0);
ndbassert(givenInstanceNo != ZNIL || b->getThreadId() == getThreadId());
+ signal->header.theSendersBlockRef = reference();
#ifdef VM_TRACE
if(globalData.testOn){
signal->header.theVerId_signalNumber = gsn;
signal->header.theReceiversBlockNumber = numberToBlock(block, instanceNo);
- signal->header.theSendersBlockRef = reference();
globalSignalLoggers.executeDirect(signal->header,
0, // in
&signal->theData[0],
=== modified file 'storage/ndb/test/include/HugoCalculator.hpp'
--- a/storage/ndb/test/include/HugoCalculator.hpp 2009-10-06 10:39:02 +0000
+++ b/storage/ndb/test/include/HugoCalculator.hpp 2010-11-04 09:53:06 +0000
@@ -44,6 +44,8 @@ public:
int getUpdatesValue(NDBT_ResultRow* const pRow) const;
int isIdCol(int colId) { return m_idCol == colId; };
int isUpdateCol(int colId){ return m_updatesCol == colId; };
+
+ const NdbDictionary::Table& getTable() const { return m_tab;}
private:
const NdbDictionary::Table& m_tab;
int m_idCol;
=== modified file 'storage/ndb/test/include/NDBT_ResultRow.hpp'
--- a/storage/ndb/test/include/NDBT_ResultRow.hpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/test/include/NDBT_ResultRow.hpp 2010-11-04 09:53:06 +0000
@@ -43,6 +43,8 @@ public:
bool operator!=(const NDBT_ResultRow& other) const {
return ! (*this == other);
}
+
+ const NdbDictionary::Table& getTable() const { return m_table;}
private:
int cols;
=== modified file 'storage/ndb/test/include/NDBT_Test.hpp'
--- a/storage/ndb/test/include/NDBT_Test.hpp 2010-06-21 09:56:51 +0000
+++ b/storage/ndb/test/include/NDBT_Test.hpp 2010-11-04 09:53:06 +0000
@@ -76,6 +76,7 @@ public:
void decProperty(const char *);
void incProperty(const char *);
+ Uint32 casProperty(const char *, Uint32 oldValue, Uint32 newValue);
// Communicate with other tests
void stopTest();
=== modified file 'storage/ndb/test/src/NDBT_Test.cpp'
--- a/storage/ndb/test/src/NDBT_Test.cpp 2010-09-30 09:32:28 +0000
+++ b/storage/ndb/test/src/NDBT_Test.cpp 2010-11-04 09:53:06 +0000
@@ -158,6 +158,21 @@ NDBT_Context::incProperty(const char * n
NdbMutex_Unlock(propertyMutexPtr);
}
+Uint32
+NDBT_Context::casProperty(const char * name, Uint32 oldValue, Uint32 newValue)
+{
+ NdbMutex_Lock(propertyMutexPtr);
+ Uint32 val = 0;
+ props.get(name, &val);
+ if (val == oldValue)
+ {
+ props.put(name, newValue, true);
+ NdbCondition_Broadcast(propertyCondPtr);
+ }
+ NdbMutex_Unlock(propertyMutexPtr);
+ return val;
+}
+
void NDBT_Context::setProperty(const char* _name, const char* _val){
NdbMutex_Lock(propertyMutexPtr);
const bool b = props.put(_name, _val, true);
No bundle (reason: revision is a merge).
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.1 branch (jonas:3951) | Jonas Oreland | 4 Nov |