Created
February 3, 2015 16:23
-
-
Save luanne/d970e984d644edf11d3b to your computer and use it in GitHub Desktop.
When a node is created with duplicate labels by the batch inserter, the consistency checker produces "The label token record is referenced twice from the same node"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.graphaware; | |
| import org.neo4j.graphdb.DynamicLabel; | |
| import org.neo4j.graphdb.schema.ConstraintCreator; | |
| import org.neo4j.unsafe.batchinsert.BatchInserter; | |
| import org.neo4j.unsafe.batchinsert.BatchInserters; | |
| import java.util.Collections; | |
| import java.util.Date; | |
| import static org.neo4j.helpers.collection.MapUtil.map; | |
| /** | |
| * Created by luanne on 03/02/15. | |
| */ | |
| public class LabelTokenIsReferencedTwiceFromSameNode { | |
| public static void main(String[] args) { | |
| String path = "/tmp/test" + new Date().getTime() + ".graph.db"; | |
| System.out.println("path = " + path); | |
| BatchInserter inserter = BatchInserters.inserter(path, Collections.EMPTY_MAP); | |
| inserter.createNode(map("itemId", 1000l), DynamicLabel.label("Item"), DynamicLabel.label("Item")); | |
| ConstraintCreator constraintCreator = inserter.createDeferredConstraint(DynamicLabel.label("Item")); | |
| constraintCreator.assertPropertyIsUnique("itemId").create(); | |
| inserter.shutdown(); | |
| /* | |
| Consistency check produces | |
| Full consistency check | |
| 2015-02-03 10:08:07.375+0000 INFO [org.neo4j]: ERROR: The label token record is referenced twice from the same node. | |
| Node[0,used=true,rel=-1,prop=0,labels=Inline(0x2000000000:[0, 0]),light] | |
| Inconsistent with: 0 | |
| ......2015-02-03 10:08:07.405+0000 INFO [org.neo4j]: ERROR: The label token record is referenced twice from the same node. | |
| Node[0,used=true,rel=-1,prop=0,labels=Inline(0x2000000000:[0, 0]),light] | |
| Inconsistent with: 0 | |
| */ | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment