try to fix core from deleting coll

This commit is contained in:
Matt Wells 2014-04-25 11:52:17 -07:00
parent b99beb0006
commit f3c06ced57
3 changed files with 26 additions and 9 deletions

@ -807,6 +807,11 @@ bool Collectiondb::deleteRec2 ( collnum_t collnum ) { //, WaitEntry *we ) {
sc->clearLocks();
//sc->m_collnum = newCollnum;
//sc->reset();
// you have to set this for tryToDeleteSpiderColl to
// actually have a shot at deleting it
sc->m_deleteMyself = true;
// cr will be invalid shortly after this
sc->m_cr = NULL;
// this will put it on "death row" so it will be deleted
// once Msg5::m_waitingForList/Merge is NULL
tryToDeleteSpiderColl ( sc );
@ -1584,12 +1589,14 @@ void CollectionRec::reset() {
sc->m_deleteMyself = true;
// if not currently being accessed nuke it now
if ( ! sc->m_msg5.m_waitingForList &&
! sc->m_msg5b.m_waitingForList &&
! sc->m_msg1.m_mcast.m_inUse ) {
mdelete ( sc, sizeof(SpiderColl),"nukecr2");
delete ( sc );
}
tryToDeleteSpiderColl ( sc );
// if ( ! sc->m_msg5.m_waitingForList &&
// ! sc->m_msg5b.m_waitingForList &&
// ! sc->m_msg1.m_mcast.m_inUse ) {
// mdelete ( sc, sizeof(SpiderColl),"nukecr2");
// delete ( sc );
// }
}
CollectionRec *g_cr = NULL;

@ -802,7 +802,9 @@ bool Msg5::needsRecall ( ) {
RdbBase *base = getRdbBase ( m_rdbId , m_collnum );
// if collection was deleted from under us, base will be NULL
if ( ! base && ! g_errno ) {
log("msg5: base lost for collnum %li",(long)m_collnum);
log("msg5: base lost for rdbid=%li collnum %li",
(long)m_rdbId,(long)m_collnum);
g_errno = ENOCOLLREC;
return false;
}
// sanity check

@ -1026,14 +1026,22 @@ bool tryToDeleteSpiderColl ( SpiderColl *sc ) {
(long)sc,(long)sc->m_collnum);
return true;
}
// this means msg5 is out
if ( sc->m_msg5.m_waitingForList ) {
log("spider: deleting sc=0x%lx for collnum=%li waiting4",
(long)sc,(long)sc->m_collnum);
return true;
}
// there's still a core of someone trying to write to someting
// in "sc" so we have to try to fix that. somewhere in xmldoc.cpp
// or spider.cpp. everyone should get sc from cr everytime i'd think
log("spider: deleting sc=0x%lx for collnum=%li",
(long)sc,(long)sc->m_collnum);
// . make sure nobody has it
// . cr might be NULL because Collectiondb.cpp::deleteRec2() might
// have nuked it
CollectionRec *cr = sc->m_cr;
// make sure nobody has it
cr->m_spiderColl = NULL;
if ( cr ) cr->m_spiderColl = NULL;
mdelete ( sc , sizeof(SpiderColl),"postdel1");
delete ( sc );
return true;