Commit 935e7a31 authored by jonas@perch.ndb.mysql.com's avatar jonas@perch.ndb.mysql.com

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new
parents 8188f77c 839cc7a2
......@@ -346,12 +346,22 @@ Dbtup::disk_page_prealloc(Signal* signal,
if ((pos= alloc.find_extent(sz)) != RNIL)
{
jam();
Uint32 cnt = 0;
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)
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
{
alloc:
jam();
/**
* We need to alloc an extent
......@@ -383,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
}
}
/**
......
......@@ -307,9 +307,9 @@ void Dbtup::execREAD_CONFIG_REQ(Signal* signal)
c_buildIndexPool.setSize(c_noOfBuildIndexRec);
c_triggerPool.setSize(noOfTriggers);
c_extent_pool.setSize(256);
c_extent_pool.setSize(8192);
c_extent_hash.setSize(1024); // 4k
c_page_request_pool.setSize(100);
c_page_request_pool.setSize(1000);
Uint32 nScanOp; // use TUX config for now
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUX_SCAN_OP, &nScanOp));
......
......@@ -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) :
......@@ -125,7 +126,7 @@ Pgman::execREAD_CONFIG_REQ(Signal* signal)
if (page_buffer > 0)
{
page_buffer /= GLOBAL_PAGE_SIZE; // in pages
m_page_entry_pool.setSize(2*page_buffer);
m_page_entry_pool.setSize(100*page_buffer);
m_page_request_pool.setSize(10000);
m_param.m_max_pages = page_buffer;
m_param.m_max_hot_pages = (page_buffer * 9) / 10;
......@@ -145,7 +146,7 @@ Pgman::Param::Param() :
m_max_io_waits(64),
m_stats_loop_delay(1000),
m_cleanup_loop_delay(200),
m_lcp_loop_delay(200)
m_lcp_loop_delay(0)
{
}
......@@ -411,6 +412,8 @@ Pgman::get_page_entry(Ptr<Page_entry>& ptr, Uint32 file_no, Uint32 page_no)
return true;
}
ndbrequire(false);
return false;
}
......@@ -739,7 +742,10 @@ Pgman::do_lcp_loop(Signal* signal, bool direct)
{
Uint32 delay = m_param.m_lcp_loop_delay;
signal->theData[0] = PgmanContinueB::LCP_LOOP;
sendSignalWithDelay(PGMAN_REF, GSN_CONTINUEB, signal, delay, 1);
if (delay)
sendSignalWithDelay(PGMAN_REF, GSN_CONTINUEB, signal, delay, 1);
else
sendSignal(PGMAN_REF, GSN_CONTINUEB, signal, 1, JBB);
}
#ifdef VM_TRACE
debugOut << "PGMAN: <do_lcp_loop on=" << m_lcp_loop_on
......@@ -1151,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))
......@@ -1209,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);
}
......@@ -2231,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),
......@@ -148,7 +149,15 @@ Tsman::execCONTINUEB(Signal* signal){
release_extent_pages(signal, ptr);
return;
}
case TsmanContinueB::LOAD_EXTENT_PAGES:
{
Ptr<Datafile> ptr;
m_file_pool.getPtr(ptr, ptrI);
load_extent_pages(signal, ptr);
return;
}
}
ndbrequire(false);
}
#ifdef VM_TRACE
......@@ -702,8 +711,9 @@ Tsman::open_file(Signal* signal,
* Update file size
*/
pages = 1 + extent_pages + data_pages;
hi = (pages * File_formats::NDB_PAGE_SIZE) >> 32;
lo = (pages * File_formats::NDB_PAGE_SIZE) & 0xFFFFFFFF;
Uint64 bytes = pages * File_formats::NDB_PAGE_SIZE;
hi = bytes >> 32;
lo = bytes & 0xFFFFFFFF;
req->file_size_hi = hi;
req->file_size_lo = lo;
......@@ -1185,7 +1195,7 @@ Tsman::scan_extent_headers(Signal* signal, Ptr<Datafile> ptr)
* Last extent header page...
* set correct no of extent headers
*/
extents= datapages / size;
extents= (datapages / size) % per_page;
}
for(Uint32 j = 0; j<extents; j++)
{
......@@ -1712,9 +1722,13 @@ Tsman::unmap_page(Signal* signal, Local_key *key)
/**
* Toggle word
*/
Uint32 old = header->get_free_bits(page_no_in_extent);
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;
}
......@@ -1815,6 +1829,14 @@ Tsman::execALLOC_PAGE_REQ(Signal* signal)
shift &= 31;
}
#if 0
printf("req.bits: %d bits: ", req.bits);
for(Uint32 i = 0; i<size; i++)
{
printf("%x", header->get_free_bits(i));
}
ndbout_c("");
#endif
err= AllocPageReq::NoPageFree;
}
......@@ -1822,6 +1844,9 @@ 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
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