//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void multipleCorruptionsInFusionIndex() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MultipleCorruptionsInFusionIndex() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE20, db => { using (Transaction tx = Db.beginTx()) { // Also make sure we have some numbers for (int i = 0; i < 1000; i++) { Node node = Db.createNode(_label); node.setProperty(PROP_KEY1, i); Node secondNode = Db.createNode(_label); secondNode.setProperty(PROP_KEY1, LocalDate.ofEpochDay(i)); } tx.success(); } }); File[] indexFiles = SchemaIndexFiles(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.List<java.io.File> files = corruptIndexes(true, (tree, inspection) -> IList <File> files = CorruptIndexes(true, (tree, inspection) => { long leafNode = inspection.LeafNodes.get(1); long internalNode = inspection.InternalNodes.get(0); tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(leafNode, GBPTreeCorruption.rightSiblingPointToNonExisting())); tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(internalNode, GBPTreeCorruption.setChild(0, internalNode))); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); foreach (File file in files) { AssertResultContainsMessage(result, "Index file: " + file.AbsolutePath); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void pageIdExceedLastId() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void PageIdExceedLastId() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { tree.@unsafe(GBPTreeCorruption.decrementFreelistWritePos()); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, "Index has a leaked page that will never be reclaimed, pageId="); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void nodeMetaInconsistency() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void NodeMetaInconsistency() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(inspection.RootNode, GBPTreeCorruption.decrementAllocOffsetInDynamicNode())); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, "has inconsistent meta data: Meta data for tree node is inconsistent"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void childNodeFoundAmongParentNodes() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ChildNodeFoundAmongParentNodes() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { long rootNode = inspection.RootNode; tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(rootNode, GBPTreeCorruption.setChild(0, rootNode))); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, "Circular reference, child tree node found among parent nodes. Parents:"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void exception() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void Exception() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { long rootNode = inspection.RootNode; tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(rootNode, GBPTreeCorruption.setHighestReasonableKeyCount())); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, "Caught exception during consistency check: org.neo4j.index.internal.gbptree.TreeInconsistencyException: Some internal problem causing out of" + " bounds: pageId:"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldIncludeIndexFileInConsistencyReport() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldIncludeIndexFileInConsistencyReport() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); File[] indexFiles = SchemaIndexFiles(); IList <File> corruptedFiles = CorruptIndexes(true, (tree, inspection) => { long rootNode = inspection.RootNode; tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(rootNode, GBPTreeCorruption.notATreeNode())); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, "Index file: " + corruptedFiles[0].AbsolutePath); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void rightmostNodeHasRightSibling() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void RightmostNodeHasRightSibling() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { long root = inspection.RootNode; tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(root, GBPTreeCorruption.setPointer(GBPTreePointerType.rightSibling(), 10))); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, "Expected rightmost node to have no right sibling but was 10"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void unusedPage() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void UnusedPage() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { long?internalNode = inspection.NodesPerLevel.get(1).get(0); int keyCount = inspection.KeyCounts.get(internalNode); tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(internalNode, GBPTreeCorruption.setKeyCount(keyCount - 1))); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, "Index has a leaked page that will never be reclaimed, pageId="); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void keysLocatedInWrongNode() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void KeysLocatedInWrongNode() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { long internalNode = inspection.NodesPerLevel.get(1).get(0); int keyCount = inspection.KeyCounts.get(internalNode); tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(internalNode, GBPTreeCorruption.swapChildOrder(0, 1, keyCount))); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, "Expected range for this tree node is"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void brokenPointer() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void BrokenPointer() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); MutableObject <long> targetNode = new MutableObject <long>(); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { targetNode.Value = inspection.RootNode; tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(targetNode.Value, GBPTreeCorruption.broken(GBPTreePointerType.leftSibling()))); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, "Broken pointer found in tree node " + targetNode.Value); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void pageIdSeenMultipleTimes() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void PageIdSeenMultipleTimes() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); MutableObject <long> targetNode = new MutableObject <long>(); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { targetNode.Value = inspection.RootNode; tree.@unsafe(GBPTreeCorruption.addFreelistEntry(targetNode.Value)); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, "Page id seen multiple times, this means either active tree node is present in freelist or pointers in tree create a loop, pageId=" + targetNode.Value); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void siblingsDontPointToEachOther() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SiblingsDontPointToEachOther() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); MutableObject <long> targetNode = new MutableObject <long>(); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { targetNode.Value = inspection.LeafNodes.get(0); tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(targetNode.Value, GBPTreeCorruption.rightSiblingPointToNonExisting())); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, "Sibling pointers misaligned."); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void pointerToOldVersionOfTreeNode() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void PointerToOldVersionOfTreeNode() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); MutableObject <long> targetNode = new MutableObject <long>(); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { targetNode.Value = inspection.RootNode; tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(targetNode.Value, GBPTreeCorruption.setPointer(GBPTreePointerType.successor(), 6))); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, "We ended up on tree node " + targetNode.Value + " which has a newer generation, successor is: 6"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void unreasonableKeyCount() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void UnreasonableKeyCount() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); MutableObject <long> targetNode = new MutableObject <long>(); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { targetNode.Value = inspection.RootNode; tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(targetNode.Value, GBPTreeCorruption.setKeyCount(int.MaxValue))); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, "Unexpected keyCount on pageId " + targetNode.Value + ", keyCount=" + int.MaxValue); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void unknownTreeNodeType() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void UnknownTreeNodeType() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); MutableObject <long> targetNode = new MutableObject <long>(); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { targetNode.Value = inspection.RootNode; tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(targetNode.Value, GBPTreeCorruption.unknownTreeNodeType())); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, "Page: " + targetNode.Value + " has an unknown tree node type:"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void multipleCorruptionsInLabelScanStore() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MultipleCorruptionsInLabelScanStore() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); MutableObject <long> rootNode = new MutableObject <long>(); File labelScanStoreFile = labelScanStoreFile(); CorruptIndexes(true, (tree, inspection) => { rootNode.Value = inspection.RootNode; tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(rootNode.Value, GBPTreeCorruption.broken(GBPTreePointerType.leftSibling()))); }, labelScanStoreFile); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse(result.Successful); AssertResultContainsMessage(result, "Index inconsistency: Broken pointer found in tree node " + rootNode.Value + ", pointerType='left sibling'"); AssertResultContainsMessage(result, "Number of inconsistent LABEL_SCAN_DOCUMENT records: 1"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void keysOutOfOrderInNode() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void KeysOutOfOrderInNode() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); MutableObject <long> targetNode = new MutableObject <long>(); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { targetNode.Value = inspection.LeafNodes.get(0); int keyCount = inspection.KeyCounts.get(targetNode.Value); tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(targetNode.Value, GBPTreeCorruption.swapKeyOrderLeaf(0, 1, keyCount))); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, string.Format("Keys in tree node {0:D} are out of order.", targetNode.Value)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void pointerHasLowerGenerationThanNode() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void PointerHasLowerGenerationThanNode() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); MutableObject <long> targetNode = new MutableObject <long>(); MutableObject <long> rightSibling = new MutableObject <long>(); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { ImmutableLongList leafNodes = inspection.LeafNodes; targetNode.Value = leafNodes.get(0); rightSibling.Value = leafNodes.get(1); tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(targetNode.Value, GBPTreeCorruption.rightSiblingPointerHasTooLowGeneration())); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, string.Format("Pointer ({0}) in tree node {1:D} has pointer generation {2:D}, but target node {3:D} has a higher generation {4:D}.", GBPTreePointerType.rightSibling(), targetNode.Value, 1, rightSibling.Value, 4)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotCheckIndexStructureIfConfiguredNotToEvenIfCheckingIndexes() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotCheckIndexStructureIfConfiguredNotToEvenIfCheckingIndexes() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); MutableObject <long> targetNode = new MutableObject <long>(); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { targetNode.Value = inspection.RootNode; tree.@unsafe(GBPTreeCorruption.addFreelistEntry(5)); }, indexFiles); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.configuration.Config config = config(org.neo4j.kernel.configuration.Settings.FALSE, org.neo4j.kernel.configuration.Settings.TRUE); Config config = config(Settings.FALSE, Settings.TRUE); ConsistencyCheckService.Result result = RunConsistencyCheck(config); assertTrue("Expected store to be consistent when not checking indexes.", result.Successful); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCheckIndexStructureEvenIfNotCheckingIndexes() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCheckIndexStructureEvenIfNotCheckingIndexes() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); MutableObject <long> targetNode = new MutableObject <long>(); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { targetNode.Value = inspection.RootNode; tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(targetNode.Value, GBPTreeCorruption.notATreeNode())); }, indexFiles); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.configuration.Config config = config(org.neo4j.kernel.configuration.Settings.TRUE, org.neo4j.kernel.configuration.Settings.FALSE); Config config = config(Settings.TRUE, Settings.FALSE); ConsistencyCheckService.Result result = RunConsistencyCheck(config); assertFalse("Expected store to be inconsistent when checking index structure.", result.Successful); AssertResultContainsMessage(result, "Page: " + targetNode.Value + " is not a tree node page"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void multipleCorruptions() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MultipleCorruptions() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); MutableObject <long> internalNode = new MutableObject <long>(); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(true, (tree, inspection) => { long leafNode = inspection.LeafNodes.get(0); internalNode.Value = inspection.NodesPerLevel.get(1).get(1); int?internalNodeKeyCount = inspection.KeyCounts.get(internalNode.Value); tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(leafNode, GBPTreeCorruption.rightSiblingPointToNonExisting())); tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(internalNode.Value, GBPTreeCorruption.swapChildOrder(0, 1, internalNodeKeyCount))); tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(internalNode.Value, GBPTreeCorruption.broken(GBPTreePointerType.leftSibling()))); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); AssertResultContainsMessage(result, "Index inconsistency: Sibling pointers misaligned."); AssertResultContainsMessage(result, "Index inconsistency: Expected range for this tree node is"); AssertResultContainsMessage(result, "Index inconsistency: Broken pointer found in tree node " + internalNode.Value + ", pointerType='left sibling'"); AssertResultContainsMessage(result, "Index inconsistency: Pointer (left sibling) in tree node " + internalNode.Value + " has pointer generation 0, but target node 0 has a higher generation 4."); }