Skip to content

Commit

Permalink
Fixes a pageSize remap issue in GBPTree
Browse files Browse the repository at this point in the history
Which was exposed by a test in LabelScanStoreTest that randomly scrambled the header
of a GBPTree file. It so happened that now and then it would provide a negative
page size, the existing sanity checking of page size didn't check this and so would
move on to close the pagedFile and then fail when trying to map the file with the
negative page size, which would then result in the fail-safe closing in GBPTree
constructor to itself fail due to the pagedFile already being closed and so
would fail the test in an unexpected way.
  • Loading branch information
tinwelint committed Jan 22, 2018
1 parent 8b97f81 commit c68d5e5
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -750,7 +750,7 @@ private static PagedFile mapWithCorrectPageSize( PageCache pageCache, File index
// This index was created with another page size, re-open with that actual page size
if ( pageSize != pageCache.pageSize() )
{
if ( pageSize > pageCache.pageSize() )
if ( pageSize > pageCache.pageSize() || pageSize < 0 )
{
throw new MetadataMismatchException(
"Tried to create tree with page size %d, but page cache used to open it this time " +
Expand Down

0 comments on commit c68d5e5

Please sign in to comment.