use of org.neo4j.kernel.impl.store.format.RecordFormats in project neo4j by neo4j.
the class MultipleIndexPopulationStressIT method createRandomData.
private void createRandomData(long nodeCount, long relCount) throws Exception {
Config config = Config.defaults(neo4j_home, directory.homePath());
RecordFormats recordFormats = RecordFormatSelector.selectForConfig(config, NullLogProvider.getInstance());
try (RandomDataInput input = new RandomDataInput(nodeCount, relCount);
JobScheduler jobScheduler = new ThreadPoolJobScheduler()) {
DatabaseLayout layout = Neo4jLayout.of(directory.homePath()).databaseLayout(DEFAULT_DATABASE_NAME);
IndexImporterFactory indexImporterFactory = new IndexImporterFactoryImpl(config);
BatchImporter importer = new ParallelBatchImporter(layout, fileSystemAbstraction, PageCacheTracer.NULL, DEFAULT, NullLogService.getInstance(), ExecutionMonitor.INVISIBLE, EMPTY, config, recordFormats, NO_MONITOR, jobScheduler, Collector.EMPTY, TransactionLogInitializer.getLogFilesInitializer(), indexImporterFactory, INSTANCE);
importer.doImport(input);
}
}
use of org.neo4j.kernel.impl.store.format.RecordFormats in project neo4j by neo4j.
the class IdGeneratorMigrator method createEmptyPlaceHolderStoreFiles.
private Set<Path> createEmptyPlaceHolderStoreFiles(DatabaseLayout layout, RecordFormats format) {
Set<Path> createdStores = new HashSet<>();
StoreType[] storesToCreate = Stream.of(StoreType.values()).filter(t -> {
Path file = layout.file(t.getDatabaseFile());
boolean exists = fileSystem.fileExists(file);
if (!exists) {
createdStores.add(file);
}
return !exists;
}).toArray(StoreType[]::new);
createStoreFactory(layout, format, new ScanOnOpenReadOnlyIdGeneratorFactory()).openNeoStores(true, storesToCreate).close();
return createdStores;
}
use of org.neo4j.kernel.impl.store.format.RecordFormats in project neo4j by neo4j.
the class EstimationSanityCheckerTest method shouldWarnAboutCountHigherThanCapacity.
@Test
void shouldWarnAboutCountHigherThanCapacity() {
// given
RecordFormats formats = Standard.LATEST_RECORD_FORMATS;
ImportLogic.Monitor monitor = mock(ImportLogic.Monitor.class);
Input.Estimates estimates = Input.knownEstimates(formats.node().getMaxId() * 2, formats.relationship().getMaxId() * 2, 0, 0, 0, 0, // we don't care about the rest of the estimates in this checking
0);
// when
new EstimationSanityChecker(formats, monitor).sanityCheck(estimates);
// then
verify(monitor).mayExceedNodeIdCapacity(formats.node().getMaxId(), estimates.numberOfNodes());
verify(monitor).mayExceedRelationshipIdCapacity(formats.relationship().getMaxId(), estimates.numberOfRelationships());
}
use of org.neo4j.kernel.impl.store.format.RecordFormats in project neo4j by neo4j.
the class BatchingNeoStoresTest method shouldNotOpenStoreWithNodesOrRelationshipsInIt.
@Test
void shouldNotOpenStoreWithNodesOrRelationshipsInIt() throws Throwable {
Config config = Config.defaults();
// GIVEN
someDataInTheDatabase(config);
// WHEN
DirectoryNotEmptyException exception = assertThrows(DirectoryNotEmptyException.class, () -> {
try (JobScheduler jobScheduler = new ThreadPoolJobScheduler()) {
RecordFormats recordFormats = selectForConfig(Config.defaults(), NullLogProvider.getInstance());
try (BatchingNeoStores store = batchingNeoStores(fileSystem, databaseLayout, recordFormats, Configuration.DEFAULT, NullLogService.getInstance(), EMPTY, Config.defaults(), jobScheduler, PageCacheTracer.NULL, INSTANCE)) {
store.createNew();
}
}
});
assertThat(exception.getMessage()).contains("already contains");
}
use of org.neo4j.kernel.impl.store.format.RecordFormats in project neo4j by neo4j.
the class BatchingNeoStoresTest method shouldRespectDbConfig.
@Test
void shouldRespectDbConfig() throws Exception {
// GIVEN
int size = 10;
Config config = Config.newBuilder().set(GraphDatabaseInternalSettings.array_block_size, size).set(GraphDatabaseInternalSettings.string_block_size, size).build();
// WHEN
RecordFormats recordFormats = LATEST_RECORD_FORMATS;
int headerSize = recordFormats.dynamic().getRecordHeaderSize();
try (JobScheduler jobScheduler = new ThreadPoolJobScheduler();
BatchingNeoStores store = batchingNeoStores(fileSystem, databaseLayout, recordFormats, Configuration.DEFAULT, NullLogService.getInstance(), EMPTY, config, jobScheduler, PageCacheTracer.NULL, INSTANCE)) {
store.createNew();
// THEN
assertEquals(size + headerSize, store.getPropertyStore().getArrayStore().getRecordSize());
assertEquals(size + headerSize, store.getPropertyStore().getStringStore().getRecordSize());
}
}
Aggregations