Logo Search packages:      
Sourcecode: maxdb-7.5.00 version File versions

Log_RawDeviceOffset Log_Writer::GetOldestRequiredOffset (  )  const [private]

Returns the oldest offset on the log device that may not be overwritten by the log writer.

Returns:
(Log_RawDeviceOffset)

Definition at line 490 of file Log_Writer.cpp.

References Log_RawDeviceIterator::GetBeginOffset(), SAPDB_Invalidatable< T, InvalidValue >::IsInvalid(), SAPDB_Invalidatable< T, InvalidValue >::IsValid(), Log_IOSequenceNo::IsValid(), Log_IOSequenceNo::LeftIsOlder(), m_LogInfoPage, m_WriteIterator, Log_InfoPage::ReadOldestKnownIOSequenceNo(), Log_InfoPage::ReadOldestNotSavedIOSequenceNo(), Log_InfoPage::ReadOldestNotSavedOffset(), Log_InfoPage::ReadSavepointEntryOffset(), and Log_InfoPage::ReadSavepointIOSequenceNo().

Referenced by EnableAddedLogDeviceIsPossible(), FreePagesForLogWriter(), and UsedPages().

{
    Log_RawDeviceOffset saveptOffset         = m_LogInfoPage.ReadSavepointEntryOffset();
    Log_RawDeviceOffset oldestNotSavedOffset = m_LogInfoPage.ReadOldestNotSavedOffset();

    if ( saveptOffset.IsInvalid())
    {
        if ( oldestNotSavedOffset.IsValid() )
            return oldestNotSavedOffset;
    }
    else
    {
        if (oldestNotSavedOffset.IsValid())
        {
            if (m_LogInfoPage.ReadOldestNotSavedIOSequenceNo().IsValid())
            {
                if (m_LogInfoPage.ReadSavepointIOSequenceNo().IsValid())
                {
                    // two valid values - return the offset of the lower (older) sequence
                    // PTS 1124727 mb 2003-10-20 also take care of eventual overflows
                    if (Log_IOSequenceNo::LeftIsOlder(m_LogInfoPage.ReadOldestNotSavedIOSequenceNo(),
                                                      m_LogInfoPage.ReadSavepointIOSequenceNo(),
                                                      m_LogInfoPage.ReadOldestKnownIOSequenceNo()))
                    {
                        return oldestNotSavedOffset;
                    }
                    else
                    {
                        return saveptOffset;
                    }
                }
            }                    
        }
        else //oldestNotSavedOffset.IsInvalid()
        {
            return saveptOffset;
        }
    }

    // no valid value at all => the first offset must be available for restart
    return m_WriteIterator.GetBeginOffset();

}


Generated by  Doxygen 1.6.0   Back to index