Neo4j:无法实例化 BatchInserter
Neo4j: Failed to instantiate BatchInserter
我在尝试创建组织时遇到以下错误。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(<generated>)
at nl.aegon.maintenance.config.MainConfiguration$$EnhancerBySpringCGLIB$$a40c43d$$FastClassBySpringCGLIB$b2b386e.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
您可以在下方找到我的 Java 配置 class
的片段
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());
}
正确的配置属性集应该是什么才能避免此错误?我正在尝试并行批量导入 3 个文件,每个文件 64 MB
我在 git 中心提到了以下内容
https://github.com/jexp/batch-import/blob/2.2/sample/batch.properties
这是 Neo4j 中抛出异常的相关方法
/**
* 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 );
}
}
我在 OSX 上使用 java 8、SDN4 和 neo4j 2.2.5。
配置选项已过时,
mmio 仅使用 dbms.pagecache.memory=1500M
批量插入器是单线程的,不能在多线程环境中使用。
您要插入多少数据?
您是否研究过 neo4j-import 工具?
高并发初始parallel-batch-inserter的底层API也可以直接使用,但不好用。
如果你真的知道你在做什么,看看这个:https://github.com/jexp/neo4j-dataset-import
问题可能在于您正在尝试在未完全关闭的现有商店上启动 BatchInserter。是吗?
我发现启动,然后关闭,带有 storeDir
的普通 neo4j
服务器修复了这个问题。
我认为这是由于未能在之前的 运行 上调用 BatchInserter.shutdown()
造成的。
我在尝试创建组织时遇到以下错误。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(<generated>)
at nl.aegon.maintenance.config.MainConfiguration$$EnhancerBySpringCGLIB$$a40c43d$$FastClassBySpringCGLIB$b2b386e.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
您可以在下方找到我的 Java 配置 class
的片段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());
}
正确的配置属性集应该是什么才能避免此错误?我正在尝试并行批量导入 3 个文件,每个文件 64 MB
我在 git 中心提到了以下内容 https://github.com/jexp/batch-import/blob/2.2/sample/batch.properties
这是 Neo4j 中抛出异常的相关方法
/**
* 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 );
}
}
我在 OSX 上使用 java 8、SDN4 和 neo4j 2.2.5。
配置选项已过时,
mmio 仅使用 dbms.pagecache.memory=1500M
批量插入器是单线程的,不能在多线程环境中使用。
您要插入多少数据?
您是否研究过 neo4j-import 工具?
高并发初始parallel-batch-inserter的底层API也可以直接使用,但不好用。
如果你真的知道你在做什么,看看这个:https://github.com/jexp/neo4j-dataset-import
问题可能在于您正在尝试在未完全关闭的现有商店上启动 BatchInserter。是吗?
我发现启动,然后关闭,带有 storeDir
的普通 neo4j
服务器修复了这个问题。
我认为这是由于未能在之前的 运行 上调用 BatchInserter.shutdown()
造成的。