Commit 357cc3ea 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 328f044e
......@@ -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,7 +393,7 @@ 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);
......@@ -403,6 +406,7 @@ Dbtup::disk_page_prealloc(Signal* signal,
}
#endif
}
}
/**
* We have a page from an extent
......
......@@ -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,6 +1726,7 @@ 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);
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,6 +1844,7 @@ Tsman::execALLOC_PAGE_REQ(Signal* signal)
return;
found:
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
......
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