Skip to content
Permalink
Browse files

fixed indextool check to report wrong skiplist offset, check of doc2r…

…ow lookup
  • Loading branch information
tomatolog committed Nov 15, 2019
1 parent cf10d7d commit 996de77f4c3ec103d965e28c36098fd07dba50c4
Showing with 13 additions and 6 deletions.
  1. +13 −6 src/sphinx.cpp
@@ -18190,10 +18190,14 @@ void CSphIndex_VLN::DebugCheck_Docs ( DebugCheckContext_t & tCtx, DebugCheckErro
iDictHits = tDictReader.UnzipInt();
}

// FIXME? verify skiplist content too
int iSkipsOffset = 0;
int64_t iSkipsOffset = 0;
if ( iDictDocs>m_tSettings.m_iSkiplistBlockSize && !bHitless )
iSkipsOffset = tDictReader.UnzipInt();
{
if ( m_uVersion<=57 )
iSkipsOffset = (int)tDictReader.UnzipInt();
else
iSkipsOffset = tDictReader.UnzipOffset();
}

// check whether the offset is as expected
if ( iDoclistOffset!=pDocsReader->GetPos() )
{
if ( iSkipsOffset<=0 || iSkipsOffset>iSkiplistLen )
{
tReporter.Fail ( "invalid skiplist offset (wordid=%llu(%s), off=%d, max=" INT64_FMT ")", UINT64 ( uWordid ), sWord, iSkipsOffset, iSkiplistLen );
tReporter.Fail ( "invalid skiplist offset (wordid=%llu(%s), off=" INT64_FMT ", max=" INT64_FMT ")", UINT64 ( uWordid ), sWord, iSkipsOffset, iSkiplistLen );
break;
}

int iCpDocs = iDocsPerCheckpoint;
// last checkpoint might have less docs
if ( iCp==iCheckpoints-1 )
iCpDocs = ( iDocs % iDocsPerCheckpoint );
{
int iLefover = ( iDocs % iDocsPerCheckpoint );
iCpDocs = ( iLefover ? iLefover : iDocsPerCheckpoint );
}

for ( int i=0; i<iCpDocs; i++ )
{

DocID_t tDocID = sphGetDocID ( dRow.Begin() );

tReporter.Fail ( "row %u( " INT64_FMT ") not mapped at lookup, docid " INT64_FMT, i, iDocinfo, tDocID );
tReporter.Fail ( "row %u(" INT64_FMT ") not mapped at lookup, docid " INT64_FMT, i, iDocinfo, tDocID );
}
}

0 comments on commit 996de77

Please sign in to comment.
You can’t perform that action at this time.