当前位置: 首页 > 知识库问答 >
问题:

neo4j索引失败,属性大小过长

诸嘉澍
2023-03-14

使用lucene_native-2.0的neo4j3.4无法为属性创建约束。显然是因为唱片太长了

<代码>原因:java。io。IOException:java。lang.IllegalArgumentException:支持的最大密钥大小为4095,但尝试存储大小为4239 | GB树的密钥[文件:/var/lib/neo4j/data/databases/graph.db/schema/index/lucene_native-2.0/79/string-1.0/index-79,布局:StringLayout[版本:0.1,标识符:24016946018123776],生成:2/4]

看来是这个问题https://github.com/neo4j/neo4j/issues/9498

但我不知道怎么修复它。我对导致问题的记录没有反馈

谢谢

贝诺特


Unable to create CONSTRAINT ON ( alias:Alias ) ASSERT alias.hr_uuid IS UNIQUE:
, reference adb86f6f-33d0-4755-a091-9703840d8156. Unable to create CONSTRAINT ON ( alias:Alias ) ASSERT alias.hr_uuid IS UNIQUE:

org.neo4j.kernel.impl.query.QueryExecutionKernelException: Unable to create CONSTRAINT ON ( alias:Alias ) ASSERT alias.hr_uuid IS UNIQUE:

    at org.neo4j.bolt.v1.runtime.TransactionStateMachineSPI$1.start(TransactionStateMachineSPI.java:158)
    at org.neo4j.bolt.v1.runtime.TransactionStateMachine$State.startExecution(TransactionStateMachine.java:446)
    at org.neo4j.bolt.v1.runtime.TransactionStateMachine$State$1.execute(TransactionStateMachine.java:259)
    at org.neo4j.bolt.v1.runtime.TransactionStateMachine$State$1.run(TransactionStateMachine.java:240)
    at org.neo4j.bolt.v1.runtime.TransactionStateMachine.run(TransactionStateMachine.java:81)
    at org.neo4j.bolt.v1.runtime.BoltStateMachine$State$2.run(BoltStateMachine.java:456)
    at org.neo4j.bolt.v1.runtime.BoltStateMachine.run(BoltStateMachine.java:222)
    at org.neo4j.bolt.v1.messaging.BoltMessageRouter.lambda$onRun$3(BoltMessageRouter.java:93)
    at org.neo4j.bolt.runtime.MetricsReportingBoltConnection.lambda$enqueue$0(MetricsReportingBoltConnection.java:69)
    at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatch(DefaultBoltConnection.java:193)
    at org.neo4j.bolt.runtime.MetricsReportingBoltConnection.processNextBatch(MetricsReportingBoltConnection.java:87)
    at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatch(DefaultBoltConnection.java:143)
    at org.neo4j.bolt.runtime.ExecutorBoltScheduler.executeBatch(ExecutorBoltScheduler.java:163)
    at org.neo4j.bolt.runtime.ExecutorBoltScheduler.lambda$null$0(ExecutorBoltScheduler.java:145)
    at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.neo4j.kernel.impl.query.QueryExecutionKernelException: Unable to create CONSTRAINT ON ( alias:Alias ) ASSERT alias.hr_uuid IS UNIQUE:

    at org.neo4j.cypher.internal.javacompat.ExecutionEngine.executeQuery(ExecutionEngine.java:65)
    at org.neo4j.bolt.v1.runtime.TransactionStateMachineSPI$1.start(TransactionStateMachineSPI.java:144)
    ... 17 more
