@Test public void shouldRefuseToUpgradeIfAllOfTheStoresWereNotShutDownCleanly() throws IOException { File comparisonDirectory = directory.directory( "shouldRefuseToUpgradeIfAllOfTheStoresWereNotShutDownCleanly-comparison" ); removeCheckPointFromTxLog( fileSystem, databaseLayout.databaseDirectory() ); fileSystem.deleteRecursively( comparisonDirectory ); fileSystem.copyRecursively( databaseLayout.databaseDirectory(), comparisonDirectory ); PageCache pageCache = pageCacheRule.getPageCache( fileSystem ); UpgradableDatabase upgradableDatabase = getUpgradableDatabase( pageCache ); try { newUpgrader( upgradableDatabase, pageCache ).migrateIfNeeded( databaseLayout ); fail( "Should throw exception" ); } catch ( StoreUpgrader.UnableToUpgradeException e ) { // expected } verifyFilesHaveSameContent( fileSystem, comparisonDirectory, databaseLayout.databaseDirectory() ); }
@Test public void shouldRefuseToUpgradeIfAnyOfTheStoresWereNotShutDownCleanly() throws IOException { File comparisonDirectory = directory.directory( "shouldRefuseToUpgradeIfAnyOfTheStoresWereNotShutDownCleanly-comparison" ); removeCheckPointFromTxLog( fileSystem, databaseLayout.databaseDirectory() ); fileSystem.deleteRecursively( comparisonDirectory ); fileSystem.copyRecursively( databaseLayout.databaseDirectory(), comparisonDirectory ); PageCache pageCache = pageCacheRule.getPageCache( fileSystem ); UpgradableDatabase upgradableDatabase = getUpgradableDatabase( pageCache ); try { newUpgrader( upgradableDatabase, pageCache ).migrateIfNeeded( databaseLayout ); fail( "Should throw exception" ); } catch ( StoreUpgrader.UnableToUpgradeException e ) { // expected } verifyFilesHaveSameContent( fileSystem, comparisonDirectory, databaseLayout.databaseDirectory() ); }