forked from Mirrors/privacore-open-source-search-engine
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:
4
Conf.cpp
4
Conf.cpp
@ -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 ;
|
||||
|
10
RdbMap.cpp
10
RdbMap.cpp
@ -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;
|
||||
|
Reference in New Issue
Block a user