use of org.neo4j.io.layout.DatabaseLayout in project neo4j by neo4j.
the class PushToCloudCommandTest method createDbAndDump.
private void createDbAndDump() {
Config config = Config.newBuilder().set(GraphDatabaseSettings.neo4j_home, homeDir.toAbsolutePath()).set(default_database, DBNAME).build();
DatabaseLayout databaseLayout = DatabaseLayout.of(config);
Neo4jLayout neo4jLayout = databaseLayout.getNeo4jLayout();
DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder(neo4jLayout.homeDirectory()).setConfig(config).build();
managementService.database(databaseLayout.getDatabaseName());
managementService.shutdown();
dump = directory.file("some-archive.dump");
new RealDumpCreator(ctx).dumpDatabase(DBNAME, dump);
}
use of org.neo4j.io.layout.DatabaseLayout in project neo4j by neo4j.
the class MemoryRecommendationsCommandTest method mustPrintMinimalPageCacheMemorySettingForConfiguredDb.
@Test
void mustPrintMinimalPageCacheMemorySettingForConfiguredDb() throws Exception {
// given
Path homeDir = neo4jLayout.homeDirectory();
Path configDir = homeDir.resolve("conf");
Files.createDirectories(configDir);
Path configFile = configDir.resolve(DEFAULT_CONFIG_FILE_NAME);
Files.createFile(configFile);
createDatabaseWithNativeIndexes(homeDir, DEFAULT_DATABASE_NAME);
PrintStream output = mock(PrintStream.class);
MemoryRecommendationsCommand command = new MemoryRecommendationsCommand(new ExecutionContext(homeDir, configDir, output, mock(PrintStream.class), testDirectory.getFileSystem()));
String heap = bytesToString(recommendHeapMemory(gibiBytes(8)));
String pagecache = bytesToString(recommendPageCacheMemory(gibiBytes(8), gibiBytes(2)));
// when
CommandLine.populateCommand(command, "--memory=8g");
command.execute();
// then
verify(output).println(contains(initial_heap_size.name() + "=" + heap));
verify(output).println(contains(max_heap_size.name() + "=" + heap));
verify(output).println(contains(pagecache_memory.name() + "=" + pagecache));
DatabaseLayout databaseLayout = neo4jLayout.databaseLayout(DEFAULT_DATABASE_NAME);
DatabaseLayout systemLayout = neo4jLayout.databaseLayout(SYSTEM_DATABASE_NAME);
long[] expectedSizes = calculatePageCacheFileSize(databaseLayout);
long[] systemSizes = calculatePageCacheFileSize(systemLayout);
long expectedPageCacheSize = expectedSizes[0] + systemSizes[0];
long expectedLuceneSize = expectedSizes[1] + systemSizes[1];
verify(output).println(contains("Total size of lucene indexes in all databases: " + bytesToString(expectedLuceneSize)));
verify(output).println(contains("Total size of data and native indexes in all databases: " + bytesToString(expectedPageCacheSize)));
}
use of org.neo4j.io.layout.DatabaseLayout in project neo4j by neo4j.
the class Neo4jLayoutSupportExtension method prepare.
private void prepare(ExtensionContext context) {
TestInstances testInstances = context.getRequiredTestInstances();
TestDirectory testDir = getTestDirectory(context);
Config config = Config.defaults(neo4j_home, testDir.homePath());
Neo4jLayout neo4jLayout = Neo4jLayout.of(config);
DatabaseLayout databaseLayout = neo4jLayout.databaseLayout(config.get(default_database));
createDirectories(testDir.getFileSystem(), neo4jLayout, databaseLayout);
for (Object testInstance : testInstances.getAllInstances()) {
injectInstance(testInstance, neo4jLayout, Neo4jLayout.class);
injectInstance(testInstance, databaseLayout, DatabaseLayout.class);
}
}
use of org.neo4j.io.layout.DatabaseLayout 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.io.layout.DatabaseLayout in project neo4j by neo4j.
the class IndexCleanupIT method providerDirectories.
private Path[] providerDirectories(FileSystemAbstraction fs, GraphDatabaseAPI db) throws IOException {
DatabaseLayout databaseLayout = db.databaseLayout();
Path dbDir = databaseLayout.databaseDirectory();
Path schemaDir = dbDir.resolve("schema");
Path indexDir = schemaDir.resolve("index");
return fs.listFiles(indexDir);
}
Aggregations