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@stripped, 2007-05-07 16:05:31+02:00, jonas@stripped +1 -0
Merge perch.ndb.mysql.com:/home/jonas/src/51-telco-gca
into perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new-ndb
MERGE: 1.2403.17.44
storage/ndb/src/kernel/vm/DynArr256.cpp@stripped, 2007-05-07 16:05:27+02:00,
jonas@stripped +0 -0
Auto merged
MERGE: 1.2.1.1
# 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: perch.ndb.mysql.com
# Root: /home/jonas/src/mysql-5.1-new-ndb/RESYNC
--- 1.3/storage/ndb/src/kernel/vm/DynArr256.cpp 2007-05-07 16:05:36 +02:00
+++ 1.4/storage/ndb/src/kernel/vm/DynArr256.cpp 2007-05-07 16:05:36 +02:00
@@ -344,18 +344,28 @@
void
DynArr256::init(ReleaseIterator &iter)
{
- iter.m_sz = 0;
+ iter.m_sz = 1;
iter.m_pos = 0;
- iter.m_ptr_i[0] = m_head.m_ptr_i;
- iter.m_ptr_i[1] = RNIL;
+ iter.m_ptr_i[0] = RNIL;
+ iter.m_ptr_i[1] = m_head.m_ptr_i;
iter.m_ptr_i[2] = RNIL;
iter.m_ptr_i[3] = RNIL;
+ iter.m_ptr_i[4] = RNIL;
}
-bool
-DynArr256::release(ReleaseIterator &iter)
+/**
+ * Iter is in next pos
+ *
+ * 0 - done
+ * 1 - data
+ * 2 - no data
+ */
+Uint32
+DynArr256::release(ReleaseIterator &iter, Uint32 * retptr)
{
- Uint32 ptrI = iter.m_ptr_i[iter.m_sz];
+ Uint32 sz = iter.m_sz;
+ Uint32 pos = iter.m_pos;
+ Uint32 ptrI = iter.m_ptr_i[sz];
Uint32 page_no = ptrI >> DA256_BITS;
Uint32 page_idx = ptrI & DA256_MASK;
Uint32 type_id = (~m_pool.m_type_id) & 0xFFFF;
@@ -364,9 +374,8 @@
if (ptrI != RNIL)
{
- Uint32 tmp = iter.m_pos & 255;
- Uint32 p0 = tmp;
- for (; p0<256 && p0 < tmp + 16; p0++)
+ Uint32 p0 = iter.m_pos & 255;
+ for (; p0<256; p0++)
{
Uint32 *retVal, *magic_ptr, p;
if (p0 != 255)
@@ -389,55 +398,53 @@
}
Uint32 magic = *magic_ptr;
+ Uint32 val = *retVal;
if (unlikely(! ((magic & (1 << p)) && (magic >> 16) ==
type_id)))
goto err;
- Uint32 val = * retVal;
- if (val != RNIL)
+ if (sz == m_head.m_sz)
{
- if (iter.m_sz + 2 == m_head.m_sz)
+ * retptr = val;
+ p0++;
+ if (p0 != 256)
{
- * retVal = RNIL;
- m_pool.release(val);
- iter.m_pos = (iter.m_pos & ~255) + p0;
- return false;
+ /**
+ * Move next
+ */
+ iter.m_pos &= ~(Uint32)255;
+ iter.m_pos |= p0;
}
else
{
- * retVal = RNIL;
- iter.m_sz++;
- iter.m_ptr_i[iter.m_sz] = val;
- iter.m_pos = (p0 << 8);
- return false;
+ /**
+ * Move up
+ */
+ m_pool.release(ptrI);
+ iter.m_sz --;
+ iter.m_pos >>= 8;
}
+ return 1;
+ }
+ else if (val != RNIL)
+ {
+ iter.m_sz++;
+ iter.m_ptr_i[iter.m_sz] = val;
+ iter.m_pos = (p0 << 8);
+ * retVal = RNIL;
+ return 2;
}
}
- if (p0 == 256)
- {
- if (iter.m_sz == 0)
- goto done;
- iter.m_sz--;
- iter.m_pos >>= 8;
-
- m_pool.release(ptrI);
- return false;
- }
- else
- {
- iter.m_pos = (iter.m_pos & ~255) + p0;
- return false;
- }
+ assert(p0 == 256);
+ m_pool.release(ptrI);
+ iter.m_sz --;
+ iter.m_pos >>= 8;
+ return 2;
}
done:
- if (m_head.m_ptr_i != RNIL)
- {
- m_pool.release(m_head.m_ptr_i);
- }
-
new (&m_head) Head();
- return true;
+ return 0;
err:
require(false);
@@ -638,6 +645,7 @@
void
simple(DynArr256 & arr, int argc, char* argv[])
{
+ ndbout_c("argc: %d", argc);
for (Uint32 i = 1; i<(Uint32)argc; i++)
{
Uint32 * s = arr.set(atoi(argv[i]));
@@ -865,7 +873,8 @@
ndbout_c("Elapsed %lldus -> %f us/set", start, uspg);
DynArr256::ReleaseIterator iter;
arr.init(iter);
- while(!arr.release(iter));
+ Uint32 val;
+ while(arr.release(iter, &val));
}
}
@@ -902,7 +911,7 @@
DynArr256::Head head;
DynArr256 arr(pool, head);
- if (strcmp(argv[1], "--args") == 0)
+ if (strcmp(argv[1], "--simple") == 0)
simple(arr, argc, argv);
else if (strcmp(argv[1], "--basic") == 0)
basic(arr, argc, argv);
@@ -913,8 +922,8 @@
DynArr256::ReleaseIterator iter;
arr.init(iter);
- Uint32 cnt = 0;
- while (!arr.release(iter)) cnt++;
+ Uint32 cnt = 0, val;
+ while (arr.release(iter, &val)) cnt++;
ndbout_c("allocatedpages: %d allocatednodes: %d releasednodes: %d"
" releasecnt: %d",
| Thread |
|---|
| • bk commit into 5.1 tree (jonas:1.2508) | jonas | 7 May |