Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCleanMultipleCrashPerPage() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCleanMultipleCrashPerPage()
        {
            // GIVEN
            Page[] pages = With(LeafWith(GBPTreeCorruption.Crashed(GBPTreePointerType.leftSibling()), GBPTreeCorruption.Crashed(GBPTreePointerType.rightSibling()), GBPTreeCorruption.Crashed(GBPTreePointerType.successor())), InternalWith(GBPTreeCorruption.Crashed(GBPTreePointerType.leftSibling()), GBPTreeCorruption.Crashed(GBPTreePointerType.rightSibling()), GBPTreeCorruption.Crashed(GBPTreePointerType.successor()), GBPTreeCorruption.Crashed(GBPTreePointerType.child(0))));
            InitializeFile(_pagedFile, pages);

            // WHEN
            SimpleCleanupMonitor monitor = new SimpleCleanupMonitor();

            CrashGenerationCleaner(_pagedFile, 0, pages.Length, monitor).clean(_executor);

            // THEN
            AssertPagesVisited(monitor, pages.Length);
            AssertCleanedCrashPointers(monitor, 7);
        }
Example #2
0
 private void AssertSiblingPointerGeneration(long currentRightmostNode, long currentRightmostNodeGeneration, long currentRightmostRightSiblingPointer, long currentRightmostRightSiblingPointerGeneration, long newRightmostNode, long newRightmostNodeGeneration, long newRightmostLeftSiblingPointer, long newRightmostLeftSiblingPointerGeneration, GBPTreeConsistencyCheckVisitor visitor)
 {
     if (currentRightmostNodeGeneration > newRightmostLeftSiblingPointerGeneration && currentRightmostNode != NO_NODE_FLAG)
     {
         // Generation of left sibling is larger than that of the pointer from right sibling
         // Left siblings view:  {_(9)}-(_)->{_}
         // Right siblings view: {_}<-(5)-{_(_)}
         visitor.pointerHasLowerGenerationThanNode(GBPTreePointerType.leftSibling(), newRightmostNode, newRightmostLeftSiblingPointerGeneration, newRightmostLeftSiblingPointer, currentRightmostNodeGeneration, _file);
     }
     if (currentRightmostRightSiblingPointerGeneration < newRightmostNodeGeneration && currentRightmostRightSiblingPointer != NO_NODE_FLAG)
     {
         // Generation of right sibling is larger than that of the pointer from left sibling
         // Left siblings view:  {_(_)}-(5)->{_}
         // Right siblings view: {_}<-(_)-{_(9)}
         visitor.pointerHasLowerGenerationThanNode(GBPTreePointerType.rightSibling(), currentRightmostNode, currentRightmostRightSiblingPointerGeneration, currentRightmostRightSiblingPointer, newRightmostNodeGeneration, _file);
     }
 }
Example #3
0
 public static PageCorruption <KEY, VALUE> LeftSiblingPointToNonExisting <KEY, VALUE>()
 {
     return((cursor, layout, node, treeState) => overwriteGSPP(cursor, GBPTreePointerType.leftSibling().offset(node), treeState.stableGeneration(), GenerationSafePointer.MAX_POINTER));
 }
Example #4
0
//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");
        }
Example #5
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.");
        }
Example #6
0
//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);
        }