use of org.neo4j.test.scheduler.ThreadPoolJobScheduler in project neo4j by neo4j.
the class PageCacheTestSupport method setUp.
@BeforeEach
public void setUp() throws IOException {
fixture = createFixture();
// noinspection ResultOfMethodCallIgnored
// Clear stray interrupts
Thread.interrupted();
fs = createFileSystemAbstraction();
jobScheduler = new ThreadPoolJobScheduler();
ensureExists(file("a"));
}
use of org.neo4j.test.scheduler.ThreadPoolJobScheduler in project neo4j by neo4j.
the class PartMergerTest method setUp.
@BeforeEach
void setUp() {
scheduler = new ThreadPoolJobScheduler();
populationWorkScheduler = new PopulationWorkScheduler() {
@Override
public <T> JobHandle<T> schedule(IndexPopulator.JobDescriptionSupplier descriptionSupplier, Callable<T> job) {
return scheduler.schedule(Group.INDEX_POPULATION_WORK, NOT_MONITORED, job);
}
};
}
use of org.neo4j.test.scheduler.ThreadPoolJobScheduler in project neo4j by neo4j.
the class RelationshipGroupDefragmenterTest method init.
private void init(RecordFormats format, int units) throws IOException {
this.units = units;
jobScheduler = new ThreadPoolJobScheduler();
stores = BatchingNeoStores.batchingNeoStores(testDirectory.getFileSystem(), databaseLayout, format, CONFIG, NullLogService.getInstance(), AdditionalInitialIds.EMPTY, Config.defaults(), jobScheduler, PageCacheTracer.NULL, INSTANCE);
stores.createNew();
}
use of org.neo4j.test.scheduler.ThreadPoolJobScheduler in project neo4j by neo4j.
the class HumanUnderstandableExecutionMonitorIT method shouldReportProgressOfNodeImport.
@Test
void shouldReportProgressOfNodeImport() throws Exception {
// given
CapturingMonitor progress = new CapturingMonitor();
HumanUnderstandableExecutionMonitor monitor = new HumanUnderstandableExecutionMonitor(progress);
IdType idType = IdType.INTEGER;
Input input = new DataGeneratorInput(NODE_COUNT, RELATIONSHIP_COUNT, idType, random.seed(), 0, bareboneNodeHeader(idType, new Extractors(';')), bareboneRelationshipHeader(idType, new Extractors(';')), 1, 1, 0, 0);
Configuration configuration = new Configuration.Overridden(Configuration.DEFAULT) {
@Override
public long pageCacheMemory() {
return mebiBytes(8);
}
};
// when
try (JobScheduler jobScheduler = new ThreadPoolJobScheduler()) {
new ParallelBatchImporter(databaseLayout, fileSystem, NULL, configuration, NullLogService.getInstance(), monitor, EMPTY, defaults(), LATEST_RECORD_FORMATS, ImportLogic.NO_MONITOR, jobScheduler, Collector.EMPTY, LogFilesInitializer.NULL, IndexImporterFactory.EMPTY, EmptyMemoryTracker.INSTANCE).doImport(input);
// then
progress.assertAllProgressReachedEnd();
}
}
use of org.neo4j.test.scheduler.ThreadPoolJobScheduler in project neo4j by neo4j.
the class ImportPanicIT method shouldExitAndThrowExceptionOnPanic.
/**
* There was this problem where some steps and in particular parallel CSV input parsing that
* paniced would hang the import entirely.
*/
@Test
void shouldExitAndThrowExceptionOnPanic() throws Exception {
try (JobScheduler jobScheduler = new ThreadPoolJobScheduler()) {
BatchImporter importer = new ParallelBatchImporter(databaseLayout, testDirectory.getFileSystem(), PageCacheTracer.NULL, Configuration.DEFAULT, NullLogService.getInstance(), ExecutionMonitor.INVISIBLE, AdditionalInitialIds.EMPTY, Config.defaults(), StandardV3_4.RECORD_FORMATS, ImportLogic.NO_MONITOR, jobScheduler, Collector.EMPTY, LogFilesInitializer.NULL, IndexImporterFactory.EMPTY, EmptyMemoryTracker.INSTANCE);
Iterable<DataFactory> nodeData = DataFactories.datas(DataFactories.data(InputEntityDecorators.NO_DECORATOR, fileAsCharReadable(nodeCsvFileWithBrokenEntries())));
Input brokenCsvInput = new CsvInput(nodeData, DataFactories.defaultFormatNodeFileHeader(), DataFactories.datas(), DataFactories.defaultFormatRelationshipFileHeader(), IdType.ACTUAL, csvConfigurationWithLowBufferSize(), CsvInput.NO_MONITOR, INSTANCE);
var e = assertThrows(InputException.class, () -> importer.doImport(brokenCsvInput));
assertTrue(e.getCause() instanceof DataAfterQuoteException);
}
}
Aggregations