mirror of
https://github.com/gigablast/open-source-search-engine.git
synced 2024-11-20 18:57:32 +03:00
fix dump core when collection deleted while dumping
This commit is contained in:
parent
56bde4c3ef
commit
fc495a5bf5
12
Rdb.cpp
12
Rdb.cpp
@ -1475,6 +1475,13 @@ bool Rdb::dumpCollLoop ( ) {
|
||||
"memory.",base->m_files[m_fn]->getFilename());
|
||||
base->buryFiles ( m_fn , m_fn+1 );
|
||||
}
|
||||
// if it was because a collection got deleted, keep going
|
||||
if ( g_errno == ENOCOLLREC ) {
|
||||
log("rdb: ignoring deleted collection and "
|
||||
"continuing dump");
|
||||
g_errno = 0;
|
||||
goto keepGoing;
|
||||
}
|
||||
// game over, man
|
||||
doneDumping();
|
||||
// update this so we don't try too much and flood the log
|
||||
@ -1482,6 +1489,7 @@ bool Rdb::dumpCollLoop ( ) {
|
||||
s_lastTryTime = getTime();
|
||||
return true;
|
||||
}
|
||||
keepGoing:
|
||||
// advance for next round
|
||||
m_dumpCollnum++;
|
||||
|
||||
@ -2344,6 +2352,10 @@ bool Rdb::hasRoom ( RdbList *list , int32_t niceness ) {
|
||||
m_lastReclaim = reclaimed;
|
||||
}
|
||||
|
||||
//if ( dataSpace <= 0 ) return true;
|
||||
// if rdbmem is already 90 percent full, just say no in case
|
||||
// we have to realloc in RdbMem.cpp::...
|
||||
|
||||
// does m_mem have room for "dataSpace"?
|
||||
if ( (int64_t)m_mem.getAvailMem() < dataSpace ) return false;
|
||||
// otherwise, we do have room
|
||||
|
@ -954,10 +954,12 @@ bool RdbDump::doneReadingForVerify ( ) {
|
||||
bool s;
|
||||
if(m_tree) {
|
||||
s = m_tree->deleteList(m_collnum,m_list,true/*do balancing?*/);
|
||||
log("dump: tree now has %i nodes",(int)m_tree->m_numUsedNodes);
|
||||
}
|
||||
else if(m_buckets) {
|
||||
s = m_buckets->deleteList(m_collnum, m_list);
|
||||
}
|
||||
|
||||
// problem?
|
||||
if ( ! s && ! m_tried ) {
|
||||
m_tried = true;
|
||||
|
@ -239,8 +239,10 @@ void RdbMem::freeDumpedMem( RdbTree *tree ) {
|
||||
// so allocData should return m_ptr2 guys
|
||||
char *newData = (char *)allocData(NULL,size,0);
|
||||
if ( ! newData ) {
|
||||
int32_t cn = 0;
|
||||
if ( tree->m_collnums ) cn = tree->m_collnums[i];
|
||||
log("rdbmem: failed to alloc %i "
|
||||
"bytes node %i",(int)size,(int)i);
|
||||
"bytes node %i (cn=%i)",(int)size,(int)i,(int)cn);
|
||||
continue;
|
||||
}
|
||||
// debug test
|
||||
|
@ -3209,8 +3209,8 @@ void RdbTree::cleanTree ( ) { // char **bases ) {
|
||||
m_collnums[i] < max &&
|
||||
g_collectiondb.m_recs[m_collnums[i]] ) continue;
|
||||
// if it is negtiave, remove it, that is wierd corruption
|
||||
if ( m_collnums[i] < 0 )
|
||||
deleteNode3 ( i , true );
|
||||
// if ( m_collnums[i] < 0 )
|
||||
// deleteNode3 ( i , true );
|
||||
// remove it otherwise
|
||||
// don't actually remove it!!!! in case collection gets
|
||||
// moved accidentally.
|
||||
|
Loading…
Reference in New Issue
Block a user