Caused by: org.neo4j.cypher.CypherExecutionException: Unable to create CONSTRAINT ON ( alias:Alias ) ASSERT alias.hr_uuid IS UNIQUE:

    at org.neo4j.cypher.internal.compatibility.v3_4.ExceptionTranslationSupport$class.translateException(ExceptionTranslationSupport.scala:35)
    at org.neo4j.cypher.internal.compatibility.v3_4.ExceptionTranslatingQueryContext.translateException(ExceptionTranslatingQueryContext.scala:41)
    at org.neo4j.cypher.internal.compatibility.v3_4.ExceptionTranslatingQueryContext.createUniqueConstraint(ExceptionTranslatingQueryContext.scala:128)
    at org.neo4j.cypher.internal.runtime.interpreted.UpdateCountingQueryContext.createUniqueConstraint(UpdateCountingQueryContext.scala:125)
    at org.neo4j.cypher.internal.compatibility.v3_4.runtime.executionplan.procs.ProcedureCallOrSchemaCommandExecutionPlanBuilder$$anonfun$6.apply(ProcedureCallOrSchemaCommandExecutionPlanBuilder.scala:80)
    at org.neo4j.cypher.internal.compatibility.v3_4.runtime.executionplan.procs.ProcedureCallOrSchemaCommandExecutionPlanBuilder$$anonfun$6.apply(ProcedureCallOrSchemaCommandExecutionPlanBuilder.scala:78)
    at org.neo4j.cypher.internal.compatibility.v3_4.runtime.executionplan.procs.PureSideEffectExecutionPlan.run(PureSideEffectExecutionPlan.scala:55)
    at org.neo4j.cypher.internal.compatibility.LatestRuntimeVariablePlannerCompatibility$ExecutionPlanWrapper$$anonfun$run$1.apply(LatestRuntimeVariablePlannerCompatibility.scala:128)
    at org.neo4j.cypher.internal.compatibility.LatestRuntimeVariablePlannerCompatibility$ExecutionPlanWrapper$$anonfun$run$1.apply(LatestRuntimeVariablePlannerCompatibility.scala:124)
    at org.neo4j.cypher.exceptionHandler$runSafely$.apply(exceptionHandler.scala:89)
    at org.neo4j.cypher.internal.compatibility.LatestRuntimeVariablePlannerCompatibility$ExecutionPlanWrapper.run(LatestRuntimeVariablePlannerCompatibility.scala:124)
    at org.neo4j.cypher.internal.PreparedPlanExecution.execute(PreparedPlanExecution.scala:29)
    at org.neo4j.cypher.internal.ExecutionEngine.execute(ExecutionEngine.scala:119)
    at org.neo4j.cypher.internal.javacompat.ExecutionEngine.executeQuery(ExecutionEngine.java:61)
    ... 18 more
Caused by: org.neo4j.kernel.api.exceptions.schema.CreateConstraintFailureException: Unable to create constraint org.neo4j.kernel.api.schema.constaints.UniquenessConstraintDescriptor@104: Existing data does not satisfy CONSTRAINT ON ( label[10]:label[10] ) ASSERT label[10].property[0] IS UNIQUE: Failed to populate index for :Alias(hr_uuid) [provider: {key=lucene+native, version=2.0}] [labelId: 10, properties [0]]
    at org.neo4j.kernel.impl.newapi.Operations.indexBackedConstraintCreate(Operations.java:1217)
    at org.neo4j.kernel.impl.newapi.Operations.uniquePropertyConstraintCreate(Operations.java:922)
    at org.neo4j.cypher.internal.runtime.interpreted.TransactionBoundQueryContext.createUniqueConstraint(TransactionBoundQueryContext.scala:666)
    at org.neo4j.cypher.internal.compatibility.v3_4.ExceptionTranslatingQueryContext$$anonfun$createUniqueConstraint$1.apply$mcZ$sp(ExceptionTranslatingQueryContext.scala:128)
    at org.neo4j.cypher.internal.compatibility.v3_4.ExceptionTranslatingQueryContext$$anonfun$createUniqueConstraint$1.apply(ExceptionTranslatingQueryContext.scala:128)
    at org.neo4j.cypher.internal.compatibility.v3_4.ExceptionTranslatingQueryContext$$anonfun$createUniqueConstraint$1.apply(ExceptionTranslatingQueryContext.scala:128)
    at org.neo4j.cypher.internal.compatibility.v3_4.ExceptionTranslationSupport$class.translateException(ExceptionTranslationSupport.scala:33)
    ... 31 more
Caused by: org.neo4j.kernel.api.exceptions.schema.UniquePropertyValueValidationException: Existing data does not satisfy CONSTRAINT ON ( label[10]:label[10] ) ASSERT label[10].property[0] IS UNIQUE: Failed to populate index for :Alias(hr_uuid) [provider: {key=lucene+native, version=2.0}] [labelId: 10, properties [0]]
    at org.neo4j.kernel.impl.api.state.ConstraintIndexCreator.awaitConstrainIndexPopulation(ConstraintIndexCreator.java:240)
    at org.neo4j.kernel.impl.api.state.ConstraintIndexCreator.createUniquenessConstraintIndex(ConstraintIndexCreator.java:131)
    at org.neo4j.kernel.impl.newapi.Operations.indexBackedConstraintCreate(Operations.java:1202)
    ... 37 more
Caused by: org.neo4j.kernel.api.exceptions.index.IndexPopulationFailedKernelException: Failed to populate index for :Alias(hr_uuid) [provider: {key=lucene+native, version=2.0}] [labelId: 10, properties [0]]
    at org.neo4j.kernel.impl.api.index.IndexPopulationFailure$1.asIndexPopulationFailure(IndexPopulationFailure.java:47)
    at org.neo4j.kernel.impl.api.index.FailedIndexProxy.failureCause(FailedIndexProxy.java:80)
    at org.neo4j.kernel.impl.api.index.FailedIndexProxy.awaitStoreScanCompleted(FailedIndexProxy.java:75)
    at org.neo4j.kernel.impl.api.index.FlippableIndexProxy.awaitStoreScanCompleted(FlippableIndexProxy.java:325)
    at org.neo4j.kernel.impl.api.index.AbstractDelegatingIndexProxy.awaitStoreScanCompleted(AbstractDelegatingIndexProxy.java:122)
    at org.neo4j.kernel.impl.api.state.ConstraintIndexCreator.awaitConstrainIndexPopulation(ConstraintIndexCreator.java:228)
    ... 39 more
Caused by: java.io.IOException: java.lang.IllegalArgumentException: Max supported key size is 4095, but tried to store key of size 4239 | GB+Tree[file:/var/lib/neo4j/data/databases/graph.db/schema/index/lucene_native-2.0/79/string-1.0/index-79, layout:StringLayout[version:0.1, identifier:24016946018123776], generation:2/4]
    at org.neo4j.kernel.impl.index.schema.NativeSchemaIndexPopulator.applyWithWorkSync(NativeSchemaIndexPopulator.java:251)
    at org.neo4j.kernel.impl.index.schema.NativeSchemaIndexPopulator.add(NativeSchemaIndexPopulator.java:153)
    at org.neo4j.kernel.impl.index.schema.fusion.FusionIndexPopulator.add(FusionIndexPopulator.java:85)
    at org.neo4j.kernel.impl.api.index.BatchingMultipleIndexPopulator.lambda$flush$2(BatchingMultipleIndexPopulator.java:167)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
    at org.neo4j.helpers.NamedThreadFactory$2.run(NamedThreadFactory.java:110)
