Search in sources :

Example 1 with RecordFormats

use of org.neo4j.kernel.impl.store.format.RecordFormats in project neo4j by neo4j.

the class IdGeneratorTest method makeSureIdCapacityCannotBeExceeded.

@Test
public void makeSureIdCapacityCannotBeExceeded() throws Exception {
    RecordFormats formats = Standard.LATEST_RECORD_FORMATS;
    List<RecordFormat<? extends AbstractBaseRecord>> recordFormats = Arrays.asList(formats.node(), formats.dynamic(), formats.labelToken(), formats.property(), formats.propertyKeyToken(), formats.relationship(), formats.relationshipGroup(), formats.relationshipTypeToken());
    for (RecordFormat format : recordFormats) {
        makeSureIdCapacityCannotBeExceeded(format);
    }
}
Also used : AbstractBaseRecord(org.neo4j.kernel.impl.store.record.AbstractBaseRecord) RecordFormats(org.neo4j.kernel.impl.store.format.RecordFormats) RecordFormat(org.neo4j.kernel.impl.store.format.RecordFormat) PropertyKeyTokenRecordFormat(org.neo4j.kernel.impl.store.format.standard.PropertyKeyTokenRecordFormat) RelationshipRecordFormat(org.neo4j.kernel.impl.store.format.standard.RelationshipRecordFormat) NodeRecordFormat(org.neo4j.kernel.impl.store.format.standard.NodeRecordFormat) PropertyRecordFormat(org.neo4j.kernel.impl.store.format.standard.PropertyRecordFormat) Test(org.junit.Test)

Example 2 with RecordFormats

use of org.neo4j.kernel.impl.store.format.RecordFormats in project neo4j by neo4j.

the class StoreFactoryTest method storeFactory.

private StoreFactory storeFactory(Config config, OpenOption... openOptions) {
    LogProvider logProvider = NullLogProvider.getInstance();
    RecordFormats recordFormats = selectForStoreOrConfig(config, storeDir, fsRule.get(), pageCache, logProvider);
    return new StoreFactory(storeDir, DEFAULT_NAME, config, idGeneratorFactory, pageCache, fsRule.get(), recordFormats, logProvider, openOptions);
}
Also used : LogProvider(org.neo4j.logging.LogProvider) NullLogProvider(org.neo4j.logging.NullLogProvider) RecordFormats(org.neo4j.kernel.impl.store.format.RecordFormats)

Example 3 with RecordFormats

use of org.neo4j.kernel.impl.store.format.RecordFormats in project neo4j by neo4j.

the class NeoStores method verifyRecordFormat.

private void verifyRecordFormat() {
    try {
        String expectedStoreVersion = recordFormats.storeVersion();
        long record = getRecord(pageCache, neoStoreFileName, STORE_VERSION);
        if (record != MetaDataRecordFormat.FIELD_NOT_PRESENT) {
            String actualStoreVersion = versionLongToString(record);
            RecordFormats actualStoreFormat = RecordFormatSelector.selectForVersion(actualStoreVersion);
            if (!isCompatibleFormats(actualStoreFormat)) {
                throw new UnexpectedStoreVersionException(actualStoreVersion, expectedStoreVersion);
            }
        }
    } catch (NoSuchFileException e) {
    // Occurs when there is no file, which is obviously when creating a store.
    // Caught as an exception because we want to leave as much interaction with files as possible
    // to the page cache.
    } catch (IOException e) {
        throw new UnderlyingStorageException(e);
    }
}
Also used : RecordFormats(org.neo4j.kernel.impl.store.format.RecordFormats) NoSuchFileException(java.nio.file.NoSuchFileException) MetaDataStore.versionLongToString(org.neo4j.kernel.impl.store.MetaDataStore.versionLongToString) IOException(java.io.IOException)

Example 4 with RecordFormats

use of org.neo4j.kernel.impl.store.format.RecordFormats in project neo4j by neo4j.

the class NeoStoresRule method open.

public NeoStores open(String... config) throws IOException {
    Config configuration = Config.embeddedDefaults(stringMap(config));
    RecordFormats formats = RecordFormatSelector.selectForConfig(configuration, NullLogProvider.getInstance());
    return open(formats, config);
}
Also used : RecordFormats(org.neo4j.kernel.impl.store.format.RecordFormats) Config(org.neo4j.kernel.configuration.Config)

Example 5 with RecordFormats

use of org.neo4j.kernel.impl.store.format.RecordFormats in project neo4j by neo4j.

the class LegacyIndexMigrator method migrate.

@Override
public void migrate(File storeDir, File migrationDir, MigrationProgressMonitor.Section progressMonitor, String versionToMigrateFrom, String versionToMigrateTo) throws IOException {
    IndexImplementation indexImplementation = indexProviders.get(LUCENE_LEGACY_INDEX_PROVIDER_NAME);
    if (indexImplementation != null) {
        RecordFormats from = RecordFormatSelector.selectForVersion(versionToMigrateFrom);
        RecordFormats to = RecordFormatSelector.selectForVersion(versionToMigrateTo);
        if (!from.hasSameCapabilities(to, CapabilityType.INDEX)) {
            originalLegacyIndexesRoot = indexImplementation.getIndexImplementationDirectory(storeDir);
            migrationLegacyIndexesRoot = indexImplementation.getIndexImplementationDirectory(migrationDir);
            if (isNotEmptyDirectory(originalLegacyIndexesRoot)) {
                migrateLegacyIndexes(progressMonitor);
                legacyIndexMigrated = true;
            }
        }
    } else {
        log.debug("Lucene index provider not found, nothing to migrate.");
    }
}
Also used : RecordFormats(org.neo4j.kernel.impl.store.format.RecordFormats) IndexImplementation(org.neo4j.kernel.spi.legacyindex.IndexImplementation)

Aggregations

RecordFormats (org.neo4j.kernel.impl.store.format.RecordFormats)43 Test (org.junit.jupiter.api.Test)13 IOException (java.io.IOException)10 Config (org.neo4j.configuration.Config)8 PageCache (org.neo4j.io.pagecache.PageCache)8 DefaultIdGeneratorFactory (org.neo4j.internal.id.DefaultIdGeneratorFactory)7 NullLogProvider (org.neo4j.logging.NullLogProvider)7 Config (org.neo4j.kernel.configuration.Config)6 StoreFactory (org.neo4j.kernel.impl.store.StoreFactory)6 File (java.io.File)5 Path (java.nio.file.Path)5 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)5 NeoStores (org.neo4j.kernel.impl.store.NeoStores)5 ForcedSecondaryUnitRecordFormats (org.neo4j.kernel.impl.store.format.ForcedSecondaryUnitRecordFormats)5 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 IdGeneratorFactory (org.neo4j.internal.id.IdGeneratorFactory)4 PagedFile (org.neo4j.io.pagecache.PagedFile)4 LogProvider (org.neo4j.logging.LogProvider)4 NoSuchFileException (java.nio.file.NoSuchFileException)3