ndb - bug#28348

  remove LCP files when dropping table
parent de307026
...@@ -44,6 +44,8 @@ class FsOpenReq { ...@@ -44,6 +44,8 @@ class FsOpenReq {
friend class Restore; friend class Restore;
friend class Dblqh; friend class Dblqh;
friend class Dbtup;
/** /**
* For printing * For printing
*/ */
......
...@@ -972,6 +972,8 @@ ArrayPool<TupTriggerData> c_triggerPool; ...@@ -972,6 +972,8 @@ ArrayPool<TupTriggerData> c_triggerPool;
struct { struct {
Uint32 tabUserPtr; Uint32 tabUserPtr;
Uint32 tabUserRef; Uint32 tabUserRef;
Uint32 m_lcpno;
Uint32 m_fragPtrI;
} m_dropTable; } m_dropTable;
State tableStatus; State tableStatus;
}; };
...@@ -1533,6 +1535,11 @@ private: ...@@ -1533,6 +1535,11 @@ private:
void execACCKEYREF(Signal* signal); void execACCKEYREF(Signal* signal);
void execACC_ABORTCONF(Signal* signal); void execACC_ABORTCONF(Signal* signal);
// Drop table
void execFSREMOVEREF(Signal*);
void execFSREMOVECONF(Signal*);
//------------------------------------------------------------------ //------------------------------------------------------------------
//------------------------------------------------------------------ //------------------------------------------------------------------
// Methods to handle execution of TUPKEYREQ + ATTRINFO. // Methods to handle execution of TUPKEYREQ + ATTRINFO.
...@@ -2423,6 +2430,8 @@ private: ...@@ -2423,6 +2430,8 @@ private:
void drop_fragment_free_extent_log_buffer_callback(Signal*, Uint32, Uint32); void drop_fragment_free_extent_log_buffer_callback(Signal*, Uint32, Uint32);
void drop_fragment_unmap_pages(Signal*, TablerecPtr, FragrecordPtr, Uint32); void drop_fragment_unmap_pages(Signal*, TablerecPtr, FragrecordPtr, Uint32);
void drop_fragment_unmap_page_callback(Signal* signal, Uint32, Uint32); void drop_fragment_unmap_page_callback(Signal* signal, Uint32, Uint32);
void drop_fragment_fsremove(Signal*, TablerecPtr, FragrecordPtr);
void drop_fragment_fsremove_done(Signal*, TablerecPtr, FragrecordPtr);
// Initialisation // Initialisation
void initData(); void initData();
......
...@@ -102,6 +102,10 @@ Dbtup::Dbtup(Block_context& ctx, Pgman* pgman) ...@@ -102,6 +102,10 @@ Dbtup::Dbtup(Block_context& ctx, Pgman* pgman)
addRecSignal(GSN_ACCKEYREF, &Dbtup::execACCKEYREF); addRecSignal(GSN_ACCKEYREF, &Dbtup::execACCKEYREF);
addRecSignal(GSN_ACC_ABORTCONF, &Dbtup::execACC_ABORTCONF); addRecSignal(GSN_ACC_ABORTCONF, &Dbtup::execACC_ABORTCONF);
// Drop table
addRecSignal(GSN_FSREMOVEREF, &Dbtup::execFSREMOVEREF, true);
addRecSignal(GSN_FSREMOVECONF, &Dbtup::execFSREMOVECONF, true);
attrbufrec = 0; attrbufrec = 0;
fragoperrec = 0; fragoperrec = 0;
fragrecord = 0; fragrecord = 0;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <ndb_limits.h> #include <ndb_limits.h>
#include <pc.hpp> #include <pc.hpp>
#include <signaldata/TupFrag.hpp> #include <signaldata/TupFrag.hpp>
#include <signaldata/FsRef.hpp>
#include <signaldata/FsConf.hpp> #include <signaldata/FsConf.hpp>
#include <signaldata/FsRemoveReq.hpp> #include <signaldata/FsRemoveReq.hpp>
#include <signaldata/DropTab.hpp> #include <signaldata/DropTab.hpp>
...@@ -1282,6 +1283,24 @@ Dbtup::drop_fragment_free_var_pages(Signal* signal) ...@@ -1282,6 +1283,24 @@ Dbtup::drop_fragment_free_var_pages(Signal* signal)
sendSignal(cownref, GSN_CONTINUEB, signal, 3, JBB); sendSignal(cownref, GSN_CONTINUEB, signal, 3, JBB);
return; return;
} }
/**
* Remove LCP's for fragment
*/
tabPtr.p->m_dropTable.m_lcpno = 0;
tabPtr.p->m_dropTable.m_fragPtrI = fragPtr.i;
drop_fragment_fsremove(signal, tabPtr, fragPtr);
}
void
Dbtup::drop_fragment_fsremove_done(Signal* signal,
TablerecPtr tabPtr,
FragrecordPtr fragPtr)
{
/**
* LCP's removed...
* now continue with "next"
*/
Uint32 logfile_group_id = fragPtr.p->m_logfile_group_id ; Uint32 logfile_group_id = fragPtr.p->m_logfile_group_id ;
releaseFragPages(fragPtr.p); releaseFragPages(fragPtr.p);
Uint32 i; Uint32 i;
...@@ -1301,6 +1320,74 @@ Dbtup::drop_fragment_free_var_pages(Signal* signal) ...@@ -1301,6 +1320,74 @@ Dbtup::drop_fragment_free_var_pages(Signal* signal)
return; return;
} }
// Remove LCP
void
Dbtup::drop_fragment_fsremove(Signal* signal,
TablerecPtr tabPtr,
FragrecordPtr fragPtr)
{
FsRemoveReq* req = (FsRemoveReq*)signal->getDataPtrSend();
req->userReference = reference();
req->userPointer = tabPtr.i;
req->directory = 0;
req->ownDirectory = 0;
Uint32 lcpno = tabPtr.p->m_dropTable.m_lcpno;
Uint32 fragId = fragPtr.p->fragmentId;
Uint32 tableId = fragPtr.p->fragTableId;
FsOpenReq::setVersion(req->fileNumber, 5);
FsOpenReq::setSuffix(req->fileNumber, FsOpenReq::S_DATA);
FsOpenReq::v5_setLcpNo(req->fileNumber, lcpno);
FsOpenReq::v5_setTableId(req->fileNumber, tableId);
FsOpenReq::v5_setFragmentId(req->fileNumber, fragId);
sendSignal(NDBFS_REF, GSN_FSREMOVEREQ, signal,
FsRemoveReq::SignalLength, JBB);
}
void
Dbtup::execFSREMOVEREF(Signal* signal)
{
jamEntry();
FsRef* ref = (FsRef*)signal->getDataPtr();
Uint32 userPointer = ref->userPointer;
FsConf* conf = (FsConf*)signal->getDataPtrSend();
conf->userPointer = userPointer;
execFSREMOVECONF(signal);
}
void
Dbtup::execFSREMOVECONF(Signal* signal)
{
jamEntry();
FsConf* conf = (FsConf*)signal->getDataPtrSend();
TablerecPtr tabPtr;
FragrecordPtr fragPtr;
tabPtr.i = conf->userPointer;
ptrCheckGuard(tabPtr, cnoOfTablerec, tablerec);
ndbrequire(tabPtr.p->tableStatus == DROPPING);
fragPtr.i = tabPtr.p->m_dropTable.m_fragPtrI;
ptrCheckGuard(fragPtr, cnoOfFragrec, fragrecord);
tabPtr.p->m_dropTable.m_lcpno++;
if (tabPtr.p->m_dropTable.m_lcpno < 3)
{
jam();
drop_fragment_fsremove(signal, tabPtr, fragPtr);
}
else
{
jam();
drop_fragment_fsremove_done(signal, tabPtr, fragPtr);
}
}
// End remove LCP
void void
Dbtup::start_restore_lcp(Uint32 tableId, Uint32 fragId) Dbtup::start_restore_lcp(Uint32 tableId, Uint32 fragId)
{ {
......
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