mirror of
https://github.com/privacore/open-source-search-engine.git
synced 2025-07-16 02:46:08 -04:00
fix file cache.
fix core when file cache max mem is 0.
This commit is contained in:
20
Msg3.cpp
20
Msg3.cpp
@ -701,8 +701,11 @@ bool Msg3::readList ( char rdbId ,
|
||||
if ( inCache ) {
|
||||
m_scans[i].m_inPageCache = true;
|
||||
m_numScansCompleted++;
|
||||
m_lists[i].set ( rec ,
|
||||
recSize ,
|
||||
// now we have to store this value, 6 or 12 so
|
||||
// we can modify the hint appropriately
|
||||
m_scans[i].m_shifted = *rec;
|
||||
m_lists[i].set ( rec +1,
|
||||
recSize-1 ,
|
||||
rec , // alloc
|
||||
recSize , // allocSize
|
||||
startKey2 ,
|
||||
@ -1072,8 +1075,10 @@ bool Msg3::doneScanning ( ) {
|
||||
-1 , // maxAge, none
|
||||
true ); // inccounts?
|
||||
if ( inCache &&
|
||||
( m_lists[i].m_listSize != recSize ||
|
||||
memcmp ( m_lists[i].m_list , rec , recSize ))) {
|
||||
// 1st byte is RdbScan::m_shifted
|
||||
( m_lists[i].m_listSize != recSize-1 ||
|
||||
memcmp ( m_lists[i].m_list , rec+1,recSize-1) ||
|
||||
*rec != m_scans[i].m_shifted ) ) {
|
||||
log("msg3: cache did not validate");
|
||||
char *xx=NULL;*xx=0;
|
||||
}
|
||||
@ -1093,8 +1098,13 @@ bool Msg3::doneScanning ( ) {
|
||||
! m_scans[i].m_inPageCache )
|
||||
rpc->addRecord ( (collnum_t)0 , // collnum
|
||||
(char *)&ck ,
|
||||
// rec1 is this little thingy
|
||||
&m_scans[i].m_shifted,
|
||||
1,
|
||||
// rec2
|
||||
m_lists[i].getList() ,
|
||||
m_lists[i].getListSize() );
|
||||
m_lists[i].getListSize() ,
|
||||
0 ); // timestamp. 0 = now
|
||||
|
||||
// if from our 'page' cache, no need to constrain
|
||||
if ( ! m_lists[i].constrain ( m_startKey ,
|
||||
|
@ -780,14 +780,15 @@ bool RdbCache::addRecord ( collnum_t collnum ,
|
||||
int32_t timestamp ,
|
||||
char **retRecPtr ) {
|
||||
|
||||
// bail if cache empty. maybe m_maxMem is 0.
|
||||
if ( m_totalBufSize <= 0 ) return true;
|
||||
|
||||
//int64_t startTime = gettimeofdayInMillisecondsLocal();
|
||||
if ( collnum < (collnum_t)0) {char *xx=NULL;*xx=0; }
|
||||
if ( collnum >= m_maxColls ) {char *xx=NULL;*xx=0; }
|
||||
// full key not allowed because we use that in markDeletedRecord()
|
||||
if ( KEYCMP(cacheKey,KEYMAX(),m_cks) == 0 ) { char *xx=NULL;*xx=0; }
|
||||
|
||||
// bail if cache empty
|
||||
if ( m_totalBufSize <= 0 ) return true;
|
||||
// debug msg
|
||||
int64_t t = 0LL ;
|
||||
if ( g_conf.m_logTimingDb ) t = gettimeofdayInMillisecondsLocal();
|
||||
|
Reference in New Issue
Block a user