Search in sources :

Example 36 with DefaultFileSystemAbstraction

use of org.neo4j.io.fs.DefaultFileSystemAbstraction in project neo4j by neo4j.

the class IndexConsistencyIT method fullConsistencyCheck.

private ConsistencyCheckService.Result fullConsistencyCheck() throws ConsistencyCheckIncompleteException, IOException {
    try (FileSystemAbstraction fsa = new DefaultFileSystemAbstraction()) {
        ConsistencyCheckService service = new ConsistencyCheckService();
        DatabaseLayout databaseLayout = db.databaseLayout();
        Config config = Config.defaults(logs_directory, databaseLayout.databaseDirectory());
        return service.runFullConsistencyCheck(databaseLayout, config, NONE, log, fsa, false, ConsistencyFlags.DEFAULT);
    }
}
Also used : DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) Config(org.neo4j.configuration.Config) DatabaseLayout(org.neo4j.io.layout.DatabaseLayout) ConsistencyCheckService(org.neo4j.consistency.ConsistencyCheckService)

Example 37 with DefaultFileSystemAbstraction

use of org.neo4j.io.fs.DefaultFileSystemAbstraction in project neo4j by neo4j.

the class CheckPointingLogRotationStressTesting method shouldBehaveCorrectlyUnderStress.

@Test
public void shouldBehaveCorrectlyUnderStress() throws Throwable {
    long durationInMinutes = parseLong(fromEnv("CHECK_POINT_LOG_ROTATION_STRESS_DURATION", DEFAULT_DURATION_IN_MINUTES));
    File storeDir = new File(fromEnv("CHECK_POINT_LOG_ROTATION_STORE_DIRECTORY", DEFAULT_STORE_DIR));
    long nodeCount = parseLong(fromEnv("CHECK_POINT_LOG_ROTATION_NODE_COUNT", DEFAULT_NODE_COUNT));
    int threads = parseInt(fromEnv("CHECK_POINT_LOG_ROTATION_WORKER_THREADS", DEFAULT_WORKER_THREADS));
    String pageCacheMemory = fromEnv("CHECK_POINT_LOG_ROTATION_PAGE_CACHE_MEMORY", DEFAULT_PAGE_CACHE_MEMORY);
    System.out.println("1/6\tBuilding initial store...");
    try (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction()) {
        new ParallelBatchImporter(ensureExistsAndEmpty(storeDir), fileSystem, DEFAULT, NullLogService.getInstance(), ExecutionMonitors.defaultVisible(), Config.defaults()).doImport(new NodeCountInputs(nodeCount));
    }
    System.out.println("2/6\tStarting database...");
    GraphDatabaseBuilder builder = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder(storeDir);
    GraphDatabaseService db = builder.setConfig(GraphDatabaseSettings.pagecache_memory, pageCacheMemory).setConfig(GraphDatabaseSettings.keep_logical_logs, Settings.FALSE).setConfig(GraphDatabaseSettings.check_point_interval_time, CHECK_POINT_INTERVAL_MINUTES + "m").setConfig(GraphDatabaseFacadeFactory.Configuration.tracer, "timer").newGraphDatabase();
    System.out.println("3/6\tWarm up db...");
    try (Workload workload = new Workload(db, defaultRandomMutation(nodeCount, db), threads)) {
        // make sure to run at least one checkpoint during warmup
        long warmUpTimeMillis = TimeUnit.SECONDS.toMillis(CHECK_POINT_INTERVAL_MINUTES * 2);
        workload.run(warmUpTimeMillis, Workload.TransactionThroughput.NONE);
    }
    System.out.println("4/6\tStarting workload...");
    TransactionThroughputChecker throughput = new TransactionThroughputChecker();
    try (Workload workload = new Workload(db, defaultRandomMutation(nodeCount, db), threads)) {
        workload.run(TimeUnit.MINUTES.toMillis(durationInMinutes), throughput);
    }
    System.out.println("5/6\tShutting down...");
    db.shutdown();
    try {
        System.out.println("6/6\tPrinting stats and recorded timings...");
        TimerTransactionTracer.printStats(System.out);
        throughput.assertThroughput(System.out);
    } finally {
        System.out.println("Done.");
    }
    // let's cleanup disk space when everything went well
    FileUtils.deleteRecursively(storeDir);
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) Workload(org.neo4j.kernel.stresstests.transaction.checkpoint.workload.Workload) ParallelBatchImporter(org.neo4j.unsafe.impl.batchimport.ParallelBatchImporter) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) File(java.io.File) GraphDatabaseBuilder(org.neo4j.graphdb.factory.GraphDatabaseBuilder) Test(org.junit.Test)

Example 38 with DefaultFileSystemAbstraction

use of org.neo4j.io.fs.DefaultFileSystemAbstraction in project neo4j by neo4j.

the class DumpCountsStore method main.

public static void main(String... args) throws IOException {
    if (args.length != 1) {
        System.err.println("Expecting exactly one argument describing the path to the store");
        System.exit(1);
    }
    try (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction()) {
        dumpCountsStore(fileSystem, new File(args[0]), System.out);
    }
}
Also used : DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) File(java.io.File)

Example 39 with DefaultFileSystemAbstraction

use of org.neo4j.io.fs.DefaultFileSystemAbstraction in project neo4j by neo4j.

the class DumpLogicalLog method main.

