Exemplo n.º 1
0
  public BatchingNeoStore(
      FileSystemAbstraction fileSystem,
      String storeDir,
      Configuration config,
      Monitor writeMonitor,
      Logging logging,
      WriterFactory writerFactory,
      Monitors monitors) {
    this.config = config;
    this.writeMonitor = writeMonitor;
    this.writerFactory = writerFactory;
    this.monitors = monitors;
    this.fileSystem = life.add(new ChannelReusingFileSystemAbstraction(fileSystem));

    this.logger = logging.getMessagesLog(getClass());
    this.neo4jConfig =
        configForStoreDir(
            new Config(
                stringMap(dense_node_threshold.name(), valueOf(config.denseNodeThreshold())),
                GraphDatabaseSettings.class),
            new File(storeDir));

    this.neoStore = newBatchWritingNeoStore();
    this.propertyKeyRepository =
        new BatchingPropertyKeyTokenRepository(neoStore.getPropertyKeyTokenStore());
    this.labelRepository = new BatchingLabelTokenRepository(neoStore.getLabelTokenStore());
    this.relationshipTypeRepository =
        new BatchingRelationshipTypeTokenRepository(neoStore.getRelationshipTypeTokenStore());
    life.start();
  }
Exemplo n.º 2
0
  private void shouldImportCsvData0(BatchingPageCache.WriterFactory delegateWriterFactory)
      throws Exception {
    // GIVEN
    Configuration config =
        new Configuration.Default() {
          @Override
          public int denseNodeThreshold() {
            return 30;
          }
        };
    BatchImporter inserter =
        new ParallelBatchImporter(
            directory.getAbsolutePath(),
            new DefaultFileSystemAbstraction(),
            config,
            new DetailedExecutionMonitor(),
            new IoQueue(config.numberOfIoThreads(), delegateWriterFactory));

    // WHEN
    int nodeCount = 100_000;
    int relationshipCount = nodeCount * 10;
    inserter.doImport(
        nodes(nodeCount), relationships(relationshipCount, nodeCount), IdMappers.actualIds());
    inserter.shutdown();

    // THEN
    GraphDatabaseService db =
        new GraphDatabaseFactory().newEmbeddedDatabase(directory.getAbsolutePath());
    try (Transaction tx = db.beginTx()) {
      verifyData(nodeCount, db);

      tx.success();
    } finally {
      db.shutdown();
    }
  }
Exemplo n.º 3
0
 private BatchingPageCache batchingPageCache(Mode mode) {
   return new BatchingPageCache(
       fileSystem, config.fileChannelBufferSize(), writerFactory, writeMonitor, mode);
 }
Exemplo n.º 4
0
 @Override
 public int fileChannelBufferSize() {
   return defaults.fileChannelBufferSize();
 }
Exemplo n.º 5
0
 @Override
 public int batchSize() {
   return defaults.batchSize();
 }
Exemplo n.º 6
0
 @Override
 public int workAheadSize() {
   return defaults.workAheadSize();
 }