ndb - fix dd drop table race condition

  add list of pages being unmaped, so we can wait for it to be empty before dropping extents
parent 48847b36
...@@ -563,6 +563,8 @@ typedef Ptr<Fragoperrec> FragoperrecPtr; ...@@ -563,6 +563,8 @@ typedef Ptr<Fragoperrec> FragoperrecPtr;
*/ */
Page_request_list::Head m_page_requests[MAX_FREE_LIST]; Page_request_list::Head m_page_requests[MAX_FREE_LIST];
DLList<Page>::Head m_unmap_pages;
/** /**
* Current extent * Current extent
*/ */
......
...@@ -956,7 +956,9 @@ Dbtup::disk_page_unmap_callback(Uint32 when, ...@@ -956,7 +956,9 @@ Dbtup::disk_page_unmap_callback(Uint32 when,
ArrayPool<Page> *pool= (ArrayPool<Page>*)&m_global_page_pool; ArrayPool<Page> *pool= (ArrayPool<Page>*)&m_global_page_pool;
LocalDLList<Page> list(*pool, alloc.m_dirty_pages[idx]); LocalDLList<Page> list(*pool, alloc.m_dirty_pages[idx]);
LocalDLList<Page> list2(*pool, alloc.m_unmap_pages);
list.remove(pagePtr); list.remove(pagePtr);
list2.add(pagePtr);
if (dirty_count == 0) if (dirty_count == 0)
{ {
...@@ -999,6 +1001,10 @@ Dbtup::disk_page_unmap_callback(Uint32 when, ...@@ -999,6 +1001,10 @@ Dbtup::disk_page_unmap_callback(Uint32 when,
<< " cnt: " << dirty_count << " " << (idx & ~0x8000) << endl; << " cnt: " << dirty_count << " " << (idx & ~0x8000) << endl;
} }
ArrayPool<Page> *pool= (ArrayPool<Page>*)&m_global_page_pool;
LocalDLList<Page> list(*pool, alloc.m_unmap_pages);
list.remove(pagePtr);
Tablespace_client tsman(0, c_tsman, Tablespace_client tsman(0, c_tsman,
fragPtr.p->fragTableId, fragPtr.p->fragTableId,
fragPtr.p->fragmentId, fragPtr.p->fragmentId,
......
...@@ -1005,7 +1005,20 @@ Dbtup::drop_fragment_unmap_pages(Signal *signal, ...@@ -1005,7 +1005,20 @@ Dbtup::drop_fragment_unmap_pages(Signal *signal,
{ {
if (tabPtr.p->m_no_of_disk_attributes) if (tabPtr.p->m_no_of_disk_attributes)
{ {
jam();
Disk_alloc_info& alloc_info= fragPtr.p->m_disk_alloc_info; Disk_alloc_info& alloc_info= fragPtr.p->m_disk_alloc_info;
if (!alloc_info.m_unmap_pages.isEmpty())
{
jam();
ndbout_c("waiting for unmape pages");
signal->theData[0] = ZUNMAP_PAGES;
signal->theData[1] = tabPtr.i;
signal->theData[2] = fragPtr.i;
signal->theData[3] = pos;
sendSignal(cownref, GSN_CONTINUEB, signal, 4, JBB);
return;
}
while(alloc_info.m_dirty_pages[pos].isEmpty() && pos < MAX_FREE_LIST) while(alloc_info.m_dirty_pages[pos].isEmpty() && pos < MAX_FREE_LIST)
pos++; pos++;
......
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