Public Member Functions | Private Member Functions | Private Attributes

i_RecoveryJob_i Class Reference
[Partition Manager]

#include <i_recoveryjob_impl.h>

Inheritance diagram for i_RecoveryJob_i:
Inheritance graph
[legend]
Collaboration diagram for i_RecoveryJob_i:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 i_RecoveryJob_i (i_PartitionManager_i &a_iPM, pm_JobMgr &a_jobMgr, i_MediumSeqByVol_t &a_medSeqByVol, i_UIMessageServer_ptr a_uims, bool a_secondTry=false)
 ~i_RecoveryJob_i ()

Private Member Functions

void Execute ()
void ProcessFRI (pm_FRIInfo a_FRIInfo)
void SetRecoveryFlagOnVolumes ()

Private Attributes

 log_CLASSID_m

Detailed Description

Definition at line 37 of file i_recoveryjob_impl.h.


Constructor & Destructor Documentation

i_RecoveryJob_i::i_RecoveryJob_i ( i_PartitionManager_i a_iPM,
pm_JobMgr a_jobMgr,
i_MediumSeqByVol_t a_medSeqByVol,
i_UIMessageServer_ptr  a_uims,
bool  a_secondTry = false 
)

Definition at line 55 of file i_recoveryjob_impl.cpp.

References cmn_CleanDir(), dbg_LOW, ui_MsgWriter::DisplayMessage(), fsc_GetReorgDir(), i_PartitionManager_i::GetName(), i_Job_i::GetResources(), ipc_EXEC_m, i_JobParams::jobID, i_JobParams::jobPriority, i_JobParams::jobType, log_DBG_m, log_FUNC_m, ipc_Log::LogJobParams(), ipc_Log::LogResources(), i_PartitionManager_i::m_config, i_Job_i::m_iJobParams, i_MaintFriJob_i::m_iPM, i_PartitionManager_i::m_iRM, i_MaintFriJob_i::m_uiMsgWriter, cfg_PMCfg::recoveryPriority, and SetRecoveryFlagOnVolumes().

Referenced by ~i_RecoveryJob_i().

    :   i_MaintFriJob_i(a_iPM, a_jobMgr, a_medSeqByVol, a_uims, "", a_secondTry)
{
    log_FUNC_m(i_RecoveryJob_i);
    
    log_DBG_m(dbg_LOW, "" << endl <<
        "Recovery Job Created:" << endl <<
        ipc_Log::LogJobParams(m_iJobParams) << endl <<
        ipc_Log::LogResources(GetResources()) << endl);
    
    ostringstream msg;
    msg << "Recovery started (JobID: " << m_iJobParams.jobID << ").";
    m_uiMsgWriter.DisplayMessage(msg.str());
    
    m_iJobParams.jobPriority = m_iPM.m_config.recoveryPriority;
    m_iJobParams.jobType  = jt_RECOVERY;

    //recovery flag in RMDB is set for volumes got through parameter a_medSeqByVol
    //redundancy - if they are set, it sets them again
    SetRecoveryFlagOnVolumes();

    //recovery flag in RMDB is set for volumes got through parameter a_medSeqByVol
    //redundancy - if they are set, it sets them again
    SetRecoveryFlagOnVolumes();

    //clear all scanned statuses for volumes
    ipc_EXEC_m(
        m_iPM.m_iRM->ClearReorgScan(m_iPM.GetName().c_str());
    );
    
    //delete old reorg files if they exist
    cmn_Path reorgDir = fsc_GetReorgDir(m_iPM.GetName());
    cmn_CleanDir(reorgDir);
}

Here is the call graph for this function:

Here is the caller graph for this function:

i_RecoveryJob_i::~i_RecoveryJob_i (  ) 

Member Function Documentation

void i_RecoveryJob_i::Execute (  )  [private, virtual]

Implements i_MaintFriJob_i.

Definition at line 243 of file i_recoveryjob_impl.cpp.

References log_FUNC_m.

void i_RecoveryJob_i::ProcessFRI ( pm_FRIInfo  a_FRIInfo  )  [private, virtual]

Implements i_MaintFriJob_i.

Definition at line 118 of file i_recoveryjob_impl.cpp.

