Search in sources :

Example 11 with RecordFormats

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

the class RecordFormatsMigrationIT method assertStoreFormat.

private void assertStoreFormat(RecordFormats expected) throws IOException {
    Config config = Config.embeddedDefaults(stringMap(GraphDatabaseSettings.pagecache_memory.name(), "8m"));
    try (PageCache pageCache = ConfigurableStandalonePageCacheFactory.createPageCache(fileSystemRule.get(), config)) {
        RecordFormats actual = RecordFormatSelector.selectForStoreOrConfig(config, testDirectory.graphDbDir(), fileSystemRule.get(), pageCache, NullLogProvider.getInstance());
        assertNotNull(actual);
        assertEquals(expected.storeVersion(), actual.storeVersion());
    }
}
Also used : RecordFormats(org.neo4j.kernel.impl.store.format.RecordFormats) Config(org.neo4j.kernel.configuration.Config) PageCache(org.neo4j.io.pagecache.PageCache)

Example 12 with RecordFormats

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

the class StoreMigrationIT method data.

@Parameterized.Parameters(name = "Migrate: {0}->{1}")
public static Iterable<Object[]> data() throws IOException {
    FileSystemAbstraction fs = fileSystemRule.get();
    PageCache pageCache = pageCacheRule.getPageCache(fs);
    File dir = TestDirectory.testDirectory(StoreMigrationIT.class).prepareDirectoryForTest("migration");
    StoreVersionCheck storeVersionCheck = new StoreVersionCheck(pageCache);
    LegacyStoreVersionCheck legacyStoreVersionCheck = new LegacyStoreVersionCheck(fs);
    List<Object[]> data = new ArrayList<>();
    ArrayList<RecordFormats> recordFormatses = new ArrayList<>();
    RecordFormatSelector.allFormats().forEach((f) -> addIfNotThere(f, recordFormatses));
    for (RecordFormats toFormat : recordFormatses) {
        UpgradableDatabase upgradableDatabase = new UpgradableDatabase(fs, storeVersionCheck, legacyStoreVersionCheck, toFormat);
        for (RecordFormats fromFormat : recordFormatses) {
            File db = new File(dir, baseDirName(toFormat, fromFormat));
            try {
                createDb(fromFormat, db);
                if (!upgradableDatabase.hasCurrentVersion(db)) {
                    upgradableDatabase.checkUpgradeable(db);
                    data.add(new Object[] { fromFormat, toFormat });
                }
            } catch (Exception e) {
            //This means that the combination is not migratable.
            }
            fs.deleteRecursively(db);
        }
    }
    return data;
}
Also used : LegacyStoreVersionCheck(org.neo4j.kernel.impl.storemigration.legacystore.LegacyStoreVersionCheck) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) RecordFormats(org.neo4j.kernel.impl.store.format.RecordFormats) ArrayList(java.util.ArrayList) LegacyStoreVersionCheck(org.neo4j.kernel.impl.storemigration.legacystore.LegacyStoreVersionCheck) File(java.io.File) PageCache(org.neo4j.io.pagecache.PageCache) IOException(java.io.IOException) ConsistencyCheckIncompleteException(org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException)

Example 13 with RecordFormats

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

the class NeoStoreDataSource method selectStoreFormats.

private static RecordFormats selectStoreFormats(Config config, File storeDir, FileSystemAbstraction fs, PageCache pageCache, LogService logService) {
    LogProvider logging = logService.getInternalLogProvider();
    RecordFormats formats = RecordFormatSelector.selectNewestFormat(config, storeDir, fs, pageCache, logging);
    new RecordFormatPropertyConfigurator(formats, config).configure();
    return formats;
}
Also used : LogProvider(org.neo4j.logging.LogProvider) RecordFormats(org.neo4j.kernel.impl.store.format.RecordFormats) RecordFormatPropertyConfigurator(org.neo4j.kernel.impl.store.format.RecordFormatPropertyConfigurator)

Example 14 with RecordFormats

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

the class BatchingNeoStoresTest method shouldDecideToAllocateDoubleRelationshipRecordUnitsOnLargeAmountOfRelationshipsOnSupportedFormat.

@Test
void shouldDecideToAllocateDoubleRelationshipRecordUnitsOnLargeAmountOfRelationshipsOnSupportedFormat() throws Exception {
    // given
    RecordFormats formats = new ForcedSecondaryUnitRecordFormats(LATEST_RECORD_FORMATS);
    try (BatchingNeoStores stores = BatchingNeoStores.batchingNeoStoresWithExternalPageCache(fileSystem, pageCache, PageCacheTracer.NULL, databaseLayout, formats, Configuration.DEFAULT, NullLogService.getInstance(), EMPTY, Config.defaults(), INSTANCE)) {
        stores.createNew();
        Input.Estimates estimates = Input.knownEstimates(0, DOUBLE_RELATIONSHIP_RECORD_UNIT_THRESHOLD << 1, 0, 0, 0, 0, 0);
        // when
        boolean doubleUnits = stores.determineDoubleRelationshipRecordUnits(estimates);
        // then
        assertTrue(doubleUnits);
    }
}
Also used : Input(org.neo4j.internal.batchimport.input.Input) ForcedSecondaryUnitRecordFormats(org.neo4j.kernel.impl.store.format.ForcedSecondaryUnitRecordFormats) RecordFormats(org.neo4j.kernel.impl.store.format.RecordFormats) ForcedSecondaryUnitRecordFormats(org.neo4j.kernel.impl.store.format.ForcedSecondaryUnitRecordFormats) Test(org.junit.jupiter.api.Test)

Example 15 with RecordFormats

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

the class BatchingNeoStoresTest method shouldNotDecideToAllocateDoubleRelationshipRecordUnitsonLowAmountOfRelationshipsOnSupportedFormat.

@Test
void shouldNotDecideToAllocateDoubleRelationshipRecordUnitsonLowAmountOfRelationshipsOnSupportedFormat() throws Exception {
    // given
    RecordFormats formats = new ForcedSecondaryUnitRecordFormats(LATEST_RECORD_FORMATS);
    try (BatchingNeoStores stores = BatchingNeoStores.batchingNeoStoresWithExternalPageCache(fileSystem, pageCache, PageCacheTracer.NULL, databaseLayout, formats, Configuration.DEFAULT, NullLogService.getInstance(), EMPTY, Config.defaults(), INSTANCE)) {
        stores.createNew();
        Input.Estimates estimates = Input.knownEstimates(0, DOUBLE_RELATIONSHIP_RECORD_UNIT_THRESHOLD >> 1, 0, 0, 0, 0, 0);
        // when
        boolean doubleUnits = stores.determineDoubleRelationshipRecordUnits(estimates);
        // then
        assertFalse(doubleUnits);
    }
}
Also used : Input(org.neo4j.internal.batchimport.input.Input) ForcedSecondaryUnitRecordFormats(org.neo4j.kernel.impl.store.format.ForcedSecondaryUnitRecordFormats) RecordFormats(org.neo4j.kernel.impl.store.format.RecordFormats) ForcedSecondaryUnitRecordFormats(org.neo4j.kernel.impl.store.format.ForcedSecondaryUnitRecordFormats) Test(org.junit.jupiter.api.Test)

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