###1、问题描述 对于这个问题在github上找到了类似的问题,可惜无人解答(链接)。 使用的环境是neo4j 3.2.3 ,apoc 3.2.0.2, 在使用语句“call apoc.index.addAllNodes(‘index-alias_name’,{Entity:['alias_name’]}, {autoUpdate:true});”建立全文索引的过程中进程崩溃,并且已经生成了一部分索引文件,之后一直无法启动neo4j。
###2、问题日志 启动时的日志如下 2019-07-15 12:09:47.830+0000 INFO ======== Neo4j 3.2.3 ======== 2019-07-15 12:09:47.860+0000 INFO Starting… 2019-07-15 12:09:48.751+0000 INFO Write transactions to database disabled 2019-07-15 12:09:49.046+0000 INFO Bolt enabled on 0.0.0.0:80. 2019-07-15 12:09:49.065+0000 INFO Initiating metrics… 2019-07-15 12:09:58.636+0000 ERROR Failed to start Neo4j: Starting Neo4j failed: Component ‘org.neo4j.server.database.LifecycleManagingDatabase@4c846db3’ was successfully initialized, but failed to start. Please see the attached cause exception “cannot change DocValues type from SORTED_SET to SORTED_NUMERIC for field “Entity.alias_name””. Starting Neo4j failed: Component ‘org.neo4j.server.database.LifecycleManagingDatabase@4c846db3’ was successfully initialized, but failed to start. Please see the attached cause exception “cannot change DocValues type from SORTED_SET to SORTED_NUMERIC for field “Entity.alias_name””. org.neo4j.server.ServerStartupException: Starting Neo4j failed: Component ‘org.neo4j.server.database.LifecycleManagingDatabase@4c846db3’ was successfully initialized, but failed to start. Please see the attached cause exception “cannot change DocValues type from SORTED_SET to SORTED_NUMERIC for field “Entity.alias_name””. at org.neo4j.server.exception.ServerStartupErrors.translateToServerStartupError(ServerStartupErrors.java:68) at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:215) at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:107) at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:80) at org.neo4j.server.enterprise.EnterpriseEntryPoint.main(EnterpriseEntryPoint.java:32) Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component ‘org.neo4j.server.database.LifecycleManagingDatabase@4c846db3’ was successfully initialized, but failed to start. Please see the attached cause exception “cannot change DocValues type from SORTED_SET to SORTED_NUMERIC for field “Entity.alias_name””. at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:444) at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:107) at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:207) … 3 more Caused by: java.lang.RuntimeException: Error starting org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory, /dockerdata/neo4j_data/data/databases/graph.db at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.initFacade(GraphDatabaseFacadeFactory.java:209) at org.neo4j.kernel.ha.HighlyAvailableGraphDatabase.<init>(HighlyAvailableGraphDatabase.java:50) at org.neo4j.server.enterprise.EnterpriseNeoServer.lambda$static$0(EnterpriseNeoServer.java:68) at org.neo4j.server.enterprise.EnterpriseNeoServer$$Lambda$127/317986356.newGraphDatabase(Unknown Source) at org.neo4j.server.database.LifecycleManagingDatabase.start(LifecycleManagingDatabase.java:89) at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:434) … 5 more Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component ‘org.neo4j.kernel.recovery.Recovery@7d2d55f1’ failed to initialize. Please see the attached cause exception “cannot change DocValues type from SORTED_SET to SORTED_NUMERIC for field “Entity.alias_name””. at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:416) at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:62) at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:98) at org.neo4j.kernel.NeoStoreDataSource.start(NeoStoreDataSource.java:510) at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:434) at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:107) at org.neo4j.kernel.impl.transaction.state.DataSourceManager.start(DataSourceManager.java:100) at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:434) at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:107) at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.initFacade(GraphDatabaseFacadeFactory.java:205) … 10 more Caused by: org.neo4j.kernel.api.exceptions.TransactionApplyKernelException: Failed to apply transaction: null at org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine.apply(RecordStorageEngine.java:333) at org.neo4j.kernel.recovery.DefaultRecoverySPI.lambda$startRecovery$0(DefaultRecoverySPI.java:94) at org.neo4j.kernel.recovery.DefaultRecoverySPI$$Lambda$320/1945969128.apply(Unknown Source) at org.neo4j.kernel.impl.api.TransactionQueue.empty(TransactionQueue.java:67) at org.neo4j.kernel.recovery.DefaultRecoverySPI.allTransactionsRecovered(DefaultRecoverySPI.java:112) at org.neo4j.kernel.recovery.Recovery.init(Recovery.java:109) at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:406) … 19 more Caused by: java.lang.IllegalArgumentException: cannot change DocValues type from SORTED_SET to SORTED_NUMERIC for field "Entity.alias_name" at org.apache.lucene.index.FieldInfo.setDocValuesType(FieldInfo.java:141) at org.apache.lucene.index.DefaultIndexingChain.indexDocValue(DefaultIndexingChain.java:432) at org.apache.lucene.index.DefaultIndexingChain.processField(DefaultIndexingChain.java:397) at org.apache.lucene.index.DefaultIndexingChain.processDocument(DefaultIndexingChain.java:321) at org.apache.lucene.index.DocumentsWriterPerThread.updateDocument(DocumentsWriterPerThread.java:234) at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:450) at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1477) at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1256) at org.neo4j.index.impl.lucene.legacy.CommitContext.applyDocuments(CommitContext.java:104) at org.neo4j.index.impl.lucene.legacy.CommitContext.close(CommitContext.java:112) at org.neo4j.index.impl.lucene.legacy.LuceneCommandApplier.close(LuceneCommandApplier.java:141) at org.neo4j.kernel.impl.api.LegacyBatchIndexApplier.close(LegacyBatchIndexApplier.java:106) at org.neo4j.kernel.impl.api.BatchTransactionApplierFacade.close(BatchTransactionApplierFacade.java:70) at org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine.apply(RecordStorageEngine.java:330) … 25 more 2019-07-15 12:09:58.637+0000 INFO Neo4j Server shutdown initiated by request 日志结束
###3、问题的关键句子 问题的关键句子是cannot change DocValues type from SORTED_SET to SORTED_NUMERIC for field 。 但是使用这句话进行谷歌一直没有找到对应的问题和解决方法。
###4、在此非常恳切的向您请求帮助,谢谢
联系方式 id :ProLights email:prolightsfx@163.com
neo4j 3.5中全文索引已经是数据库本地索引了,参见相关文档: https://neo4j.com/docs/cypher-manual/3.5/schema/index/#schema-index-fulltext-search 感觉是你Entity.alias_name的属性类型不一致。
@graphway 感谢您的解答。neo4j3.5已经闭源了吧,我只能使用开源的图数据库,目前使用的neo4j3.2不支持全文索引本地索引,请问开源的3.3或者3.4支持吗?此外根据您的推测是我的数据库里Entity.alias_name的属性存在字符串和数组2种类型的数据吗吗?数据库里的alias_name属性正常情况是一个字符串(可能是空串)。
@graphway 是这样的,线上服务再用,只能使用企业版,http://neo4j.com.cn/topic/5b4974e5d40e09d75e4d22a2 社区版不支持高可用集群和因果集群,只有企业版支持。
经过测试, CREATE ( e:Entity { name:“大大”, alias_name:"" } )
CREATE ( e:Entity { name:"", alias_name:“小小” } );
CREATE ( e:Entity { name:“没有alias_name字段” } );
CREATE ( e:Entity { name:“没有alias_name字段”, alias_name:100 } ); 对于alias_name字段使用apoc建立全文索引时,字段为空字符串,字段为字符串,字段为数字,没有这个字段都没有问题。 但加入一个alias_name为数组的实体后,进程崩溃了。算是复现了上文中的问题。 CREATE ( e:Entity { name:“alias_name字段是数组”, alias_name:[‘数组元素1’,‘数组元素2’,‘皮皮虾’] } ); 从而确认应该是 该属性在同一个数据库中既存在该属性为字符串类型的实体,也存在该属性为数组类型的实体,导致使用apoc建立全文索引的时候neo4j进程奔溃。