Example #1
0
//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");
        }
Example #2
0
//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.");
        }