protected void prepareSampleDatabase( String version, FileSystemAbstraction fileSystem, DatabaseLayout databaseLayout, File databaseDirectory ) throws IOException { MigrationTestUtils.prepareSampleLegacyDatabase( version, fileSystem, databaseLayout.databaseDirectory(), databaseDirectory ); }
@Before public void setup() throws IOException { fileSystem = fileSystemRule.get(); PageCache pageCache = pageCacheRule.getPageCache( fileSystem ); workingStoreDir = testDir.storeDir( "working_" + version ); workingDatabaseLayout = testDir.databaseLayout( workingStoreDir ); check = new StoreVersionCheck( pageCache ); File prepareDirectory = testDir.directory( "prepare_" + version ); prepareSampleLegacyDatabase( version, fileSystem, workingDatabaseLayout.databaseDirectory(), prepareDirectory ); }
@Test public void shouldComputeTheLastTxInfoCorrectly() throws Exception { // given DatabaseLayout databaseLayout = directory.databaseLayout(); File prepare = directory.directory( "prepare" ); MigrationTestUtils.prepareSampleLegacyDatabase( version, fs, databaseLayout.databaseDirectory(), prepare ); // and a state of the migration saying that it has done the actual migration LogService logService = NullLogService.getInstance(); PageCache pageCache = pageCacheRule.getPageCache( fs ); LogTailScanner tailScanner = getTailScanner( databaseLayout.databaseDirectory() ); UpgradableDatabase upgradableDatabase = getUpgradableDatabase( pageCache, tailScanner ); String versionToMigrateFrom = upgradableDatabase.checkUpgradable( databaseLayout ).storeVersion(); SilentMigrationProgressMonitor progressMonitor = new SilentMigrationProgressMonitor(); StoreMigrator migrator = new StoreMigrator( fs, pageCache, CONFIG, logService, jobScheduler ); DatabaseLayout migrationLayout = directory.databaseLayout( StoreUpgrader.MIGRATION_DIRECTORY ); // when migrator.migrate( databaseLayout, migrationLayout, progressMonitor.startSection( "section" ), versionToMigrateFrom, upgradableDatabase.currentVersion() ); // then assertTrue( txIdComparator.apply( migrator.readLastTxInformation( migrationLayout ) ) ); }
throws IOException, ConsistencyCheckIncompleteException MigrationTestUtils.prepareSampleLegacyDatabase( version, fs, workingDatabaseLayout.databaseDirectory(), prepareDirectory ); PageCache pageCache = pageCacheRule.getPageCache( fs ); StoreVersionCheck check = new StoreVersionCheck( pageCache );
@Test public void shouldComputeTheLastTxLogPositionCorrectly() throws Throwable { // GIVEN a legacy database DatabaseLayout databaseLayout = directory.databaseLayout(); File prepare = directory.directory( "prepare" ); MigrationTestUtils.prepareSampleLegacyDatabase( version, fs, databaseLayout.databaseDirectory(), prepare ); // and a state of the migration saying that it has done the actual migration LogService logService = NullLogService.getInstance(); PageCache pageCache = pageCacheRule.getPageCache( fs ); LogTailScanner tailScanner = getTailScanner( databaseLayout.databaseDirectory() ); UpgradableDatabase upgradableDatabase = getUpgradableDatabase( pageCache, tailScanner ); String versionToMigrateFrom = upgradableDatabase.checkUpgradable( databaseLayout ).storeVersion(); SilentMigrationProgressMonitor progressMonitor = new SilentMigrationProgressMonitor(); StoreMigrator migrator = new StoreMigrator( fs, pageCache, CONFIG, logService, jobScheduler ); DatabaseLayout migrationLayout = directory.databaseLayout( StoreUpgrader.MIGRATION_DIRECTORY ); // WHEN migrating migrator.migrate( databaseLayout, migrationLayout, progressMonitor.startSection( "section" ), versionToMigrateFrom, upgradableDatabase.currentVersion() ); // THEN it should compute the correct last tx log position assertEquals( expectedLogPosition, migrator.readLastTxLogPosition( migrationLayout ) ); }
throws IOException, ConsistencyCheckIncompleteException MigrationTestUtils.prepareSampleLegacyDatabase( version, fs, workingDatabaseLayout.databaseDirectory(), prepareDirectory ); PageCache pageCache = pageCacheRule.getPageCache( fs ); StoreVersionCheck check = new StoreVersionCheck( pageCache );
MigrationTestUtils.prepareSampleLegacyDatabase( version, fs, databaseLayout.databaseDirectory(), prepare );
MigrationTestUtils.prepareSampleLegacyDatabase( version, fs, databaseLayout.databaseDirectory(), prepare );
MigrationTestUtils.prepareSampleLegacyDatabase( version, fs, databaseLayout.databaseDirectory(), prepare );