public boolean isConsitentWithIndex ( ) throws IOException { byte [ ] b = new byte [ keySize ] ; long offset = 0 ; int maxChunk = getChunkIndex ( getFilledUpFromContentStart ( ) ) ; boolean isConsistent = true ; for ( int i = 1 ; i <= maxChunk ; i ++ ) { offset = i * getChunkSize ( ) - elementSize ; read ( offset , ByteBuffer . wrap ( b ) ) ; if ( KeyUtils . compareKey ( getIndex ( ) . maxKeyPerChunk [ i - 1 ] , b ) != 0 ) { logger . error ( "Index is not consistent to data. Expected {}, but found {}." , Arrays . toString ( getIndex ( ) . maxKeyPerChunk [ i - 1 ] ) , Arrays . toString ( b ) ) ; isConsistent = false ; } } return isConsistent ; }
This method checks if the data is consistent with the index .