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

Kernel_IAdminHotStandby::TriggerSynchronizeResult Kernel_Administration::TriggerSynchronize ( tgg00_TransContext &  serverTaskStartContext  )  [private, virtual]

The timeout task uses this to start the synchronization server task.

Parameters:
serverTaskStartContext is used to start the synch server task
Returns:
TriggerSynchronizeResult

Implements Kernel_IAdminHotStandby.

Definition at line 3182 of file Kernel_Administration.cpp.

References Kernel_DateTime::DetermineDelayedTime(), Log_RawDeviceIterator::GetDistanceFrom(), RTEConf_ParameterAccess::GetInteger(), Log_RawDeviceIterator::GetPosition(), Log_Volume::GetWriterPosition(), RTEConf_ParameterAccess::Instance(), Log_Volume::Instance(), SAPDB_Invalidatable< T, InvalidValue >::IsValid(), Kernel_DateTime::IsValid(), m_LastSyncOffset, m_LastSyncTime, m_SynchronizationIsNeeded, m_SynchronizationIsRunning, and Kernel_DateTime::OlderThan().

{
    SAPDBTRACE_METHOD_DEBUG ("Kernel_Administration::TriggerSynchronize", Common_Trace, 5);

    if ( ! m_SynchronizationIsNeeded || m_SynchronizationIsRunning )
        return TriggerSynchronizeOk; // fast return because called by timeout task
    
    // needs no critical region because is only called by timeout task
    m_SynchronizationIsRunning = true;
    
    Log_RawDeviceIterator currentWriterPosition = Log_Volume::Instance().GetWriterPosition();

    if ( m_LastSyncOffset.IsValid()
         &&
         currentWriterPosition.GetPosition() == m_LastSyncOffset )
      {
        // Not enough log was written to sync again.
        m_SynchronizationIsRunning = false;
        return TriggerSynchronizeNotNeeded;
      }

    // decrement the position, because the page on the current write position must not been read by the standby
    --currentWriterPosition;

    if ( m_LastSyncOffset.IsValid()
         &&
         currentWriterPosition.GetDistanceFrom(m_LastSyncOffset) < 1 )
      {
        // Not enough log was written to sync again.
        m_SynchronizationIsRunning = false;
        return TriggerSynchronizeNotNeeded;
      }
    
    if (m_LastSyncTime.IsValid())           // PTS 1125481 mb 2003-11-18
    {
        RTEConf_Parameter::Integer syncInterval = 0;
        SAPDBErr_MessageList       error;
        if( ! RTEConf_ParameterAccess::Instance()->GetInteger(UTF8("HS_SYNC_INTERVAL"), syncInterval, error) )
        {
            RTE_Message (error);
            RTE_Crash(SAPDBErr_Exception(__CONTEXT__,SAPDBERR_ASSERT_STATE_FAILED,"GetParameter: HS_SYNC_INTERVAL"));
        }

        Kernel_DateTime startOfSyncInterval;
        startOfSyncInterval.DetermineDelayedTime(static_cast<SAPDB_UInt>(syncInterval));
        
        if (startOfSyncInterval.OlderThan(m_LastSyncTime))
        {
            // span of time since last synchronize not long enough
            m_SynchronizationIsRunning = false;
            return TriggerSynchronizeNotNeeded;
        }
    }
        
    // Server is started now

    tgg00_TransChild childtrans;
    tgg00_MessBlock  sendmblock;

    g01mblock_init (serverTaskStartContext, m_restart, mm_consistent, sendmblock);
    k53child_trans_build (m_restart, 0, childtrans);
    sendmblock.mb_reply() = false;
    
    k90send (sendmblock, childtrans);
    
    if ( sendmblock.mb_trns()->trError_gg00 != e_ok )
      {
        m_SynchronizationIsRunning = false;
        return TriggerSynchronizeStartSyncServerFailed;
      }
    
    return TriggerSynchronizeOk;
}


Generated by  Doxygen 1.6.0   Back to index