Caused by: java.lang.IllegalArgumentException: Max supported key size is 4095, but tried to store key of size 4239 | GB+Tree[file:/var/lib/neo4j/data/databases/graph.db/schema/index/lucene_native-2.0/79/string-1.0/index-79, layout:StringLayout[version:0.1, identifier:24016946018123776], generation:2/4]
    at org.neo4j.index.internal.gbptree.DynamicSizeUtil.putKeyValueSize(DynamicSizeUtil.java:138)
    at org.neo4j.index.internal.gbptree.TreeNodeDynamicSize.insertKeyValueAt(TreeNodeDynamicSize.java:197)
    at org.neo4j.index.internal.gbptree.TreeNodeDynamicSize.doSplitLeaf(TreeNodeDynamicSize.java:656)
    at org.neo4j.index.internal.gbptree.InternalTreeLogic.splitLeaf(InternalTreeLogic.java:656)
    at org.neo4j.index.internal.gbptree.InternalTreeLogic.doInsertInLeaf(InternalTreeLogic.java:552)
    at org.neo4j.index.internal.gbptree.InternalTreeLogic.insertInLeaf(InternalTreeLogic.java:514)
    at org.neo4j.index.internal.gbptree.InternalTreeLogic.insert(InternalTreeLogic.java:355)
    at org.neo4j.index.internal.gbptree.GBPTree$SingleWriter.merge(GBPTree.java:1192)
    at org.neo4j.kernel.impl.index.schema.NativeSchemaIndexUpdater.processAdd(NativeSchemaIndexUpdater.java:132)
    at org.neo4j.kernel.impl.index.schema.NativeSchemaIndexUpdater.processUpdate(NativeSchemaIndexUpdater.java:86)
    at org.neo4j.kernel.impl.index.schema.NativeSchemaIndexPopulator$IndexUpdateApply.process(NativeSchemaIndexPopulator.java:328)
    at org.neo4j.kernel.impl.index.schema.NativeSchemaIndexPopulator$IndexUpdateWork.apply(NativeSchemaIndexPopulator.java:355)
    at org.neo4j.kernel.impl.index.schema.NativeSchemaIndexPopulator$IndexUpdateWork.apply(NativeSchemaIndexPopulator.java:334)
    at org.neo4j.concurrent.WorkSync.doSynchronizedWork(WorkSync.java:231)
    at org.neo4j.concurrent.WorkSync.tryDoWork(WorkSync.java:157)
    at org.neo4j.concurrent.WorkSync.apply(WorkSync.java:91)
    at org.neo4j.kernel.impl.index.schema.NativeSchemaIndexPopulator.applyWithWorkSync(NativeSchemaIndexPopulator.java:238)
    ... 7 more

共有2个答案

韩晋
2023-03-14

我们在这里的操作手册中对此进行了记录。

作为解决方法,您可以使用过程db.createUniqueProperty tyConstraint(),传递约束的标签和属性,并传递Lucene native-1.0作为第二个参数来指定索引提供程序(1.0中没有本机字符串索引,因此它将使用Lucene)。

我们同样有db.createIndex()用于强制使用特定索引提供程序创建索引。

孔山
2023-03-14

您可以这样轻松地显示最后的记录:

MATCH (a:Alias) WITH a ORDER BY size(a.property) DESC LIMIT 1000 RETURN a.property
 类似资料:
  • 我有以下SDN 4节点实体: 在这个实体内部,我添加了属性并声明了一个索引。 现在,我将按产品名称实现不区分大小写的搜索。 我创建了一个SDN 4存储库方法: 为了搜索产品,我使用以下密码: 我认为索引在这种情况下不能有效地工作,因为我小写了字符串。 Neo4j/SDN 4中使索引在这里工作的正确方法是什么?

  • 问题内容: 假设此JSON对象: 可以像这样检索“ set2”属性: 有没有一种方法可以通过索引检索“ set2”属性?它是JSON对象的第二个属性。这是行不通的(当然): 因此,假设我要检索JSON对象的第二个属性,但我不知道它的名称-那么我该怎么做? 更新: 是的,我知道对象是无序属性的集合。但是我不认为浏览器会干扰JSON文字/字符串定义的“原始”顺序。 问题答案: JavaScript中的

  • 我有一个MongoDB,里面有大约80k个文档,每个文档都是一个带有、等的条目。我想做,为此我使用以下命令创建了一个文本索引: 索引构建失败,因为它运行内存溢出并杀死了运行mongoDB的作业。这在日志中: 2018-03-22T14:58:12.017 0000 I-[initandlisten]索引构建:2500/861872% 2018-03-22T14:58:15.028 0000 I-[

  • 尝试打印包含 698 个项目的 ArrayList 时收到以下错误: 我使用了以下代码,我希望收到错误: 我的问题是,如果数组的大小是698,那么max索引不应该是697吗?我不明白为什么错误给出指数:698。

  • 应用yml在带有主类和hibernate的模块中: 主要pom: 我的模块pom: 在父项目中: 错误: