fixed bug of not saving waiting trees!

took out misleading Collectiondb::getNumRecs() func.! bad
This commit is contained in:
Matt Wells
2014-01-23 01:02:11 -08:00
parent e351cb9939
commit 26b98a591a
3 changed files with 12 additions and 5 deletions

@ -1079,7 +1079,7 @@ void storeLineWaiters ( ) {
goto loop;
}
#include "Process.h"
// . destroys the slot if false is returned
// . this is registered in Msg4::set() to handle add rdb record msgs

@ -306,7 +306,9 @@ void StateCD::sendBackDump2 ( ) {
m_numReplies = 0;
// read 10MB from each shard's spiderdb at a time
m_minRecSizes = 9999999;
//m_minRecSizes = 9999999;
// 1ook to be more fluid
m_minRecSizes = 99999;
// we stop reading from all shards when this becomes false
m_someoneNeedsMore = true;

@ -888,14 +888,19 @@ void SpiderCache::save ( bool useThread ) {
// assume saving
//m_isSaving = true;
// loop over all SpiderColls and get the best
for ( long i = 0 ; i < g_collectiondb.getNumRecs() ; i++ ) {
for ( long i = 0 ; i < g_collectiondb.m_numRecs ; i++ ) {
SpiderColl *sc = getSpiderCollIffNonNull(i);//m_spiderColls[i];
if ( ! sc ) continue;
RdbTree *tree = &sc->m_waitingTree;
if ( ! tree->m_needsSave ) continue;
// if already saving from a thread
if ( tree->m_isSaving ) continue;
char *filename = "waitingtree";
char dir[1024];
sprintf(dir,"%scoll.%s.%li",g_hostdb.m_dir,
sc->m_coll,(long)sc->m_collnum);
// log it for now
log("spider: saving waiting tree for cn=%li",(long)i);
// returns false if it blocked, callback will be called
tree->fastSave ( dir, // g_hostdb.m_dir ,
filename ,
@ -938,7 +943,7 @@ void SpiderCache::save ( bool useThread ) {
}
bool SpiderCache::needsSave ( ) {
for ( long i = 0 ; i < g_collectiondb.getNumRecs() ; i++ ) {
for ( long i = 0 ; i < g_collectiondb.m_numRecs ; i++ ) {
SpiderColl *sc = getSpiderCollIffNonNull(i);//m_spiderColls[i];
if ( ! sc ) continue;
if ( sc->m_waitingTree.m_needsSave ) return true;
@ -951,7 +956,7 @@ bool SpiderCache::needsSave ( ) {
void SpiderCache::reset ( ) {
log(LOG_DEBUG,"spider: resetting spidercache");
// loop over all SpiderColls and get the best
for ( long i = 0 ; i < g_collectiondb.getNumRecs() ; i++ ) {
for ( long i = 0 ; i < g_collectiondb.m_numRecs ; i++ ) {
SpiderColl *sc = getSpiderCollIffNonNull(i);
if ( ! sc ) continue;
sc->reset();