use of org.neo4j.kernel.impl.store.format.RecordFormats in project neo4j by neo4j.
the class EstimationSanityCheckerTest method shouldWarnAboutCountGettingCloseToCapacity.
@Test
void shouldWarnAboutCountGettingCloseToCapacity() {
// given
RecordFormats formats = Standard.LATEST_RECORD_FORMATS;
ImportLogic.Monitor monitor = mock(ImportLogic.Monitor.class);
Input.Estimates estimates = Input.knownEstimates(formats.node().getMaxId() - 1000, formats.relationship().getMaxId() - 1000, 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 EstimationSanityCheckerTest method shouldNotWantIfCountWayLowerThanCapacity.
@Test
void shouldNotWantIfCountWayLowerThanCapacity() {
// given
RecordFormats formats = Standard.LATEST_RECORD_FORMATS;
ImportLogic.Monitor monitor = mock(ImportLogic.Monitor.class);
Input.Estimates estimates = Input.knownEstimates(1000, 1000, 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
verifyNoMoreInteractions(monitor);
}
use of org.neo4j.kernel.impl.store.format.RecordFormats in project neo4j by neo4j.
the class CsvInputEstimateCalculationIT method shouldCalculateCorrectEstimates.
@Test
void shouldCalculateCorrectEstimates() throws Exception {
// given a couple of input files of various layouts
Input input = generateData();
RecordFormats format = LATEST_RECORD_FORMATS;
Input.Estimates estimates = input.calculateEstimates(new PropertyValueRecordSizeCalculator(format.property().getRecordSize(NO_STORE_HEADER), GraphDatabaseInternalSettings.string_block_size.defaultValue(), 0, GraphDatabaseInternalSettings.array_block_size.defaultValue(), 0));
// when
Config config = Config.defaults();
FileSystemAbstraction fs = new DefaultFileSystemAbstraction();
try (JobScheduler jobScheduler = new ThreadPoolJobScheduler()) {
new ParallelBatchImporter(databaseLayout, fs, PageCacheTracer.NULL, PBI_CONFIG, NullLogService.getInstance(), INVISIBLE, EMPTY, config, format, ImportLogic.NO_MONITOR, jobScheduler, Collector.EMPTY, LogFilesInitializer.NULL, IndexImporterFactory.EMPTY, EmptyMemoryTracker.INSTANCE).doImport(input);
// then compare estimates with actual disk sizes
SingleFilePageSwapperFactory swapperFactory = new SingleFilePageSwapperFactory(fs);
try (PageCache pageCache = new MuninnPageCache(swapperFactory, jobScheduler, MuninnPageCache.config(1000));
NeoStores stores = new StoreFactory(databaseLayout, config, new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName()), pageCache, fs, NullLogProvider.getInstance(), PageCacheTracer.NULL, writable()).openAllNeoStores()) {
assertRoughlyEqual(estimates.numberOfNodes(), stores.getNodeStore().getNumberOfIdsInUse());
assertRoughlyEqual(estimates.numberOfRelationships(), stores.getRelationshipStore().getNumberOfIdsInUse());
assertRoughlyEqual(estimates.numberOfNodeProperties() + estimates.numberOfRelationshipProperties(), calculateNumberOfProperties(stores));
}
long measuredPropertyStorage = propertyStorageSize();
long estimatedPropertyStorage = estimates.sizeOfNodeProperties() + estimates.sizeOfRelationshipProperties();
assertThat(estimatedPropertyStorage).as("Estimated property storage size of %s must be within 10%% of the measured size of %s.", bytesToString(estimatedPropertyStorage), bytesToString(measuredPropertyStorage)).isCloseTo(measuredPropertyStorage, withPercentage(10.0));
}
}
use of org.neo4j.kernel.impl.store.format.RecordFormats in project neo4j by neo4j.
the class PageAlignedTest method shouldNotSeeAlignedAndStandardAsEqualFormats.
@Test
void shouldNotSeeAlignedAndStandardAsEqualFormats() {
// given
RecordFormats aligned = PageAligned.LATEST_RECORD_FORMATS;
RecordFormats standard = Standard.LATEST_RECORD_FORMATS;
// when/then
assertNotEquals(aligned, standard, RecordFormats::node);
assertNotEquals(aligned, standard, RecordFormats::dynamic);
assertNotEquals(aligned, standard, RecordFormats::labelToken);
assertNotEquals(aligned, standard, RecordFormats::property);
assertNotEquals(aligned, standard, RecordFormats::propertyKeyToken);
assertNotEquals(aligned, standard, RecordFormats::relationship);
assertNotEquals(aligned, standard, RecordFormats::relationshipGroup);
assertNotEquals(aligned, standard, RecordFormats::relationshipTypeToken);
assertNotEquals(aligned, standard, RecordFormats::schema);
// don't check meta data format because it had never even filled one page and it has been made page-aligned by default anyway
}
use of org.neo4j.kernel.impl.store.format.RecordFormats in project neo4j by neo4j.
the class StoreFactoryTest method storeFactory.
private StoreFactory storeFactory(Config config, PageCacheTracer pageCacheTracer, ImmutableSet<OpenOption> openOptions) {
LogProvider logProvider = NullLogProvider.getInstance();
RecordFormats recordFormats = selectForStoreOrConfig(config, databaseLayout, fileSystem, pageCache, logProvider, NULL);
return new StoreFactory(databaseLayout, config, idGeneratorFactory, pageCache, fileSystem, recordFormats, logProvider, pageCacheTracer, writable(), openOptions);
}
Aggregations