Example #1
0
 public static PageCorruption <KEY, VALUE> SetChild <KEY, VALUE>(int childPos, long childPointer)
 {
     return((cursor, layout, node, treeState) =>
     {
         GenerationKeeper childGeneration = new GenerationKeeper();
         node.childAt(cursor, childPos, treeState.stableGeneration(), treeState.unstableGeneration(), childGeneration);
         OverwriteGSPP(cursor, GBPTreePointerType.child(childPos).offset(node), childGeneration.Generation, childPointer);
     });
 }
Example #2
0
        public static PageCorruption <KEY, VALUE> SwapChildOrder <KEY, VALUE>(int firstChildPos, int secondChildPos, int keyCount)
        {
            return((cursor, layout, node, treeState) =>
            {
                // Read first and second child together with generation
                GenerationKeeper firstChildGeneration = new GenerationKeeper();
                long firstChild = node.childAt(cursor, firstChildPos, treeState.stableGeneration(), treeState.unstableGeneration(), firstChildGeneration);
                GenerationKeeper secondChildGeneration = new GenerationKeeper();
                long secondChild = node.childAt(cursor, secondChildPos, treeState.stableGeneration(), treeState.unstableGeneration(), secondChildGeneration);

                // Overwrite respective child with the other
                OverwriteGSPP(cursor, GBPTreePointerType.child(firstChildPos).offset(node), secondChildGeneration.Generation, secondChild);
                OverwriteGSPP(cursor, GBPTreePointerType.child(secondChildPos).offset(node), firstChildGeneration.Generation, firstChild);
            });
        }
Example #3
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);
        }