/**
     * Usage: [--txfilter "regex"] [--ccfilter cc-report-file] [--tofile] storeDirOrFile1 storeDirOrFile2 ...
     *
     * --txfilter
     * Will match regex against each {@link LogEntry} and if there is a match,
     * include transaction containing the LogEntry in the dump.
     * regex matching is done with {@link Pattern}
     *
     * --ccfilter
     * Will look at an inconsistency report file from consistency checker and
     * include transactions that are relevant to them
     *
     * --tofile
     * Redirects output to dump-logical-log.txt in the store directory
     */
public static void main(String[] args) throws IOException {
    Args arguments = Args.withFlags(TO_FILE).parse(args);
    TimeZone timeZone = parseTimeZoneConfig(arguments);
    Predicate<LogEntry[]> filter = parseFilter(arguments, timeZone);
    Function<LogEntry, String> serializer = parseSerializer(filter, timeZone);
    try (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction();
        Printer printer = getPrinter(arguments)) {
        for (String fileAsString : arguments.orphans()) {
            new DumpLogicalLog(fileSystem).dump(fileAsString, printer.getFor(fileAsString), filter, serializer);
        }
    }
}
Also used : Args(org.neo4j.helpers.Args) TimeZone.getTimeZone(java.util.TimeZone.getTimeZone) TimeZone(java.util.TimeZone) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) LogEntry(org.neo4j.kernel.impl.transaction.log.entry.LogEntry)

Example 40 with DefaultFileSystemAbstraction

use of org.neo4j.io.fs.DefaultFileSystemAbstraction in project neo4j by neo4j.

the class DumpStore method main.

public static void main(String... args) throws Exception {
    if (args == null || args.length == 0) {
        System.err.println("SYNTAX: [file[:id[,id]*]]+");
        return;
    }
    try (DefaultFileSystemAbstraction fs = new DefaultFileSystemAbstraction();
        PageCache pageCache = createPageCache(fs)) {
        final DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fs);
        Function<File, StoreFactory> createStoreFactory = file -> new StoreFactory(file.getParentFile(), Config.defaults(), idGeneratorFactory, pageCache, fs, logProvider());
        for (String arg : args) {
            dumpFile(createStoreFactory, arg);
        }
    }
}
Also used : LogProvider(org.neo4j.logging.LogProvider) StandalonePageCacheFactory.createPageCache(org.neo4j.io.pagecache.impl.muninn.StandalonePageCacheFactory.createPageCache) Token(org.neo4j.storageengine.api.Token) NullLogProvider(org.neo4j.logging.NullLogProvider) Function(java.util.function.Function) ByteBuffer(java.nio.ByteBuffer) NeoStores(org.neo4j.kernel.impl.store.NeoStores) AbstractBaseRecord(org.neo4j.kernel.impl.store.record.AbstractBaseRecord) FormattedLogProvider(org.neo4j.logging.FormattedLogProvider) CommonAbstractStore(org.neo4j.kernel.impl.store.CommonAbstractStore) TokenRecord(org.neo4j.kernel.impl.store.record.TokenRecord) PrintStream(java.io.PrintStream) PageCache(org.neo4j.io.pagecache.PageCache) Config(org.neo4j.kernel.configuration.Config) DefaultIdGeneratorFactory(org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory) FORCE(org.neo4j.kernel.impl.store.record.RecordLoad.FORCE) SchemaStorage(org.neo4j.kernel.impl.store.SchemaStorage) SchemaStore(org.neo4j.kernel.impl.store.SchemaStore) TokenStore(org.neo4j.kernel.impl.store.TokenStore) PrintStreamLogger(org.neo4j.logging.PrintStreamLogger) File(java.io.File) DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) RecordStore(org.neo4j.kernel.impl.store.RecordStore) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) HexPrinter(org.neo4j.kernel.impl.util.HexPrinter) StoreType(org.neo4j.kernel.impl.store.StoreType) NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) NodeStore(org.neo4j.kernel.impl.store.NodeStore) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) DefaultIdGeneratorFactory(org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) File(java.io.File) StandalonePageCacheFactory.createPageCache(org.neo4j.io.pagecache.impl.muninn.StandalonePageCacheFactory.createPageCache) PageCache(org.neo4j.io.pagecache.PageCache)

Aggregations

DefaultFileSystemAbstraction (org.neo4j.io.fs.DefaultFileSystemAbstraction)82 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)43 File (java.io.File)24 Path (java.nio.file.Path)21 PageCache (org.neo4j.io.pagecache.PageCache)21 Test (org.junit.Test)14 Test (org.junit.jupiter.api.Test)13 IOException (java.io.IOException)12 DatabaseLayout (org.neo4j.io.layout.DatabaseLayout)11 Config (org.neo4j.kernel.configuration.Config)11 Config (org.neo4j.configuration.Config)9 ThreadPoolJobScheduler (org.neo4j.test.scheduler.ThreadPoolJobScheduler)8 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)7 Transaction (org.neo4j.graphdb.Transaction)7 PrintStream (java.io.PrintStream)6 Before (org.junit.Before)6 CommandFailed (org.neo4j.commandline.admin.CommandFailed)6 Args (org.neo4j.helpers.Args)6 StandalonePageCacheFactory.createPageCache (org.neo4j.io.pagecache.impl.muninn.StandalonePageCacheFactory.createPageCache)6 JobScheduler (org.neo4j.scheduler.JobScheduler)6