Commit 901d775f authored by unknown's avatar unknown

ndb dd -

  fix bug in LCP + extent alloc


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