fix file cache.

fix core when file cache max mem is 0.
This commit is contained in:
Matt Wells
2015-09-10 22:21:55 -07:00
parent 8611a06dc8
commit 3c8c415d04
2 changed files with 18 additions and 7 deletions

@ -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();