References i_VolInfo_t::blockSize, dbg_DETAIL, dbg_LOW, dbg_NORM, cmn_File::DeleteF(), cmn_Global::dirs, ui_MsgWriter::DisplayMessage(), evt_ERROR, evt_WARNING, i_PartitionManager_i::FSCRecovery(), g_cmn, i_Job_i::GetJobTypeText(), i_Job_i::GetResources(), ie_FATAL_ERROR, ipc_EXEC_m, ivd_Error, i_JobParams::jobID, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), ipc_Log::LogVolInfo(), i_MaintFriJob_i::m_allFriSuccess, pm_FRIInfo::m_beaNum, i_Job_i::m_iJobParams, i_MaintFriJob_i::m_iPM, pm_FRIInfo::m_lastDataPos, i_MaintFriJob_i::m_mediumInfoVec, i_Job_i::m_rm, i_MaintFriJob_i::m_uiMsgWriter, pm_FRIInfo::m_volNum, i_VolInfo_t::medVolID, ivd_Directories::tmp, and i_VolInfo_t::volNum.

                                                    {
    log_FUNC_m(ProcessFRI);

    try {
        UInt32_t mediumKey = GetResources()[a_FRIInfo.m_beaNum].mediumKey;
        log_DBG_m(dbg_LOW,"Calling FSC for Recovery for medium " << mediumKey);
        log_DBG_m(dbg_NORM,"Invoking Recovery for " <<
                            m_mediumInfoVec[a_FRIInfo.m_beaNum].m_friVolStatus.size() <<
                            " volumes.");
        
        MediumInfo_t &medInfo = m_mediumInfoVec[a_FRIInfo.m_beaNum];
        
        UInt32_t currentVol(0);
        bool found(false);
        for (UInt32_t i(0); i < medInfo.m_friVolStatus.size(); i++){
            if (medInfo.m_friVolStatus[i].m_volInfo.volNum == a_FRIInfo.m_volNum){
                found = true;
                log_DBG_m(dbg_DETAIL,"i=" << i << endl <<
                    ipc_Log::LogVolInfo(medInfo.m_friVolStatus[i].m_volInfo));

                currentVol = i;
                break;               
            }
        }
        if (!found){
            throw ivd_Error(ie_FATAL_ERROR, "Medium Volume does not exist.");
        }

        i_VolInfo_t &volInfo = medInfo.m_friVolStatus[currentVol].m_volInfo;
        
        try {
            try {
                ostringstream msg;
                msg << "Recovery started for volume: " << volInfo.medVolID;
                m_uiMsgWriter.DisplayMessage(msg.str());
                log_DBG_m(dbg_LOW, msg.str());

                m_iPM.FSCRecovery(
                    string(volInfo.medVolID), 
                    volInfo.volNum,
                    mediumKey,
                    volInfo.blockSize,
                    a_FRIInfo.m_lastDataPos);

                msg.str("");
                msg << "Recovery finished for volume: " << volInfo.medVolID;
                m_uiMsgWriter.DisplayMessage(msg.str());
                log_DBG_m(dbg_LOW, msg.str());

                // set FRI processed
                medInfo.m_friVolStatus[currentVol].m_processed = true;
                
                //delete tmp/fri
                try {
                    cmn_Path friPath =  g_cmn.dirs.tmp + 
                                        string("fri") + 
                                        string(volInfo.medVolID);

                    cmn_File delFri(friPath);
                    delFri.DeleteF();
                }
                catch (ivd_Exception& e){
                    log_DBG_m(dbg_LOW, "Error while "
                            "deleting tmp fri File: " << endl << e 
                                << endl << "Continuing recovery");
                    //ignore this error                                        
                }

                // anounce RM that volume is recovered.
                ipc_EXEC_m(
                    ostringstream msg;
                    msg << "Clearing recovery flag " << volInfo.medVolID;
                    m_uiMsgWriter.DisplayMessage(msg.str());

                    m_rm->ClearRecoveryFlag(
                                    CORBA::string_dup(volInfo.medVolID) );
                );
            }
            catch (ivd_DFError) {
                if (medInfo.m_friVolStatus[currentVol].m_recreated) {
                    ostringstream sstr;
                    sstr << "Got bad data even on data volume" 
                        << volInfo.medVolID <<
                        ". Set volume as unused and skip it.";
                    log_WriteEvent(evt_ERROR, sstr.str(), 
                                GetJobTypeText(), 
                                m_iJobParams.jobID );
                    
                    m_uiMsgWriter.DisplayMessage(sstr.str());
                    m_allFriSuccess = false;
                }
                else {
                    ostringstream sstr;
                    sstr << "Bad data format on volume" 
                        << volInfo.medVolID <<
                        ", retry with scanning data volume.";
                    log_WriteEvent( evt_WARNING, 
                                    sstr.str(), 
                                    GetJobTypeText(), 
                                    m_iJobParams.jobID );
                    m_uiMsgWriter.DisplayMessage(sstr.str());
                    m_allFriSuccess = false;
        
#if TGT_OS_linux
#warning "TODO: restart fri recreation for this volume"
#elif TGT_OS_windows
#pragma message ("TODO: restart fri recreation for this volume")
#endif
                }
            }
        } catch (ivd_Exception& e) {
            ostringstream msg;
            msg << "Recovery of volume " << volInfo.medVolID << 
                " failed" << endl << e;
            m_uiMsgWriter.DisplayMessage(msg.str());

            m_allFriSuccess = false;
            log_ERR_m(msg.str());
        }
    } catch(ivd_Error&e){
        log_ERR_m("Exception called while processing FRI for medium:" <<
                    GetResources()[a_FRIInfo.m_beaNum].barcode << endl << e);
    }
}

Here is the call graph for this function:

void i_RecoveryJob_i::SetRecoveryFlagOnVolumes (  )  [private]

Definition at line 107 of file i_recoveryjob_impl.cpp.

References ipc_EXEC_m, log_FUNC_m, MediumInfo_t::m_friVolStatus, i_MaintFriJob_i::m_mediumInfoVec, i_Job_i::m_rm, and i_VolInfo_t::medVolID.

Referenced by i_RecoveryJob_i().

                                              {
    log_FUNC_m(SetRecoveryFlagOnVolumes);
    for (UInt32_t i(0); i < m_mediumInfoVec.size(); i++){ //for each volume
        MediumInfo_t & med = m_mediumInfoVec[i];
        for (UInt32_t j(0); j < med.m_friVolStatus.size(); j++){
            i_VolInfo_t medVol = med.m_friVolStatus[j].m_volInfo;
            ipc_EXEC_m(m_rm->SetRecoveryFlag(medVol.medVolID););           
        }
    }
}

Here is the caller graph for this function:


Member Data Documentation

Reimplemented from i_MaintFriJob_i.

Definition at line 55 of file i_recoveryjob_impl.h.


The documentation for this class was generated from the following files: