Java Neo4j:实例化BatchInserter失败

Java Neo4j:实例化BatchInserter失败,java,neo4j,spring-data-neo4j,Java,Neo4j,Spring Data Neo4j,我在尝试创建org.neo4j.unsafe.batchinsert.BatchInserter时遇到以下错误 Caused by: java.lang.IllegalStateException: Misaligned file size 68 for DynamicArrayStore[fileName:neostore.nodestore.db.labels, blockSize:60], expected version length 25 at org.neo4j.kernel

我在尝试创建org.neo4j.unsafe.batchinsert.BatchInserter时遇到以下错误

Caused by: java.lang.IllegalStateException: Misaligned file size 68 for DynamicArrayStore[fileName:neostore.nodestore.db.labels, blockSize:60], expected version length 25
    at org.neo4j.kernel.impl.store.AbstractDynamicStore.verifyFileSizeAndTruncate(AbstractDynamicStore.java:265)
    at org.neo4j.kernel.impl.store.CommonAbstractStore.loadStorage(CommonAbstractStore.java:230)
    at org.neo4j.kernel.impl.store.CommonAbstractStore.<init>(CommonAbstractStore.java:118)
    at org.neo4j.kernel.impl.store.AbstractDynamicStore.<init>(AbstractDynamicStore.java:92)
    at org.neo4j.kernel.impl.store.DynamicArrayStore.<init>(DynamicArrayStore.java:64)
    at org.neo4j.kernel.impl.store.StoreFactory.newNodeStore(StoreFactory.java:328)
    at org.neo4j.kernel.impl.store.StoreFactory.newNodeStore(StoreFactory.java:317)
    at org.neo4j.kernel.impl.store.StoreFactory.newNeoStore(StoreFactory.java:161)
    at org.neo4j.unsafe.batchinsert.BatchInserterImpl.<init>(BatchInserterImpl.java:262)
    at org.neo4j.unsafe.batchinsert.BatchInserters.inserter(BatchInserters.java:87)
    at org.neo4j.unsafe.batchinsert.BatchInserters.inserter(BatchInserters.java:81)
    at org.neo4j.unsafe.batchinsert.BatchInserters.inserter(BatchInserters.java:56)
    at nl.aegon.maintenance.config.MainConfiguration.getBatchInserter(MainConfiguration.java:137)
    at nl.aegon.maintenance.config.MainConfiguration$$EnhancerBySpringCGLIB$$a40c43d.CGLIB$getBatchInserter$6(<generated>)
    at nl.aegon.maintenance.config.MainConfiguration$$EnhancerBySpringCGLIB$$a40c43d$$FastClassBySpringCGLIB$$1b2b386e.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
    at nl.aegon.maintenance.config.MainConfiguration$$EnhancerBySpringCGLIB$$a40c43d.getBatchInserter(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 62 more

我在OSX上使用java 8、SDN4和neo4j 2.2.5。

配置选项已经过时

对于mmio,仅使用
dbms.pagecache.memory=1500M

批处理插入器是单线程的,不能在多线程环境中使用

要插入多少数据

你检查过工具了吗

高度并发的初始并行批处理插入器的底层API也可以直接使用,但使用起来并不容易


如果您真的知道自己在做什么,请查看以下内容:

问题可能是您试图在未完全关闭的现有存储上启动批插入器。是吗?

我发现一个正常的
neo4j
服务器在启动后关闭了
storeDir
后修复了这个问题


我认为这是由于在上一次运行时未能调用
BatchInserter.shutdown()

非常感谢Michael!不,事实上那不是我的情况。
private static class configurationSettings extends HashMap<String, String> {
    {
      put("dump_configuration", "false");
      put("cache_type", "none");
      put("use_memory_mapped_buffers", "true");
      put("neostore.propertystore.db.index.keys.mapped_memory", "5M");
      put("neostore.propertystore.db.index.mapped_memory", "5M");
      put("neostore.nodestore.db.mapped_memory", "200M");
      put("neostore.relationshipstore.db.mapped_memory", "500M");
      put("neostore.propertystore.db.mapped_memory", "200M");
      put("neostore.propertystore.db.strings.mapped_memory", "200M");
    }
  }

@Bean
  public BatchInserter getBatchInserter() {
    LOG.debug("Initialising a batch inserter with store directory: {}", databaseConnectionProperties.getStoreDirectory());
    return BatchInserters.inserter(databaseConnectionProperties.getStoreDirectory(), new configurationSettings());
  }
/**
     * Note: This method runs before the file has been mapped by the page cache, and therefore needs to
     * operate on the store files directly. This method is called by constructors.
     */
@Override
    protected void verifyFileSizeAndTruncate() throws IOException
    {
        int expectedVersionLength = UTF8.encode( buildTypeDescriptorAndVersion( getTypeDescriptor() ) ).length;
        long fileSize = getFileChannel().size();
        if ( (fileSize - expectedVersionLength) % blockSize != 0 )
        {
            setStoreNotOk( new IllegalStateException(
                    "Misaligned file size " + fileSize + " for " + this + ", expected version length " +
                    expectedVersionLength ) );
        }
        if ( getStoreOk() )
        {
            getFileChannel().truncate( fileSize - expectedVersionLength );
        }
    }