Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | Private Attributes | Friends

i_EfficientRecallJob_i Class Reference
[Partition Manager]

#include <i_recalljob_impl.h>

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

List of all members.

Public Member Functions

 i_EfficientRecallJob_i (i_PartitionManager_i &a_iPM, pm_JobMgr &a_jobMgr, ivd_MediaKey_t a_mediumKey, fsc_FLSPerMedia *a_fileLocPerVolume_p, i_JobID_t a_hsmJobIndexID)
virtual void GetNewResources (i_Index_t a_resNum)
i_RecallList_tPrepareRecallListSeq ()
void PrepareFailedRecallListSeq (i_RecallList_t &a_seqOfFailedFiles)
virtual void MediumOperationComplete (i_Index_t a_beaNum, i_CompletionStatus_e a_status)
virtual void CompleteJob (i_CompletionStatus_e a_status)
i_FileLocationDataList_tGetNextRecallSet ()
i_FSC_ptr GetFSC ()
virtual i_JobRequestList_tGetFiles ()

Public Attributes

ivd_FileSize_t m_fileSize

Protected Attributes

i_PartitionManager_im_iPM

Private Member Functions

virtual ~i_EfficientRecallJob_i ()
void Process ()
 Non-interface function.
void Execute ()
bool SetNextVolume ()
bool PrepareResource ()
void CleanUp ()
void RecallRetry ()
void ReleaseResources ()
void AbortRecallOnHsm ()

Private Attributes

i_JobID_t m_hsmJobIndexID
ivd_MediaKey_t m_mediumKey
ivd_MedVolNum_t m_medVolNum
fsc_FLSPerMediam_fileLoc_p
pm_VolStatus_m m_mediaVolStatus_m
fsc_FLSPerVolumem_currentVolumeFLS_p
UInt32_t m_firstBlockOffset
pm_EfficientRecallClientThreadm_recallClientThread
cmn_ThreadCounter m_recallCounter
bool m_beaGotSplit
bool m_hsmRecallCalled
 log_CLASSID_m

Friends

class pm_EfficientRecallClientThread

Detailed Description

Definition at line 147 of file i_recalljob_impl.h.


Constructor & Destructor Documentation

i_EfficientRecallJob_i::~i_EfficientRecallJob_i (  )  [private, virtual]

Definition at line 110 of file i_efficientrecalljob_impl.cpp.

References CleanUp(), and log_FUNC_m.

Here is the call graph for this function:

i_EfficientRecallJob_i::i_EfficientRecallJob_i ( i_PartitionManager_i a_iPM,
pm_JobMgr a_jobMgr,
ivd_MediaKey_t  a_mediumKey,
fsc_FLSPerMedia a_fileLocPerVolume_p,
i_JobID_t  a_hsmJobIndexID 
)

Definition at line 52 of file i_efficientrecalljob_impl.cpp.

References i_JobParams::bufId, i_JobParams::bufType, i_JobParams::copies, rm_String::cvalue_p, i_Job_i::GetJobTypeText(), ie_INVALID_ARG, i_Job_i::InitBeaStatus(), ipc_EXEC_m, i_JobParams::jobID, i_JobParams::jobPriority, i_JobParams::jobType, log_FUNC_m, log_WriteEvent(), i_Job_i::m_activeBeas, i_PartitionManager_i::m_config, i_PartitionManager_i::m_externalClient, m_hsmJobIndexID, i_Job_i::m_iJobParams, m_iPM, i_PartitionManager_i::m_rmPart, cfg_PMCfg::name, rm_Partition::partitionUUIDString, i_JobParams::partName, i_JobParams::partUUID, cfg_PMCfg::recallPriority, ipc_Init::ResourceInit(), and i_Job_i::SetResources().

        :   i_Job_i(a_jobMgr),
            m_fileSize(0),
            m_iPM(a_iPM),
            m_hsmJobIndexID(a_hsmJobIndexID),
            m_mediumKey(a_mediumKey),
            m_fileLoc_p(a_fileLoc_p),
            m_currentVolumeFLS_p(NULL),
            m_firstBlockOffset(3),
            m_beaGotSplit(false),
            m_hsmRecallCalled(false){

    log_FUNC_m(i_EfficientRecallJob_i);
    
    if (m_hsmJobIndexID == 0) {
        throw ivd_InternalError(ie_INVALID_ARG, "HSM job index ID is 0.");
    }
    
    ostringstream os;
    os << "Started (Main " << m_hsmJobIndexID << "). ";

    m_iJobParams.jobType = jt_RECALL;
    log_WriteEvent(os.str(), GetJobTypeText(), m_iJobParams.jobID);

    ipc_EXEC_m(
        m_iJobParams.jobPriority   = m_iPM.m_config.recallPriority;
        m_iJobParams.partName      =
            CORBA::string_dup(m_iPM.m_config.name.c_str());
        m_iJobParams.partUUID      =
            CORBA::string_dup(m_iPM.m_rmPart.partitionUUIDString.cvalue_p);
    );

    if (m_iPM.m_externalClient) {
        m_iJobParams.bufType  = i_REMOTE_BUF;
    }
    else {
        m_iJobParams.bufType  = i_DISK_BUF;
    }
    m_iJobParams.bufId         = m_iJobParams.jobID;
    m_iJobParams.copies        = 0;

    i_ResourceList_t resources;
    resources.length(1);

    ipc_Init::ResourceInit(resources[0]); //sets all members to 0 or to ipc_nilStr
    SetResources(resources);

    m_activeBeas.resize(1); //recall has always one Bea
    InitBeaStatus(1);
}

