[英]Neo4j: Failed to instantiate BatchInserter
嘗試創建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
您可以在下面找到我的Java配置類的代碼段
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 MB,每個64 MB
我在git hub 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工具?
高度並發的初始並行批量插入器的基礎API也可以直接使用,但使用起來並不容易。
如果您真的知道自己在做什么,請查看以下內容: https : //github.com/jexp/neo4j-dataset-import
問題可能是您試圖在尚未完全關閉的現有商店上啟動BatchInserter。 是嗎
我發現啟動並關閉具有該storeDir
的普通neo4j
服務器可以解決此問題。
我認為這是由於上次運行未能調用BatchInserter.shutdown()
引起的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.