20 #include <ndb_global.h>
22 #include <DataBuffer.hpp>
27 Buffer(Uint32
size){ m_sz =
size; buffer =
new Uint32[m_sz]; m_len = 0;}
28 ~
Buffer(){
delete [] buffer;}
47 for(Uint32
i = 0;
i<buf.m_len;
i++){
48 if(buf.buffer[
i] != * it.data){
55 for(Uint32
i = 0;
i<buf.m_len;
i++){
58 if(buf.buffer[
i] != * it.data){
67 test(Uint32 loops, Uint32 iter){
69 ndbout_c(
"DataBuffer<%d> loops=%d iter=%d", sz, loops, iter);
72 Uint32
size = sz*((10 + (rand() % (10 * sz)) + sz - 1)/sz);
81 bool testOverRun =
true;
83 for(Uint32
i = 0;
i<iter;
i++){
84 Uint32 c = (rand() % (testOverRun ? 7 : 4));
88 c = (testOverRun ? c : 0);
96 alloc = 1 + (rand() % (free - 1));
102 for(; !it.curr.isNull(); db.next(it))
109 for(Uint32
i = 0;
i<alloc;
i++)
110 buf.buffer[buf.m_len +
i] = buf.m_len +
i;
112 require(db.
append(&buf.buffer[buf.m_len], alloc));
117 for(Uint32
i = 0;
i<alloc;
i++){
118 buf.buffer[buf.m_len +
i] = buf.m_len +
i;
119 require(db.
seize(1));
121 * it.data = buf.buffer[buf.m_len +
i];
127 for(Uint32
i = 0;
i<alloc;
i++){
128 buf.buffer[buf.m_len +
i] = buf.m_len +
i;
131 require(db.
seize(alloc));
133 for(Uint32
i = 0;
i<alloc;
i++){
134 * it.data = buf.buffer[buf.m_len +
i];
141 require(!db.
append(buf.buffer, alloc + free));
147 for(Uint32
i = 0;
i<free;
i++){
148 require(db.
seize(1));
151 require(!db.
seize(1));
157 require(!db.
seize(alloc + free));
171 srand(NdbTick_CurrentMillisecond());
185 ErrorReporter::handleAssert(
const char *
msg,
const char *
file,
int line)
187 ndbout <<
"ErrorReporter::handleAssert activated - "
188 <<
" line= " << line << endl;