Here is the call graph for this function:


Member Function Documentation

void i_EfficientRecallJob_i::AbortRecallOnHsm (  )  [private]

Definition at line 455 of file i_efficientrecalljob_impl.cpp.

References dbg_DETAIL, dbg_LOW, i_JobParams::diskBufferFS, i_PartitionManager_i::GetHSM(), i_Job_i::GetJobId(), i_DISK_BUF, log_DBG_m, log_FUNC_m, m_hsmJobIndexID, i_Job_i::m_iJobParams, m_iPM, PrepareFailedRecallListSeq(), and SetNextVolume().

Referenced by CompleteJob().

                                              {
    log_FUNC_m(AbortRecallOnHsm);

    i_RecallList_t seqOfFailedFiles;
    
    while (1){
        PrepareFailedRecallListSeq(seqOfFailedFiles);

        if (SetNextVolume()){
            log_DBG_m(dbg_DETAIL, "continue");
            continue;
        }
        else {
            log_DBG_m(dbg_DETAIL, "break");
            //no more volumes
            break;
        }
    }
    log_DBG_m(dbg_DETAIL, "calling hsm");

    log_DBG_m(dbg_LOW, "Aborting #files:" <<  seqOfFailedFiles.length());

    if (seqOfFailedFiles.length() > 0){
        for (UInt32_t i(0); i < seqOfFailedFiles.length(); i++){
            log_DBG_m(dbg_LOW, "fileID:" << seqOfFailedFiles[i].fileID );
        }
        m_iPM.GetHSM()->EfficientRecall(
            seqOfFailedFiles,
            GetJobId(),
            m_hsmJobIndexID,
            0,
            i_DISK_BUF,
            m_iJobParams.diskBufferFS,
            false,
            i_DownloadAgent::_nil());
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void i_EfficientRecallJob_i::CleanUp (  )  [private]

Definition at line 115 of file i_efficientrecalljob_impl.cpp.

References log_ERR_m, log_FUNC_m, m_currentVolumeFLS_p, m_fileLoc_p, m_mediaVolStatus_m, and NULL.

Referenced by ~i_EfficientRecallJob_i().

                                    {
    log_FUNC_m(CleanUp);

    if (m_fileLoc_p != NULL) {
        delete m_fileLoc_p;
        m_fileLoc_p = NULL;
    }

    if (m_currentVolumeFLS_p != NULL) {
        delete m_currentVolumeFLS_p;
        m_currentVolumeFLS_p = NULL;
    }

    try {
        pm_VolStatus_m::iterator p;
        for (p = m_mediaVolStatus_m.begin(); p != m_mediaVolStatus_m.end();) {
            m_mediaVolStatus_m.erase(p++);
        }
    } catch (ivd_Exception& e){
        log_ERR_m(  "Catch exception while erasing m_mediaVolStatus_m: " <<
                    e);
    }
}

Here is the caller graph for this function:

void i_EfficientRecallJob_i::CompleteJob ( i_CompletionStatus_e  a_status  )  [virtual]

Implements i_Job_i.

Definition at line 494 of file i_efficientrecalljob_impl.cpp.

References AbortRecallOnHsm(), dbg_LOW, dbg_NORM, i_SUCCEDED, ipc_EXEC_m, ipc_ObjectExists(), i_Job_i::IsAborted(), i_JobParams::jobID, log_DBG_m, log_ERR_m, log_FUNC_m, ipc_Log::LogStatus(), i_Job_i::m_activeBeas, i_Job_i::m_iJobParams, i_Job_i::ReleaseDiskBuffer(), and i_Job_i::Remove().

Referenced by MediumOperationComplete().

                                                                     {
    log_FUNC_m(CompleteJob);

    try {
        log_DBG_m(dbg_LOW, "[" << m_iJobParams.jobID << "] " <<
            "~i_EfficientRecallJob_i finished" );

        if ( a_status != i_SUCCEDED ){
            //job failed!!
            log_ERR_m(
                "[" << m_iJobParams.jobID << "] " <<
                "Could not recall." << " " <<
                ipc_Log::LogStatus(a_status) );

            try {
                ipc_EXEC_m(
                    if (ipc_ObjectExists(m_activeBeas[0])) {
                        m_activeBeas[0]->Remove();
                    }
                    else {
                        log_DBG_m(dbg_NORM, "Bea not running. Skip m_activeBeas[0]->Remove()");
                    }
                );
            } catch (...){
                //ignore
            }
        }
        if (IsAborted() || (a_status != i_SUCCEDED)){
            AbortRecallOnHsm();
            ReleaseDiskBuffer();
        }

        //remove job
        ipc_EXEC_m(Remove(););

    } catch (ivd_Exception& e) {
        log_ERR_m("[" << m_iJobParams.jobID <<"] " << e);
    } catch (ivd_InternalError& ie) {
        log_ERR_m("[" << m_iJobParams.jobID << "] " << ie);
    } catch (...) {
        log_ERR_m("[" << m_iJobParams.jobID << "] " << "Caught unknown" );
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Implements i_Job_i.

Definition at line 691 of file i_efficientrecalljob_impl.cpp.

References i_Job_i::AllocateDiskBuffer(), dbg_DETAIL, dbg_LOW, pm_RecallSetReader::EndOfCurrentVolume(), pm_RecallSetReader::GetCurrentSplitSize(), pm_RecallSetReader::GetRemainingBytesToCopy(), i_Job_i::IsAborted(), i_Job_i::IsFinished(), pm_RecallSetReader::IsWriteFinished(), i_JobParams::jobID, log_DBG_m, log_FUNC_m, i_Job_i::m_activate_x, pm_VolStatus::m_blockSize, i_Job_i::m_iJobParams, m_iPM, i_PartitionManager_i::m_maxDiskBuff, m_mediaVolStatus_m, pm_VolStatus::m_recallSetReader, i_Job_i::m_status, i_Job_i::NeedsProcess(), PrepareResource(), Process(), pm_RecallSetReader::SetCurrentBuffSize(), and i_Job_i::WaitBeasToFinish().

                                     {
    log_FUNC_m(Execute);

    log_DBG_m(dbg_DETAIL,"[" << m_iJobParams.jobID <<
                          "] " << "Running Efficient Recall job.");
    try {
        cmn_MutexLock l(m_activate_x);
        PrepareResource();

        if (IsAborted()) {
            return;
        }

        pm_VolStatus *vol = m_mediaVolStatus_m[m_iJobParams.jobID];
        bool first (true);

        while (!IsFinished()) {

            WaitBeasToFinish(5);

            log_DBG_m(dbg_LOW,"[" << m_iJobParams.jobID <<
                                "] " << "waiting finished, resuming...");

            if (IsFinished()) {
                break;
            }

            if (vol->m_recallSetReader.EndOfCurrentVolume()
                && vol->m_recallSetReader.IsWriteFinished()) {
                    log_DBG_m(dbg_LOW,"[" << m_iJobParams.jobID <<
                                "] " << "deleting current vol pointer");

                    pm_VolStatus *tmpVol = vol;
                    vol = NULL;
                    delete tmpVol;

                    log_DBG_m(dbg_LOW,"[" << m_iJobParams.jobID <<
                                "] " << "get new media vol status pointer");

                    vol = m_mediaVolStatus_m[m_iJobParams.jobID];
                    first = true;
            }

            if ( first || vol->m_recallSetReader.IsWriteFinished() ) {
                if ( NeedsProcess(0) ) {
                    UInt64_t allocated(0);
                    allocated = AllocateDiskBuffer(
                                vol->m_recallSetReader.GetCurrentSplitSize(),
                                vol->m_recallSetReader.GetRemainingBytesToCopy(),
                                m_iPM.m_maxDiskBuff,
                                vol->m_blockSize,
                                m_iPM.m_maxDiskBuff);
                    vol->m_recallSetReader.SetCurrentBuffSize(allocated);

                    if (IsAborted()) {
                        return;
                        }

                    Process();
                }
                first = false;
            }
        } //while (!IsFinished())
    } catch (ivd_Exception& e){
        log_DBG_m(dbg_LOW, e);
        m_status = i_FAILED;
        throw;
    }
}

Here is the call graph for this function:

i_JobRequestList_t * i_EfficientRecallJob_i::GetFiles ( void   )  [virtual]

Implements i_Job_i.

Definition at line 769 of file i_efficientrecalljob_impl.cpp.

References ie_IMPOSSIBLE, and log_FUNC_m.

                                                    {
    log_FUNC_m(GetFiles);

    try {
        throw ivd_InternalError(ie_IMPOSSIBLE);
    } ipc_CATCH_IVD_THROW_CORBA_m;
    return NULL;
} // i_EfficientRecallJob_i::GetFiles()

i_FSC_ptr i_EfficientRecallJob_i::GetFSC ( void   )  [virtual]

Implements i_Job_i.

Definition at line 538 of file i_efficientrecalljob_impl.cpp.

References i_PartitionManager_i::GetFSC(), ipc_EXEC_m, log_FUNC_m, and m_iPM.

                                         {
    log_FUNC_m(GetFSC);
    try {
        ipc_EXEC_m(
            i_FSC_ptr tmpFSC = i_FSC::_duplicate(m_iPM.GetFSC());
            return tmpFSC;
        );
    } ipc_CATCH_IVD_THROW_CORBA_m;

}

Here is the call graph for this function:

void i_EfficientRecallJob_i::GetNewResources ( i_Index_t  a_resNum  )  [virtual]

Implements i_Job_i.

Definition at line 762 of file i_efficientrecalljob_impl.cpp.

References ie_IMPOSSIBLE, and log_FUNC_m.

                                                              {
    log_FUNC_m(GetNewResources);
    try {
        throw ivd_InternalError(ie_IMPOSSIBLE);
    } ipc_CATCH_IVD_THROW_CORBA_m;
}

i_FileLocationDataList_t * i_EfficientRecallJob_i::GetNextRecallSet (  )  [virtual]
void i_EfficientRecallJob_i::MediumOperationComplete ( i_Index_t  a_beaNum,
i_CompletionStatus_e  a_status 
) [virtual]

Implements i_Job_i.

Definition at line 245 of file i_efficientrecalljob_impl.cpp.

References cmn_Condition::Broadcast(), bs_RUNNING, i_JobParams::bufType, CompleteJob(), dbg_DETAIL, dbg_LOW, dbg_NORM, i_JobParams::diskBufferFS, dt_DISKBUF, pm_RecallSetReader::EndOfCurrentVolume(), evt_ERROR, g_cmn, i_Job_i::GetDiskBufferFileName(), ivd_BaseException::GetFriendly(), i_PartitionManager_i::GetHSM(), i_Job_i::GetJobTypeText(), i_Job_i::GetResources(), i_SUCCEDED, ipc_EXEC_m, i_Job_i::IsAborted(), job_POST_MED_PROC, i_JobParams::jobID, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), ipc_Log::LogStatus(), i_Job_i::m_activate_c, i_Job_i::m_activate_x, m_beaGotSplit, i_Job_i::m_beasStatus_x, i_PartitionManager_i::m_externalClient, cmn_SysInfo::m_hostName, m_hsmJobIndexID, i_Job_i::m_iJobParams, m_iPM, m_mediaVolStatus_m, m_mediumKey, m_medVolNum, pm_VolStatus::m_recallSetReader, i_Job_i::m_status, PrepareRecallListSeq(), PrepareResource(), pm_VolStatus::ReadFinished(), i_Job_i::ReleaseDiskBuffer(), ReleaseResources(), ipc_Corba::ResolveSvc(), i_Job_i::SetBeaStatus(), i_Job_i::SetDiskBufferWritten(), i_Job_i::SetResMedOpComplete(), i_Job_i::SetStatus(), cmn_Global::si, and pm_VolStatus::WriteFinished().

                                                       {

    log_FUNC_m(MediumOperationComplete);

    pm_VolStatus *vol = m_mediaVolStatus_m[m_iJobParams.jobID];
    {
        cmn_MutexLock l(m_beasStatus_x);
        SetBeaStatus(a_beaNum, bs_RUNNING);
    }

    log_DBG_m(dbg_NORM,
        "[" << m_iJobParams.jobID << "] " <<
        "Recall CompleteJob called by Bea: " <<
        a_beaNum << "  status: " <<
        ipc_Log::LogStatus(a_status) );

    try {
            m_beaGotSplit = false;
            SetStatus(job_POST_MED_PROC);

            // Recall retry problem, bug ID 6673
            // Just call completeJob if failed, without retrying
        
            //if ( (a_status == i_MEDIUM_ERROR) || (a_status == i_HW_ERROR) ){
            //    RecallRetry();
             
            //    m_activate_c.Broadcast();
            //    return;
            //} else {

            if (a_status != i_SUCCEDED) {
                CompleteJob(a_status);
                return;
            }

            //};

            try {
                SetDiskBufferWritten();
                vol->ReadFinished(a_status);
                // copy recalled files to m_seqRecallList
                i_RecallList_t* seqRecallList = PrepareRecallListSeq();

                i_DownloadAgent_var dagt;
                // Send file to HSM
                if (m_iPM.m_externalClient) {
                    ipc_EXEC_m(
                        CORBA::Object_var obj = ipc_Corba::ResolveSvc(g_cmn.si.m_hostName);
                        i_Service_var svc = i_Service::_narrow(obj);
                        dagt = svc->CreateDownloadAgent(
                            dt_DISKBUF,
                            GetDiskBufferFileName().c_str() );
                    );
                };

                try {
                    ipc_EXEC_m(

                        log_DBG_m(dbg_DETAIL, "m_seqRecallList.length(): "
                                << seqRecallList->length() );

                        m_iPM.GetHSM()->EfficientRecall(
                            *seqRecallList,
                            m_iJobParams.jobID,
                            m_hsmJobIndexID,
                            GetResources()[0].blockSize,
                            m_iJobParams.bufType,
                            m_iJobParams.diskBufferFS,
                            true,
                            dagt);

                        if (!CORBA::is_nil(dagt)) {
                            dagt->Remove();
                            dagt = i_DownloadAgent::_nil();
                        }
                    );

                    m_status = i_SUCCEDED;
                    ReleaseDiskBuffer();
                    vol->WriteFinished(a_status);

                } catch (ivd_Exception &e){
                    ostringstream os;
                    os << "Failed (Main " << m_hsmJobIndexID << ", " << e.GetFriendly() << ").";
                    log_WriteEvent(evt_ERROR, os.str(),
                        GetJobTypeText(), m_iJobParams.jobID);
                    log_ERR_m(  "[" << m_iJobParams.jobID << "] " <<
                        "Caught Exception when calling HSM->Recall: " << e);
                    m_status = i_FAILED;
                }

                if (!CORBA::is_nil(dagt)) {
                    try {
                        dagt->Remove();
                    }
                    catch (...) {
                        log_DBG_m(dbg_DETAIL, "m_downloadAgent->Remove() failed. Ignored.");
                    };
                }
            }
            catch (...) {
                log_DBG_m(dbg_LOW, "unknown exception caught");
                //ignore
            }

        if (IsAborted()) {
            return;
        }

        if (vol->m_recallSetReader.EndOfCurrentVolume()) {
            log_DBG_m(dbg_LOW, "[" << m_iJobParams.jobID << "] "
                << "End of current volume" 
                << " (mediumKey:" << m_mediumKey
                << " medVolNum:" << m_medVolNum << ")");
            if (PrepareResource()) {
                log_DBG_m(dbg_LOW, "[" << m_iJobParams.jobID << "] "
                    << "Starting next volume..."
                    << " (mediumKey:" << m_mediumKey
                    << " medVolNum:" << m_medVolNum << ")");

                cmn_MutexLock l(m_activate_x);
                m_activate_c.Broadcast();
            } else { //no more volumes
                SetResMedOpComplete(a_beaNum);
                SetStatus(job_POST_MED_PROC);
                ReleaseResources();
                CompleteJob(m_status);
                ostringstream os;
                os << "Finished (Main " << m_hsmJobIndexID << "). ";
                log_WriteEvent(os.str(),
                    GetJobTypeText(), m_iJobParams.jobID);
            }
        }
        else {
            log_DBG_m(dbg_LOW, "[" << m_iJobParams.jobID << "] "
                << "Finished current set, starting next set..."
                << " (mediumKey:" << m_mediumKey
                << " medVolNum:" << m_medVolNum << ")");
            cmn_MutexLock l(m_activate_x);
            m_activate_c.Broadcast();
        }
    } ipc_CATCH_IVD_THROW_CORBA_m;
}

Here is the call graph for this function:

void i_EfficientRecallJob_i::PrepareFailedRecallListSeq ( i_RecallList_t a_seqOfFailedFiles  ) 

Definition at line 427 of file i_efficientrecalljob_impl.cpp.

References dbg_LOW, ivd_FileLocationData_t::fileID, i_Recall_t::fileID, ivd_FileLocationData_t::fileIdx, i_Recall_t::fileIdx, i_Recall_t::fileSize, fsc_FLSPerVolume::GetRefOfFileLocDataVec(), log_DBG_m, log_FUNC_m, m_currentVolumeFLS_p, ivd_FileLocationData_t::migrationID, i_Recall_t::migrationID, and NULL.

Referenced by AbortRecallOnHsm().

                                                                                          {
    log_FUNC_m(PrepareFailedRecallListSeq);

    if (m_currentVolumeFLS_p == NULL){
        return;
    }

    ivd_FileLocationData_t_v_t& fldVec = m_currentVolumeFLS_p->GetRefOfFileLocDataVec();
    log_DBG_m(dbg_LOW, "fldVec.size():" <<  fldVec.size());

    UInt32_t currentLength(a_seqOfFailedFiles.length());
    a_seqOfFailedFiles.length(currentLength + fldVec.size());

    log_DBG_m(dbg_LOW, "a_seqOfFailedFiles.length():" <<  a_seqOfFailedFiles.length());

    for (unsigned int i = currentLength; i < a_seqOfFailedFiles.length(); ++i) {
        i_Recall_t &recallStr = a_seqOfFailedFiles[i];
        ivd_FileLocationData_t &fldSour = fldVec[i - currentLength];

        recallStr.fileID      = fldSour.fileID;
        recallStr.migrationID = fldSour.migrationID;
        // Get Copies set it to split size.
        // HSM set it to file size to be checked in FSC. Not checked if 0.
        recallStr.fileSize    = 0;
        recallStr.fileIdx     = fldSour.fileIdx;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

i_RecallList_t * i_EfficientRecallJob_i::PrepareRecallListSeq (  ) 

Definition at line 217 of file i_efficientrecalljob_impl.cpp.

References pm_RecallSetReader::GetCurrentRecallSet(), i_JobParams::jobID, log_ERR_m, log_FUNC_m, i_Job_i::m_iJobParams, m_mediaVolStatus_m, and pm_VolStatus::m_recallSetReader.

Referenced by MediumOperationComplete(), and RecallRetry().

                                                             {
    log_FUNC_m(PrepareRecallListSeq);

    try {
        
        pm_VolStatus *vol = m_mediaVolStatus_m[m_iJobParams.jobID];

        i_RecallList_t_var recallList(vol->m_recallSetReader.GetCurrentRecallSet());

        if (recallList->length() == 0) {
            log_ERR_m("Recall sequence list is empty.");
        }
        return recallList._retn();
    }
    catch (ivd_Exception& e) {
        log_ERR_m(e);
        throw;
    }
    catch (ivd_InternalError& ie) {
        log_ERR_m(ie);
        throw;
    }
    catch (...) {
        log_ERR_m("Caught unknown" );
        throw;
    }             
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool i_EfficientRecallJob_i::PrepareResource (  )  [private]

Definition at line 570 of file i_efficientrecalljob_impl.cpp.

References i_Medium_t::barcode, i_Resource_t::barcode, i_Resource_t::blockOffset, ivd_FileLocationData_t::blockOffset, i_Resource_t::blockSize, i_Medium_t::blockSize, dbg_DETAIL, dbg_LOW, dbg_NORM, fsc_FLSPerMedia::GetNextFSLPerVolume(), fsc_FLSPerVolume::GetRefOfFileLocDataVec(), i_Job_i::GetResources(), ipc_EXEC_m, job_MED_PROC, i_JobParams::jobID, log_DBG_m, log_ERR_m, log_FUNC_m, m_currentVolumeFLS_p, m_fileLoc_p, m_fileSize, m_firstBlockOffset, i_Job_i::m_iJob, i_Job_i::m_iJobParams, m_iPM, i_PartitionManager_i::m_iRM, m_mediaVolStatus_m, m_mediumKey, m_medVolNum, i_Job_i::m_rm, i_Job_i::m_status, i_Medium_t::mediaPoolName, i_Resource_t::mediumFamily, i_Resource_t::mediumKey, i_Resource_t::medVolNr, NULL, i_Resource_t::poolKey, i_Resource_t::poolType, i_Resource_t::resAllocated, i_Resource_t::resBeaStarted, i_Resource_t::resNum, i_Resource_t::resProcessed, i_Resource_t::resRequested, i_Job_i::SetResources(), i_Job_i::SetResRequested(), i_Job_i::SetStatus(), i_Resource_t::splitOffset, and ivd_FileLocationData_t::splitSize.

Referenced by Execute(), and MediumOperationComplete().

                                            {
    log_FUNC_m(PrepareResource);

    try {
        //delete data location vector
        if (m_currentVolumeFLS_p !=  NULL){
            log_DBG_m(dbg_DETAIL, "deleting m_currentVolumeFLS_p.");
            delete m_currentVolumeFLS_p;
        }

        //set next volume for data location
        m_currentVolumeFLS_p = m_fileLoc_p->GetNextFSLPerVolume(m_mediumKey,
                                                                m_medVolNum);


        if (m_currentVolumeFLS_p ==  NULL){
            log_DBG_m(dbg_DETAIL, "No more volumes to process.");
            return false;
        }

        ivd_FileLocationData_t_v_t& fldVec = m_currentVolumeFLS_p->GetRefOfFileLocDataVec();

        m_fileSize = 0;

        for (UInt32_t i = 0; i < fldVec.size(); i++){
            ivd_FileLocationData_t &fld = fldVec[i];


            log_DBG_m(dbg_DETAIL,"[" << m_iJobParams.jobID <<
                                 "] " << "m_iCopiesPos[" << i << "],  " <<
                                 fld.blockOffset << "," <<
                                 fld.splitSize);
            m_fileSize += fld.splitSize;
        }

        log_DBG_m(dbg_NORM,"[" << m_iJobParams.jobID
            << "] " << " m_fileSize:" << m_fileSize);

        log_DBG_m(dbg_NORM,"[" << m_iJobParams.jobID
            << "] " << " mediumKey:" << m_mediumKey
            << " medVolNum:" << m_medVolNum);

        SetStatus(job_MED_PROC);

        i_Resource_t tmpRes;
        tmpRes = GetResources()[0];
        i_MediumVol_t mv;
        try {
            ipc_EXEC_m (
                i_MediumVol_t_var medVol =
                    m_rm->SelectMediumVolByKey(
                            m_mediumKey,
                            m_medVolNum
                    );
                tmpRes.barcode= medVol->mediumBarcode;
                mv = medVol;
            );
        } catch (ivd_Error &e){
            log_ERR_m(e);
        }

        i_Medium_t medium;
        ipc_EXEC_m(
            i_Medium_t_var med = m_iPM.m_iRM->SelectMedium(tmpRes.barcode);
            medium = med;
        );

        m_mediaVolStatus_m[m_iJobParams.jobID] = new pm_VolStatus(mv,
                                                                  medium.blockSize,
                                                                  fldVec.begin(),
                                                                  fldVec.end());

        ivd_FileLocationData_t &fldFirstFile = fldVec[0];

        tmpRes.mediumKey    = m_mediumKey;
        tmpRes.medVolNr     = m_medVolNum;
        tmpRes.blockOffset  = fldFirstFile.blockOffset;
        tmpRes.splitOffset  = m_firstBlockOffset;
        tmpRes.resRequested = true;
        tmpRes.resProcessed = false;
        tmpRes.resBeaStarted= false;       

        SetResources(tmpRes);

        if (!tmpRes.resAllocated) {
           log_DBG_m(dbg_LOW,"[" << m_iJobParams.jobID <<
                "] " << "Getting Recall Resources from RM");
            ipc_EXEC_m(
                i_MediaPool_t_var mpool;
                mpool = m_rm->SelectMediaPool(medium.mediaPoolName);
                
                SetResRequested(0);

                tmpRes.resNum       = 0;                
                tmpRes.barcode      = CORBA::string_dup(string(medium.barcode).c_str());
                tmpRes.blockSize    = medium.blockSize;
                tmpRes.poolKey      = mpool->mediaPoolKey;
                tmpRes.poolType     = mpool->mediaPoolType;
                tmpRes.mediumFamily = mpool->mediaFamily;
                SetResources(tmpRes);

                m_rm->GetRecallResources(m_iJob,
                                        m_iJobParams,
                                        GetResources()[0]);
                /* 
                There should be no resource manipulation after 
                this point until end of function. AssignResource will 
                be called by RM and in some cases it can finish before
                this function causing recall thread to freeze.
                */
           );
        }
    } catch (ivd_Exception& e){
        log_DBG_m(dbg_LOW, e);
        m_status = i_RMCOPYPOS_ERROR;
        throw;
    }
    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void i_EfficientRecallJob_i::Process (  )  [private]

Non-interface function.

Definition at line 157 of file i_efficientrecalljob_impl.cpp.

References i_Job_i::ActivateBea(), i_Resource_t::blockOffset, bs_PROCESSING, bs_RUNNING, dbg_DETAIL, pm_RecallSetReader::EndOfCurrentVolume(), ivd_BaseException::GetError(), i_Job_i::GetResources(), ie_MEDIUM_HWERR, ie_MEDIUM_MEDERR, ie_MEDIUM_PROTECTED, ie_SCSI_HOST, ipc_EXEC_m, i_Job_i::IsAborted(), i_JobParams::jobID, i_Job_i::LoadUnload(), log_DBG_m, log_ERR_m, log_FUNC_m, i_Job_i::m_activeBeas, i_Job_i::m_beasStatus_x, i_Job_i::m_iJobParams, m_mediaVolStatus_m, m_medVolNum, pm_VolStatus::m_recallSetReader, i_Job_i::m_rm, i_Resource_t::mediumKey, i_Resource_t::medVolId, i_Resource_t::medVolNr, RecallRetry(), ReleaseResources(), i_Job_i::SetBeaStatus(), i_Job_i::SetResources(), and i_Job_i::SetResProcessed().

Referenced by Execute().

                                    {
    log_FUNC_m(Process);

    i_Resource_t tmpRes = GetResources()[0];
    tmpRes.medVolNr = m_medVolNum;

    i_MediumVol_t_var iMV;

    ipc_EXEC_m(
        iMV = m_rm->SelectMediumVolByKey(tmpRes.mediumKey,
                                         tmpRes.medVolNr);
    );

    tmpRes.blockOffset = 3;
    tmpRes.medVolId = iMV->medVolId;

    log_DBG_m(dbg_DETAIL, "Dump of tmpRes record.  medVolNr: " << tmpRes.medVolNr
                         << ", mediumKey: " << tmpRes.mediumKey
                         << ", blockOffset: " << tmpRes.blockOffset
                         << ", medVolId: " << tmpRes.medVolId);

    SetResources(tmpRes);

    LoadUnload(0);

    try {
        cmn_MutexLock l(m_beasStatus_x);
        ipc_EXEC_m(ActivateBea(0););
        SetBeaStatus(0, bs_RUNNING);

        if (IsAborted()){
            return;
        }
        pm_VolStatus *vol = m_mediaVolStatus_m[m_iJobParams.jobID];

        if (vol->m_recallSetReader.EndOfCurrentVolume()) {
            SetResProcessed(0);
        }
        ipc_EXEC_m(m_activeBeas[0]->Recall(););

        SetBeaStatus(0, bs_PROCESSING);
    } catch (ivd_Exception& e){
        log_ERR_m("[" << m_iJobParams.jobID <<
                    "] Catched Exception when calling Bea->Recall " << e);
        switch (e.GetError()){
            case(ie_MEDIUM_MEDERR):
            case(ie_MEDIUM_PROTECTED):
            case(ie_MEDIUM_HWERR):
            case(ie_SCSI_HOST):
                {
                    ReleaseResources();
                    RecallRetry();
                    break;
                }
            default:
                throw;
        }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void i_EfficientRecallJob_i::RecallRetry (  )  [private]

Definition at line 420 of file i_efficientrecalljob_impl.cpp.

References i_PartitionManager_i::EfficientRecall(), log_FUNC_m, m_hsmJobIndexID, m_iPM, and PrepareRecallListSeq().

Referenced by Process().

Here is the call graph for this function:

Here is the caller graph for this function:

void i_EfficientRecallJob_i::ReleaseResources (  )  [private]

Definition at line 391 of file i_efficientrecalljob_impl.cpp.

References dbg_LOW, dbg_NORM, i_Job_i::GetResources(), ipc_EXEC_m, i_JobParams::jobID, log_DBG_m, log_ERR_m, log_FUNC_m, i_Job_i::m_iJobParams, i_Job_i::m_rm, and i_Job_i::SetResReleased().

Referenced by MediumOperationComplete(), and Process().

                                             {
    log_FUNC_m(ReleaseResources);
    try {
        ipc_EXEC_m(
            //resource are released because hsm->recall can last long time
            log_DBG_m(dbg_LOW, "[" << m_iJobParams.jobID <<
            "] " << "ReleaseResource for jobId");
            i_ResourceList_t res = GetResources();
            try {
                ipc_EXEC_m(m_rm->ReleaseResource(m_iJobParams, res));
            } catch (ivd_Error &e){
                log_ERR_m("Releasing FAILED for jobID: " <<
                           m_iJobParams.jobID << endl << e)
            }

            for (UInt32_t i = 0 ; i < res.length(); ++i) {
                SetResReleased(i);
            }
        log_DBG_m(dbg_NORM,"[" << m_iJobParams.jobID <<
            "] " << "Resources Released for job");

        );
    } catch (ivd_Exception& e){
        log_ERR_m(
            "[" << m_iJobParams.jobID << "] " <<
            "Catched Exception when calling rm->ReleaseResource" << e);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool i_EfficientRecallJob_i::SetNextVolume (  )  [private]

Definition at line 550 of file i_efficientrecalljob_impl.cpp.

References dbg_DETAIL, fsc_FLSPerMedia::GetNextFSLPerVolume(), log_DBG_m, log_FUNC_m, m_currentVolumeFLS_p, m_fileLoc_p, m_mediumKey, m_medVolNum, and NULL.

Referenced by AbortRecallOnHsm().

                                          {
    log_FUNC_m(SetNextVolume);
    //delete data location vector
    if (m_currentVolumeFLS_p !=  NULL){
        log_DBG_m(dbg_DETAIL, "deleting m_currentVolumeFLS_p.");
        delete m_currentVolumeFLS_p;
    }

    //set next volume for data location
    m_currentVolumeFLS_p = m_fileLoc_p->GetNextFSLPerVolume(m_mediumKey,
        m_medVolNum);

    if (m_currentVolumeFLS_p ==  NULL){
        log_DBG_m(dbg_DETAIL, "No more volumes to process.");
        return false;
    } else {
        return true;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class pm_EfficientRecallClientThread [friend]

Definition at line 153 of file i_recalljob_impl.h.


Member Data Documentation

Reimplemented from i_Job_i.

Definition at line 211 of file i_recalljob_impl.h.

Definition at line 208 of file i_recalljob_impl.h.

Referenced by MediumOperationComplete().

Definition at line 200 of file i_recalljob_impl.h.

Referenced by CleanUp(), PrepareResource(), and SetNextVolume().

Definition at line 177 of file i_recalljob_impl.h.

Referenced by PrepareResource().

Definition at line 204 of file i_recalljob_impl.h.

Referenced by PrepareResource().

Definition at line 209 of file i_recalljob_impl.h.

Definition at line 195 of file i_recalljob_impl.h.

Referenced by MediumOperationComplete(), PrepareResource(), and SetNextVolume().

Definition at line 206 of file i_recalljob_impl.h.

Definition at line 207 of file i_recalljob_impl.h.


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