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

Kernel_IAdminHotStandby::InitStandbyResult Kernel_Administration::InitStandby ( tsp00_TaskId  taskid,
SAPDBErr_MessageList errlist 
) [private, virtual]

This initializes the current node as a standby node.

  • This is called by the cluster coordinator as a first step to create a new standby node.
  • The command INFO STANDBY is sent to the master to get an internal data packet which is used to establish the data mirror. If the communication fails the error InitStandbyCommunicationError is returned.
  • The command PREPARE STANDBY is sent to the master.
    Parameters:
    taskid is used for synchronization.
    errlist may be filled with any additional error message.
    Returns:
    InitStandbyResult
    Precondition:
  • The parameters must be set up for a standby configuration otherwise InitStandbyWrongRole is returned
  • If the log info page can be read and the current node is the master node or the current node is the default master then the error InitStandbyNotAllowed is returned.

Implements Kernel_IAdminHotStandby.

Definition at line 2725 of file Kernel_Administration.cpp.

References IOMan_IDataManager::CloseAllDataVolumes(), Kernel_StateScope::EnterCriticalState(), RTEHSS_KernelInterface::EstablishMirror(), RTEHSS_KernelInterface::FreeMemory(), IOMan_IDataManager::GetInstance(), GetMaster(), RTEHSS_KernelInterface::GetOwnNodeName(), RTEHSS_KernelInterface::GotInitStandby(), RTEHSS_KernelInterface::Instance(), Kernel_State::IsStandby(), m_State, RTEHSS_KernelInterface::Mapping::mappingString, RTEHSS_KernelInterface::SendInfoStandby(), and RTEHSS_KernelInterface::SendPrepareStandby().

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

    if ( ! m_State.IsStandby() )
    {
        errlist = Admin_Exception(__CONTEXT__,KERNEL_COMMAND_NOT_ALLOWED,"Init Standby","role is not standby");
        return InitStandbyWrongRole;
    }

    Kernel_StateScope state (Kernel_State::criticalStateConfiguration, m_State);

    if ( ! state.EnterCriticalState() )
    {
        errlist = Admin_Exception(__CONTEXT__, KERNEL_ENTER_CRITICAL_STATE_FAILED, "Configuration");
        return InitStandbyNotAllowed;
    }

    RTEHSS_KernelInterface &hss = RTEHSS_KernelInterface::Instance();

    // Notify INIT STANDBY was accepted
    hss.GotInitStandby();

    // Check if the master wants to become a standby

    RTE_Nodename masterNodeName;
    RTE_Nodename ownNodeName;

    if ( ! GetMaster (masterNodeName, errlist) )
        return InitStandbyCannotReadMaster;

    if ( ! hss.GetOwnNodeName (ownNodeName,errlist) )
        return InitStandbyCannotReadOwnName;

    if ( ! strcmp (masterNodeName, ownNodeName) )
    {
        errlist = Admin_Exception(__CONTEXT__, KERNEL_INIT_STANDBY_NOT_ALLOWED,
                                  ownNodeName, masterNodeName);
        return InitStandbyNotAllowed;
    }
    
    // Write a message to knldiag
    
    RTE_Message(Admin_Exception(__CONTEXT__, KERNEL_INIT_STANDBY_START, masterNodeName));
    
    if( ! IOMan_IDataManager::GetInstance().CreateAllDataVolumes(taskid) )
        return InitStandbyCreateDataVolumesFailed;

    // determine the masters mapping info

    RTEHSS_KernelInterface::Mapping otherMapping;

    if ( ! hss.SendInfoStandby(masterNodeName, otherMapping, errlist) )
        return InitStandbyCommunicationError;

    // Establish the data volume mirror

    if ( ! hss.EstablishMirror(otherMapping, errlist) )
        return InitStandbyEstablishMirrorFailed;

      if ( ! hss.FreeMemory(otherMapping.mappingString, errlist) )
        return InitStandbyFreeMemoryFailed;

    // The data volumes become prepared for usage

    if ( ! hss.SendPrepareStandby(errlist) )
        return InitStandbyCommunicationError;
    
      IOMan_IDataManager::GetInstance().CloseAllDataVolumes(taskid);
    return InitStandbyOk;
}


Generated by  Doxygen 1.6.0   Back to index