示例#1
0
 internal virtual void AssertLast(GBPTreeConsistencyCheckVisitor visitor)
 {
     if (_currentRightmostRightSiblingPointer != NO_NODE_FLAG)
     {
         visitor.rightmostNodeHasRightSibling(_currentRightmostRightSiblingPointer, _currentRightmostNode, _file);
     }
 }
 internal FreelistSeenIdsVisitor(File file, BitArray seenIds, long lastId, GBPTreeConsistencyCheckVisitor <KEY> visitor)
 {
     this.File    = file;
     this.SeenIds = seenIds;
     this.LastId  = lastId;
     this.Visitor = visitor;
 }
示例#3
0
 private bool ConsistencyCheck(GBPTreeConsistencyCheckVisitor <KEY> visitor)
 {
     try
     {
         return(Tree.consistencyCheck(visitor));
     }
     catch (IOException e)
     {
         throw new UncheckedIOException(e);
     }
 }
示例#4
0
 private bool ConsistencyCheck(GBPTreeConsistencyCheckVisitor <LabelScanKey> visitor)
 {
     try
     {
         return(_index.consistencyCheck(visitor));
     }
     catch (IOException e)
     {
         throw new UncheckedIOException(e);
     }
 }
 internal virtual void Report(GBPTreeConsistencyCheckVisitor <KEY> visitor)
 {
     if (KeysOutOfOrder.notEmpty())
     {
         KeysOutOfOrder.forEach(pageId => visitor.keysOutOfOrderInNode(pageId, File));
     }
     if (KeysLocatedInWrongNodeConflict.notEmpty())
     {
         KeysLocatedInWrongNodeConflict.forEach(keyInWrongNode => visitor.keysLocatedInWrongNode(keyInWrongNode.range, keyInWrongNode.key, keyInWrongNode.pos, keyInWrongNode.keyCount, keyInWrongNode.pageId, File));
     }
 }
示例#6
0
        private void AssertSiblingsAgreeOnBeingSiblings(long currentRightmostNode, long currentRightmostNodeGeneration, long currentRightmostRightSiblingPointer, long currentRightmostRightSiblingPointerGeneration, long newRightmostNode, long newRightmostNodeGeneration, long newRightmostLeftSiblingPointer, long newRightmostLeftSiblingPointerGeneration, GBPTreeConsistencyCheckVisitor visitor)
        {
            bool siblingsPointToEachOther = true;

            if (newRightmostLeftSiblingPointer != currentRightmostNode)
            {
                // Right sibling does not point to left sibling
                // Left siblings view:  {2(_)}-(_)->{_}
                // Right siblings view: {1}<-(_)-{_(_)}
                siblingsPointToEachOther = false;
            }
            if (newRightmostNode != currentRightmostRightSiblingPointer && (currentRightmostRightSiblingPointer != NO_NODE_FLAG || currentRightmostNode != NO_NODE_FLAG))
            {
                // Left sibling does not point to right sibling
                // Left siblings view:  {_(_)}-(_)->{1}
                // Right siblings view: {_}<-(_)-{2(_)}
                siblingsPointToEachOther = false;
            }
            if (!siblingsPointToEachOther)
            {
                visitor.siblingsDontPointToEachOther(currentRightmostNode, currentRightmostNodeGeneration, currentRightmostRightSiblingPointerGeneration, currentRightmostRightSiblingPointer, newRightmostLeftSiblingPointer, newRightmostLeftSiblingPointerGeneration, newRightmostNode, newRightmostNodeGeneration, _file);
            }
        }
示例#7
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);
     }
 }
示例#8
0
        internal virtual void AssertNext(PageCursor cursor, long newRightmostNodeGeneration, long newRightmostLeftSiblingPointer, long newRightmostLeftSiblingPointerGeneration, long newRightmostRightSiblingPointer, long newRightmostRightSiblingPointerGeneration, GBPTreeConsistencyCheckVisitor visitor)
        {
            long newRightmostNode = cursor.CurrentPageId;

            // Assert we have reached expected node and that we agree about being siblings
            AssertSiblingsAgreeOnBeingSiblings(_currentRightmostNode, _currentRightmostNodeGeneration, _currentRightmostRightSiblingPointer, _currentRightmostRightSiblingPointerGeneration, newRightmostNode, newRightmostNodeGeneration, newRightmostLeftSiblingPointer, newRightmostLeftSiblingPointerGeneration, visitor);
            // Assert that both sibling pointers have reasonable generations
            AssertSiblingPointerGeneration(_currentRightmostNode, _currentRightmostNodeGeneration, _currentRightmostRightSiblingPointer, _currentRightmostRightSiblingPointerGeneration, newRightmostNode, newRightmostNodeGeneration, newRightmostLeftSiblingPointer, newRightmostLeftSiblingPointerGeneration, visitor);

            // Update currentRightmostNode = newRightmostNode;
            _currentRightmostNode                          = newRightmostNode;
            _currentRightmostNodeGeneration                = newRightmostNodeGeneration;
            _currentRightmostRightSiblingPointer           = newRightmostRightSiblingPointer;
            _currentRightmostRightSiblingPointerGeneration = newRightmostRightSiblingPointerGeneration;
        }
示例#9
0
 /// <returns> <seealso cref="string"/> describing inconsistency of empty string "" if no inconsistencies. </returns>
 internal abstract string CheckMetaConsistency(PageCursor cursor, int keyCount, Type type, GBPTreeConsistencyCheckVisitor <KEY> visitor);
 internal CleanTrackingConsistencyCheckVisitor(GBPTreeConsistencyCheckVisitor <KEY> @delegate)
 {
     this.@delegate = @delegate;
 }
示例#11
0
 internal override string CheckMetaConsistency(PageCursor cursor, int keyCount, Type type, GBPTreeConsistencyCheckVisitor <KEY> visitor)
 {
     return("");
 }