ndb dd -

  fix bug in LCP + extent alloc
parent b5fdbe13
...@@ -350,11 +350,14 @@ Dbtup::disk_page_prealloc(Signal* signal, ...@@ -350,11 +350,14 @@ Dbtup::disk_page_prealloc(Signal* signal,
LocalDLList<Extent_info> list(c_extent_pool, alloc.m_free_extents[pos]); LocalDLList<Extent_info> list(c_extent_pool, alloc.m_free_extents[pos]);
list.first(ext); list.first(ext);
while((pageBits= tsman.alloc_page_from_extent(&ext.p->m_key, bits)) < 0) while((pageBits= tsman.alloc_page_from_extent(&ext.p->m_key, bits)) < 0)
if(!list.next(ext) || ++cnt < 10) if(!list.next(ext) || ++cnt == 10)
break; break;
ndbout_c("cnt: %d", cnt);
if (cnt == 10 || ext.isNull()) if (cnt == 10 || ext.isNull())
goto alloc; goto alloc;
list.remove(ext); list.remove(ext);
alloc.m_curr_extent_info_ptr_i= ext.i;
ext.p->m_free_matrix_pos= RNIL;
} }
else else
{ {
...@@ -390,18 +393,19 @@ Dbtup::disk_page_prealloc(Signal* signal, ...@@ -390,18 +393,19 @@ Dbtup::disk_page_prealloc(Signal* signal,
LocalSLList<Extent_info, Extent_list_t> LocalSLList<Extent_info, Extent_list_t>
list1(c_extent_pool, alloc.m_extent_list); list1(c_extent_pool, alloc.m_extent_list);
list1.add(ext); list1.add(ext);
}
alloc.m_curr_extent_info_ptr_i= ext.i; alloc.m_curr_extent_info_ptr_i= ext.i;
ext.p->m_free_matrix_pos= RNIL; ext.p->m_free_matrix_pos= RNIL;
pageBits= tsman.alloc_page_from_extent(&ext.p->m_key, bits); pageBits= tsman.alloc_page_from_extent(&ext.p->m_key, bits);
#ifdef VM_TRACE #ifdef VM_TRACE
ddassert(pageBits >= 0); ddassert(pageBits >= 0);
#else #else
if (unlikely(pageBits < 0)) if (unlikely(pageBits < 0))
{ {
return -AllocExtentReq::NoExtentAvailable; return -AllocExtentReq::NoExtentAvailable;
} }
#endif #endif
}
} }
/** /**
......
...@@ -40,10 +40,11 @@ ...@@ -40,10 +40,11 @@
#define dbg(x) #define dbg(x)
#endif #endif
static bool g_dbg_lcp = false;
#if 1 #if 1
#define DBG_LCP(x) #define DBG_LCP(x)
#else #else
#define DBG_LCP(x) ndbout << x #define DBG_LCP(x) if(g_dbg_lcp) ndbout << x
#endif #endif
Pgman::Pgman(const Configuration & conf) : Pgman::Pgman(const Configuration & conf) :
...@@ -1156,15 +1157,25 @@ Pgman::process_lcp(Signal* signal) ...@@ -1156,15 +1157,25 @@ Pgman::process_lcp(Signal* signal)
// start or re-start from beginning of current hash bucket // start or re-start from beginning of current hash bucket
if (m_lcp_curr_bucket != ~(Uint32)0) if (m_lcp_curr_bucket != ~(Uint32)0)
{ {
DBG_LCP(" PROCESS LCP m_lcp_curr_bucket"
<< m_lcp_curr_bucket << endl);
Page_hashlist::Iterator iter; Page_hashlist::Iterator iter;
pl_hash.next(m_lcp_curr_bucket, iter); pl_hash.next(m_lcp_curr_bucket, iter);
Uint32 loop = 0;
while (iter.curr.i != RNIL && --max_count > 0) while (iter.curr.i != RNIL &&
m_lcp_outstanding < max_count &&
(loop ++ < 32 || iter.bucket == m_lcp_curr_bucket))
{ {
Ptr<Page_entry>& ptr = iter.curr; Ptr<Page_entry>& ptr = iter.curr;
Uint16 state = ptr.p->m_state; Uint16 state = ptr.p->m_state;
DBG_LCP("PROCESS LCP: " << ptr); DBG_LCP("LCP "
<< " m_lcp_outstanding: " << m_lcp_outstanding
<< " max_count: " << max_count
<< " loop: " << loop
<< " iter.curr.i: " << iter.curr.i
<< " " << ptr);
if (ptr.p->m_last_lcp < m_last_lcp && if (ptr.p->m_last_lcp < m_last_lcp &&
(state & Page_entry::DIRTY)) (state & Page_entry::DIRTY))
...@@ -1214,6 +1225,10 @@ Pgman::process_lcp(Signal* signal) ...@@ -1214,6 +1225,10 @@ Pgman::process_lcp(Signal* signal)
ptr.p->m_last_lcp = m_last_lcp; ptr.p->m_last_lcp = m_last_lcp;
m_lcp_outstanding++; m_lcp_outstanding++;
} }
else
{
DBG_LCP(" NOT DIRTY" << endl);
}
pl_hash.next(iter); pl_hash.next(iter);
} }
...@@ -2236,6 +2251,36 @@ Pgman::execDUMP_STATE_ORD(Signal* signal) ...@@ -2236,6 +2251,36 @@ Pgman::execDUMP_STATE_ORD(Signal* signal)
ndbout << "Only in VM_TRACE builds" << endl; ndbout << "Only in VM_TRACE builds" << endl;
#endif #endif
} }
if (signal->theData[0] == 11004)
{
ndbout << "Dump LCP bucket m_lcp_outstanding: %d", m_lcp_outstanding;
if (m_lcp_curr_bucket != ~(Uint32)0)
{
Page_hashlist::Iterator iter;
pl_hash.next(m_lcp_curr_bucket, iter);
ndbout_c(" %d", m_lcp_curr_bucket);
while (iter.curr.i != RNIL && iter.bucket == m_lcp_curr_bucket)
{
Ptr<Page_entry>& ptr = iter.curr;
ndbout << ptr << endl;
pl_hash.next(iter);
}
ndbout_c("-- done");
}
else
{
ndbout_c(" == ~0");
}
}
if (signal->theData[0] == 11005)
{
g_dbg_lcp = ~g_dbg_lcp;
}
} }
// page cache client // page cache client
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <signaldata/GetTabInfo.hpp> #include <signaldata/GetTabInfo.hpp>
#include <dbtup/Dbtup.hpp> #include <dbtup/Dbtup.hpp>
#define JONAS 0
Tsman::Tsman(const Configuration & conf, class Pgman* pg, class Lgman* lg) : Tsman::Tsman(const Configuration & conf, class Pgman* pg, class Lgman* lg) :
SimulatedBlock(TSMAN, conf), SimulatedBlock(TSMAN, conf),
...@@ -1725,8 +1726,9 @@ Tsman::unmap_page(Signal* signal, Local_key *key) ...@@ -1725,8 +1726,9 @@ Tsman::unmap_page(Signal* signal, Local_key *key)
unsigned bit = unsigned bit =
(header->get_free_bits(page_no_in_extent) & ((1 << (SZ - 1)) - 1)); (header->get_free_bits(page_no_in_extent) & ((1 << (SZ - 1)) - 1));
header->update_free_bits(page_no_in_extent, bit); header->update_free_bits(page_no_in_extent, bit);
ndbout_c("toggle page: (%d, %d, %d) from %x to %x", if (JONAS)
key->m_page_no, extent, page_no_in_extent, old, bit); ndbout_c("toggle page: (%d, %d, %d) from %x to %x",
key->m_page_no, extent, page_no_in_extent, old, bit);
return 0; return 0;
} }
...@@ -1842,8 +1844,9 @@ Tsman::execALLOC_PAGE_REQ(Signal* signal) ...@@ -1842,8 +1844,9 @@ Tsman::execALLOC_PAGE_REQ(Signal* signal)
return; return;
found: found:
ndbout_c("alloc page: (%d, %d, %d)", if (JONAS)
data_off + extent * size + page_no, per_page + extent, page_no); ndbout_c("alloc page: (%d, %d, %d)",
data_off + extent * size + page_no, per_page + extent, page_no);
src_bits |= (1 << (SZ - 1)); // high unlogged, allocated bit src_bits |= (1 << (SZ - 1)); // high unlogged, allocated bit
header->update_free_bits(page_no, src_bits); header->update_free_bits(page_no, src_bits);
rep->bits= src_bits & ((1 << (SZ - 1)) - 1); rep->bits= src_bits & ((1 << (SZ - 1)) - 1);
......
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