Commit 5b1f8747 authored by joerg@debian.(none)'s avatar joerg@debian.(none)

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

into debian.(none):/M51/mysql-5.1
parents 2b8cedb1 d07232a0
...@@ -32,7 +32,7 @@ struct AllocExtentReq { ...@@ -32,7 +32,7 @@ struct AllocExtentReq {
enum ErrorCode { enum ErrorCode {
UnmappedExtentPageIsNotImplemented = 1, UnmappedExtentPageIsNotImplemented = 1,
NoExtentAvailable = 2 NoExtentAvailable = 1601
}; };
union union
......
...@@ -1601,6 +1601,8 @@ private: ...@@ -1601,6 +1601,8 @@ private:
* Reply from nodeId * Reply from nodeId
*/ */
void startInfoReply(Signal *, Uint32 nodeId); void startInfoReply(Signal *, Uint32 nodeId);
void dump_replica_info();
}; };
#if (DIH_CDATA_SIZE < _SYSFILE_SIZE32) #if (DIH_CDATA_SIZE < _SYSFILE_SIZE32)
......
...@@ -8925,6 +8925,80 @@ void Dbdih::packFragIntoPagesLab(Signal* signal, RWFragment* wf) ...@@ -8925,6 +8925,80 @@ void Dbdih::packFragIntoPagesLab(Signal* signal, RWFragment* wf)
/*****************************************************************************/ /*****************************************************************************/
/* ********** START FRAGMENT MODULE *************/ /* ********** START FRAGMENT MODULE *************/
/*****************************************************************************/ /*****************************************************************************/
void
Dbdih::dump_replica_info()
{
TabRecordPtr tabPtr;
FragmentstorePtr fragPtr;
for(tabPtr.i = 0; tabPtr.i < ctabFileSize; tabPtr.i++)
{
ptrCheckGuard(tabPtr, ctabFileSize, tabRecord);
if (tabPtr.p->tabStatus != TabRecord::TS_ACTIVE)
continue;
for(Uint32 fid = 0; fid<tabPtr.p->totalfragments; fid++)
{
getFragstore(tabPtr.p, fid, fragPtr);
ndbout_c("tab: %d frag: %d gci: %d\n -- storedReplicas:",
tabPtr.i, fid, SYSFILE->newestRestorableGCI);
Uint32 i;
ReplicaRecordPtr replicaPtr;
replicaPtr.i = fragPtr.p->storedReplicas;
for(; replicaPtr.i != RNIL; replicaPtr.i = replicaPtr.p->nextReplica)
{
ptrCheckGuard(replicaPtr, creplicaFileSize, replicaRecord);
ndbout_c(" node: %d initialGci: %d nextLcp: %d noCrashedReplicas: %d",
replicaPtr.p->procNode,
replicaPtr.p->initialGci,
replicaPtr.p->nextLcp,
replicaPtr.p->noCrashedReplicas);
for(i = 0; i<MAX_LCP_STORED; i++)
{
ndbout_c(" i: %d %s : lcpId: %d maxGci Completed: %d Started: %d",
i,
(replicaPtr.p->lcpStatus[i] == ZVALID ?"VALID":"INVALID"),
replicaPtr.p->lcpId[i],
replicaPtr.p->maxGciCompleted[i],
replicaPtr.p->maxGciStarted[i]);
}
for (i = 0; i < 8; i++)
{
ndbout_c(" crashed replica: %d replicaLastGci: %d createGci: %d",
i,
replicaPtr.p->replicaLastGci[i],
replicaPtr.p->createGci[i]);
}
}
ndbout_c(" -- oldStoredReplicas");
replicaPtr.i = fragPtr.p->oldStoredReplicas;
for(; replicaPtr.i != RNIL; replicaPtr.i = replicaPtr.p->nextReplica)
{
ptrCheckGuard(replicaPtr, creplicaFileSize, replicaRecord);
for(i = 0; i<MAX_LCP_STORED; i++)
{
ndbout_c(" i: %d %s : lcpId: %d maxGci Completed: %d Started: %d",
i,
(replicaPtr.p->lcpStatus[i] == ZVALID ?"VALID":"INVALID"),
replicaPtr.p->lcpId[i],
replicaPtr.p->maxGciCompleted[i],
replicaPtr.p->maxGciStarted[i]);
}
for (i = 0; i < 8; i++)
{
ndbout_c(" crashed replica: %d replicaLastGci: %d createGci: %d",
i,
replicaPtr.p->replicaLastGci[i],
replicaPtr.p->createGci[i]);
}
}
}
}
}
void Dbdih::startFragment(Signal* signal, Uint32 tableId, Uint32 fragId) void Dbdih::startFragment(Signal* signal, Uint32 tableId, Uint32 fragId)
{ {
Uint32 TloopCount = 0; Uint32 TloopCount = 0;
...@@ -8986,6 +9060,7 @@ void Dbdih::startFragment(Signal* signal, Uint32 tableId, Uint32 fragId) ...@@ -8986,6 +9060,7 @@ void Dbdih::startFragment(Signal* signal, Uint32 tableId, Uint32 fragId)
/* SEARCH FOR STORED REPLICAS THAT CAN BE USED TO RESTART THE SYSTEM. */ /* SEARCH FOR STORED REPLICAS THAT CAN BE USED TO RESTART THE SYSTEM. */
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
searchStoredReplicas(fragPtr); searchStoredReplicas(fragPtr);
if (cnoOfCreateReplicas == 0) { if (cnoOfCreateReplicas == 0) {
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/* THERE WERE NO STORED REPLICAS AVAILABLE THAT CAN SERVE AS REPLICA TO*/ /* THERE WERE NO STORED REPLICAS AVAILABLE THAT CAN SERVE AS REPLICA TO*/
...@@ -8998,6 +9073,10 @@ void Dbdih::startFragment(Signal* signal, Uint32 tableId, Uint32 fragId) ...@@ -8998,6 +9073,10 @@ void Dbdih::startFragment(Signal* signal, Uint32 tableId, Uint32 fragId)
char buf[64]; char buf[64];
BaseString::snprintf(buf, sizeof(buf), "table: %d fragment: %d gci: %d", BaseString::snprintf(buf, sizeof(buf), "table: %d fragment: %d gci: %d",
tableId, fragId, SYSFILE->newestRestorableGCI); tableId, fragId, SYSFILE->newestRestorableGCI);
ndbout_c(buf);
dump_replica_info();
progError(__LINE__, NDBD_EXIT_NO_RESTORABLE_REPLICA, buf); progError(__LINE__, NDBD_EXIT_NO_RESTORABLE_REPLICA, buf);
ndbrequire(false); ndbrequire(false);
return; return;
......
...@@ -565,7 +565,6 @@ typedef Ptr<Fragoperrec> FragoperrecPtr; ...@@ -565,7 +565,6 @@ typedef Ptr<Fragoperrec> FragoperrecPtr;
* *
*/ */
STATIC_CONST( SZ = EXTENT_SEARCH_MATRIX_SIZE ); STATIC_CONST( SZ = EXTENT_SEARCH_MATRIX_SIZE );
Uint32 m_extent_search_matrix[SZ]; // 4x4
DLList<Extent_info>::Head m_free_extents[SZ]; DLList<Extent_info>::Head m_free_extents[SZ];
Uint32 m_total_extent_free_space_thresholds[EXTENT_SEARCH_MATRIX_ROWS]; Uint32 m_total_extent_free_space_thresholds[EXTENT_SEARCH_MATRIX_ROWS];
Uint32 m_page_free_bits_map[EXTENT_SEARCH_MATRIX_COLS]; Uint32 m_page_free_bits_map[EXTENT_SEARCH_MATRIX_COLS];
...@@ -593,6 +592,8 @@ typedef Ptr<Fragoperrec> FragoperrecPtr; ...@@ -593,6 +592,8 @@ typedef Ptr<Fragoperrec> FragoperrecPtr;
SLList<Extent_info, Extent_list_t>::Head m_extent_list; SLList<Extent_info, Extent_list_t>::Head m_extent_list;
}; };
void dump_disk_alloc(Disk_alloc_info&);
struct Fragrecord { struct Fragrecord {
Uint32 nextStartRange; Uint32 nextStartRange;
Uint32 currentPageRange; Uint32 currentPageRange;
......
...@@ -1439,6 +1439,7 @@ int Dbtup::handleInsertReq(Signal* signal, ...@@ -1439,6 +1439,7 @@ int Dbtup::handleInsertReq(Signal* signal,
int ret= disk_page_prealloc(signal, fragPtr, &tmp, size); int ret= disk_page_prealloc(signal, fragPtr, &tmp, size);
if (unlikely(ret < 0)) if (unlikely(ret < 0))
{ {
terrorCode = -ret;
goto disk_prealloc_error; goto disk_prealloc_error;
} }
......
...@@ -40,6 +40,12 @@ ...@@ -40,6 +40,12 @@
#define dbg(x) #define dbg(x)
#endif #endif
#if 1
#define DBG_LCP(x)
#else
#define DBG_LCP(x) ndbout << x
#endif
Pgman::Pgman(const Configuration & conf) : Pgman::Pgman(const Configuration & conf) :
SimulatedBlock(PGMAN, conf), SimulatedBlock(PGMAN, conf),
m_file_map(m_data_buffer_pool), m_file_map(m_data_buffer_pool),
...@@ -1083,6 +1089,7 @@ Pgman::execLCP_FRAG_ORD(Signal* signal) ...@@ -1083,6 +1089,7 @@ Pgman::execLCP_FRAG_ORD(Signal* signal)
LcpFragOrd* ord = (LcpFragOrd*)signal->getDataPtr(); LcpFragOrd* ord = (LcpFragOrd*)signal->getDataPtr();
ndbrequire(ord->lcpId >= m_last_lcp_complete + 1 || m_last_lcp_complete == 0); ndbrequire(ord->lcpId >= m_last_lcp_complete + 1 || m_last_lcp_complete == 0);
m_last_lcp = ord->lcpId; m_last_lcp = ord->lcpId;
DBG_LCP("execLCP_FRAG_ORD" << endl);
ndbrequire(!m_lcp_outstanding); ndbrequire(!m_lcp_outstanding);
ndbrequire(m_lcp_copy_page_free); ndbrequire(m_lcp_copy_page_free);
...@@ -1104,6 +1111,8 @@ Pgman::execEND_LCP_REQ(Signal* signal) ...@@ -1104,6 +1111,8 @@ Pgman::execEND_LCP_REQ(Signal* signal)
EndLcpReq* req = (EndLcpReq*)signal->getDataPtr(); EndLcpReq* req = (EndLcpReq*)signal->getDataPtr();
m_end_lcp_req = *req; m_end_lcp_req = *req;
DBG_LCP("execEND_LCP_REQ" << endl);
#ifdef VM_TRACE #ifdef VM_TRACE
debugOut debugOut
<< "PGMAN: execEND_LCP_REQ" << "PGMAN: execEND_LCP_REQ"
...@@ -1117,6 +1126,7 @@ Pgman::execEND_LCP_REQ(Signal* signal) ...@@ -1117,6 +1126,7 @@ Pgman::execEND_LCP_REQ(Signal* signal)
ndbrequire(! m_lcp_loop_on); ndbrequire(! m_lcp_loop_on);
signal->theData[0] = m_end_lcp_req.senderData; signal->theData[0] = m_end_lcp_req.senderData;
sendSignal(m_end_lcp_req.senderRef, GSN_END_LCP_CONF, signal, 1, JBB); sendSignal(m_end_lcp_req.senderRef, GSN_END_LCP_CONF, signal, 1, JBB);
DBG_LCP("GSN_END_LCP_CONF" << endl);
} }
m_last_lcp_complete = m_last_lcp; m_last_lcp_complete = m_last_lcp;
...@@ -1149,6 +1159,8 @@ Pgman::process_lcp(Signal* signal) ...@@ -1149,6 +1159,8 @@ Pgman::process_lcp(Signal* signal)
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);
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))
{ {
...@@ -1159,6 +1171,7 @@ Pgman::process_lcp(Signal* signal) ...@@ -1159,6 +1171,7 @@ Pgman::process_lcp(Signal* signal)
} }
if (state & Page_entry::BUSY) if (state & Page_entry::BUSY)
{ {
DBG_LCP(" BUSY" << endl);
break; // wait for it break; // wait for it
} }
if (state & Page_entry::LOCKED) if (state & Page_entry::LOCKED)
...@@ -1169,6 +1182,7 @@ Pgman::process_lcp(Signal* signal) ...@@ -1169,6 +1182,7 @@ Pgman::process_lcp(Signal* signal)
*/ */
if (!m_lcp_copy_page_free) if (!m_lcp_copy_page_free)
{ {
DBG_LCP(" !m_lcp_copy_page_free" << endl);
break; break;
} }
m_lcp_copy_page_free = false; m_lcp_copy_page_free = false;
...@@ -1183,10 +1197,12 @@ Pgman::process_lcp(Signal* signal) ...@@ -1183,10 +1197,12 @@ Pgman::process_lcp(Signal* signal)
} }
else if (state & Page_entry::PAGEOUT) else if (state & Page_entry::PAGEOUT)
{ {
DBG_LCP(" PAGEOUT -> state |= LCP" << endl);
set_page_state(ptr, state | Page_entry::LCP); set_page_state(ptr, state | Page_entry::LCP);
} }
else else
{ {
DBG_LCP(" pageout()" << endl);
ptr.p->m_state |= Page_entry::LCP; ptr.p->m_state |= Page_entry::LCP;
pageout(signal, ptr); pageout(signal, ptr);
} }
...@@ -1205,11 +1221,15 @@ Pgman::process_lcp(Signal* signal) ...@@ -1205,11 +1221,15 @@ Pgman::process_lcp(Signal* signal)
{ {
signal->theData[0] = m_end_lcp_req.senderData; signal->theData[0] = m_end_lcp_req.senderData;
sendSignal(m_end_lcp_req.senderRef, GSN_END_LCP_CONF, signal, 1, JBB); sendSignal(m_end_lcp_req.senderRef, GSN_END_LCP_CONF, signal, 1, JBB);
DBG_LCP("GSN_END_LCP_CONF" << endl);
} }
DBG_LCP(" -- RETURN FALSE" << endl);
m_last_lcp_complete = m_last_lcp; m_last_lcp_complete = m_last_lcp;
m_lcp_curr_bucket = ~(Uint32)0; m_lcp_curr_bucket = ~(Uint32)0;
return false; return false;
} }
DBG_LCP(" -- RETURN TRUE" << endl);
return true; return true;
} }
......
...@@ -684,20 +684,15 @@ Tsman::open_file(Signal* signal, ...@@ -684,20 +684,15 @@ Tsman::open_file(Signal* signal,
req->file_size_lo = lo; req->file_size_lo = lo;
Uint64 pages = (Uint64(hi) << 32 | lo) / File_formats::NDB_PAGE_SIZE; Uint64 pages = (Uint64(hi) << 32 | lo) / File_formats::NDB_PAGE_SIZE;
Uint32 extent_size = ts_ptr.p->m_extent_size; // Extent size in #pages
// Extent size in #pages Uint64 extents = (pages + extent_size - 1) / extent_size;
Uint32 extent_size = ts_ptr.p->m_extent_size; extents = extents ? extents : 1;
Uint64 data_pages = extents * extent_size;
Uint32 eh_words = File_formats::Datafile::extent_header_words(extent_size); Uint32 eh_words = File_formats::Datafile::extent_header_words(extent_size);
ndbrequire(eh_words < File_formats::Datafile::EXTENT_PAGE_WORDS); ndbrequire(eh_words < File_formats::Datafile::EXTENT_PAGE_WORDS);
Uint32 extents_per_page = File_formats::Datafile::EXTENT_PAGE_WORDS/eh_words; Uint32 extents_per_page = File_formats::Datafile::EXTENT_PAGE_WORDS/eh_words;
Uint64 tmp = Uint64(extents_per_page) * Uint64(extent_size); Uint64 extent_pages = (extents + extents_per_page - 1) / extents_per_page;
Uint64 extent_pages = pages / (1+tmp);
extent_pages = extent_pages ? extent_pages : 1;
Uint64 data_pages = pages - extent_pages -1;
Uint64 extents = data_pages / extent_size;
data_pages = extents * extent_size;
ptr.p->m_create.m_extent_pages = extent_pages; ptr.p->m_create.m_extent_pages = extent_pages;
ptr.p->m_create.m_data_pages = data_pages; ptr.p->m_create.m_data_pages = data_pages;
......
...@@ -80,6 +80,7 @@ static const char* empty_string = ""; ...@@ -80,6 +80,7 @@ static const char* empty_string = "";
* 1300 - BACKUP * 1300 - BACKUP
* 1400 - SUMA * 1400 - SUMA
* 1500 - LGMAN * 1500 - LGMAN
* 1600 - TSMAN
* 4000 - API * 4000 - API
* 4100 - "" * 4100 - ""
* 4200 - "" * 4200 - ""
...@@ -197,7 +198,8 @@ ErrorBundle ErrorCodes[] = { ...@@ -197,7 +198,8 @@ ErrorBundle ErrorCodes[] = {
{ 903, HA_ERR_INDEX_FILE_FULL, IS, "Too many ordered indexes (increase MaxNoOfOrderedIndexes)" }, { 903, HA_ERR_INDEX_FILE_FULL, IS, "Too many ordered indexes (increase MaxNoOfOrderedIndexes)" },
{ 904, HA_ERR_INDEX_FILE_FULL, IS, "Out of fragment records (increase MaxNoOfOrderedIndexes)" }, { 904, HA_ERR_INDEX_FILE_FULL, IS, "Out of fragment records (increase MaxNoOfOrderedIndexes)" },
{ 905, DMEC, IS, "Out of attribute records (increase MaxNoOfAttributes)" }, { 905, DMEC, IS, "Out of attribute records (increase MaxNoOfAttributes)" },
{ 1601, HA_ERR_RECORD_FILE_FULL, IS, "Out extents, tablespace full" },
/** /**
* TimeoutExpired * TimeoutExpired
*/ */
......
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