use of org.neo4j.storageengine.api.StoreVersion in project neo4j by neo4j.
the class IndexConfigMigrator method needConfigMigration.
private boolean needConfigMigration(String versionToMigrateFrom, String versionToMigrateTo) {
StoreVersion fromVersionInformation = storageEngineFactory.versionInformation(versionToMigrateFrom);
StoreVersion toVersionInformation = storageEngineFactory.versionInformation(versionToMigrateTo);
return !fromVersionInformation.hasCompatibleCapabilities(toVersionInformation, CapabilityType.INDEX_CONFIG);
}
use of org.neo4j.storageengine.api.StoreVersion in project neo4j by neo4j.
the class IndexProviderMigrator method needProviderMigration.
private boolean needProviderMigration(String versionToMigrateFrom, String versionToMigrateTo) {
StoreVersion fromVersionInformation = storageEngineFactory.versionInformation(versionToMigrateFrom);
StoreVersion toVersionInformation = storageEngineFactory.versionInformation(versionToMigrateTo);
return !fromVersionInformation.hasCompatibleCapabilities(toVersionInformation, CapabilityType.INDEX_PROVIDER);
}
use of org.neo4j.storageengine.api.StoreVersion in project neo4j by neo4j.
the class SchemaIndexMigratorTest method schemaAndLabelIndexesRemovedAfterSuccessfulMigration.
@Test
void schemaAndLabelIndexesRemovedAfterSuccessfulMigration() throws IOException {
StorageEngineFactory storageEngineFactory = mock(StorageEngineFactory.class);
StoreVersion version = mock(StoreVersion.class);
when(version.hasCompatibleCapabilities(any(), eq(CapabilityType.INDEX))).thenReturn(false);
when(storageEngineFactory.versionInformation(anyString())).thenReturn(version);
IndexImporterFactory indexImporterFactory = mock(IndexImporterFactory.class);
IndexDirectoryStructure directoryStructure = mock(IndexDirectoryStructure.class);
Path indexProviderRootDirectory = databaseLayout.file("just-some-directory");
when(directoryStructure.rootDirectory()).thenReturn(indexProviderRootDirectory);
SchemaIndexMigrator migrator = new SchemaIndexMigrator("Test migrator", fs, pageCache, directoryStructure, storageEngineFactory, true);
when(indexProvider.getProviderDescriptor()).thenReturn(new IndexProviderDescriptor("key", "version"));
migrator.migrate(databaseLayout, migrationLayout, progressReporter, "from", "to", indexImporterFactory);
migrator.moveMigratedFiles(migrationLayout, databaseLayout, "from", "to");
verify(fs).deleteRecursively(indexProviderRootDirectory);
}
use of org.neo4j.storageengine.api.StoreVersion in project neo4j by neo4j.
the class SchemaIndexMigratorTest method shouldDeleteRelationshipIndexesAfterCrossFormatFamilyMigration.
@Test
void shouldDeleteRelationshipIndexesAfterCrossFormatFamilyMigration() throws IOException {
// given
IndexProviderDescriptor provider = new IndexProviderDescriptor("k", "v");
IndexDirectoryStructure directoryStructure = directoriesByProvider(databaseLayout.databaseDirectory()).forProvider(provider);
StorageEngineFactory storageEngineFactory = mock(StorageEngineFactory.class);
StoreVersion fromVersion = mock(StoreVersion.class);
StoreVersion toVersion = mock(StoreVersion.class);
when(fromVersion.hasCompatibleCapabilities(toVersion, CapabilityType.FORMAT)).thenReturn(false);
when(storageEngineFactory.versionInformation("from")).thenReturn(fromVersion);
when(storageEngineFactory.versionInformation("to")).thenReturn(toVersion);
List<SchemaRule> schemaRules = new ArrayList<>();
schemaRules.add(forSchema(SchemaDescriptor.forLabel(1, 2, 3)).withName("n1").materialise(1L));
schemaRules.add(forSchema(SchemaDescriptor.forRelType(5, 3)).withName("r1").materialise(2L));
schemaRules.add(forSchema(SchemaDescriptor.fulltext(RELATIONSHIP, new int[] { 1, 2, 3 }, new int[] { 4, 5, 6 })).withName("r2").materialise(3L));
schemaRules.add(forSchema(SchemaDescriptor.fulltext(NODE, new int[] { 1, 2, 3 }, new int[] { 4, 5, 6 })).withName("n2").materialise(4L));
when(storageEngineFactory.loadSchemaRules(any(), any(), any(), any(), any())).thenReturn(schemaRules);
SchemaIndexMigrator migrator = new SchemaIndexMigrator("Test migrator", fs, pageCache, directoryStructure, storageEngineFactory, false);
// when
migrator.migrate(databaseLayout, migrationLayout, progressReporter, "from", "to", IndexImporterFactory.EMPTY);
migrator.moveMigratedFiles(databaseLayout, migrationLayout, "from", "to");
// then
verify(fs, never()).deleteRecursively(directoryStructure.directoryForIndex(1L));
verify(fs).deleteRecursively(directoryStructure.directoryForIndex(2L));
verify(fs).deleteRecursively(directoryStructure.directoryForIndex(3L));
verify(fs, never()).deleteRecursively(directoryStructure.directoryForIndex(4L));
}
use of org.neo4j.storageengine.api.StoreVersion in project neo4j by neo4j.
the class TokenIndexMigrator method migrate.
@Override
public void migrate(DatabaseLayout directoryLayout, DatabaseLayout migrationLayout, ProgressReporter progressReporter, String versionToMigrateFrom, String versionToMigrateTo, IndexImporterFactory indexImporterFactory) {
StoreVersion fromVersion = storageEngineFactory.versionInformation(versionToMigrateFrom);
StoreVersion toVersion = storageEngineFactory.versionInformation(versionToMigrateTo);
deleteRelationshipTokenIndex = !fromVersion.hasCompatibleCapabilities(toVersion, CapabilityType.FORMAT);
}
Aggregations