neo4j3.4无法为属性创建约束。显然是因为记录太长
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]
似乎是这个问题 https://github.com/neo4j/neo4j/issues/9498
但是我不知道如何解决它。对于导致问题的记录,我没有任何反馈
谢谢
Benoît
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
答案 0 :(得分:0)
您可以像这样轻松显示最近的记录:
MATCH (a:Alias) WITH a ORDER BY size(a.property) DESC LIMIT 1000 RETURN a.property
答案 1 :(得分:0)
我们已在操作手册here中对此进行了记录。
作为一种解决方法,您可以使用过程db.createUniquePropertyConstraint(),传递约束的标签和属性,并传递“ lucene + native-1.0”作为第二个参数来指定索引提供程序(无本地字符串索引)在1.0中使用,因此将使用lucene。
我们同样具有db.createIndex()
,用于通过特定的索引提供程序强制创建索引。