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); } }
public static PageCorruption <KEY, VALUE> RightSiblingPointToNonExisting <KEY, VALUE>() { return((cursor, layout, node, treeState) => overwriteGSPP(cursor, GBPTreePointerType.rightSibling().offset(node), treeState.stableGeneration(), GenerationSafePointer.MAX_POINTER)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void crashPointer() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void CrashPointer() { Setup(GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10); MutableObject <long> targetNode = new MutableObject <long>(); File[] indexFiles = SchemaIndexFiles(); CorruptIndexes(false, (tree, inspection) => { targetNode.Value = inspection.RootNode; tree.@unsafe(GBPTreeCorruption.pageSpecificCorruption(targetNode.Value, GBPTreeCorruption.crashed(GBPTreePointerType.rightSibling()))); }, indexFiles); ConsistencyCheckService.Result result = RunConsistencyCheck(); assertFalse("Expected store to be considered inconsistent.", result.Successful); AssertResultContainsMessage(result, "Crashed 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 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 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 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); }