Skip to content

Instantly share code, notes, and snippets.

@tomatolog
Created November 14, 2012 16:21
Show Gist options
  • Save tomatolog/4073084 to your computer and use it in GitHub Desktop.
Save tomatolog/4073084 to your computer and use it in GitHub Desktop.
additional report on spa loading failed
--- src\sphinx.cpp
+++ src\sphinx.cpp
@@ -680,14 +680,14 @@
}
if ( bCheckSizeT )
{
size_t sCheck = (size_t)st.st_size;
if ( st.st_size!=SphOffset_t(sCheck) )
{
- sError.SetSprintf ( "failed to load %s: bad size "INT64_FMT" (out of size_t; 4 GB limit on 32-bit machine hit?)",
- GetFilename(), (int64_t)st.st_size );
+ sError.SetSprintf ( "failed to load %s: bad size "INT64_FMT"("INT64_FMT") (out of size_t; 4 GB limit on 32-bit machine hit?)",
+ GetFilename(), (int64_t)st.st_size, SphOffset_t(sCheck) );
return -1;
}
}
return st.st_size;
}
@@ -14853,12 +14853,14 @@
CSphAutofile tDocinfo ( GetIndexFileName("spa"), SPH_O_READ, m_sLastError );
if ( tDocinfo.GetFD()<0 )
return false;
int64_t iDocinfoSize = tDocinfo.GetSize ( iEntrySize, true, m_sLastError ) / sizeof(DWORD);
+ if ( iDocinfoSize<0 )
+ return false;
int64_t iRealDocinfoSize = m_uMinMaxIndex ? m_uMinMaxIndex : iDocinfoSize;
// intentionally losing data; we don't support more than 4B documents per instance yet
m_uDocinfo = (DWORD)( iRealDocinfoSize / iStride );
if ( iRealDocinfoSize!=(int64_t)m_uDocinfo*iStride && !m_bId32to64 )
@@ -14892,13 +14894,14 @@
m_pDocinfoIndex = m_pDocinfo.GetWritePtr()+iDocinfoSize;
} else
{
if ( iDocinfoSize < iRealDocinfoSize )
{
- m_sLastError.SetSprintf ( "precomputed chunk size check mismatch" );
+ m_sLastError.SetSprintf ( "precomputed chunk size check mismatch (docinfo="INT64_FMT", real="INT64_FMT", rows=%d, min-max="INT64_FMT")",
+ iDocinfoSize, iRealDocinfoSize, m_uDocinfo, m_uMinMaxIndex );
return false;
}
m_uDocinfoIndex = (DWORD)( ( ( iDocinfoSize - iRealDocinfoSize ) / (m_bId32to64?iStride2:iStride) / 2 ) - 1 );
// prealloc docinfo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment