forked from Mirrors/privacore-open-source-search-engine
fix data corruption detection and repair bug.
do not core on corrupt http reply missing \0. just set the g_errno to ECORRUPTDATA. give more informative corruption log msgs.
This commit is contained in:
12
Msg5.cpp
12
Msg5.cpp
@ -1537,7 +1537,9 @@ void Msg5::repairLists_r ( ) {
|
||||
if ( i < nn && base ) {
|
||||
long fn = m_msg3.m_fileNums[i];
|
||||
BigFile *bf = base->getFile ( fn );
|
||||
log("db: Corrupt filename is %s.",bf->getFilename());
|
||||
log("db: Corrupt filename is %s in collnum %li."
|
||||
,bf->getFilename()
|
||||
,(long)m_collnum);
|
||||
//key_t sk = m_listPtrs[i]->getStartKey();
|
||||
//key_t ek = m_listPtrs[i]->getEndKey ();
|
||||
//log("db: "
|
||||
@ -1553,10 +1555,10 @@ void Msg5::repairLists_r ( ) {
|
||||
}
|
||||
// . remove the bad eggs from the list
|
||||
// . TODO: support non-fixed data sizes
|
||||
if ( m_listPtrs[i]->getFixedDataSize() >= 0 )
|
||||
m_listPtrs[i]->removeBadData_r();
|
||||
else
|
||||
m_listPtrs[i]->reset();
|
||||
//if ( m_listPtrs[i]->getFixedDataSize() >= 0 )
|
||||
m_listPtrs[i]->removeBadData_r();
|
||||
//else
|
||||
//m_listPtrs[i]->reset();
|
||||
// otherwise we have a patchable error
|
||||
m_hadCorruption = true;
|
||||
// don't add a list with errors to cache, please
|
||||
|
@ -1091,7 +1091,14 @@ bool RdbList::removeBadData_r ( ) {
|
||||
// . if not fixed size, remove all the data for now
|
||||
// . TODO: make this better, man
|
||||
if ( m_fixedDataSize == -1 ) {
|
||||
reset();
|
||||
// don't call reset because it sets m_ks back to 12
|
||||
//reset();
|
||||
m_listSize = 0;
|
||||
m_list = NULL;
|
||||
m_listPtr = NULL;
|
||||
m_listEnd = NULL;
|
||||
m_mergeMinListSize = -1;
|
||||
m_lastKeyIsValid = false;
|
||||
return true;
|
||||
}
|
||||
//key_t oldk;
|
||||
|
17
XmlDoc.cpp
17
XmlDoc.cpp
@ -14666,7 +14666,22 @@ char **XmlDoc::gotHttpReply ( ) {
|
||||
// sanity check -- check after bailing on corruption because
|
||||
// corrupted replies do not end in NULLs
|
||||
if ( m_httpReplySize > 0 && m_httpReply[m_httpReplySize-1] ) {
|
||||
char *xx=NULL;*xx=0; }
|
||||
log("http: httpReplySize=%li http reply does not end in \\0 "
|
||||
"for %s in collnum=%li. blanking out reply."
|
||||
,m_httpReplySize
|
||||
,m_firstUrl.m_url
|
||||
,(long)m_collnum
|
||||
);
|
||||
// free it i guess
|
||||
mfree ( m_httpReply, m_httpReplyAllocSize, "XmlDocHR" );
|
||||
// and reset it
|
||||
m_httpReplySize = 0;
|
||||
m_httpReply = NULL;
|
||||
m_httpReplyAllocSize = 0;
|
||||
// call it data corruption i guess for now
|
||||
g_errno = ECORRUPTDATA;
|
||||
//char *xx=NULL;*xx=0;
|
||||
}
|
||||
|
||||
// if its a bad gzip reply, a compressed http reply, then
|
||||
// make the whole thing empty? some websites return compressed replies
|
||||
|
4
main.cpp
4
main.cpp
@ -16878,8 +16878,8 @@ bool isRecoveryFutile ( ) {
|
||||
// get time stamp
|
||||
long timestamp = ff.getLastModifiedTime ( );
|
||||
|
||||
// skip if not iwthin last minute
|
||||
if ( timestamp < now - 60 ) continue;
|
||||
// skip if not iwthin 2 minutes
|
||||
if ( timestamp < now - 2*60 ) continue;
|
||||
|
||||
// open it up to see if ends with sighandle
|
||||
long toRead = 3000;
|
||||
|
Reference in New Issue
Block a user