make it so we can still save coll.conf on

malloc/free cores. do not call RdbMap::reduceMemFootprint()
on maps that are from files being merged into and we're
resuming the killed merge at startup.
This commit is contained in:
Matt Wells
2015-08-21 18:07:07 -07:00
parent 23c7862892
commit 0f7910125b
3 changed files with 16 additions and 3 deletions

@ -532,7 +532,9 @@ bool Conf::save ( ) {
g_conf.m_testMem = false;
//char fname[1024];
//sprintf ( fname , "%sgb.conf.saving", g_hostdb.m_dir );
SafeBuf fn;
// fix so if we core in malloc/free we can still save conf
char fnbuf[1024];
SafeBuf fn(fnbuf,1024);
fn.safePrintf("%sgb.conf",g_hostdb.m_dir);
bool status = g_parms.saveToXml ( (char *)this ,
fn.getBufStart(),

@ -3866,8 +3866,9 @@ bool Parms::saveToXml ( char *THIS , char *f , char objType ) {
if ( g_conf.m_readOnlyMode ) return true;
// print into buffer
// "seeds" can be pretty big so go with safebuf now
//char buf[MAX_CONF_SIZE];
SafeBuf sb;
// fix so if we core in malloc/free we can still save conf
char tmpbuf[200000];
SafeBuf sb(tmpbuf,200000);
//char *p = buf;
//char *pend = buf + MAX_CONF_SIZE;
int32_t len ;

@ -1286,6 +1286,16 @@ void RdbMap::reduceMemFootPrint () {
if ( m_numPages >= 100 ) return;
// if already reduced, return now
if ( m_newPagesPerSegment > 0 ) return;
// if it is like posdb0054.map then it is being merged into and
// we'll resume a killed merge, so don't mess with it, we'll need to
// add more pages.
char *s = m_file.getFilename();
for ( ; s && *s && ! is_digit(*s) ; s++ );
int id = 0;
if ( s ) id = atoi(s);
if ( id && (id % 2) == 0 ) return;
// seems kinda buggy now..
m_reducedMem = true;
//return;