private CompletableFuture < ? > loadSmallestOffsetPage ( PageCollection pageCollection , TimeoutTimer timer ) { if ( pageCollection . getCount ( ) <= 1 ) { // We only modified at most one page. This means have at most one page in the index, so no point in re-loading it. return CompletableFuture . completedFuture ( null ) ; } long minOffset = calculateMinOffset ( pageCollection . getRootPage ( ) ) ; return locatePage ( page -> getPagePointer ( minOffset , page ) , page -> ! page . isIndexPage ( ) || page . getOffset ( ) == minOffset , pageCollection , timer ) ; }
Loads the BTreePage with the smallest offset from the DataSource . The purpose of this is for incremental compaction . The page with the smallest offset will be moved to the end of the index which allows the external data source to perform any truncation necessary in order to free up space .