|
|||||||||||
|
bk commit into 5.1 tree (jonas:1.2583) BUG#30975
From: <jonas(at)mysql.com>
Date: Sat Sep 29 2007 - 05:27:55 EDT
ChangeSet@1.2583, 2007-09-29 11:27:50+02:00, jonas@perch.ndb.mysql.com +8 -0 ndb - bug#30975
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp@1.158, 2007-09-29 11:27:48+02:00, jonas@perch.ndb.mysql.com +8 -3 inform tup which fragments restores to which lcps storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp@1.67, 2007-09-29 11:27:48+02:00, jonas@perch.ndb.mysql.com +5 -4
storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp@1.26, 2007-09-29 11:27:48+02:00, jonas@perch.ndb.mysql.com +197 -65 only update extent pages after unmap add more debugging storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp@1.38, 2007-09-29 11:27:48+02:00, jonas@perch.ndb.mysql.com +21 -11 sync create/drop table to undo log if present storage/ndb/src/kernel/blocks/lgman.cpp@1.25, 2007-09-29 11:27:47+02:00, jonas@perch.ndb.mysql.com +10 -2 inform tup of all LCP records storage/ndb/src/kernel/blocks/pgman.cpp@1.31, 2007-09-29 11:27:47+02:00, jonas@perch.ndb.mysql.com +32 -4 split disk_page_unmap into 2
storage/ndb/src/kernel/blocks/tsman.cpp@1.15, 2007-09-29 11:27:48+02:00, jonas@perch.ndb.mysql.com +38 -24 remove concept of lsn for extent pages storage/ndb/src/kernel/blocks/tsman.hpp@1.9, 2007-09-29 11:27:48+02:00, jonas@perch.ndb.mysql.com +9 -15 remove concept of lsn for extent pages # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: jonas # Host: perch.ndb.mysql.com # Root: /home/jonas/src/telco-6.1 --- 1.25/storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp 2007-09-29 11:27:55 +02:00 +++ 1.26/storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp 2007-09-29 11:27:55 +02:00 @@ -530,7 +530,9 @@ #endif #ifdef VM_TRACE
- ndbout << "allocated " << pages << " pages: " << ext.p->m_key << endl;
+ ndbout << "allocated " << pages << " pages: " << ext.p->m_key
+ << " table: " << fragPtr.p->fragTableId
+ << " fragment: " << fragPtr.p->fragmentId << endl;
#endif
ext.p->m_first_page_no = ext.p->m_key.m_page_no;
bzero(ext.p->m_free_page_count, sizeof(ext.p->m_free_page_count));
@@ -909,8 +911,10 @@ }
void
Ptr<GlobalPage> gpage;
{
- - Local_key key; - key.m_page_no = pagePtr.p->m_page_no; - key.m_file_no = pagePtr.p->m_file_no; - Uint32 idx = pagePtr.p->list_index;
Disk_alloc_info& alloc= fragPtr.p->m_disk_alloc_info;
+ if (DBG_DISK)
+ {
+ ndbout << "disk_page_unmap_callback(after) " << key
+ << " cnt: " << dirty_count << " " << (idx & ~0x8000) << endl;
+ }
+
Tablespace_client tsman(0, c_tsman,
fragPtr.p->fragTableId,
fragPtr.p->fragmentId,
fragPtr.p->m_tablespace_id);
- tsman.unmap_page(&key, idx);
- jamEntry(); - pagePtr.p->list_index = idx | 0x8000;
+ if (DBG_DISK && alloc.calc_page_free_bits(real_free) != (idx & ~0x8000))
+ {
+ ndbout << key
+ << " calc: " << alloc.calc_page_free_bits(real_free)
+ << " idx: " << (idx & ~0x8000)
+ << endl;
+ }
+ tsman.update_page_free_bits(&key, alloc.calc_page_free_bits(real_free));
} - - ArrayPool }
void
lsn= disk_page_undo_alloc(pagePtr.p, key, sz, gci, logfile_group_id);
}
-
- Uint32 new_free = pagePtr.p->free_space;
- Uint32 new_bits= alloc.calc_page_free_bits(new_free);
-
- if (old_bits != new_bits)
- {
- Tablespace_client tsman(signal, c_tsman,
- fragPtrP->fragTableId,
- fragPtrP->fragmentId,
- fragPtrP->m_tablespace_id);
-
- tsman.update_page_free_bits(key, new_bits, lsn);
- jamEntry();
- }
}
void
Uint32 new_free = pagePtr.p->free_space; Uint32 new_bits = alloc.calc_page_free_bits(new_free);
case File_formats::Undofile::UNDO_END: + jam();
f_undo_done = true;
return;
default: @@ -1437,14 +1499,32 @@ }
void
+
+ if (lcpId == RNIL)
+ {
+ disk_restart_undo_lcp(tableId, fragId, Fragrecord::UC_CREATE, 0);
+ if (DBG_UNDO)
+ {
+ ndbout_c("mark_no_lcp (%u, %u)", tableId, fragId);
+ }
+ }
+ else
+ {
+ disk_restart_undo_lcp(tableId, fragId, Fragrecord::UC_SET_LCP, lcpId);
+ if (DBG_UNDO)
+ {
+ ndbout_c("mark_no_lcp (%u, %u)", tableId, fragId);
+ }
+
+ }
}
void
if (tabPtr.p->tableStatus == DEFINED)
{
FragrecordPtr fragPtr;
getFragmentrec(fragPtr, fragId, tabPtr.p);
if (!fragPtr.isNull())
{
- fragPtr.p->m_undo_complete |= flag;
+ jam();
+ switch(flag){
+ case Fragrecord::UC_CREATE:
+ jam();
+ fragPtr.p->m_undo_complete |= flag;
+ return;
+ case Fragrecord::UC_LCP:
+ jam();
+ if (fragPtr.p->m_undo_complete == 0 &&
+ fragPtr.p->m_restore_lcp_id == lcpId)
+ {
+ jam();
+ fragPtr.p->m_undo_complete |= flag;
+ if (DBG_UNDO)
+ ndbout_c("table: %u fragment: %u lcp: %u -> done",
+ tableId, fragId, lcpId);
+ }
+ return;
+ case Fragrecord::UC_SET_LCP:
+ {
+ jam();
+ if (DBG_UNDO)
+ ndbout_c("table: %u fragment: %u restore to lcp: %u",
+ tableId, fragId, lcpId);
+ ndbrequire(fragPtr.p->m_undo_complete == 0);
+ ndbrequire(fragPtr.p->m_restore_lcp_id == RNIL);
+ fragPtr.p->m_restore_lcp_id = lcpId;
+ return;
+ }
+ }
+ jamLine(flag);
+ ndbrequire(false);
}
} } @@ -1480,6 +1592,7 @@
pagePtr.p->nextList != RNIL ||
pagePtr.p->prevList != RNIL)
{ + jam();
update = true;
pagePtr.p->list_index |= 0x8000;
pagePtr.p->nextList = pagePtr.p->prevList = RNIL;
@@ -1490,6 +1603,9 @@
if (tableId >= cnoOfTablerec)
+ jam();
+ if (DBG_UNDO)
+ ndbout_c("UNDO table> %u", tableId);
disk_restart_undo_next(signal);
return;
} @@ -1498,6 +1614,9 @@ if (undo->m_table_ptr.p->tableStatus != DEFINED) {
+ jam();
+ if (DBG_UNDO)
+ ndbout_c("UNDO !defined (%u) ", tableId);
disk_restart_undo_next(signal);
return;
} @@ -1505,19 +1624,25 @@
getFragmentrec(undo->m_fragment_ptr, fragId, undo->m_table_ptr.p);
if(undo->m_fragment_ptr.isNull())
+ jam();
+ if (DBG_UNDO)
+ ndbout_c("UNDO fragment null %u/%u", tableId, fragId);
disk_restart_undo_next(signal);
return;
} if (undo->m_fragment_ptr.p->m_undo_complete) {
+ jam();
+ if (DBG_UNDO)
+ ndbout_c("UNDO undo complete %u/%u", tableId, fragId);
disk_restart_undo_next(signal);
return;
}
Uint64 lsn = 0;
if (undo->m_lsn <= lsn)
if (DBG_UNDO)
{
ndbout << "apply: " << undo->m_lsn << "(" << lsn << " )"
+ + disk_restart_undo_page_bits(signal, undo);
}
ndbout << "ignore: " << undo->m_lsn << "(" << lsn << " )"
- << key << " type: " << undo->m_type << endl;
+ << key << " type: " << undo->m_type
+ << " tab: " << tableId << endl;
}
@@ -1643,16 +1775,12 @@ Uint32 new_bits = alloc.calc_page_free_bits(free); pageP->list_index = 0x8000 | new_bits;
@@ -1675,12 +1803,14 @@
if (!fragPtr.isNull())
{
+ jam();
Disk_alloc_info& alloc= fragPtr.p->m_disk_alloc_info;
Ptr@@ -1715,6 +1846,7 @@ Dbtup::disk_restart_page_bits(Uint32 tableId, Uint32 fragId,
const Local_key*, Uint32 bits)
{
TablerecPtr tabPtr;
if(m_latest_lcp == 0 ||
if (! (state & Page_entry::LOCKED))
+
+ if (ptr.p->m_copy_page_i != RNIL)
+ {
+ m_global_page_pool.release(ptr.p->m_copy_page_i);
+ }
set_page_state(ptr, 0);
debugOut << "PGMAN: " << ptr << " : process_cleanup" << endl; #endif
- c_tup->disk_page_unmap_callback(ptr.p->m_real_page_i,
+ c_tup->disk_page_unmap_callback(0,
+ ptr.p->m_real_page_i,
ptr.p->m_dirty_count);
pageout(signal, ptr);
max_count--;
@@ -1189,6 +1195,11 @@ void Pgman::execLCP_FRAG_ORD(Signal* signal) {
+ if (ERROR_INSERTED(11008))
+ {
+ ndbout_c("Ignore LCP_FRAG_ORD");
+ return;
+ }
LcpFragOrd* ord = (LcpFragOrd*)signal->getDataPtr();
ndbrequire(ord->lcpId >= m_last_lcp_complete + 1 || m_last_lcp_complete == 0);
m_last_lcp = ord->lcpId;
+ if (ERROR_INSERTED(11008))
+ {
+ ndbout_c("Ignore END_LCP");
+ return;
+ }
+
EndLcpReq* req = (EndLcpReq*)signal->getDataPtr(); m_end_lcp_req = *req; @@ -1283,7 +1300,8 @@
{
DBG_LCP(" pageout()" << endl);
ptr.p->m_state |= Page_entry::LCP;
- c_tup->disk_page_unmap_callback(ptr.p->m_real_page_i,
+ c_tup->disk_page_unmap_callback(0,
+ ptr.p->m_real_page_i,
ptr.p->m_dirty_count);
pageout(signal, ptr);
}
@@ -1505,6 +1523,10 @@
Page_state state = ptr.p->m_state;
+ c_tup->disk_page_unmap_callback(1, + ptr.p->m_real_page_i, + ptr.p->m_dirty_count); + state &= ~ Page_entry::PAGEOUT; state &= ~ Page_entry::EMPTY; state &= ~ Page_entry::DIRTY; @@ -1758,7 +1780,7 @@ #endif
state |= Page_entry::REQUEST;
{
if (pl_hash.find(ptr, key))
{
ndbout << "pageout " << ptr << endl;
- c_tup->disk_page_unmap_callback(ptr.p->m_real_page_i,
+ c_tup->disk_page_unmap_callback(0,
+ ptr.p->m_real_page_i,
ptr.p->m_dirty_count);
pageout(signal, ptr);
}
@@ -2475,6 +2498,11 @@
if (signal->theData[0] == 11007)
+ }
+
+ if (signal->theData[0] == 11008)
+ {
+ SET_ERROR_INSERT_VALUE(11008);
}
+NdbOut&
+operator<<(NdbOut& out, const File_formats::Datafile::Extent_header & obj)
+{
+ out << "table: " << obj.m_table
+ << " fragment: " << obj.m_fragment_id << " ";
+ for(Uint32 i = 0; i<32; i++)
+ {
+ char t[2];
+ BaseString::snprintf(t, sizeof(t), "%x", obj.get_free_bits(i));
+ out << t;
+ }
+ return out;
+}
+
void Tsman::execDROP_FILEGROUP_REQ(Signal* signal){ jamEntry(); @@ -1582,8 +1596,7 @@ int Tsman::update_page_free_bits(Signal* signal, Local_key *key, - unsigned committed_bits, - Uint64 lsn) + unsigned committed_bits) { jamEntry(); @@ -1618,6 +1631,18 @@
File_formats::Datafile::Extent_header* header =
page->get_header(val.m_extent_no, val.m_extent_size);
+ if (header->m_table == RNIL)
+ {
+ ndbout << "update page free bits page: " << *key
+ << " " << *header << endl;
+ }
+
+ if (0)
+ {
+ ndbout << "update page free bits page(" << committed_bits << ") "
+ << *key << " " << *header << endl;
+ }
+ ndbrequire(header->m_table != RNIL);
Uint32 page_no_in_extent = calc_page_no_in_extent(key->m_page_no, &val);
Uint32 src = header->get_free_bits(page_no_in_extent) & UNCOMMITTED_MASK;
header->update_free_bits(page_no_in_extent, src | committed_bits);
return 0;
File_formats::Datafile::Extent_header* header =
page->get_header(val.m_extent_no, val.m_extent_size);
+ if (header->m_table == RNIL)
+ {
+ ndbout << "trying to unmap page: " << *key
+ << " " << *header << endl;
+ }
ndbrequire(header->m_table != RNIL);
Uint32 page_no_in_extent = calc_page_no_in_extent(key->m_page_no, &val);
{ jamEntry(); @@ -1774,21 +1802,7 @@
(File_formats::Datafile::Extent_page*)ptr_p;
File_formats::Datafile::Extent_header* header =
page->get_header(val.m_extent_no, val.m_extent_size);
-
- Uint64 lsn = 0;
- lsn += page->m_page_header.m_page_lsn_hi; lsn <<= 32;
- lsn += page->m_page_header.m_page_lsn_lo;
-
- if (undo_lsn > lsn && undo_lsn > page_lsn)
- {
- if (DBG_UNDO)
- ndbout << "tsman: ignore " << undo_lsn << "(" << lsn << ", "
- << page_lsn << ") "
- << *key << " "
- << " -> " << bits << endl;
- return 0;
- } -
+
if (header->m_table == RNIL)
{
if (DBG_UNDO)
@@ -1855,7 +1869,7 @@
/**
* Handling of unmapped extent header pages is not implemented
*/
- int flags = 0; + int flags = Page_cache_client::DIRTY_REQ;
int real_page_id;
int alloc_extent(Signal* signal, Uint32 tablespace, Local_key* key);
int alloc_page_from_extent(Signal*, Uint32, Local_key*, Uint32 bits);
/**
* Update page free bits
*/
- int update_page_free_bits(Local_key*, unsigned bits, Uint64 lsn); + int update_page_free_bits(Local_key*, unsigned bits); /**
/**
inline
- unsigned committed_bits, - Uint64 lsn, - Uint64 page_lsn) + unsigned committed_bits) { return m_tsman->restart_undo_page_free_bits(m_signal, m_table_id, m_fragment_id, key, - committed_bits, - lsn, - page_lsn); + committed_bits); } #endif
c_lcpId = (c_lcpId == 0 ? lcpId : c_lcpId); c_lcpId = (c_lcpId < lcpId ? c_lcpId : lcpId);
DLList<ScanOp>::Head m_scanList;
int disk_restart_alloc_extent(Uint32 tableId, Uint32 fragId,
const Local_key* key, Uint32 pages);
Local_key m_key;
private: void disk_restart_undo_next(Signal*); - void disk_restart_undo_lcp(Uint32, Uint32, Uint32 flag); + void disk_restart_undo_lcp(Uint32, Uint32, Uint32 flag, Uint32 lcpId); void disk_restart_undo_callback(Signal* signal, Uint32, Uint32); void disk_restart_undo_alloc(Apply_undo*); void disk_restart_undo_update(Apply_undo*); --- 1.37/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp 2007-09-29 11:27:55 +02:00 +++ 1.38/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp 2007-09-29 11:27:55 +02:00 @@ -146,6 +146,7 @@ regFragPtr.p->m_lcp_scan_op = RNIL; regFragPtr.p->m_lcp_keep_list = RNIL; regFragPtr.p->m_var_page_chunks = RNIL; + regFragPtr.p->m_restore_lcp_id = RNIL; if (ERROR_INSERTED(4007) && regTabPtr.p->fragid[0] == fragId || ERROR_INSERTED(4008) && regTabPtr.p->fragid[1] == fragId) { @@ -673,11 +674,11 @@
switch(ret){
default:
}
void
return;
-#if NOT_YET_UNDO_DROP_TABLE
if (logfile_group_id != RNIL)
safe_cast(&Dbtup::drop_table_log_buffer_callback);
Uint32 sz= sizeof(Disk_undo::Drop) >> 2;
int r0 = c_lgman->alloc_log_space(logfile_group_id, sz);
-
+ if (r0)
+ {
+ jam();
+ warningEvent("Failed to alloc log space for drop table: %u",
+ tabPtr.i);
+ goto done;
+ }
+
Logfile_client lgman(this, c_lgman, logfile_group_id);
int res= lgman.get_log_buffer(signal, sz, &cb);
switch(res){
} -#endif - + +done: drop_table_logsync_callback(signal, tabPtr.i, RNIL); } @@ -1163,9 +1172,10 @@
switch(ret){
default:
}
-- MySQL Code Commits Mailing List For list archives: http://lists.mysql.com/commits To unsubscribe: http://lists.mysql.com/commits?unsub=lists@pantek.comReceived on Sat Sep 29 05:28:16 2007 This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 09:45:10 EDT |
||||||||||
|
|||||||||||